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

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

Issue 1915943002: simplify handle-affine: subclass overrides just describe their leaf behavior (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: early out if onCanHandleComplexCTM returns false Created 4 years, 8 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 | « include/effects/SkMergeImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | 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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 * 3. Wack the CTM to be just SCALE, and wrap the imagefilter with a Matrix ImageFilter that 1210 * 3. Wack the CTM to be just SCALE, and wrap the imagefilter with a Matrix ImageFilter that
1211 * contains the REMAINDER 1211 * contains the REMAINDER
1212 * 4. Proceed as usual, allowing the client to draw into the layer (now wit h a scale-only CTM) 1212 * 4. Proceed as usual, allowing the client to draw into the layer (now wit h a scale-only CTM)
1213 * 5. During restore, we process the MatrixImageFilter, which applies REMAI NDER to the output 1213 * 5. During restore, we process the MatrixImageFilter, which applies REMAI NDER to the output
1214 * of the original imagefilter, and draw that (via drawSprite) 1214 * of the original imagefilter, and draw that (via drawSprite)
1215 * 6. Unwack the CTM to its original state (i.e. stashedMatrix) 1215 * 6. Unwack the CTM to its original state (i.e. stashedMatrix)
1216 * 1216 *
1217 * Perhaps in the future we could augment #5 to apply REMAINDER as part of the draw (no longer 1217 * Perhaps in the future we could augment #5 to apply REMAINDER as part of the draw (no longer
1218 * a sprite operation) to avoid the extra buffer/overhead of MatrixImageFil ter. 1218 * a sprite operation) to avoid the extra buffer/overhead of MatrixImageFil ter.
1219 */ 1219 */
1220 if (imageFilter && !stashedMatrix.isScaleTranslate() && !imageFilter->canHan dleAffine() && 1220 if (imageFilter && !stashedMatrix.isScaleTranslate() && !imageFilter->canHan dleComplexCTM() &&
1221 stashedMatrix.decomposeScale(&scale, &remainder)) 1221 stashedMatrix.decomposeScale(&scale, &remainder))
1222 { 1222 {
1223 // We will restore the matrix (which we are overwriting here) in restore via fStashedMatrix 1223 // We will restore the matrix (which we are overwriting here) in restore via fStashedMatrix
1224 this->internalSetMatrix(SkMatrix::MakeScale(scale.width(), scale.height( ))); 1224 this->internalSetMatrix(SkMatrix::MakeScale(scale.width(), scale.height( )));
1225 SkPaint* p = lazyP.set(*paint); 1225 SkPaint* p = lazyP.set(*paint);
1226 p->setImageFilter(SkImageFilter::MakeMatrixFilter(remainder, 1226 p->setImageFilter(SkImageFilter::MakeMatrixFilter(remainder,
1227 SkFilterQuality::kLow_ SkFilterQuality, 1227 SkFilterQuality::kLow_ SkFilterQuality,
1228 sk_ref_sp(imageFilter) )); 1228 sk_ref_sp(imageFilter) ));
1229 imageFilter = p->getImageFilter(); 1229 imageFilter = p->getImageFilter();
1230 paint = p; 1230 paint = p;
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 3094
3095 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3095 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3096 fCanvas->restoreToCount(fSaveCount); 3096 fCanvas->restoreToCount(fSaveCount);
3097 } 3097 }
3098 3098
3099 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3099 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3100 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3100 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3101 return this->makeSurface(info, props).release(); 3101 return this->makeSurface(info, props).release();
3102 } 3102 }
3103 #endif 3103 #endif
OLDNEW
« no previous file with comments | « include/effects/SkMergeImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698