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

Side by Side Diff: gm/xfermodeimagefilter.cpp

Issue 16034013: Remove unpremul/remul from SkArithmeticMode, both raster and GPU, since the SVG spec actually defin… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix keygen. Created 7 years, 6 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "SkArithmeticMode.h" 9 #include "SkArithmeticMode.h"
10 #include "SkXfermodeImageFilter.h" 10 #include "SkXfermodeImageFilter.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkXfermodeImageFilter, (mode, background))); 128 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkXfermodeImageFilter, (mode, background)));
129 paint.setImageFilter(filter); 129 paint.setImageFilter(filter);
130 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToS calar(y)); 130 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToS calar(y));
131 x += fBitmap.width() + MARGIN; 131 x += fBitmap.width() + MARGIN;
132 if (x + fBitmap.width() > WIDTH) { 132 if (x + fBitmap.width() > WIDTH) {
133 x = 0; 133 x = 0;
134 y += fBitmap.height() + MARGIN; 134 y += fBitmap.height() + MARGIN;
135 } 135 }
136 } 136 }
137 // Test arithmetic mode as image filter 137 // Test arithmetic mode as image filter
138 SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(0, SK_Scalar1, SK _Scalar1, 0)); 138 SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(0, SK_Scalar1, SK _Scalar1, 0, true));
139 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkXfermodeImageFilter, (mo de, background))); 139 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkXfermodeImageFilter, (mo de, background)));
140 paint.setImageFilter(filter); 140 paint.setImageFilter(filter);
141 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToScala r(y)); 141 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToScala r(y));
142 x += fBitmap.width() + MARGIN; 142 x += fBitmap.width() + MARGIN;
143 if (x + fBitmap.width() > WIDTH) { 143 if (x + fBitmap.width() > WIDTH) {
144 x = 0; 144 x = 0;
145 y += fBitmap.height() + MARGIN; 145 y += fBitmap.height() + MARGIN;
146 } 146 }
147 // Test NULL mode 147 // Test NULL mode
148 filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, (NULL, background))); 148 filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, (NULL, background)));
149 paint.setImageFilter(filter); 149 paint.setImageFilter(filter);
150 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToScala r(y)); 150 drawClippedBitmap(canvas, fBitmap, paint, SkIntToScalar(x), SkIntToScala r(y));
151 } 151 }
152 private: 152 private:
153 typedef GM INHERITED; 153 typedef GM INHERITED;
154 SkBitmap fBitmap, fCheckerboard; 154 SkBitmap fBitmap, fCheckerboard;
155 bool fInitialized; 155 bool fInitialized;
156 }; 156 };
157 157
158 ////////////////////////////////////////////////////////////////////////////// 158 //////////////////////////////////////////////////////////////////////////////
159 159
160 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; } 160 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; }
161 static GMRegistry reg(MyFactory); 161 static GMRegistry reg(MyFactory);
162 162
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698