Fix off-by-one error in assertion; improve coverage_to_exact_alpha()

implementation.

http://codereview.appspot.com/5504116/



git-svn-id: http://skia.googlecode.com/svn/trunk@2947 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
tomhudson@google.com 2012-01-03 20:12:42 +00:00
parent abf00aaaa0
commit 31bab3934c
2 changed files with 4 additions and 4 deletions

View File

@ -487,7 +487,7 @@ void SkRgnClipBlitter::blitAntiRect(int x, int y, int width, int height,
const SkIRect& r = iter.rect();
SkASSERT(bounds.contains(r));
SkASSERT(r.fLeft >= x);
SkASSERT(r.fRight < x + width + 2);
SkASSERT(r.fRight <= x + width + 2);
SkAlpha effectiveLeftAlpha = (r.fLeft == x) ? leftAlpha : 255;
SkAlpha effectiveRightAlpha = (r.fRight == x + width + 2) ?

View File

@ -157,9 +157,9 @@ static inline int coverage_to_alpha(int aa) {
}
static inline int coverage_to_exact_alpha(int aa) {
static int map [] = { 0, 64, 128, 192, 255 };
SkASSERT(SHIFT == 2);
return map[aa];
int alpha = (256 >> SHIFT) * aa;
// clamp 256->255
return alpha - (alpha >> 8);
}
void SuperBlitter::blitH(int x, int y, int width) {