aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_AntiPath.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-09 15:54:38 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-09 15:54:38 +0000
commit2f3567c0003b948ad90528e597ea1e8326f644ae (patch)
treeb76b6005c6f03fbf35dd44839ade046fb1bc3c69 /src/core/SkScan_AntiPath.cpp
parent9dc527bebfaca7c87a39302510399bb0d0fe770d (diff)
check-point for unifying results between runs and mask backends for aa
git-svn-id: http://skia.googlecode.com/svn/trunk@1554 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkScan_AntiPath.cpp')
-rw-r--r--src/core/SkScan_AntiPath.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 398f786c95..4dc2cd346c 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -26,8 +26,20 @@
#define SCALE (1 << SHIFT)
#define MASK (SCALE - 1)
+/*
+ We have two techniques for capturing the output of the supersampler:
+ - SUPERMASK, which records a large mask-bitmap
+ this is often faster for small, complex objects
+ - RLE, which records a rle-encoded scanline
+ this is often faster for large objects with big spans
+
+ NEW_AA is a set of code-changes to try to make both paths produce identical
+ results. Its not quite there yet, though the remaining differences may be
+ in the subsequent blits, and not in the different masks/runs...
+ */
//#define FORCE_SUPERMASK
//#define FORCE_RLE
+//#define SK_SUPPORT_NEW_AA
///////////////////////////////////////////////////////////////////////////////
@@ -281,9 +293,17 @@ static void add_aa_span(uint8_t* alpha, U8CPU startAlpha, int middleCount,
edge of the current span round to the same super-sampled x value,
I might overflow to 256 with this add, hence the funny subtract.
*/
+#ifdef SK_SUPPORT_NEW_AA
+ if (startAlpha) {
+ unsigned tmp = *alpha + startAlpha;
+ SkASSERT(tmp <= 256);
+ *alpha++ = SkToU8(tmp - (tmp >> 8));
+ }
+#else
unsigned tmp = *alpha + startAlpha;
SkASSERT(tmp <= 256);
*alpha++ = SkToU8(tmp - (tmp >> 8));
+#endif
if (middleCount >= MIN_COUNT_FOR_QUAD_LOOP) {
// loop until we're quad-byte aligned
@@ -365,7 +385,15 @@ void MaskSuperBlitter::blitH(int x, int y, int width) {
SkASSERT(row < fMask.fImage + kMAX_STORAGE + 1);
add_aa_span(row, coverage_to_alpha(fe - fb));
} else {
+#ifdef SK_SUPPORT_NEW_AA
+ if (0 == fb) {
+ n += 1;
+ } else {
+ fb = (1 << SHIFT) - fb;
+ }
+#else
fb = (1 << SHIFT) - fb;
+#endif
SkASSERT(row >= fMask.fImage);
SkASSERT(row + n + 1 < fMask.fImage + kMAX_STORAGE + 1);
add_aa_span(row, coverage_to_alpha(fb), n, coverage_to_alpha(fe),