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

Side by Side Diff: gm/composeshader.cpp

Issue 1544873002: handle halfway case in scan converter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more comments Created 4 years, 11 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 | include/core/SkRect.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkBitmapProcShader.h" 10 #include "SkBitmapProcShader.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 pts[0].set(0, 0); 155 pts[0].set(0, 0);
156 pts[1].set(SkIntToScalar(length), 0); 156 pts[1].set(SkIntToScalar(length), 0);
157 colors[0] = SK_ColorBLUE; 157 colors[0] = SK_ColorBLUE;
158 colors[1] = SkColorSetARGB(0, 0, 0, 0xFF); 158 colors[1] = SkColorSetARGB(0, 0, 0, 0xFF);
159 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kCl amp_TileMode); 159 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kCl amp_TileMode);
160 } 160 }
161 161
162 162
163 class ComposeShaderBitmapGM : public skiagm::GM { 163 class ComposeShaderBitmapGM : public skiagm::GM {
164 public: 164 public:
165 ComposeShaderBitmapGM() { 165 ComposeShaderBitmapGM()
166 : fColorBitmapShader(nullptr)
167 , fAlpha8BitmapShader(nullptr)
168 , fLinearGradientShader(nullptr)
169 {
170 }
171
172 void onOnceBeforeDraw() override {
166 draw_color_bm(&fColorBitmap, squareLength); 173 draw_color_bm(&fColorBitmap, squareLength);
167 draw_alpha8_bm(&fAlpha8Bitmap, squareLength); 174 draw_alpha8_bm(&fAlpha8Bitmap, squareLength);
168 SkMatrix s; 175 SkMatrix s;
169 s.reset(); 176 s.reset();
170 fColorBitmapShader = new SkBitmapProcShader(fColorBitmap, SkShader::kRep eat_TileMode, 177 fColorBitmapShader = new SkBitmapProcShader(fColorBitmap, SkShader::kRep eat_TileMode,
171 SkShader::kRepeat_TileMode, &s); 178 SkShader::kRepeat_TileMode, &s);
172 fAlpha8BitmapShader = new SkBitmapProcShader(fAlpha8Bitmap, SkShader::kR epeat_TileMode, 179 fAlpha8BitmapShader = new SkBitmapProcShader(fAlpha8Bitmap, SkShader::kR epeat_TileMode,
173 SkShader::kRepeat_TileMode, &s); 180 SkShader::kRepeat_TileMode, &s);
174 fLinearGradientShader = make_linear_gradient_shader(squareLength); 181 fLinearGradientShader = make_linear_gradient_shader(squareLength);
175 } 182 }
183
176 ~ComposeShaderBitmapGM() { 184 ~ComposeShaderBitmapGM() {
177 SkSafeUnref(fColorBitmapShader); 185 SkSafeUnref(fColorBitmapShader);
178 SkSafeUnref(fAlpha8BitmapShader); 186 SkSafeUnref(fAlpha8BitmapShader);
179 SkSafeUnref(fLinearGradientShader); 187 SkSafeUnref(fLinearGradientShader);
180 } 188 }
181 189
182 protected: 190 protected:
183 SkString onShortName() override { 191 SkString onShortName() override {
184 return SkString("composeshader_bitmap"); 192 return SkString("composeshader_bitmap");
185 } 193 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SkShader* fLinearGradientShader; 245 SkShader* fLinearGradientShader;
238 246
239 typedef GM INHERITED; 247 typedef GM INHERITED;
240 }; 248 };
241 249
242 ////////////////////////////////////////////////////////////////////////////// 250 //////////////////////////////////////////////////////////////////////////////
243 251
244 DEF_GM( return new ComposeShaderGM; ) 252 DEF_GM( return new ComposeShaderGM; )
245 DEF_GM( return new ComposeShaderAlphaGM; ) 253 DEF_GM( return new ComposeShaderAlphaGM; )
246 DEF_GM( return new ComposeShaderBitmapGM; ) 254 DEF_GM( return new ComposeShaderBitmapGM; )
OLDNEW
« no previous file with comments | « no previous file | include/core/SkRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698