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

Side by Side Diff: gm/convexpolyclip.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 7 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/colortype.cpp ('k') | gm/drawbitmaprect.cpp » ('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 20 matching lines...) Expand all
31 31
32 SkScalar pos[] = {0, 32 SkScalar pos[] = {0,
33 SK_Scalar1 / 6, 33 SK_Scalar1 / 6,
34 2 * SK_Scalar1 / 6, 34 2 * SK_Scalar1 / 6,
35 3 * SK_Scalar1 / 6, 35 3 * SK_Scalar1 / 6,
36 4 * SK_Scalar1 / 6, 36 4 * SK_Scalar1 / 6,
37 5 * SK_Scalar1 / 6, 37 5 * SK_Scalar1 / 6,
38 SK_Scalar1}; 38 SK_Scalar1};
39 39
40 SkPaint paint; 40 SkPaint paint;
41 paint.setShader(SkGradientShader::CreateRadial(
42 pt, radius,
43 colors, pos,
44 SK_ARRAY_COUNT(colors),
45 SkShader::kRepeat_TileMode))->unref();
46 SkRect rect = SkRect::MakeWH(wScalar, hScalar); 41 SkRect rect = SkRect::MakeWH(wScalar, hScalar);
47 SkMatrix mat = SkMatrix::I(); 42 SkMatrix mat = SkMatrix::I();
48 for (int i = 0; i < 4; ++i) { 43 for (int i = 0; i < 4; ++i) {
49 paint.getShader()->setLocalMatrix(mat); 44 paint.setShader(SkGradientShader::CreateRadial(
45 pt, radius,
46 colors, pos,
47 SK_ARRAY_COUNT(colors),
48 SkShader::kRepeat_TileMode,
49 NULL, 0, &mat))->unref();
50 canvas.drawRect(rect, paint); 50 canvas.drawRect(rect, paint);
51 rect.inset(wScalar / 8, hScalar / 8); 51 rect.inset(wScalar / 8, hScalar / 8);
52 mat.preTranslate(6 * wScalar, 6 * hScalar); 52 mat.preTranslate(6 * wScalar, 6 * hScalar);
53 mat.postScale(SK_Scalar1 / 3, SK_Scalar1 / 3); 53 mat.postScale(SK_Scalar1 / 3, SK_Scalar1 / 3);
54 } 54 }
55 55
56 paint.setAntiAlias(true); 56 paint.setAntiAlias(true);
57 paint.setTextSize(wScalar / 2.2f); 57 paint.setTextSize(wScalar / 2.2f);
58 paint.setShader(0); 58 paint.setShader(0);
59 paint.setColor(SK_ColorLTGRAY); 59 paint.setColor(SK_ColorLTGRAY);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 SkTLList<Clip> fClips; 293 SkTLList<Clip> fClips;
294 SkBitmap fBmp; 294 SkBitmap fBmp;
295 295
296 typedef GM INHERITED; 296 typedef GM INHERITED;
297 }; 297 };
298 298
299 DEF_GM( return SkNEW(ConvexPolyClip); ) 299 DEF_GM( return SkNEW(ConvexPolyClip); )
300 300
301 } 301 }
OLDNEW
« no previous file with comments | « gm/colortype.cpp ('k') | gm/drawbitmaprect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698