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

Side by Side Diff: gm/xfermodes.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 2011 Google Inc. 3 * Copyright 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 SkScalar x, SkScalar y) { 53 SkScalar x, SkScalar y) {
54 SkPaint p; 54 SkPaint p;
55 55
56 canvas->drawBitmap(fSrcB, x, y, &p); 56 canvas->drawBitmap(fSrcB, x, y, &p);
57 p.setAlpha(alpha); 57 p.setAlpha(alpha);
58 p.setXfermode(mode); 58 p.setXfermode(mode);
59 canvas->drawBitmap(fDstB, x, y, &p); 59 canvas->drawBitmap(fDstB, x, y, &p);
60 } 60 }
61 61
62 virtual void onOnceBeforeDraw() SK_OVERRIDE { 62 virtual void onOnceBeforeDraw() SK_OVERRIDE {
63 fBG.setConfig(SkBitmap::kARGB_4444_Config, 2, 2, 4); 63 fBG.setConfig(SkBitmap::kARGB_4444_Config, 2, 2, 4, kOpaque_SkAlphaType) ;
64 fBG.setPixels(gData); 64 fBG.setPixels(gData);
65 fBG.setIsOpaque(true);
66 65
67 make_bitmaps(W, H, &fSrcB, &fDstB); 66 make_bitmaps(W, H, &fSrcB, &fDstB);
68 } 67 }
69 68
70 public: 69 public:
71 const static int W = 64; 70 const static int W = 64;
72 const static int H = 64; 71 const static int H = 64;
73 XfermodesGM() {} 72 XfermodesGM() {}
74 73
75 protected: 74 protected:
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 private: 175 private:
177 typedef GM INHERITED; 176 typedef GM INHERITED;
178 }; 177 };
179 178
180 ////////////////////////////////////////////////////////////////////////////// 179 //////////////////////////////////////////////////////////////////////////////
181 180
182 static GM* MyFactory(void*) { return new XfermodesGM; } 181 static GM* MyFactory(void*) { return new XfermodesGM; }
183 static GMRegistry reg(MyFactory); 182 static GMRegistry reg(MyFactory);
184 183
185 } 184 }
OLDNEW
« no previous file with comments | « gm/bleed.cpp ('k') | gm/xfermodes2.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698