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

Side by Side Diff: gm/xfermodes2.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/xfermodes.cpp ('k') | gm/xfermodes3.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 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 "SkShader.h" 10 #include "SkShader.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static const uint32_t kCheckData[] = { 89 static const uint32_t kCheckData[] = {
90 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), 90 SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
91 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 91 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
92 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 92 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
93 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) 93 SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
94 }; 94 };
95 SkBitmap bg; 95 SkBitmap bg;
96 bg.allocN32Pixels(2, 2, true); 96 bg.allocN32Pixels(2, 2, true);
97 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 97 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
98 98
99 SkMatrix lm;
100 lm.setScale(SkIntToScalar(16), SkIntToScalar(16));
99 fBG.reset(SkShader::CreateBitmapShader(bg, 101 fBG.reset(SkShader::CreateBitmapShader(bg,
100 SkShader::kRepeat_TileMode, 102 SkShader::kRepeat_TileMode,
101 SkShader::kRepeat_TileMode)); 103 SkShader::kRepeat_TileMode,
102 SkMatrix lm; 104 &lm));
103 lm.setScale(SkIntToScalar(16), SkIntToScalar(16));
104 fBG->setLocalMatrix(lm);
105 105
106 SkBitmap dstBmp; 106 SkBitmap dstBmp;
107 dstBmp.allocN32Pixels(kSize, kSize); 107 dstBmp.allocN32Pixels(kSize, kSize);
108 SkPMColor* pixels = reinterpret_cast<SkPMColor*>(dstBmp.getPixels()); 108 SkPMColor* pixels = reinterpret_cast<SkPMColor*>(dstBmp.getPixels());
109 109
110 for (int y = 0; y < kSize; ++y) { 110 for (int y = 0; y < kSize; ++y) {
111 int c = y * (1 << kShift); 111 int c = y * (1 << kShift);
112 SkPMColor rowColor = SkPackARGB32(c, c, 0, c/2); 112 SkPMColor rowColor = SkPackARGB32(c, c, 0, c/2);
113 for (int x = 0; x < kSize; ++x) { 113 for (int x = 0; x < kSize; ++x) {
114 pixels[kSize * y + x] = rowColor; 114 pixels[kSize * y + x] = rowColor;
(...skipping 29 matching lines...) Expand all
144 144
145 typedef GM INHERITED; 145 typedef GM INHERITED;
146 }; 146 };
147 147
148 ////////////////////////////////////////////////////////////////////////////// 148 //////////////////////////////////////////////////////////////////////////////
149 149
150 static GM* MyFactory(void*) { return new Xfermodes2GM; } 150 static GM* MyFactory(void*) { return new Xfermodes2GM; }
151 static GMRegistry reg(MyFactory); 151 static GMRegistry reg(MyFactory);
152 152
153 } 153 }
OLDNEW
« no previous file with comments | « gm/xfermodes.cpp ('k') | gm/xfermodes3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698