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

Side by Side Diff: gm/xfermodes3.cpp

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 virtual void onOnceBeforeDraw() SK_OVERRIDE { 183 virtual void onOnceBeforeDraw() SK_OVERRIDE {
184 static const uint32_t kCheckData[] = { 184 static const uint32_t kCheckData[] = {
185 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), 185 SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
186 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 186 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
187 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 187 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
188 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) 188 SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
189 }; 189 };
190 SkBitmap bg; 190 SkBitmap bg;
191 bg.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); 191 bg.setConfig(SkBitmap::kARGB_8888_Config, 2, 2, 0, kOpaque_SkAlphaType);
192 bg.allocPixels(); 192 bg.allocPixels();
193 SkAutoLockPixels bgAlp(bg); 193 SkAutoLockPixels bgAlp(bg);
194 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 194 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
195 bg.setIsOpaque(true);
196 195
197 fBGShader.reset(SkShader::CreateBitmapShader(bg, 196 fBGShader.reset(SkShader::CreateBitmapShader(bg,
198 SkShader::kRepeat_TileMode, 197 SkShader::kRepeat_TileMode,
199 SkShader::kRepeat_TileMode) ); 198 SkShader::kRepeat_TileMode) );
200 SkMatrix lm; 199 SkMatrix lm;
201 lm.setScale(SkIntToScalar(kCheckSize), SkIntToScalar(kCheckSize)); 200 lm.setScale(SkIntToScalar(kCheckSize), SkIntToScalar(kCheckSize));
202 fBGShader->setLocalMatrix(lm); 201 fBGShader->setLocalMatrix(lm);
203 202
204 SkPaint bmpPaint; 203 SkPaint bmpPaint;
205 static const SkPoint kCenter = { SkIntToScalar(kSize) / 2, SkIntToScalar (kSize) / 2 }; 204 static const SkPoint kCenter = { SkIntToScalar(kSize) / 2, SkIntToScalar (kSize) / 2 };
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SkAutoTUnref<SkShader> fBmpShader; 236 SkAutoTUnref<SkShader> fBmpShader;
238 237
239 typedef GM INHERITED; 238 typedef GM INHERITED;
240 }; 239 };
241 240
242 ////////////////////////////////////////////////////////////////////////////// 241 //////////////////////////////////////////////////////////////////////////////
243 242
244 DEF_GM(return new Xfermodes3GM;) 243 DEF_GM(return new Xfermodes3GM;)
245 244
246 } 245 }
OLDNEW
« no previous file with comments | « gm/xfermodes2.cpp ('k') | include/core/SkBitmap.h » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698