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

Side by Side Diff: gm/xfermodeimagefilter.cpp

Issue 1243103002: make xfermode* 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/xfermodes.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 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 "sk_tool_utils.h" 9 #include "sk_tool_utils.h"
10 #include "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 17 matching lines...) Expand all
28 SkString onShortName() override { 28 SkString onShortName() override {
29 return SkString("xfermodeimagefilter"); 29 return SkString("xfermodeimagefilter");
30 } 30 }
31 31
32 void make_bitmap() { 32 void make_bitmap() {
33 fBitmap.allocN32Pixels(80, 80); 33 fBitmap.allocN32Pixels(80, 80);
34 SkCanvas canvas(fBitmap); 34 SkCanvas canvas(fBitmap);
35 canvas.clear(0x00000000); 35 canvas.clear(0x00000000);
36 SkPaint paint; 36 SkPaint paint;
37 paint.setAntiAlias(true); 37 paint.setAntiAlias(true);
38 sk_tool_utils::set_portable_typeface(&paint); 38 sk_tool_utils::set_portable_typeface_always(&paint);
39 paint.setColor(0xD000D000); 39 paint.setColor(0xD000D000);
40 paint.setTextSize(SkIntToScalar(96)); 40 paint.setTextSize(SkIntToScalar(96));
41 const char* str = "e"; 41 const char* str = "e";
42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint); 42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint);
43 } 43 }
44 44
45 SkISize onISize() override { 45 SkISize onISize() override {
46 return SkISize::Make(WIDTH, HEIGHT); 46 return SkISize::Make(WIDTH, HEIGHT);
47 } 47 }
48 48
(...skipping 14 matching lines...) Expand all
63 canvas->clipRect(rect); 63 canvas->clipRect(rect);
64 canvas->drawPaint(paint); 64 canvas->drawPaint(paint);
65 canvas->restore(); 65 canvas->restore();
66 } 66 }
67 67
68 void onOnceBeforeDraw() override { 68 void onOnceBeforeDraw() override {
69 make_bitmap(); 69 make_bitmap();
70 70
71 fCheckerboard.allocN32Pixels(80, 80); 71 fCheckerboard.allocN32Pixels(80, 80);
72 SkCanvas checkerboardCanvas(fCheckerboard); 72 SkCanvas checkerboardCanvas(fCheckerboard);
73 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF40 4040, 8); 73 sk_tool_utils::draw_checkerboard(&checkerboardCanvas,
74 sk_tool_utils::color_to_565(0xFFA0A0A0),
75 sk_tool_utils::color_to_565(0xFF404040), 8);
74 } 76 }
75 77
76 void onDraw(SkCanvas* canvas) override { 78 void onDraw(SkCanvas* canvas) override {
77 canvas->clear(SK_ColorBLACK); 79 canvas->clear(SK_ColorBLACK);
78 SkPaint paint; 80 SkPaint paint;
79 81
80 const struct { 82 const struct {
81 SkXfermode::Mode fMode; 83 SkXfermode::Mode fMode;
82 const char* fLabel; 84 const char* fLabel;
83 } gModes[] = { 85 } gModes[] = {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 private: 203 private:
202 SkBitmap fBitmap, fCheckerboard; 204 SkBitmap fBitmap, fCheckerboard;
203 typedef GM INHERITED; 205 typedef GM INHERITED;
204 }; 206 };
205 207
206 ////////////////////////////////////////////////////////////////////////////// 208 //////////////////////////////////////////////////////////////////////////////
207 209
208 DEF_GM( return new XfermodeImageFilterGM; ); 210 DEF_GM( return new XfermodeImageFilterGM; );
209 211
210 } 212 }
OLDNEW
« no previous file with comments | « no previous file | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698