Index: src/core/SkBlitter_RGB16.cpp |
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp |
index e22aac4edaccbf0fcaf4ed7cbca6c8657b05acfb..21b5a16e3c3533961ce5232e7a21f5152ee32a84 100644 |
--- a/src/core/SkBlitter_RGB16.cpp |
+++ b/src/core/SkBlitter_RGB16.cpp |
@@ -107,8 +107,7 @@ |
class SkRGB16_Shader_Blitter : public SkShaderBlitter { |
public: |
- SkRGB16_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, |
- SkShader::Context* shaderContext); |
+ SkRGB16_Shader_Blitter(const SkBitmap& device, const SkPaint& paint); |
virtual ~SkRGB16_Shader_Blitter(); |
virtual void blitH(int x, int y, int width); |
virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
@@ -130,8 +129,7 @@ |
// used only if the shader can perform shadSpan16 |
class SkRGB16_Shader16_Blitter : public SkRGB16_Shader_Blitter { |
public: |
- SkRGB16_Shader16_Blitter(const SkBitmap& device, const SkPaint& paint, |
- SkShader::Context* shaderContext); |
+ SkRGB16_Shader16_Blitter(const SkBitmap& device, const SkPaint& paint); |
virtual void blitH(int x, int y, int width); |
virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
const int16_t* runs); |
@@ -143,8 +141,7 @@ |
class SkRGB16_Shader_Xfermode_Blitter : public SkShaderBlitter { |
public: |
- SkRGB16_Shader_Xfermode_Blitter(const SkBitmap& device, const SkPaint& paint, |
- SkShader::Context* shaderContext); |
+ SkRGB16_Shader_Xfermode_Blitter(const SkBitmap& device, const SkPaint& paint); |
virtual ~SkRGB16_Shader_Xfermode_Blitter(); |
virtual void blitH(int x, int y, int width); |
virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
@@ -682,9 +679,8 @@ |
/////////////////////////////////////////////////////////////////////////////// |
SkRGB16_Shader16_Blitter::SkRGB16_Shader16_Blitter(const SkBitmap& device, |
- const SkPaint& paint, |
- SkShader::Context* shaderContext) |
- : SkRGB16_Shader_Blitter(device, paint, shaderContext) { |
+ const SkPaint& paint) |
+ : SkRGB16_Shader_Blitter(device, paint) { |
SkASSERT(SkShader::CanCallShadeSpan16(fShaderFlags)); |
} |
@@ -692,28 +688,28 @@ |
SkASSERT(x + width <= fDevice.width()); |
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
- SkShader::Context* shaderContext = fShaderContext; |
- |
- int alpha = shaderContext->getSpan16Alpha(); |
+ SkShader* shader = fShader; |
+ |
+ int alpha = shader->getSpan16Alpha(); |
if (0xFF == alpha) { |
- shaderContext->shadeSpan16(x, y, device, width); |
+ shader->shadeSpan16(x, y, device, width); |
} else { |
uint16_t* span16 = (uint16_t*)fBuffer; |
- shaderContext->shadeSpan16(x, y, span16, width); |
+ shader->shadeSpan16(x, y, span16, width); |
SkBlendRGB16(span16, device, SkAlpha255To256(alpha), width); |
} |
} |
void SkRGB16_Shader16_Blitter::blitRect(int x, int y, int width, int height) { |
- SkShader::Context* shaderContext = fShaderContext; |
- uint16_t* dst = fDevice.getAddr16(x, y); |
- size_t dstRB = fDevice.rowBytes(); |
- int alpha = shaderContext->getSpan16Alpha(); |
+ SkShader* shader = fShader; |
+ uint16_t* dst = fDevice.getAddr16(x, y); |
+ size_t dstRB = fDevice.rowBytes(); |
+ int alpha = shader->getSpan16Alpha(); |
if (0xFF == alpha) { |
if (fShaderFlags & SkShader::kConstInY16_Flag) { |
// have the shader blit directly into the device the first time |
- shaderContext->shadeSpan16(x, y, dst, width); |
+ shader->shadeSpan16(x, y, dst, width); |
// and now just memcpy that line on the subsequent lines |
if (--height > 0) { |
const uint16_t* orig = dst; |
@@ -724,7 +720,7 @@ |
} |
} else { // need to call shadeSpan16 for every line |
do { |
- shaderContext->shadeSpan16(x, y, dst, width); |
+ shader->shadeSpan16(x, y, dst, width); |
y += 1; |
dst = (uint16_t*)((char*)dst + dstRB); |
} while (--height); |
@@ -733,14 +729,14 @@ |
int scale = SkAlpha255To256(alpha); |
uint16_t* span16 = (uint16_t*)fBuffer; |
if (fShaderFlags & SkShader::kConstInY16_Flag) { |
- shaderContext->shadeSpan16(x, y, span16, width); |
+ shader->shadeSpan16(x, y, span16, width); |
do { |
SkBlendRGB16(span16, dst, scale, width); |
dst = (uint16_t*)((char*)dst + dstRB); |
} while (--height); |
} else { |
do { |
- shaderContext->shadeSpan16(x, y, span16, width); |
+ shader->shadeSpan16(x, y, span16, width); |
SkBlendRGB16(span16, dst, scale, width); |
y += 1; |
dst = (uint16_t*)((char*)dst + dstRB); |
@@ -752,11 +748,11 @@ |
void SkRGB16_Shader16_Blitter::blitAntiH(int x, int y, |
const SkAlpha* SK_RESTRICT antialias, |
const int16_t* SK_RESTRICT runs) { |
- SkShader::Context* shaderContext = fShaderContext; |
+ SkShader* shader = fShader; |
SkPMColor* SK_RESTRICT span = fBuffer; |
- uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
- |
- int alpha = shaderContext->getSpan16Alpha(); |
+ uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
+ |
+ int alpha = shader->getSpan16Alpha(); |
uint16_t* span16 = (uint16_t*)span; |
if (0xFF == alpha) { |
@@ -770,9 +766,9 @@ |
int aa = *antialias; |
if (aa == 255) { |
// go direct to the device! |
- shaderContext->shadeSpan16(x, y, device, count); |
+ shader->shadeSpan16(x, y, device, count); |
} else if (aa) { |
- shaderContext->shadeSpan16(x, y, span16, count); |
+ shader->shadeSpan16(x, y, span16, count); |
SkBlendRGB16(span16, device, SkAlpha255To256(aa), count); |
} |
device += count; |
@@ -791,7 +787,7 @@ |
int aa = SkAlphaMul(*antialias, alpha); |
if (aa) { |
- shaderContext->shadeSpan16(x, y, span16, count); |
+ shader->shadeSpan16(x, y, span16, count); |
SkBlendRGB16(span16, device, SkAlpha255To256(aa), count); |
} |
@@ -806,9 +802,8 @@ |
/////////////////////////////////////////////////////////////////////////////// |
SkRGB16_Shader_Blitter::SkRGB16_Shader_Blitter(const SkBitmap& device, |
- const SkPaint& paint, |
- SkShader::Context* shaderContext) |
-: INHERITED(device, paint, shaderContext) { |
+ const SkPaint& paint) |
+: INHERITED(device, paint) { |
SkASSERT(paint.getXfermode() == NULL); |
fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * sizeof(SkPMColor)); |
@@ -839,20 +834,20 @@ |
void SkRGB16_Shader_Blitter::blitH(int x, int y, int width) { |
SkASSERT(x + width <= fDevice.width()); |
- fShaderContext->shadeSpan(x, y, fBuffer, width); |
+ fShader->shadeSpan(x, y, fBuffer, width); |
// shaders take care of global alpha, so we pass 0xFF (should be ignored) |
fOpaqueProc(fDevice.getAddr16(x, y), fBuffer, width, 0xFF, x, y); |
} |
void SkRGB16_Shader_Blitter::blitRect(int x, int y, int width, int height) { |
- SkShader::Context* shaderContext = fShaderContext; |
- SkBlitRow::Proc proc = fOpaqueProc; |
- SkPMColor* buffer = fBuffer; |
- uint16_t* dst = fDevice.getAddr16(x, y); |
- size_t dstRB = fDevice.rowBytes(); |
+ SkShader* shader = fShader; |
+ SkBlitRow::Proc proc = fOpaqueProc; |
+ SkPMColor* buffer = fBuffer; |
+ uint16_t* dst = fDevice.getAddr16(x, y); |
+ size_t dstRB = fDevice.rowBytes(); |
if (fShaderFlags & SkShader::kConstInY32_Flag) { |
- shaderContext->shadeSpan(x, y, buffer, width); |
+ shader->shadeSpan(x, y, buffer, width); |
do { |
proc(dst, buffer, width, 0xFF, x, y); |
y += 1; |
@@ -860,7 +855,7 @@ |
} while (--height); |
} else { |
do { |
- shaderContext->shadeSpan(x, y, buffer, width); |
+ shader->shadeSpan(x, y, buffer, width); |
proc(dst, buffer, width, 0xFF, x, y); |
y += 1; |
dst = (uint16_t*)((char*)dst + dstRB); |
@@ -885,9 +880,9 @@ |
void SkRGB16_Shader_Blitter::blitAntiH(int x, int y, |
const SkAlpha* SK_RESTRICT antialias, |
const int16_t* SK_RESTRICT runs) { |
- SkShader::Context* shaderContext = fShaderContext; |
+ SkShader* shader = fShader; |
SkPMColor* SK_RESTRICT span = fBuffer; |
- uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
+ uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
for (;;) { |
int count = *runs; |
@@ -906,7 +901,7 @@ |
int nonZeroCount = count + count_nonzero_span(runs + count, antialias + count); |
SkASSERT(nonZeroCount <= fDevice.width()); // don't overrun fBuffer |
- shaderContext->shadeSpan(x, y, span, nonZeroCount); |
+ shader->shadeSpan(x, y, span, nonZeroCount); |
SkPMColor* localSpan = span; |
for (;;) { |
@@ -933,9 +928,8 @@ |
/////////////////////////////////////////////////////////////////////// |
SkRGB16_Shader_Xfermode_Blitter::SkRGB16_Shader_Xfermode_Blitter( |
- const SkBitmap& device, const SkPaint& paint, |
- SkShader::Context* shaderContext) |
-: INHERITED(device, paint, shaderContext) { |
+ const SkBitmap& device, const SkPaint& paint) |
+: INHERITED(device, paint) { |
fXfermode = paint.getXfermode(); |
SkASSERT(fXfermode); |
fXfermode->ref(); |
@@ -956,18 +950,18 @@ |
uint16_t* device = fDevice.getAddr16(x, y); |
SkPMColor* span = fBuffer; |
- fShaderContext->shadeSpan(x, y, span, width); |
+ fShader->shadeSpan(x, y, span, width); |
fXfermode->xfer16(device, span, width, NULL); |
} |
void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y, |
const SkAlpha* SK_RESTRICT antialias, |
const int16_t* SK_RESTRICT runs) { |
- SkShader::Context* shaderContext = fShaderContext; |
- SkXfermode* mode = fXfermode; |
+ SkShader* shader = fShader; |
+ SkXfermode* mode = fXfermode; |
SkPMColor* SK_RESTRICT span = fBuffer; |
- uint8_t* SK_RESTRICT aaExpand = fAAExpand; |
- uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
+ uint8_t* SK_RESTRICT aaExpand = fAAExpand; |
+ uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); |
for (;;) { |
int count = *runs; |
@@ -987,7 +981,7 @@ |
antialias + count); |
SkASSERT(nonZeroCount <= fDevice.width()); // don't overrun fBuffer |
- shaderContext->shadeSpan(x, y, span, nonZeroCount); |
+ shader->shadeSpan(x, y, span, nonZeroCount); |
x += nonZeroCount; |
SkPMColor* localSpan = span; |
@@ -1018,7 +1012,6 @@ |
/////////////////////////////////////////////////////////////////////////////// |
SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint, |
- SkShader::Context* shaderContext, |
SkTBlitterAllocator* allocator) { |
SkASSERT(allocator != NULL); |
@@ -1030,14 +1023,12 @@ |
SkASSERT(NULL == mode || NULL != shader); |
if (shader) { |
- SkASSERT(shaderContext != NULL); |
if (mode) { |
- blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device, paint, |
- shaderContext); |
- } else if (shaderContext->canCallShadeSpan16()) { |
- blitter = allocator->createT<SkRGB16_Shader16_Blitter>(device, paint, shaderContext); |
+ blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device, paint); |
+ } else if (shader->canCallShadeSpan16()) { |
+ blitter = allocator->createT<SkRGB16_Shader16_Blitter>(device, paint); |
} else { |
- blitter = allocator->createT<SkRGB16_Shader_Blitter>(device, paint, shaderContext); |
+ blitter = allocator->createT<SkRGB16_Shader_Blitter>(device, paint); |
} |
} else { |
// no shader, no xfermode, (and we always ignore colorfilter) |