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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 1120033003: remove unneeded SK_SUPPORT_LEGACY_IMAGEFILTER_TO_COLORFILTER flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 static SkPaint* set_if_needed(SkLazyPaint* lazy, const SkPaint& orig) { 303 static SkPaint* set_if_needed(SkLazyPaint* lazy, const SkPaint& orig) {
304 return lazy->isValid() ? lazy->get() : lazy->set(orig); 304 return lazy->isValid() ? lazy->get() : lazy->set(orig);
305 } 305 }
306 306
307 /** 307 /**
308 * If the paint has an imagefilter, but it can be simplified to just a colorfil ter, return that 308 * If the paint has an imagefilter, but it can be simplified to just a colorfil ter, return that
309 * colorfilter, else return NULL. 309 * colorfilter, else return NULL.
310 */ 310 */
311 static SkColorFilter* image_to_color_filter(const SkPaint& paint) { 311 static SkColorFilter* image_to_color_filter(const SkPaint& paint) {
312 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_TO_COLORFILTER
313 return NULL;
314 #else
315 SkImageFilter* imgf = paint.getImageFilter(); 312 SkImageFilter* imgf = paint.getImageFilter();
316 if (!imgf) { 313 if (!imgf) {
317 return NULL; 314 return NULL;
318 } 315 }
319 316
320 SkColorFilter* imgCF; 317 SkColorFilter* imgCF;
321 if (!imgf->asAColorFilter(&imgCF)) { 318 if (!imgf->asAColorFilter(&imgCF)) {
322 return NULL; 319 return NULL;
323 } 320 }
324 321
325 SkColorFilter* paintCF = paint.getColorFilter(); 322 SkColorFilter* paintCF = paint.getColorFilter();
326 if (NULL == paintCF) { 323 if (NULL == paintCF) {
327 // there is no existing paint colorfilter, so we can just return the ima gefilter's 324 // there is no existing paint colorfilter, so we can just return the ima gefilter's
328 return imgCF; 325 return imgCF;
329 } 326 }
330 327
331 // The paint has both a colorfilter(paintCF) and an imagefilter-which-is-a-c olorfilter(imgCF) 328 // The paint has both a colorfilter(paintCF) and an imagefilter-which-is-a-c olorfilter(imgCF)
332 // and we need to combine them into a single colorfilter. 329 // and we need to combine them into a single colorfilter.
333 SkAutoTUnref<SkColorFilter> autoImgCF(imgCF); 330 SkAutoTUnref<SkColorFilter> autoImgCF(imgCF);
334 return SkColorFilter::CreateComposeFilter(imgCF, paintCF); 331 return SkColorFilter::CreateComposeFilter(imgCF, paintCF);
335 #endif
336 } 332 }
337 333
338 class AutoDrawLooper { 334 class AutoDrawLooper {
339 public: 335 public:
340 AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint, 336 AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint,
341 bool skipLayerForImageFilter = false, 337 bool skipLayerForImageFilter = false,
342 const SkRect* bounds = NULL) : fOrigPaint(paint) { 338 const SkRect* bounds = NULL) : fOrigPaint(paint) {
343 fCanvas = canvas; 339 fCanvas = canvas;
344 fFilter = canvas->getDrawFilter(); 340 fFilter = canvas->getDrawFilter();
345 fPaint = &fOrigPaint; 341 fPaint = &fOrigPaint;
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 } 2641 }
2646 2642
2647 if (matrix) { 2643 if (matrix) {
2648 canvas->concat(*matrix); 2644 canvas->concat(*matrix);
2649 } 2645 }
2650 } 2646 }
2651 2647
2652 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2648 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2653 fCanvas->restoreToCount(fSaveCount); 2649 fCanvas->restoreToCount(fSaveCount);
2654 } 2650 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698