Chromium Code Reviews| Index: src/core/SkBitmapDevice.cpp |
| diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp |
| index 2711004aef14de4fbda9fbe12f2c74b171acdfa5..f21419a20732193069f072a6f9eba712a2c0bda7 100644 |
| --- a/src/core/SkBitmapDevice.cpp |
| +++ b/src/core/SkBitmapDevice.cpp |
| @@ -57,7 +57,8 @@ static bool valid_for_bitmap_device(const SkImageInfo& info, |
| return true; |
| } |
|
robertphillips
2014/09/16 14:15:18
Why this change?
reed1
2014/09/16 18:16:01
Historical edit/unedit. Fixed.
|
| -SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap) { |
| +SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap) |
| +{ |
| SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); |
| } |
| @@ -374,20 +375,19 @@ SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { |
| /////////////////////////////////////////////////////////////////////////////// |
|
robertphillips
2014/09/16 14:15:18
Rename to supports_lcd and switch sense?
reed1
2014/09/16 18:16:01
Done.
|
| +static bool disable_lcd(const SkBitmap& target) { |
| + return kN32_SkColorType != target.colorType(); |
| +} |
| + |
| bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { |
| - if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { |
| - // we're cool with the paint as is |
| - return false; |
| + uint32_t clearMask = 0; |
| + |
| + if (paint.isLCDRenderText() && paint.isAntiAlias() && disable_lcd(fBitmap)) { |
| + clearMask |= SkPaint::kLCDRenderText_Flag; |
| } |
| - if (kN32_SkColorType != fBitmap.colorType() || |
| - paint.getRasterizer() || |
| - paint.getPathEffect() || |
| - paint.isFakeBoldText() || |
| - paint.getStyle() != SkPaint::kFill_Style || |
| - !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
| - // turn off lcd |
| - flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
| + if (clearMask) { |
| + flags->fFlags = paint.getFlags() & ~clearMask; |
| flags->fHinting = paint.getHinting(); |
| return true; |
| } |