| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 p.setColor(SK_ColorRED); | 29 p.setColor(SK_ColorRED); |
| 30 p.setAntiAlias(true); | 30 p.setAntiAlias(true); |
| 31 p.setStyle(SkPaint::kStroke_Style); | 31 p.setStyle(SkPaint::kStroke_Style); |
| 32 p.setStrokeWidth(22); | 32 p.setStrokeWidth(22); |
| 33 | 33 |
| 34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100); | 34 SkRect r = SkRect::MakeXYWH(20, 20, 100, 100); |
| 35 // setting the height of this to 19 causes failure | 35 // setting the height of this to 19 causes failure |
| 36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20); | 36 SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20); |
| 37 | 37 |
| 38 canvas->save(); | 38 canvas->save(); |
| 39 canvas->clipRect(rect, SkCanvas::kReplace_Op, true); | 39 canvas->clipRect(rect, true); |
| 40 canvas->drawRect(r, p); | 40 canvas->drawRect(r, p); |
| 41 canvas->restore(); | 41 canvas->restore(); |
| 42 | 42 |
| 43 p.setColor(SK_ColorBLUE); | 43 p.setColor(SK_ColorBLUE); |
| 44 p.setStrokeWidth(2); | 44 p.setStrokeWidth(2); |
| 45 canvas->drawRect(rect, p); | 45 canvas->drawRect(rect, p); |
| 46 | 46 |
| 47 p.setColor(SK_ColorRED); | 47 p.setColor(SK_ColorRED); |
| 48 p.setAntiAlias(true); | 48 p.setAntiAlias(true); |
| 49 p.setStyle(SkPaint::kStroke_Style); | 49 p.setStyle(SkPaint::kStroke_Style); |
| 50 p.setStrokeWidth(22); | 50 p.setStrokeWidth(22); |
| 51 | 51 |
| 52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100); | 52 SkRect r2 = SkRect::MakeXYWH(20, 140, 100, 100); |
| 53 // setting the height of this to 19 causes failure | 53 // setting the height of this to 19 causes failure |
| 54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19); | 54 SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19); |
| 55 | 55 |
| 56 canvas->save(); | 56 canvas->save(); |
| 57 canvas->clipRect(rect2, SkCanvas::kReplace_Op, true); | 57 canvas->clipRect(rect2, true); |
| 58 canvas->drawRect(r2, p); | 58 canvas->drawRect(r2, p); |
| 59 canvas->restore(); | 59 canvas->restore(); |
| 60 | 60 |
| 61 p.setColor(SK_ColorBLUE); | 61 p.setColor(SK_ColorBLUE); |
| 62 p.setStrokeWidth(2); | 62 p.setStrokeWidth(2); |
| 63 canvas->drawRect(rect2, p); | 63 canvas->drawRect(rect2, p); |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 typedef skiagm::GM INHERITED; | 67 typedef skiagm::GM INHERITED; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 DEF_GM(return new ClipStrokeRectGM;) | 70 DEF_GM(return new ClipStrokeRectGM;) |
| OLD | NEW |