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

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

Issue 2142033002: Factor code to rotate a canvas about a point. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to canvas. Created 4 years, 5 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 | « samplecode/SampleHT.cpp ('k') | 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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 m.setScale(sx, sy); 1491 m.setScale(sx, sy);
1492 this->concat(m); 1492 this->concat(m);
1493 } 1493 }
1494 1494
1495 void SkCanvas::rotate(SkScalar degrees) { 1495 void SkCanvas::rotate(SkScalar degrees) {
1496 SkMatrix m; 1496 SkMatrix m;
1497 m.setRotate(degrees); 1497 m.setRotate(degrees);
1498 this->concat(m); 1498 this->concat(m);
1499 } 1499 }
1500 1500
1501 void SkCanvas::rotate(SkScalar degrees, SkScalar px, SkScalar py) {
reed1 2016/07/12 17:28:59 possibly check for 0 == degrees to skip the rest.
bungeman-skia 2016/07/12 17:37:42 If so, I think it would need to be done above as w
1502 SkMatrix m;
1503 m.setRotate(degrees, px, py);
1504 this->concat(m);
1505 }
1506
1501 void SkCanvas::skew(SkScalar sx, SkScalar sy) { 1507 void SkCanvas::skew(SkScalar sx, SkScalar sy) {
1502 SkMatrix m; 1508 SkMatrix m;
1503 m.setSkew(sx, sy); 1509 m.setSkew(sx, sy);
1504 this->concat(m); 1510 this->concat(m);
1505 } 1511 }
1506 1512
1507 void SkCanvas::concat(const SkMatrix& matrix) { 1513 void SkCanvas::concat(const SkMatrix& matrix) {
1508 if (matrix.isIdentity()) { 1514 if (matrix.isIdentity()) {
1509 return; 1515 return;
1510 } 1516 }
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 3128
3123 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3129 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3124 fCanvas->restoreToCount(fSaveCount); 3130 fCanvas->restoreToCount(fSaveCount);
3125 } 3131 }
3126 3132
3127 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3133 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3128 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3134 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3129 return this->makeSurface(info, props).release(); 3135 return this->makeSurface(info, props).release();
3130 } 3136 }
3131 #endif 3137 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleHT.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698