Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: src/core/SkBlitter_ARGB32.cpp

Issue 1060153003: add new blit2 methods in support of antialiased hairlines guard flag SK_SUPPORT_LEGACY_BLITANTIH2V2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: specialize non-opaque color as well Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBlitter.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter_ARGB32.cpp
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index bbad6c792664dc0d51e23e4570aa27eef84f19e9..caf85ddc1fec65b2cbeb64ea1968f6ca90f0471d 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -106,6 +106,25 @@ void SkARGB32_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
}
}
+#ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
+void SkARGB32_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
+
+ device[0] = SkBlendARGB32(fPMColor, device[0], a0);
+ device[1] = SkBlendARGB32(fPMColor, device[1], a1);
+}
+
+void SkARGB32_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
+
+ device[0] = SkBlendARGB32(fPMColor, device[0], a0);
+ device = (uint32_t*)((char*)device + fDevice.rowBytes());
+ device[0] = SkBlendARGB32(fPMColor, device[0], a1);
+}
+#endif
+
//////////////////////////////////////////////////////////////////////////////////////
#define solid_8_pixels(mask, dst, color) \
@@ -180,6 +199,25 @@ void SkARGB32_Opaque_Blitter::blitMask(const SkMask& mask,
}
}
+#ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
+void SkARGB32_Opaque_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
+
+ device[0] = SkFastFourByteInterp(fPMColor, device[0], a0);
+ device[1] = SkFastFourByteInterp(fPMColor, device[1], a1);
+}
+
+void SkARGB32_Opaque_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
+
+ device[0] = SkFastFourByteInterp(fPMColor, device[0], a0);
+ device = (uint32_t*)((char*)device + fDevice.rowBytes());
+ device[0] = SkFastFourByteInterp(fPMColor, device[0], a1);
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
@@ -256,6 +294,25 @@ void SkARGB32_Black_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
}
}
+#ifndef SK_SUPPORT_LEGACY_BLITANTIH2V2
+void SkARGB32_Black_Blitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x + 1, y);)
+
+ device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0);
+ device[1] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[1], 256 - a1);
+}
+
+void SkARGB32_Black_Blitter::blitAntiV2(int x, int y, U8CPU a0, U8CPU a1) {
+ uint32_t* device = fDevice.getAddr32(x, y);
+ SkDEBUGCODE((void)fDevice.getAddr32(x, y + 1);)
+
+ device[0] = (a0 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a0);
+ device = (uint32_t*)((char*)device + fDevice.rowBytes());
+ device[0] = (a1 << SK_A32_SHIFT) + SkAlphaMulQ(device[0], 256 - a1);
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// Special version of SkBlitRow::Factory32 that knows we're in kSrc_Mode,
« no previous file with comments | « src/core/SkBlitter.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698