OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 28 matching lines...) Expand all Loading... |
39 * Test calling SkStroker for rectangles. Cases to cover: | 39 * Test calling SkStroker for rectangles. Cases to cover: |
40 * | 40 * |
41 * geometry: normal, small (smaller than stroke-width), empty, inverted | 41 * geometry: normal, small (smaller than stroke-width), empty, inverted |
42 * joint-type for the corners | 42 * joint-type for the corners |
43 */ | 43 */ |
44 class StrokeRectGM : public skiagm::GM { | 44 class StrokeRectGM : public skiagm::GM { |
45 public: | 45 public: |
46 StrokeRectGM() {} | 46 StrokeRectGM() {} |
47 | 47 |
48 protected: | 48 protected: |
49 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 49 uint32_t onGetFlags() const SK_OVERRIDE { |
50 return kSkipTiled_Flag; | 50 return kSkipTiled_Flag; |
51 } | 51 } |
52 | 52 |
53 virtual SkString onShortName() SK_OVERRIDE { | 53 SkString onShortName() SK_OVERRIDE { |
54 return SkString("strokerect"); | 54 return SkString("strokerect"); |
55 } | 55 } |
56 | 56 |
57 virtual SkISize onISize() SK_OVERRIDE { | 57 SkISize onISize() SK_OVERRIDE { |
58 return SkISize::Make(1024, 740); | 58 return SkISize::Make(1024, 740); |
59 } | 59 } |
60 | 60 |
61 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 61 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
62 canvas->drawColor(SK_ColorWHITE); | 62 canvas->drawColor(SK_ColorWHITE); |
63 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2); | 63 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2); |
64 | 64 |
65 SkPaint paint; | 65 SkPaint paint; |
66 paint.setStyle(SkPaint::kStroke_Style); | 66 paint.setStyle(SkPaint::kStroke_Style); |
67 paint.setStrokeWidth(STROKE_WIDTH); | 67 paint.setStrokeWidth(STROKE_WIDTH); |
68 | 68 |
69 static const SkPaint::Join gJoins[] = { | 69 static const SkPaint::Join gJoins[] = { |
70 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join | 70 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join |
71 }; | 71 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 typedef GM INHERITED; | 111 typedef GM INHERITED; |
112 }; | 112 }; |
113 | 113 |
114 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 114 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
115 | 115 |
116 DEF_GM(return new StrokeRectGM;) | 116 DEF_GM(return new StrokeRectGM;) |
OLD | NEW |