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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 1238083004: make imagefilters* imagemagnifier imageresizetiled portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | gm/imagefiltersgraph.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 paint.setImageFilter(imf); 138 paint.setImageFilter(imf);
139 paint.setAntiAlias(true); 139 paint.setAntiAlias(true);
140 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint); 140 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint);
141 } 141 }
142 142
143 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 143 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
144 SkPaint paint; 144 SkPaint paint;
145 paint.setImageFilter(imf); 145 paint.setImageFilter(imf);
146 paint.setColor(SK_ColorCYAN); 146 paint.setColor(SK_ColorCYAN);
147 paint.setAntiAlias(true); 147 paint.setAntiAlias(true);
148 sk_tool_utils::set_portable_typeface(&paint); 148 sk_tool_utils::set_portable_typeface_always(&paint);
149 paint.setTextSize(r.height()/2); 149 paint.setTextSize(r.height()/2);
150 paint.setTextAlign(SkPaint::kCenter_Align); 150 paint.setTextAlign(SkPaint::kCenter_Align);
151 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint); 151 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint);
152 } 152 }
153 153
154 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 154 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
155 SkPaint paint; 155 SkPaint paint;
156 paint.setImageFilter(imf); 156 paint.setImageFilter(imf);
157 157
158 SkIRect bounds; 158 SkIRect bounds;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 SkISize onISize() override { return SkISize::Make(512, 342); } 277 SkISize onISize() override { return SkISize::Make(512, 342); }
278 278
279 void drawWaterfall(SkCanvas* canvas, const SkPaint& origPaint) { 279 void drawWaterfall(SkCanvas* canvas, const SkPaint& origPaint) {
280 const uint32_t flags[] = { 280 const uint32_t flags[] = {
281 0, 281 0,
282 SkPaint::kAntiAlias_Flag, 282 SkPaint::kAntiAlias_Flag,
283 SkPaint::kAntiAlias_Flag | SkPaint::kLCDRenderText_Flag, 283 SkPaint::kAntiAlias_Flag | SkPaint::kLCDRenderText_Flag,
284 }; 284 };
285 SkPaint paint(origPaint); 285 SkPaint paint(origPaint);
286 sk_tool_utils::set_portable_typeface_always(&paint);
286 paint.setTextSize(30); 287 paint.setTextSize(30);
287 288
288 SkAutoCanvasRestore acr(canvas, true); 289 SkAutoCanvasRestore acr(canvas, true);
289 for (size_t i = 0; i < SK_ARRAY_COUNT(flags); ++i) { 290 for (size_t i = 0; i < SK_ARRAY_COUNT(flags); ++i) {
290 paint.setFlags(flags[i]); 291 paint.setFlags(flags[i]);
291 canvas->drawText("Hamburgefons", 11, 0, 0, paint); 292 canvas->drawText("Hamburgefons", 11, 0, 0, paint);
292 canvas->translate(0, 40); 293 canvas->translate(0, 40);
293 } 294 }
294 } 295 }
295 296
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { 341 class ImageFiltersText_CF : public ImageFiltersTextBaseGM {
341 public: 342 public:
342 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} 343 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {}
343 344
344 void installFilter(SkPaint* paint) override { 345 void installFilter(SkPaint* paint) override {
345 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf ermode::kSrcIn_Mode))->unref(); 346 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf ermode::kSrcIn_Mode))->unref();
346 } 347 }
347 }; 348 };
348 DEF_GM( return new ImageFiltersText_CF; ) 349 DEF_GM( return new ImageFiltersText_CF; )
349 350
OLDNEW
« no previous file with comments | « no previous file | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698