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

Unified Diff: gm/filterbitmap.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/downsamplebitmap.cpp ('k') | gm/filterindiabox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/filterbitmap.cpp
diff --git a/gm/filterbitmap.cpp b/gm/filterbitmap.cpp
index 81aa3e19e055c0469c641fc59e14570cd0d2e173..d40f8bcd7c05185ed547fb92b3b7a6098e83d3e4 100644
--- a/gm/filterbitmap.cpp
+++ b/gm/filterbitmap.cpp
@@ -24,24 +24,22 @@ 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 FilterBitmapGM : public skiagm::GM {
« no previous file with comments | « gm/downsamplebitmap.cpp ('k') | gm/filterindiabox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698