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

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

Issue 1938823002: remove SK_SUPPORT_LEGACY_IMAGEFILTER_CTM flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 const SkPaint* paint = rec.fPaint; 1194 const SkPaint* paint = rec.fPaint;
1195 SaveLayerFlags saveLayerFlags = rec.fSaveLayerFlags; 1195 SaveLayerFlags saveLayerFlags = rec.fSaveLayerFlags;
1196 1196
1197 #ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG 1197 #ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
1198 saveLayerFlags &= ~kDontClipToLayer_PrivateSaveLayerFlag; 1198 saveLayerFlags &= ~kDontClipToLayer_PrivateSaveLayerFlag;
1199 #endif 1199 #endif
1200 1200
1201 SkLazyPaint lazyP; 1201 SkLazyPaint lazyP;
1202 SkImageFilter* imageFilter = paint ? paint->getImageFilter() : NULL; 1202 SkImageFilter* imageFilter = paint ? paint->getImageFilter() : NULL;
1203 SkMatrix stashedMatrix = fMCRec->fMatrix; 1203 SkMatrix stashedMatrix = fMCRec->fMatrix;
1204 #ifndef SK_SUPPORT_LEGACY_IMAGEFILTER_CTM
1205 SkMatrix remainder; 1204 SkMatrix remainder;
1206 SkSize scale; 1205 SkSize scale;
1207 /* 1206 /*
1208 * ImageFilters (so far) do not correctly handle matrices (CTM) that contai n rotation/skew/etc. 1207 * ImageFilters (so far) do not correctly handle matrices (CTM) that contai n rotation/skew/etc.
1209 * but they do handle scaling. To accommodate this, we do the following: 1208 * but they do handle scaling. To accommodate this, we do the following:
1210 * 1209 *
1211 * 1. Stash off the current CTM 1210 * 1. Stash off the current CTM
1212 * 2. Decompose the CTM into SCALE and REMAINDER 1211 * 2. Decompose the CTM into SCALE and REMAINDER
1213 * 3. Wack the CTM to be just SCALE, and wrap the imagefilter with a Matrix ImageFilter that 1212 * 3. Wack the CTM to be just SCALE, and wrap the imagefilter with a Matrix ImageFilter that
1214 * contains the REMAINDER 1213 * contains the REMAINDER
(...skipping 10 matching lines...) Expand all
1225 { 1224 {
1226 // We will restore the matrix (which we are overwriting here) in restore via fStashedMatrix 1225 // We will restore the matrix (which we are overwriting here) in restore via fStashedMatrix
1227 this->internalSetMatrix(SkMatrix::MakeScale(scale.width(), scale.height( ))); 1226 this->internalSetMatrix(SkMatrix::MakeScale(scale.width(), scale.height( )));
1228 SkPaint* p = lazyP.set(*paint); 1227 SkPaint* p = lazyP.set(*paint);
1229 p->setImageFilter(SkImageFilter::MakeMatrixFilter(remainder, 1228 p->setImageFilter(SkImageFilter::MakeMatrixFilter(remainder,
1230 SkFilterQuality::kLow_ SkFilterQuality, 1229 SkFilterQuality::kLow_ SkFilterQuality,
1231 sk_ref_sp(imageFilter) )); 1230 sk_ref_sp(imageFilter) ));
1232 imageFilter = p->getImageFilter(); 1231 imageFilter = p->getImageFilter();
1233 paint = p; 1232 paint = p;
1234 } 1233 }
1235 #endif
1236 1234
1237 // do this before we create the layer. We don't call the public save() since 1235 // do this before we create the layer. We don't call the public save() since
1238 // that would invoke a possibly overridden virtual 1236 // that would invoke a possibly overridden virtual
1239 this->internalSave(); 1237 this->internalSave();
1240 1238
1241 fDeviceCMDirty = true; 1239 fDeviceCMDirty = true;
1242 1240
1243 SkIRect ir; 1241 SkIRect ir;
1244 if (!this->clipRectBounds(bounds, saveLayerFlags, &ir, imageFilter)) { 1242 if (!this->clipRectBounds(bounds, saveLayerFlags, &ir, imageFilter)) {
1245 return; 1243 return;
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 3062
3065 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3063 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3066 fCanvas->restoreToCount(fSaveCount); 3064 fCanvas->restoreToCount(fSaveCount);
3067 } 3065 }
3068 3066
3069 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3067 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3070 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3068 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3071 return this->makeSurface(info, props).release(); 3069 return this->makeSurface(info, props).release();
3072 } 3070 }
3073 #endif 3071 #endif
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