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

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: address comments from #6 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 368
369 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() { 369 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() {
370 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get(); 370 SkImageFilter::Cache* cache = SkImageFilter::Cache::Get();
371 cache->ref(); 371 cache->ref();
372 return cache; 372 return cache;
373 } 373 }
374 374
375 /////////////////////////////////////////////////////////////////////////////// 375 ///////////////////////////////////////////////////////////////////////////////
376 376
377 // Our current blitters only work on 32bit targets.
378 static bool supports_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() && !supports_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