Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
| 10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 } | 376 } |
| 377 | 377 |
| 378 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { | 378 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { |
| 379 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get(); | 379 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get(); |
| 380 cache->ref(); | 380 cache->ref(); |
| 381 return cache; | 381 return cache; |
| 382 } | 382 } |
| 383 | 383 |
| 384 /////////////////////////////////////////////////////////////////////////////// | 384 /////////////////////////////////////////////////////////////////////////////// |
| 385 | 385 |
| 386 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { | 386 bool SkBitmapDevice::onDisableLCD(const SkPaint& paint) const { |
| 387 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { | |
| 388 // we're cool with the paint as is | |
| 389 return false; | |
| 390 } | |
| 391 | |
| 392 if (kN32_SkColorType != fBitmap.colorType() || | 387 if (kN32_SkColorType != fBitmap.colorType() || |
| 393 paint.getRasterizer() || | 388 paint.getRasterizer() || |
| 394 paint.getPathEffect() || | 389 paint.getPathEffect() || |
| 395 paint.isFakeBoldText() || | 390 paint.isFakeBoldText() || |
| 396 paint.getStyle() != SkPaint::kFill_Style || | 391 paint.getStyle() != SkPaint::kFill_Style || |
| 397 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 392 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) |
| 398 // turn off lcd, but turn on kGenA8 | 393 { |
| 399 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | |
| 400 flags->fFlags |= SkPaint::kGenA8FromLCD_Flag; | |
| 401 return true; | 394 return true; |
|
f(malita)
2014/11/12 20:49:14
Maybe inline the condition in a single return stat
| |
| 402 } | 395 } |
| 403 // we're cool with the paint as is | |
| 404 return false; | 396 return false; |
| 405 } | 397 } |
| OLD | NEW |