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

Side by Side Diff: gm/xfermodes2.cpp

Issue 1041913002: Fix variable names in xfermodes2 gm test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 bg.allocN32Pixels(2, 2, true); 97 bg.allocN32Pixels(2, 2, true);
98 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 98 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
99 99
100 SkMatrix lm; 100 SkMatrix lm;
101 lm.setScale(SkIntToScalar(16), SkIntToScalar(16)); 101 lm.setScale(SkIntToScalar(16), SkIntToScalar(16));
102 fBG.reset(SkShader::CreateBitmapShader(bg, 102 fBG.reset(SkShader::CreateBitmapShader(bg,
103 SkShader::kRepeat_TileMode, 103 SkShader::kRepeat_TileMode,
104 SkShader::kRepeat_TileMode, 104 SkShader::kRepeat_TileMode,
105 &lm)); 105 &lm));
106 106
107 SkBitmap dstBmp; 107 SkBitmap srcBmp;
108 dstBmp.allocN32Pixels(kSize, kSize); 108 srcBmp.allocN32Pixels(kSize, kSize);
109 SkPMColor* pixels = reinterpret_cast<SkPMColor*>(dstBmp.getPixels()); 109 SkPMColor* pixels = reinterpret_cast<SkPMColor*>(srcBmp.getPixels());
110 110
111 for (int y = 0; y < kSize; ++y) { 111 for (int y = 0; y < kSize; ++y) {
112 int c = y * (1 << kShift); 112 int c = y * (1 << kShift);
113 SkPMColor rowColor = SkPackARGB32(c, c, 0, c/2); 113 SkPMColor rowColor = SkPackARGB32(c, c, 0, c/2);
114 for (int x = 0; x < kSize; ++x) { 114 for (int x = 0; x < kSize; ++x) {
115 pixels[kSize * y + x] = rowColor; 115 pixels[kSize * y + x] = rowColor;
116 } 116 }
117 } 117 }
118 fSrc.reset(SkShader::CreateBitmapShader(dstBmp, 118 fSrc.reset(SkShader::CreateBitmapShader(srcBmp,
119 SkShader::kClamp_TileMode, 119 SkShader::kClamp_TileMode,
120 SkShader::kClamp_TileMode)); 120 SkShader::kClamp_TileMode));
121 SkBitmap srcBmp; 121 SkBitmap dstBmp;
122 srcBmp.allocN32Pixels(kSize, kSize); 122 dstBmp.allocN32Pixels(kSize, kSize);
123 pixels = reinterpret_cast<SkPMColor*>(srcBmp.getPixels()); 123 pixels = reinterpret_cast<SkPMColor*>(dstBmp.getPixels());
124 124
125 for (int x = 0; x < kSize; ++x) { 125 for (int x = 0; x < kSize; ++x) {
126 int c = x * (1 << kShift); 126 int c = x * (1 << kShift);
127 SkPMColor colColor = SkPackARGB32(c, 0, c, c/2); 127 SkPMColor colColor = SkPackARGB32(c, 0, c, c/2);
128 for (int y = 0; y < kSize; ++y) { 128 for (int y = 0; y < kSize; ++y) {
129 pixels[kSize * y + x] = colColor; 129 pixels[kSize * y + x] = colColor;
130 } 130 }
131 } 131 }
132 fDst.reset(SkShader::CreateBitmapShader(srcBmp, 132 fDst.reset(SkShader::CreateBitmapShader(dstBmp,
133 SkShader::kClamp_TileMode, 133 SkShader::kClamp_TileMode,
134 SkShader::kClamp_TileMode)); 134 SkShader::kClamp_TileMode));
135 } 135 }
136 136
137 enum { 137 enum {
138 kShift = 2, 138 kShift = 2,
139 kSize = 256 >> kShift, 139 kSize = 256 >> kShift,
140 }; 140 };
141 141
142 SkAutoTUnref<SkShader> fBG; 142 SkAutoTUnref<SkShader> fBG;
143 SkAutoTUnref<SkShader> fSrc; 143 SkAutoTUnref<SkShader> fSrc;
144 SkAutoTUnref<SkShader> fDst; 144 SkAutoTUnref<SkShader> fDst;
145 145
146 typedef GM INHERITED; 146 typedef GM INHERITED;
147 }; 147 };
148 148
149 ////////////////////////////////////////////////////////////////////////////// 149 //////////////////////////////////////////////////////////////////////////////
150 150
151 static GM* MyFactory(void*) { return new Xfermodes2GM; } 151 static GM* MyFactory(void*) { return new Xfermodes2GM; }
152 static GMRegistry reg(MyFactory); 152 static GMRegistry reg(MyFactory);
153 153
154 } 154 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698