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

Side by Side Diff: gm/xfermodes3.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/xfermodes2.cpp ('k') | include/core/SkShader.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 2013 Google Inc. 3 * Copyright 2013 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 #include "gm.h" 8 #include "gm.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), 188 SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
189 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 189 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
190 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 190 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
191 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) 191 SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
192 }; 192 };
193 SkBitmap bg; 193 SkBitmap bg;
194 bg.allocN32Pixels(2, 2, true); 194 bg.allocN32Pixels(2, 2, true);
195 SkAutoLockPixels bgAlp(bg); 195 SkAutoLockPixels bgAlp(bg);
196 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 196 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
197 197
198 SkMatrix lm;
199 lm.setScale(SkIntToScalar(kCheckSize), SkIntToScalar(kCheckSize));
198 fBGShader.reset(SkShader::CreateBitmapShader(bg, 200 fBGShader.reset(SkShader::CreateBitmapShader(bg,
199 SkShader::kRepeat_TileMode, 201 SkShader::kRepeat_TileMode,
200 SkShader::kRepeat_TileMode) ); 202 SkShader::kRepeat_TileMode,
201 SkMatrix lm; 203 &lm));
202 lm.setScale(SkIntToScalar(kCheckSize), SkIntToScalar(kCheckSize));
203 fBGShader->setLocalMatrix(lm);
204 204
205 SkPaint bmpPaint; 205 SkPaint bmpPaint;
206 static const SkPoint kCenter = { SkIntToScalar(kSize) / 2, SkIntToScalar (kSize) / 2 }; 206 static const SkPoint kCenter = { SkIntToScalar(kSize) / 2, SkIntToScalar (kSize) / 2 };
207 static const SkColor kColors[] = { SK_ColorTRANSPARENT, 0x80800000, 207 static const SkColor kColors[] = { SK_ColorTRANSPARENT, 0x80800000,
208 0xF020F060, SK_ColorWHITE }; 208 0xF020F060, SK_ColorWHITE };
209 bmpPaint.setShader(SkGradientShader::CreateRadial(kCenter, 209 bmpPaint.setShader(SkGradientShader::CreateRadial(kCenter,
210 3 * SkIntToScalar(kSiz e) / 4, 210 3 * SkIntToScalar(kSiz e) / 4,
211 kColors, 211 kColors,
212 NULL, 212 NULL,
213 SK_ARRAY_COUNT(kColors ), 213 SK_ARRAY_COUNT(kColors ),
(...skipping 23 matching lines...) Expand all
237 SkAutoTUnref<SkShader> fBmpShader; 237 SkAutoTUnref<SkShader> fBmpShader;
238 238
239 typedef GM INHERITED; 239 typedef GM INHERITED;
240 }; 240 };
241 241
242 ////////////////////////////////////////////////////////////////////////////// 242 //////////////////////////////////////////////////////////////////////////////
243 243
244 DEF_GM(return new Xfermodes3GM;) 244 DEF_GM(return new Xfermodes3GM;)
245 245
246 } 246 }
OLDNEW
« no previous file with comments | « gm/xfermodes2.cpp ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698