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

Unified Diff: src/core/SkBlitter_A8.cpp

Issue 50673005: Revert "Revert "speed up A8 by creating a new entry-point in SkDraw that blits the path's coverage … (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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.cpp ('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_A8.cpp
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index 7fca29ecf5d0c2e31c12b0fe9b01bdceba74d8e6..1df033f54bce314060a435973836eb5a51f28a07 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -347,3 +347,93 @@ void SkA8_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
alpha += mask.fRowBytes;
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#define SK_A8_COVERAGE_BLIT_SKIP_ZEROS
+
+SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkBitmap& device,
+ const SkPaint& paint) : SkRasterBlitter(device) {
+ SkASSERT(NULL == paint.getShader());
+ SkASSERT(NULL == paint.getXfermode());
+ SkASSERT(NULL == paint.getColorFilter());
+}
+
+void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
+ const int16_t runs[]) {
+ SkASSERT(0 == x);
+
+ uint8_t* device = fDevice.getAddr8(x, y);
+ SkDEBUGCODE(int totalCount = 0;)
+
+ for (;;) {
+ int count = runs[0];
+ SkASSERT(count >= 0);
+ if (count == 0) {
+ return;
+ }
+#ifdef SK_A8_COVERAGE_BLIT_SKIP_ZEROS
+ if (antialias[0])
+#endif
+ {
+ memset(device, antialias[0], count);
+ }
+ runs += count;
+ antialias += count;
+ device += count;
+
+ SkDEBUGCODE(totalCount += count;)
+ }
+ SkASSERT(fDevice.width() == totalCount);
+}
+
+void SkA8_Coverage_Blitter::blitH(int x, int y, int width) {
+ memset(fDevice.getAddr8(x, y), 0xFF, width);
+}
+
+void SkA8_Coverage_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
+#ifdef SK_A8_COVERAGE_BLIT_SKIP_ZEROS
+ if (0 == alpha) {
+ return;
+ }
+#endif
+ uint8_t* dst = fDevice.getAddr8(x, y);
+ const size_t dstRB = fDevice.rowBytes();
+ while (--height >= 0) {
+ *dst = alpha;
+ dst += dstRB;
+ }
+}
+
+void SkA8_Coverage_Blitter::blitRect(int x, int y, int width, int height) {
+ uint8_t* dst = fDevice.getAddr8(x, y);
+ const size_t dstRB = fDevice.rowBytes();
+ while (--height >= 0) {
+ memset(dst, 0xFF, width);
+ dst += dstRB;
+ }
+}
+
+void SkA8_Coverage_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
+ SkASSERT(SkMask::kA8_Format == mask.fFormat);
+
+ int x = clip.fLeft;
+ int y = clip.fTop;
+ int width = clip.width();
+ int height = clip.height();
+
+ uint8_t* dst = fDevice.getAddr8(x, y);
+ const uint8_t* src = mask.getAddr8(x, y);
+ const size_t srcRB = mask.fRowBytes;
+ const size_t dstRB = fDevice.rowBytes();
+
+ while (--height >= 0) {
+ memcpy(dst, src, width);
+ dst += dstRB;
+ src += srcRB;
+ }
+}
+
+const SkBitmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {
+ return NULL;
+}
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698