line rasterizer test
Revision | b2e37df1885c05eec08d623da211a0a03e12bbca (tree) |
---|---|
Zeit | 2011-02-14 01:55:16 |
Autor | beru <berupon@gmai...> |
Commiter | beru |
slop correction revised
changed minimum width
@@ -82,13 +82,16 @@ public: | ||
82 | 82 | const NumericT gradient = dy / width; |
83 | 83 | float rotation = abs(width / dy); |
84 | 84 | |
85 | - alpha *= slopeCorrectionTable_[ ToInt(mul<slopeCorrectionTableSize - 1>(abs(gradient))) ]; | |
86 | - | |
85 | + { | |
86 | + float r2 = width < height ? (width/height) : (height/width); | |
87 | + alpha *= slopeCorrectionTable_[ ToInt(mul<slopeCorrectionTableSize - 1>(r2)) ]; | |
88 | + } | |
87 | 89 | uint8_t pat1[512] = {0}; |
88 | 90 | uint8_t pat2[512+1]; |
89 | 91 | |
90 | - float patLen = rotation * 1.28; | |
92 | + float patLen = rotation * 1.4; | |
91 | 93 | patLen = std::min(256.0f, patLen); |
94 | + patLen = std::max(1.50001f, patLen); | |
92 | 95 | int iPatLen = ceil(patLen); |
93 | 96 | for (size_t i=0; i<iPatLen; ++i) { |
94 | 97 | float x = (i * 2) / patLen; |
@@ -112,7 +115,7 @@ public: | ||
112 | 115 | const size_t w = iPatLen * 2; |
113 | 116 | shift(pat1, pat2, w, fracOffset); |
114 | 117 | for (size_t x=0; x<w; ++x) { |
115 | - ptr[io+x] = pat2[x]; | |
118 | + ptr[io+x] = pat2[x] * (alpha / 255.0); | |
116 | 119 | } |
117 | 120 | OffsetPtr(ptr, lineOffset); |
118 | 121 | curOffset += offset; |