aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBlitter.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-04-14 18:39:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-14 18:39:57 -0700
commitdd83031b98db4c6d3d0de2353bf115152a7d1464 (patch)
treead5d37b51be4935c20c413ec096ce9d084e13f51 /src/core/SkBlitter.h
parentc3c5990ac0f1063eb92a98b98a71314b5b5ef7e8 (diff)
add new blit2 methods in support of antialiased hairlines
before: 9M 1 528µs 530µs 539µs 607µs 5% ▁▁▁▁▁▁▁▁█▂ 8888 path_hairline_small_AA_quad after: 9M 1 355µs 356µs 358µs 375µs 2% ▂▁▁▁▁▁▁▁▁█ 8888 path_hairline_small_AA_quad BUG=skia: does require new baselines (bug chrome is guarded) Review URL: https://codereview.chromium.org/1060153003
Diffstat (limited to 'src/core/SkBlitter.h')
-rw-r--r--src/core/SkBlitter.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index 9447bf1b51..51d60a4576 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,10 +5,15 @@
* found in the LICENSE file.
*/
-
#ifndef SkBlitter_DEFINED
#define SkBlitter_DEFINED
+#ifdef SK_SUPPORT_LEGACY_BLITANTIH2V2
+ #define SK_BLITANTIH2V2_VIRTUAL
+#else
+ #define SK_BLITANTIH2V2_VIRTUAL virtual
+#endif
+
#include "SkBitmap.h"
#include "SkBitmapProcShader.h"
#include "SkMask.h"
@@ -55,6 +59,35 @@ public:
*/
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value);
+ // (x, y), (x + 1, y)
+ SK_BLITANTIH2V2_VIRTUAL void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
+ int16_t runs[3];
+ uint8_t aa[2];
+
+ runs[0] = 1;
+ runs[1] = 1;
+ runs[2] = 0;
+ aa[0] = SkToU8(a0);
+ aa[1] = SkToU8(a1);
+ this->blitAntiH(x, y, aa, runs);
+ }
+
+ // (x, y), (x, y + 1)
+ SK_BLITANTIH2V2_VIRTUAL void blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
+ int16_t runs[2];
+ uint8_t aa[1];
+
+ runs[0] = 1;
+ runs[1] = 0;
+ aa[0] = SkToU8(a0);
+ this->blitAntiH(x, y, aa, runs);
+ // reset in case the clipping blitter modified runs
+ runs[0] = 1;
+ runs[1] = 0;
+ aa[0] = SkToU8(a1);
+ this->blitAntiH(x, y + 1, aa, runs);
+ }
+
/**
* Special method just to identify the null blitter, which is returned
* from Choose() if the request cannot be fulfilled. Default impl