aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/image_pict.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-08-19 06:07:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-19 06:07:29 -0700
commita32cc950fb6a4ec8580ce7ab74ef44061383551e (patch)
treed60ac5d44ac53429aca474eba96540aa9d0c6663 /gm/image_pict.cpp
parent48305e835351291ef72a7084c6c1af7b185d89c0 (diff)
widen gm to show entire image, add place-holder for no context
BUG=skia: TBR= Review URL: https://codereview.chromium.org/1294113003
Diffstat (limited to 'gm/image_pict.cpp')
-rw-r--r--gm/image_pict.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index 010173974e..22b3d0067b 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -199,7 +199,7 @@ protected:
}
SkISize onISize() override {
- return SkISize::Make(850, 450);
+ return SkISize::Make(960, 450);
}
void onOnceBeforeDraw() override {
@@ -240,6 +240,14 @@ protected:
SkAutoTUnref<GrTexture> texture(cache->lockAsTexture(canvas->getGrContext(),
kUntiled_SkImageUsageType));
if (!texture) {
+ // show placeholder if we have no texture
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ SkRect r = SkRect::MakeXYWH(x, y, SkIntToScalar(cache->info().width()),
+ SkIntToScalar(cache->info().width()));
+ canvas->drawRect(r, paint);
+ canvas->drawLine(r.left(), r.top(), r.right(), r.bottom(), paint);
+ canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint);
return;
}
// No API to draw a GrTexture directly, so we cheat and create a private image subclass