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

Side by Side Diff: gm/xfermodes2.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 "SkShader.h" 10 #include "SkShader.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 private: 87 private:
88 virtual void onOnceBeforeDraw() SK_OVERRIDE { 88 virtual void onOnceBeforeDraw() SK_OVERRIDE {
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.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); 96 bg.setConfig(SkBitmap::kARGB_8888_Config, 2, 2, 0, kOpaque_SkAlphaType);
97 bg.allocPixels(); 97 bg.allocPixels();
98 SkAutoLockPixels bgAlp(bg); 98 SkAutoLockPixels bgAlp(bg);
99 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 99 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
100 bg.setIsOpaque(true);
101 100
102 fBG.reset(SkShader::CreateBitmapShader(bg, 101 fBG.reset(SkShader::CreateBitmapShader(bg,
103 SkShader::kRepeat_TileMode, 102 SkShader::kRepeat_TileMode,
104 SkShader::kRepeat_TileMode)); 103 SkShader::kRepeat_TileMode));
105 SkMatrix lm; 104 SkMatrix lm;
106 lm.setScale(SkIntToScalar(16), SkIntToScalar(16)); 105 lm.setScale(SkIntToScalar(16), SkIntToScalar(16));
107 fBG->setLocalMatrix(lm); 106 fBG->setLocalMatrix(lm);
108 107
109 SkBitmap dstBmp; 108 SkBitmap dstBmp;
110 dstBmp.setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize); 109 dstBmp.setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 150
152 typedef GM INHERITED; 151 typedef GM INHERITED;
153 }; 152 };
154 153
155 ////////////////////////////////////////////////////////////////////////////// 154 //////////////////////////////////////////////////////////////////////////////
156 155
157 static GM* MyFactory(void*) { return new Xfermodes2GM; } 156 static GM* MyFactory(void*) { return new Xfermodes2GM; }
158 static GMRegistry reg(MyFactory); 157 static GMRegistry reg(MyFactory);
159 158
160 } 159 }
OLDNEW
« no previous file with comments | « gm/xfermodes.cpp ('k') | gm/xfermodes3.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698