2 * Copyright 2011 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
12 class ClipStrokeRectGM : public skiagm::GM {
19 SkString onShortName() override {
20 return SkString("clip_strokerect");
23 SkISize onISize() override {
24 return SkISize::Make(200, 400);
27 void onDraw(SkCanvas* canvas) override {
29 p.setColor(SK_ColorRED);
31 p.setStyle(SkPaint::kStroke_Style);
34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100);
35 // setting the height of this to 19 causes failure
36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20);
39 canvas->clipRect(rect, SkRegion::kReplace_Op, true);
40 canvas->drawRect(r, p);
43 p.setColor(SK_ColorBLUE);
45 canvas->drawRect(rect, p);
47 p.setColor(SK_ColorRED);
49 p.setStyle(SkPaint::kStroke_Style);
52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100);
53 // setting the height of this to 19 causes failure
54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19);
57 canvas->clipRect(rect2, SkRegion::kReplace_Op, true);
58 canvas->drawRect(r2, p);
61 p.setColor(SK_ColorBLUE);
63 canvas->drawRect(rect2, p);
67 typedef skiagm::GM INHERITED;
70 DEF_GM( return SkNEW(ClipStrokeRectGM); )