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 { |