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

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: 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
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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); 1442 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint);
1443 } 1443 }
1444 } 1444 }
1445 1445
1446 LOOPER_END 1446 LOOPER_END
1447 } 1447 }
1448 1448
1449 ///////////////////////////////////////////////////////////////////////////// 1449 /////////////////////////////////////////////////////////////////////////////
1450 1450
1451 void SkCanvas::translate(SkScalar dx, SkScalar dy) { 1451 void SkCanvas::translate(SkScalar dx, SkScalar dy) {
1452 SkMatrix m; 1452 this->checkForDeferredSave();
1453 m.setTranslate(dx, dy); 1453 fDeviceCMDirty = true;
1454 this->concat(m); 1454 fMCRec->fMatrix.preTranslate(dx,dy);
1455
1456 // Translate shouldn't affect the is-scale-translateness of the matrix.
1457 // (Remember, fConservativeIsScaleTranslate is conservative, so false is alw ays fine.)
1458 SkASSERT(!fConservativeIsScaleTranslate || fMCRec->fMatrix.isScaleTranslate( ));
1459
1460 this->didTranslate(dx,dy);
1455 } 1461 }
1456 1462
1457 void SkCanvas::scale(SkScalar sx, SkScalar sy) { 1463 void SkCanvas::scale(SkScalar sx, SkScalar sy) {
1458 SkMatrix m; 1464 SkMatrix m;
1459 m.setScale(sx, sy); 1465 m.setScale(sx, sy);
1460 this->concat(m); 1466 this->concat(m);
1461 } 1467 }
1462 1468
1463 void SkCanvas::rotate(SkScalar degrees) { 1469 void SkCanvas::rotate(SkScalar degrees) {
1464 SkMatrix m; 1470 SkMatrix m;
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 3369
3364 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3370 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3365 fCanvas->restoreToCount(fSaveCount); 3371 fCanvas->restoreToCount(fSaveCount);
3366 } 3372 }
3367 3373
3368 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3374 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3369 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3375 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3370 return this->makeSurface(info, props).release(); 3376 return this->makeSurface(info, props).release();
3371 } 3377 }
3372 #endif 3378 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkLiteDL.h » ('j') | src/core/SkMatrix.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698