aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBlitter.cpp
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-01 21:09:00 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-01 21:09:00 +0000
commitf974a5d7826688c9d87cc36a56c697ea5fae12de (patch)
tree42859d8a4fbe39095526ef62a48cd5c92fb1d729 /src/core/SkBlitter.cpp
parent05fffdcc912cb9678e03d39529577e2a29b9209e (diff)
New function SkBlitter::blitAntiRect(); specifically accelerated for
supersampled antialiased clips. git-svn-id: http://skia.googlecode.com/svn/trunk@2783 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBlitter.cpp')
-rw-r--r--src/core/SkBlitter.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 307d51b340..17cba4776d 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -52,6 +52,16 @@ void SkBlitter::blitRect(int x, int y, int width, int height) {
}
}
+/// Default implementation doesn't check for any easy optimizations
+/// such as alpha == 0 or 255; also uses blitV(), which some subclasses
+/// may not support.
+void SkBlitter::blitAntiRect(int x, int y, int width, int height,
+ SkAlpha leftAlpha, SkAlpha rightAlpha) {
+ this->blitV(x, y, height, leftAlpha);
+ this->blitRect(x + 1, y, width, height);
+ this->blitV(x + width - 1, y, height, rightAlpha);
+}
+
//////////////////////////////////////////////////////////////////////////////
static inline void bits_to_runs(SkBlitter* blitter, int x, int y,
@@ -118,7 +128,8 @@ void SkBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
int rite_mask = 0xFF << (8 - (rite_edge & 7));
int full_runs = (rite_edge >> 3) - ((left_edge + 7) >> 3);
- // check for empty right mask, so we don't read off the end (or go slower than we need to)
+ // check for empty right mask, so we don't read off the end
+ // (or go slower than we need to)
if (rite_mask == 0) {
SkASSERT(full_runs >= 0);
full_runs -= 1;
@@ -128,8 +139,8 @@ void SkBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
full_runs -= 1;
}
- // back up manually so we can keep in sync with our byte-aligned src
- // have cx reflect our actual starting x-coord
+ // Back up manually so we can keep in sync with our byte-aligned
+ // src; have cx reflect our actual starting x-coord.
cx -= left_edge & 7;
if (full_runs < 0) {
@@ -141,7 +152,8 @@ void SkBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
}
} else {
while (--height >= 0) {
- bits_to_runs(this, cx, cy, bits, left_mask, full_runs + 2, rite_mask);
+ bits_to_runs(this, cx, cy, bits, left_mask, full_runs + 2,
+ rite_mask);
bits += mask_rowBytes;
cy += 1;
}