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

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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
« no previous file with comments | « gm/hairlines.cpp ('k') | gm/matrixconvolution.cpp » ('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 "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 paint.setImageFilter(merge); 133 paint.setImageFilter(merge);
134 canvas->drawPaint(paint); 134 canvas->drawPaint(paint);
135 canvas->translate(SkIntToScalar(100), 0); 135 canvas->translate(SkIntToScalar(100), 0);
136 } 136 }
137 { 137 {
138 SkAutoTUnref<SkImageFilter> morph(new SkDilateImageFilter(5, 5)); 138 SkAutoTUnref<SkImageFilter> morph(new SkDilateImageFilter(5, 5));
139 139
140 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0, 140 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
141 0, SK_Scalar1, 0, 0, 0, 141 0, SK_Scalar1, 0, 0, 0,
142 0, 0, SK_Scalar1, 0, 0, 142 0, 0, SK_Scalar1, 0, 0,
143 0, 0, 0, SkFloatToScalar(0.5f), 0 }; 143 0, 0, 0, 0.5f, 0 };
144 144
145 SkAutoTUnref<SkColorFilter> matrixFilter(new SkColorMatrixFilter(mat rix)); 145 SkAutoTUnref<SkColorFilter> matrixFilter(new SkColorMatrixFilter(mat rix));
146 SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Cre ate(matrixFilter, morph)); 146 SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Cre ate(matrixFilter, morph));
147 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOve r_Mode)); 147 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOve r_Mode));
148 SkAutoTUnref<SkImageFilter> blendColor(new SkXfermodeImageFilter(mod e, colorMorph)); 148 SkAutoTUnref<SkImageFilter> blendColor(new SkXfermodeImageFilter(mod e, colorMorph));
149 149
150 SkPaint paint; 150 SkPaint paint;
151 paint.setImageFilter(blendColor); 151 paint.setImageFilter(blendColor);
152 drawClippedBitmap(canvas, fBitmap, paint); 152 drawClippedBitmap(canvas, fBitmap, paint);
153 canvas->translate(SkIntToScalar(100), 0); 153 canvas->translate(SkIntToScalar(100), 0);
154 } 154 }
155 { 155 {
156 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0, 156 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
157 0, SK_Scalar1, 0, 0, 0, 157 0, SK_Scalar1, 0, 0, 0,
158 0, 0, SK_Scalar1, 0, 0, 158 0, 0, SK_Scalar1, 0, 0,
159 0, 0, 0, SkFloatToScalar(0.5f), 0 }; 159 0, 0, 0, 0.5f, 0 };
160 SkColorMatrixFilter matrixCF(matrix); 160 SkColorMatrixFilter matrixCF(matrix);
161 SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::C reate(&matrixCF)); 161 SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::C reate(&matrixCF));
162 SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10) , matrixFilter); 162 SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10) , matrixFilter);
163 163
164 SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar 1, SK_Scalar1, 0)); 164 SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar 1, SK_Scalar1, 0));
165 SkXfermodeImageFilter arithFilter(arith, matrixFilter, &offsetFilter ); 165 SkXfermodeImageFilter arithFilter(arith, matrixFilter, &offsetFilter );
166 166
167 SkPaint paint; 167 SkPaint paint;
168 paint.setImageFilter(&arithFilter); 168 paint.setImageFilter(&arithFilter);
169 drawClippedBitmap(canvas, fBitmap, paint); 169 drawClippedBitmap(canvas, fBitmap, paint);
(...skipping 17 matching lines...) Expand all
187 private: 187 private:
188 typedef GM INHERITED; 188 typedef GM INHERITED;
189 SkBitmap fBitmap; 189 SkBitmap fBitmap;
190 bool fInitialized; 190 bool fInitialized;
191 }; 191 };
192 192
193 /////////////////////////////////////////////////////////////////////////////// 193 ///////////////////////////////////////////////////////////////////////////////
194 194
195 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } 195 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; }
196 static skiagm::GMRegistry reg(MyFactory); 196 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/hairlines.cpp ('k') | gm/matrixconvolution.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698