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

Unified Diff: src/core/SkBlitter_ARGB32.cpp

Issue 160103002: Work in progress to make SkShader immutable. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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.cpp ('k') | src/core/SkComposeShader.cpp » ('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 d4bec1bc086fe7e7c3fcc9f4bb0b4b183731edb8..187961e7cdabf94d2282f3baa78ba485a100aef3 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -275,7 +275,9 @@ static void blend_srcmode(SkPMColor* SK_RESTRICT device,
}
SkARGB32_Shader_Blitter::SkARGB32_Shader_Blitter(const SkBitmap& device,
- const SkPaint& paint) : INHERITED(device, paint) {
+ const SkPaint& paint, SkShader::Context* context)
+ : INHERITED(device, paint, context)
+{
fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * (sizeof(SkPMColor)));
fXfermode = paint.getXfermode();
@@ -319,10 +321,10 @@ void SkARGB32_Shader_Blitter::blitH(int x, int y, int width) {
uint32_t* device = fDevice.getAddr32(x, y);
if (fShadeDirectlyIntoDevice) {
- fShader->shadeSpan(x, y, device, width);
+ fShader->shadeSpan(fContext, x, y, device, width);
} else {
SkPMColor* span = fBuffer;
- fShader->shadeSpan(x, y, span, width);
+ fShader->shadeSpan(fContext, x, y, span, width);
if (fXfermode) {
fXfermode->xfer32(device, span, width, NULL);
} else {
@@ -343,14 +345,14 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
if (fConstInY) {
if (fShadeDirectlyIntoDevice) {
// shade the first row directly into the device
- fShader->shadeSpan(x, y, device, width);
+ fShader->shadeSpan(fContext, x, y, device, width);
span = device;
while (--height > 0) {
device = (uint32_t*)((char*)device + deviceRB);
memcpy(device, span, width << 2);
}
} else {
- fShader->shadeSpan(x, y, span, width);
+ fShader->shadeSpan(fContext, x, y, span, width);
SkXfermode* xfer = fXfermode;
if (xfer) {
do {
@@ -381,7 +383,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
} while (--height > 0);
} else {
do {
- shader->shadeSpan(x, y, device, width);
+ shader->shadeSpan(fContext, x, y, device, width);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -390,7 +392,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
SkXfermode* xfer = fXfermode;
if (xfer) {
do {
- shader->shadeSpan(x, y, span, width);
+ shader->shadeSpan(fContext, x, y, span, width);
xfer->xfer32(device, span, width, NULL);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
@@ -398,7 +400,7 @@ void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) {
} else {
SkBlitRow::Proc32 proc = fProc32;
do {
- shader->shadeSpan(x, y, span, width);
+ shader->shadeSpan(fContext, x, y, span, width);
proc(device, span, width, 255);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
@@ -422,7 +424,7 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
break;
int aa = *antialias;
if (aa) {
- shader->shadeSpan(x, y, span, count);
+ shader->shadeSpan(fContext, x, y, span, count);
if (aa == 255) {
xfer->xfer32(device, span, count, NULL);
} else {
@@ -448,9 +450,9 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
if (aa) {
if (aa == 255) {
// cool, have the shader draw right into the device
- shader->shadeSpan(x, y, device, count);
+ shader->shadeSpan(fContext, x, y, device, count);
} else {
- shader->shadeSpan(x, y, span, count);
+ shader->shadeSpan(fContext, x, y, span, count);
fProc32Blend(device, span, count, aa);
}
}
@@ -467,7 +469,7 @@ void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
}
int aa = *antialias;
if (aa) {
- fShader->shadeSpan(x, y, span, count);
+ fShader->shadeSpan(fContext, x, y, span, count);
if (aa == 255) {
fProc32(device, span, count, 255);
} else {
@@ -522,7 +524,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
SkASSERT(SkMask::kA8_Format == mask.fFormat);
SkXfermode* xfer = fXfermode;
do {
- shader->shadeSpan(x, y, span, width);
+ shader->shadeSpan(fContext, x, y, span, width);
xfer->xfer32((SkPMColor*)dstRow, span, width, maskRow);
dstRow += dstRB;
maskRow += maskRB;
@@ -530,7 +532,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
} while (--height > 0);
} else {
do {
- shader->shadeSpan(x, y, span, width);
+ shader->shadeSpan(fContext, x, y, span, width);
proc(dstRow, maskRow, span, width);
dstRow += dstRB;
maskRow += maskRB;
@@ -548,7 +550,7 @@ void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
if (fConstInY) {
SkPMColor c;
- fShader->shadeSpan(x, y, &c, 1);
+ fShader->shadeSpan(fContext, x, y, &c, 1);
if (fShadeDirectlyIntoDevice) {
if (255 == alpha) {
@@ -592,7 +594,7 @@ void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
} while (--height > 0);
} else {
do {
- shader->shadeSpan(x, y, device, 1);
+ shader->shadeSpan(fContext, x, y, device, 1);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
} while (--height > 0);
@@ -608,7 +610,7 @@ void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
} while (--height > 0);
} else {
do {
- shader->shadeSpan(x, y, &c, 1);
+ shader->shadeSpan(fContext, x, y, &c, 1);
*device = SkFourByteInterp(c, *device, alpha);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
@@ -620,7 +622,7 @@ void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
SkXfermode* xfer = fXfermode;
if (xfer) {
do {
- shader->shadeSpan(x, y, span, 1);
+ shader->shadeSpan(fContext, x, y, span, 1);
xfer->xfer32(device, span, 1, &alpha);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
@@ -628,7 +630,7 @@ void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
} else {
SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
do {
- shader->shadeSpan(x, y, span, 1);
+ shader->shadeSpan(fContext, x, y, span, 1);
proc(device, span, 1, alpha);
y += 1;
device = (uint32_t*)((char*)device + deviceRB);
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkComposeShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698