aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/ninepatchstretch.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-11-18 13:28:51 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-18 13:28:51 -0800
commit33a5fce6126dc5d3927a71fdc6c35af6f5893fd5 (patch)
tree86dbddbe639d6fb2310e017618c4f5f4f55e9b54 /gm/ninepatchstretch.cpp
parent39e7aa48d7ca4c144c457374bf0a0dcc0c5be92d (diff)
Initial implementation of GPU no filter NinePatch
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1454933002
Diffstat (limited to 'gm/ninepatchstretch.cpp')
-rw-r--r--gm/ninepatchstretch.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 4074add1bb..218b452862 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -66,7 +66,7 @@ protected:
}
SkISize onISize() override {
- return SkISize::Make(760, 400);
+ return SkISize::Make(760, 800);
}
void onDraw(SkCanvas* canvas) override {
@@ -91,16 +91,17 @@ protected:
SkScalar y = SkIntToScalar(100);
SkPaint paint;
- paint.setFilterQuality(kLow_SkFilterQuality);
-
- for (int iy = 0; iy < 2; ++iy) {
- for (int ix = 0; ix < 2; ++ix) {
- int i = ix * 2 + iy;
- SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
- size[i].width(), size[i].height());
- canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
- canvas->drawImageNine(fImage, fCenter, r.makeOffset(360, 0), &paint);
-
+ for (int filter = 0; filter < 2; filter++) {
+ paint.setFilterQuality(filter == 0 ? kLow_SkFilterQuality : kNone_SkFilterQuality);
+ canvas->translate(0, filter * SkIntToScalar(400));
+ for (int iy = 0; iy < 2; ++iy) {
+ for (int ix = 0; ix < 2; ++ix) {
+ int i = ix * 2 + iy;
+ SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
+ size[i].width(), size[i].height());
+ canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
+ canvas->drawImageNine(fImage, fCenter, r.makeOffset(360, 0), &paint);
+ }
}
}
}