From cafc9f9e80e30fa75ad8a952e7a290e72f211ce7 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Sat, 22 Aug 2009 03:44:57 +0000 Subject: fixes around isOpaque and dithering - copyTo() now preserves isOpaqueness, and BitmapCopyTest tests it - bitmap shader doesn't claim to have shadespan16 if dithering is on, since its sampler doesn't auto-dither (note that gradients do auto-dither in their 16bit sampler) - blitter setup just relies on the shader to report if its 16bit sampler can be called (allowing gradients to say yes regardless of dither, but bitmaps to say no if dithering is on) git-svn-id: http://skia.googlecode.com/svn/trunk@331 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkBitmapProcShader.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/core/SkBitmapProcShader.cpp') 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; } -- cgit v1.2.3