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

Unified Diff: gm/filterindiabox.cpp

Issue 789033002: Remove SkCanvas::drawBitmapMatrix() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: non-const canvas ptr 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
« no previous file with comments | « gm/filterbitmap.cpp ('k') | gm/xfermodes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/filterindiabox.cpp
diff --git a/gm/filterindiabox.cpp b/gm/filterindiabox.cpp
index a29f08b8b62a4b338d0a4ba94a910d018e96dadc..6b662f064f946ebcbe2660e499d48bfdf609e7ad 100644
--- a/gm/filterindiabox.cpp
+++ b/gm/filterindiabox.cpp
@@ -23,24 +23,23 @@ static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) {
return SkSize::Make(bounds.width(), bounds.height());
}
-static void draw_row(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx) {
+static void draw_cell(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx,
+ SkPaint::FilterLevel lvl) {
SkPaint paint;
+ paint.setFilterLevel(lvl);
SkAutoCanvasRestore acr(canvas, true);
- canvas->drawBitmapMatrix(bm, mat, &paint);
-
- paint.setFilterLevel(SkPaint::kLow_FilterLevel);
- canvas->translate(dx, 0);
- canvas->drawBitmapMatrix(bm, mat, &paint);
-
- paint.setFilterLevel(SkPaint::kMedium_FilterLevel);
canvas->translate(dx, 0);
- canvas->drawBitmapMatrix(bm, mat, &paint);
+ canvas->concat(mat);
+ canvas->drawBitmap(bm, 0, 0, &paint);
+}
- paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
- canvas->translate(dx, 0);
- canvas->drawBitmapMatrix(bm, mat, &paint);
+static void draw_row(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, SkScalar dx) {
+ draw_cell(canvas, bm, mat, 0 * dx, SkPaint::kNone_FilterLevel);
+ draw_cell(canvas, bm, mat, 1 * dx, SkPaint::kLow_FilterLevel);
+ draw_cell(canvas, bm, mat, 2 * dx, SkPaint::kMedium_FilterLevel);
+ draw_cell(canvas, bm, mat, 3 * dx, SkPaint::kHigh_FilterLevel);
}
class FilterIndiaBoxGM : public skiagm::GM {
« no previous file with comments | « gm/filterbitmap.cpp ('k') | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698