Chromium Code Reviews| Index: src/core/SkBitmapDevice.cpp |
| diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp |
| index 2711004aef14de4fbda9fbe12f2c74b171acdfa5..5c2f9eb9e0d71a369b384aaf1bebc7ac1f3a79b2 100644 |
| --- a/src/core/SkBitmapDevice.cpp |
| +++ b/src/core/SkBitmapDevice.cpp |
| @@ -57,7 +57,10 @@ static bool valid_for_bitmap_device(const SkImageInfo& info, |
| return true; |
| } |
| -SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap) { |
| +SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps* props) |
| + : fBitmap(bitmap) |
| + , fProps(props ? *props : SkSurfaceProps()) |
| +{ |
| SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); |
| } |
| @@ -68,6 +71,11 @@ SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& |
| SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); |
| } |
| +SkBitmapDevice* SkBitmapDevice::Create(const SkBitmap& bitmap, const SkSurfaceProps* props) { |
| + // validate bitmap? |
| + return SkNEW_ARGS(SkBitmapDevice, (bitmap, props)); |
| +} |
| + |
| SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, |
| const SkDeviceProperties* props) { |
| SkAlphaType newAT = origInfo.alphaType(); |
| @@ -374,20 +382,19 @@ SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { |
| /////////////////////////////////////////////////////////////////////////////// |
| +static bool disable_lcd(const SkBitmap& target) { |
| + return kN32_SkColorType != target.colorType(); |
|
bungeman-skia
2014/09/15 20:47:13
comment that we do this because we don't have a bl
|
| +} |
| + |
| 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; |
| } |