Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: un-plumb props into device (not needed) Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698