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

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

Issue 2255283002: Fast path translate() in SkCanvas and SkLiteDL. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: plumb translate() through to SkRecord too Created 4 years, 4 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/private/SkRecords.h ('k') | src/core/SkLiteDL.h » ('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 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); 1437 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint);
1438 } 1438 }
1439 } 1439 }
1440 1440
1441 LOOPER_END 1441 LOOPER_END
1442 } 1442 }
1443 1443
1444 ///////////////////////////////////////////////////////////////////////////// 1444 /////////////////////////////////////////////////////////////////////////////
1445 1445
1446 void SkCanvas::translate(SkScalar dx, SkScalar dy) { 1446 void SkCanvas::translate(SkScalar dx, SkScalar dy) {
1447 SkMatrix m; 1447 this->checkForDeferredSave();
1448 m.setTranslate(dx, dy); 1448 fDeviceCMDirty = true;
1449 this->concat(m); 1449 fMCRec->fMatrix.preTranslate(dx,dy);
1450
1451 // Translate shouldn't affect the is-scale-translateness of the matrix.
1452 SkASSERT(fIsScaleTranslate == fMCRec->fMatrix.isScaleTranslate());
1453
1454 this->didTranslate(dx,dy);
1450 } 1455 }
1451 1456
1452 void SkCanvas::scale(SkScalar sx, SkScalar sy) { 1457 void SkCanvas::scale(SkScalar sx, SkScalar sy) {
1453 SkMatrix m; 1458 SkMatrix m;
1454 m.setScale(sx, sy); 1459 m.setScale(sx, sy);
1455 this->concat(m); 1460 this->concat(m);
1456 } 1461 }
1457 1462
1458 void SkCanvas::rotate(SkScalar degrees) { 1463 void SkCanvas::rotate(SkScalar degrees) {
1459 SkMatrix m; 1464 SkMatrix m;
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
3374 3379
3375 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3380 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3376 fCanvas->restoreToCount(fSaveCount); 3381 fCanvas->restoreToCount(fSaveCount);
3377 } 3382 }
3378 3383
3379 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3384 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3380 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3385 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3381 return this->makeSurface(info, props).release(); 3386 return this->makeSurface(info, props).release();
3382 } 3387 }
3383 #endif 3388 #endif
OLDNEW
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkLiteDL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698