| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "gm.h" | 9 #include "gm.h" |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static const SkScalar kMargin = 10.f; | 142 static const 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 = canvas->getDeviceSize(); |
| 147 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(size.fWidth), | 147 canvas->drawBitmapRect(fBmp, SkRect::MakeIWH(size.fWidth, size.fHeight),
&bgPaint); |
| 148 SkIntToScalar(size.fHeight)); | |
| 149 canvas->drawBitmapRectToRect(fBmp, NULL, dstRect, &bgPaint); | |
| 150 | 148 |
| 151 static const char kTxt[] = "Clip Me!"; | 149 static const char kTxt[] = "Clip Me!"; |
| 152 SkPaint txtPaint; | 150 SkPaint txtPaint; |
| 153 txtPaint.setTextSize(23.f); | 151 txtPaint.setTextSize(23.f); |
| 154 txtPaint.setAntiAlias(true); | 152 txtPaint.setAntiAlias(true); |
| 155 sk_tool_utils::set_portable_typeface_always(&txtPaint); | 153 sk_tool_utils::set_portable_typeface_always(&txtPaint); |
| 156 txtPaint.setColor(sk_tool_utils::color_to_565(SK_ColorDKGRAY)); | 154 txtPaint.setColor(sk_tool_utils::color_to_565(SK_ColorDKGRAY)); |
| 157 SkScalar textW = txtPaint.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1); | 155 SkScalar textW = txtPaint.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1); |
| 158 | 156 |
| 159 SkScalar startX = 0; | 157 SkScalar startX = 0; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 292 |
| 295 SkTLList<Clip> fClips; | 293 SkTLList<Clip> fClips; |
| 296 SkBitmap fBmp; | 294 SkBitmap fBmp; |
| 297 | 295 |
| 298 typedef GM INHERITED; | 296 typedef GM INHERITED; |
| 299 }; | 297 }; |
| 300 | 298 |
| 301 DEF_GM( return SkNEW(ConvexPolyClip); ) | 299 DEF_GM( return SkNEW(ConvexPolyClip); ) |
| 302 | 300 |
| 303 } | 301 } |
| OLD | NEW |