Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: gm/convexpolyclip.cpp

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/bleed.cpp ('k') | include/core/SkBitmapDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/bleed.cpp ('k') | include/core/SkBitmapDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698