aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmap.cpp2
-rw-r--r--src/core/SkBitmapProcShader.cpp18
-rw-r--r--src/core/SkBlitter.cpp14
-rw-r--r--src/core/SkColorTable.cpp8
4 files changed, 26 insertions, 16 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index d87f001ed8..9478faef52 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -793,6 +793,8 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const {
canvas.drawBitmap(*this, 0, 0, &paint);
}
+ tmp.setIsOpaque(this->isOpaque());
+
dst->swap(tmp);
return true;
}
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 7eb8ea148b..353388b74c 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -102,19 +102,19 @@ bool SkBitmapProcShader::setContext(const SkBitmap& device,
}
// update fFlags
- fFlags = 0;
+ uint32_t flags = 0;
if (bitmapIsOpaque && (255 == this->getPaintAlpha())) {
- fFlags |= kOpaqueAlpha_Flag;
+ flags |= kOpaqueAlpha_Flag;
}
switch (fState.fBitmap->config()) {
case SkBitmap::kRGB_565_Config:
- fFlags |= (kHasSpan16_Flag | kIntrinsicly16_Flag);
+ flags |= (kHasSpan16_Flag | kIntrinsicly16_Flag);
break;
case SkBitmap::kIndex8_Config:
case SkBitmap::kARGB_8888_Config:
if (bitmapIsOpaque) {
- fFlags |= kHasSpan16_Flag;
+ flags |= kHasSpan16_Flag;
}
break;
case SkBitmap::kA8_Config:
@@ -123,11 +123,19 @@ bool SkBitmapProcShader::setContext(const SkBitmap& device,
break;
}
+ if (paint.isDither()) {
+ // gradients can auto-dither in their 16bit sampler, but we don't so
+ // we clear the flag here
+ flags &= ~kHasSpan16_Flag;
+ }
+
// if we're only 1-pixel heigh, and we don't rotate, then we can claim this
if (1 == fState.fBitmap->height() &&
only_scale_and_translate(this->getTotalInverse())) {
- fFlags |= kConstInY_Flag;
+ flags |= kConstInY_Flag;
}
+
+ fFlags = flags;
return true;
}
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index faf29c1712..e60887e588 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -896,16 +896,8 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
((SkPaint*)&paint)->setShader(shader)->unref();
}
- bool doDither = paint.isDither();
-
- if (shader)
- {
- if (!shader->setContext(device, paint, matrix))
- return SkNEW(SkNullBlitter);
-
- // disable dither if our shader is natively 16bit (no need to upsample)
- if (shader->getFlags() & SkShader::kIntrinsicly16_Flag)
- doDither = false;
+ if (shader && !shader->setContext(device, paint, matrix)) {
+ return SkNEW(SkNullBlitter);
}
switch (device.getConfig()) {
@@ -929,7 +921,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
{
if (mode)
SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Xfermode_Blitter, storage, storageSize, (device, paint));
- else if (SkShader::CanCallShadeSpan16(shader->getFlags()) && !doDither)
+ else if (shader->canCallShadeSpan16())
SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader16_Blitter, storage, storageSize, (device, paint));
else
SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Blitter, storage, storageSize, (device, paint));
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 41e6895fff..308287c1ea 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -132,6 +132,14 @@ const uint16_t* SkColorTable::lock16BitCache()
return f16BitCache;
}
+void SkColorTable::setIsOpaque(bool isOpaque) {
+ if (isOpaque) {
+ fFlags |= kColorsAreOpaque_Flag;
+ } else {
+ fFlags &= ~kColorsAreOpaque_Flag;
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
SkColorTable::SkColorTable(SkFlattenableReadBuffer& buffer) {