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

Side by Side 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 unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 break; 49 break;
50 default: 50 default:
51 return false; 51 return false;
52 } 52 }
53 53
54 if (newAlphaType) { 54 if (newAlphaType) {
55 *newAlphaType = canonicalAlphaType; 55 *newAlphaType = canonicalAlphaType;
56 } 56 }
57 return true; 57 return true;
58 } 58 }
59 59
robertphillips 2014/09/16 14:15:18 Why this change?
reed1 2014/09/16 18:16:01 Historical edit/unedit. Fixed.
60 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap) { 60 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap)
61 {
61 SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); 62 SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
62 } 63 }
63 64
64 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties) 65 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
65 : SkBaseDevice(deviceProperties) 66 : SkBaseDevice(deviceProperties)
66 , fBitmap(bitmap) 67 , fBitmap(bitmap)
67 { 68 {
68 SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); 69 SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL));
69 } 70 }
70 71
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return NULL; 367 return NULL;
367 } 368 }
368 369
369 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { 370 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() {
370 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get(); 371 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get();
371 cache->ref(); 372 cache->ref();
372 return cache; 373 return cache;
373 } 374 }
374 375
375 /////////////////////////////////////////////////////////////////////////////// 376 ///////////////////////////////////////////////////////////////////////////////
376 377
robertphillips 2014/09/16 14:15:18 Rename to supports_lcd and switch sense?
reed1 2014/09/16 18:16:01 Done.
378 static bool disable_lcd(const SkBitmap& target) {
379 return kN32_SkColorType != target.colorType();
380 }
381
377 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { 382 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
378 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { 383 uint32_t clearMask = 0;
379 // we're cool with the paint as is 384
380 return false; 385 if (paint.isLCDRenderText() && paint.isAntiAlias() && disable_lcd(fBitmap)) {
386 clearMask |= SkPaint::kLCDRenderText_Flag;
381 } 387 }
382 388
383 if (kN32_SkColorType != fBitmap.colorType() || 389 if (clearMask) {
384 paint.getRasterizer() || 390 flags->fFlags = paint.getFlags() & ~clearMask;
385 paint.getPathEffect() ||
386 paint.isFakeBoldText() ||
387 paint.getStyle() != SkPaint::kFill_Style ||
388 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) {
389 // turn off lcd
390 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
391 flags->fHinting = paint.getHinting(); 391 flags->fHinting = paint.getHinting();
392 return true; 392 return true;
393 } 393 }
394 // we're cool with the paint as is 394 // we're cool with the paint as is
395 return false; 395 return false;
396 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698