OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 fBmp = make_bmp(100, 100); | 137 fBmp = make_bmp(100, 100); |
138 } | 138 } |
139 | 139 |
140 void onDraw(SkCanvas* canvas) override { | 140 void onDraw(SkCanvas* canvas) override { |
141 SkScalar y = 0; | 141 SkScalar y = 0; |
142 constexpr SkScalar kMargin = 10.f; | 142 constexpr SkScalar kMargin = 10.f; |
143 | 143 |
144 SkPaint bgPaint; | 144 SkPaint bgPaint; |
145 bgPaint.setAlpha(0x15); | 145 bgPaint.setAlpha(0x15); |
146 SkISize size = canvas->getDeviceSize(); | 146 SkISize size = this->onISize(); |
147 canvas->drawBitmapRect(fBmp, SkRect::MakeIWH(size.fWidth, size.fHeight),
&bgPaint); | 147 canvas->drawBitmapRect(fBmp, SkRect::MakeIWH(size.fWidth, size.fHeight),
&bgPaint); |
148 | 148 |
149 constexpr char kTxt[] = "Clip Me!"; | 149 constexpr char kTxt[] = "Clip Me!"; |
150 SkPaint txtPaint; | 150 SkPaint txtPaint; |
151 txtPaint.setTextSize(23.f); | 151 txtPaint.setTextSize(23.f); |
152 txtPaint.setAntiAlias(true); | 152 txtPaint.setAntiAlias(true); |
153 sk_tool_utils::set_portable_typeface(&txtPaint); | 153 sk_tool_utils::set_portable_typeface(&txtPaint); |
154 txtPaint.setColor(sk_tool_utils::color_to_565(SK_ColorDKGRAY)); | 154 txtPaint.setColor(sk_tool_utils::color_to_565(SK_ColorDKGRAY)); |
155 SkScalar textW = txtPaint.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1); | 155 SkScalar textW = txtPaint.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1); |
156 | 156 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 typedef SkTLList<Clip, 1> ClipList; | 293 typedef SkTLList<Clip, 1> ClipList; |
294 ClipList fClips; | 294 ClipList fClips; |
295 SkBitmap fBmp; | 295 SkBitmap fBmp; |
296 | 296 |
297 typedef GM INHERITED; | 297 typedef GM INHERITED; |
298 }; | 298 }; |
299 | 299 |
300 DEF_GM(return new ConvexPolyClip;) | 300 DEF_GM(return new ConvexPolyClip;) |
301 } | 301 } |
OLD | NEW |