diff options
author | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 18:00:02 +0000 |
---|---|---|
committer | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 18:00:02 +0000 |
commit | 04f7c07b0c7f66450225978f5f0d5717000d81d7 (patch) | |
tree | 7499c19d02c65ea741fdb27ab2576155a7b68181 /skia | |
parent | 3f310f8d07a9c39850393a3b8bd4f4b62f7d0cfb (diff) | |
download | chromium_src-04f7c07b0c7f66450225978f5f0d5717000d81d7.zip chromium_src-04f7c07b0c7f66450225978f5f0d5717000d81d7.tar.gz chromium_src-04f7c07b0c7f66450225978f5f0d5717000d81d7.tar.bz2 |
Incorporate r134 from Skia. See http://crbugs.com/9005 for details.
R=brettw
Review URL: http://codereview.chromium.org/52019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/sgl/SkScan_Antihair.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/skia/sgl/SkScan_Antihair.cpp b/skia/sgl/SkScan_Antihair.cpp index 04e4690..9ee16e6 100644 --- a/skia/sgl/SkScan_Antihair.cpp +++ b/skia/sgl/SkScan_Antihair.cpp @@ -21,6 +21,22 @@ #include "SkRegion.h" #include "SkFDot6.h" +/* Our attempt to compute the worst case "bounds" for the horizontal and + vertical cases has some numerical bug in it, and we sometimes undervalue + our extends. The bug is that when this happens, we will set the clip to + NULL (for speed), and thus draw outside of the clip by a pixel, which might + only look bad, but it might also access memory outside of the valid range + allcoated for the device bitmap. + + This define enables our fix to outset our "bounds" by 1, thus avoiding the + chance of the bug, but at the cost of sometimes taking the rectblitter + case (i.e. not setting the clip to NULL) when we might not actually need + to. If we can improve/fix the actual calculations, then we can remove this + step. +*/ +#define OUTSET_BEFORE_CLIP_TEST true + + #define HLINE_STACK_BUFFER 100 static inline int SmallDot6Scale(int value, int dot6) { @@ -284,6 +300,10 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1, bottom = SkFixedCeil(fstart + SK_FixedHalf); top = SkFixedFloor(fstart + (istop - istart - 1) * slope - SK_FixedHalf); } + if (OUTSET_BEFORE_CLIP_TEST) { + top -= 1; + bottom += 1; + } if (top >= clip->fBottom || bottom <= clip->fTop) return; if (clip->fTop <= top && clip->fBottom >= bottom) @@ -357,6 +377,10 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1, right = SkFixedCeil(fstart + SK_FixedHalf); left = SkFixedFloor(fstart + (istop - istart - 1) * slope - SK_FixedHalf); } + if (OUTSET_BEFORE_CLIP_TEST) { + left -= 1; + right += 1; + } if (left >= clip->fRight || right <= clip->fLeft) return; if (clip->fLeft <= left && clip->fRight >= right) |