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

Unified Diff: gm/bitmapmatrix.cpp

Issue 789033002: Remove SkCanvas::drawBitmapMatrix() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: gm/bitmapmatrix.cpp
diff --git a/gm/bitmapmatrix.cpp b/gm/bitmapmatrix.cpp
index 052d1533164195af39bb1cb6e2af286913800170..ae4f407a8cfcf91450f986763cad35c5b2776b2b 100644
--- a/gm/bitmapmatrix.cpp
+++ b/gm/bitmapmatrix.cpp
@@ -44,12 +44,16 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
paint.setDither(true);
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ canvas->drawBitmap(bm, 0, 0, &paint);
// Draw stretched horizontally and squished vertically.
canvas->translate(SkIntToScalar(bm.width() + 5), 0);
matrix.setScale(SkIntToScalar(2), SK_ScalarHalf);
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ {
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
+ }
// Draw rotated
canvas->translate(SkIntToScalar(bm.width()*2 + 5), 0);
@@ -58,7 +62,8 @@ protected:
SkIntToScalar(bm.height() / 2));
canvas->save();
canvas->translate(0, SkIntToScalar(10));
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
canvas->restore();
// Draw with perspective
@@ -66,19 +71,31 @@ protected:
matrix.reset();
matrix.setPerspX(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000)));
matrix.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000)));
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ {
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
+ }
// Draw with skew
canvas->translate(SkIntToScalar(bm.width() + 5), 0);
matrix.reset();
matrix.setSkew(SkIntToScalar(2), SkIntToScalar(2));
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ {
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
+ }
// Draw with sin/cos
canvas->translate(SkIntToScalar(bm.width() * 4), 0);
matrix.reset();
matrix.setSinCos(SK_ScalarHalf, SkIntToScalar(2));
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ {
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
+ }
{
// test the following code path:
@@ -102,7 +119,8 @@ protected:
canvas->save();
canvas->translate(0, SkIntToScalar(20));
- canvas->drawBitmapMatrix(bm, matrix, &paint);
+ canvas->concat(matrix);
+ canvas->drawBitmap(bm, 0, 0, &paint);
canvas->restore();
}

Powered by Google App Engine
This is Rietveld 408576698