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

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

Issue 1618843002: Hide SkCanvas::{set,get}DrawFilter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 class AutoDrawLooper { 438 class AutoDrawLooper {
439 public: 439 public:
440 // "rawBounds" is the original bounds of the primitive about to be drawn, un modified by the 440 // "rawBounds" is the original bounds of the primitive about to be drawn, un modified by the
441 // paint. It's used to determine the size of the offscreen layer for filters . 441 // paint. It's used to determine the size of the offscreen layer for filters .
442 // If null, the clip will be used instead. 442 // If null, the clip will be used instead.
443 AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint, 443 AutoDrawLooper(SkCanvas* canvas, const SkSurfaceProps& props, const SkPaint& paint,
444 bool skipLayerForImageFilter = false, 444 bool skipLayerForImageFilter = false,
445 const SkRect* rawBounds = nullptr) : fOrigPaint(paint) { 445 const SkRect* rawBounds = nullptr) : fOrigPaint(paint) {
446 fCanvas = canvas; 446 fCanvas = canvas;
447 #ifdef SK_SUPPORT_LEGACY_DRAWFLTER
447 fFilter = canvas->getDrawFilter(); 448 fFilter = canvas->getDrawFilter();
449 #else
450 fFilter = nullptr;
451 #endif
448 fPaint = &fOrigPaint; 452 fPaint = &fOrigPaint;
449 fSaveCount = canvas->getSaveCount(); 453 fSaveCount = canvas->getSaveCount();
450 fTempLayerForImageFilter = false; 454 fTempLayerForImageFilter = false;
451 fDone = false; 455 fDone = false;
452 456
453 SkColorFilter* simplifiedCF = image_to_color_filter(fOrigPaint); 457 SkColorFilter* simplifiedCF = image_to_color_filter(fOrigPaint);
454 if (simplifiedCF) { 458 if (simplifiedCF) {
455 SkPaint* paint = set_if_needed(&fLazyPaintInit, fOrigPaint); 459 SkPaint* paint = set_if_needed(&fLazyPaintInit, fOrigPaint);
456 paint->setColorFilter(simplifiedCF)->unref(); 460 paint->setColorFilter(simplifiedCF)->unref();
457 paint->setImageFilter(nullptr); 461 paint->setImageFilter(nullptr);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // free up the contents of our deque 775 // free up the contents of our deque
772 this->restoreToCount(1); // restore everything but the last 776 this->restoreToCount(1); // restore everything but the last
773 777
774 this->internalRestore(); // restore the last, since we're going away 778 this->internalRestore(); // restore the last, since we're going away
775 779
776 delete fMetaData; 780 delete fMetaData;
777 781
778 dec_canvas(); 782 dec_canvas();
779 } 783 }
780 784
785 #ifdef SK_SUPPORT_LEGACY_DRAWFLTER
781 SkDrawFilter* SkCanvas::getDrawFilter() const { 786 SkDrawFilter* SkCanvas::getDrawFilter() const {
782 return fMCRec->fFilter; 787 return fMCRec->fFilter;
783 } 788 }
784 789
785 SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) { 790 SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
786 this->checkForDeferredSave(); 791 this->checkForDeferredSave();
787 SkRefCnt_SafeAssign(fMCRec->fFilter, filter); 792 SkRefCnt_SafeAssign(fMCRec->fFilter, filter);
788 return filter; 793 return filter;
789 } 794 }
795 #endif
790 796
791 SkMetaData& SkCanvas::getMetaData() { 797 SkMetaData& SkCanvas::getMetaData() {
792 // metadata users are rare, so we lazily allocate it. If that changes we 798 // metadata users are rare, so we lazily allocate it. If that changes we
793 // can decide to just make it a field in the device (rather than a ptr) 799 // can decide to just make it a field in the device (rather than a ptr)
794 if (nullptr == fMetaData) { 800 if (nullptr == fMetaData) {
795 fMetaData = new SkMetaData; 801 fMetaData = new SkMetaData;
796 } 802 }
797 return *fMetaData; 803 return *fMetaData;
798 } 804 }
799 805
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 } 3033 }
3028 3034
3029 if (matrix) { 3035 if (matrix) {
3030 canvas->concat(*matrix); 3036 canvas->concat(*matrix);
3031 } 3037 }
3032 } 3038 }
3033 3039
3034 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3040 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3035 fCanvas->restoreToCount(fSaveCount); 3041 fCanvas->restoreToCount(fSaveCount);
3036 } 3042 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698