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

Side by Side Diff: gm/tileimagefilter.cpp

Issue 1244833002: make stroketext textblob* texteffects tileimagefilter gm 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 | « gm/texteffects.cpp ('k') | no next file » | 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBitmapSource.h" 9 #include "SkBitmapSource.h"
10 #include "SkColorFilterImageFilter.h" 10 #include "SkColorFilterImageFilter.h"
11 #include "SkColorMatrixFilter.h" 11 #include "SkColorMatrixFilter.h"
12 #include "SkTileImageFilter.h" 12 #include "SkTileImageFilter.h"
13 #include "gm.h" 13 #include "gm.h"
14 14
15 #define WIDTH 400 15 #define WIDTH 400
16 #define HEIGHT 100 16 #define HEIGHT 100
17 #define MARGIN 12 17 #define MARGIN 12
18 18
19 static SkBitmap make_bitmap() { 19 static SkBitmap make_bitmap() {
20 SkBitmap bitmap; 20 SkBitmap bitmap;
21 bitmap.allocN32Pixels(50, 50); 21 bitmap.allocN32Pixels(50, 50);
22 SkCanvas canvas(bitmap); 22 SkCanvas canvas(bitmap);
23 canvas.clear(0xFF000000); 23 canvas.clear(0xFF000000);
24 SkPaint paint; 24 SkPaint paint;
25 paint.setAntiAlias(true); 25 paint.setAntiAlias(true);
26 sk_tool_utils::set_portable_typeface(&paint); 26 sk_tool_utils::set_portable_typeface_always(&paint);
27 paint.setColor(0xD000D000); 27 paint.setColor(0xD000D000);
28 paint.setTextSize(SkIntToScalar(50)); 28 paint.setTextSize(SkIntToScalar(50));
29 const char* str = "e"; 29 const char* str = "e";
30 canvas.drawText(str, strlen(str), SkIntToScalar(10), SkIntToScalar(45), pain t); 30 canvas.drawText(str, strlen(str), SkIntToScalar(10), SkIntToScalar(45), pain t);
31 return bitmap; 31 return bitmap;
32 } 32 }
33 33
34 34
35 namespace skiagm { 35 namespace skiagm {
36 36
(...skipping 10 matching lines...) Expand all
47 47
48 SkISize onISize() override{ 48 SkISize onISize() override{
49 return SkISize::Make(WIDTH, HEIGHT); 49 return SkISize::Make(WIDTH, HEIGHT);
50 } 50 }
51 51
52 void onOnceBeforeDraw() override { 52 void onOnceBeforeDraw() override {
53 fBitmap = make_bitmap(); 53 fBitmap = make_bitmap();
54 54
55 fCheckerboard.allocN32Pixels(80, 80); 55 fCheckerboard.allocN32Pixels(80, 80);
56 SkCanvas checkerboardCanvas(fCheckerboard); 56 SkCanvas checkerboardCanvas(fCheckerboard);
57 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF40 4040, 8); 57 sk_tool_utils::draw_checkerboard(&checkerboardCanvas,
58 sk_tool_utils::color_to_565(0xFFA0A0A0),
59 sk_tool_utils::color_to_565(0xFF404040), 8);
58 } 60 }
59 61
60 void onDraw(SkCanvas* canvas) override { 62 void onDraw(SkCanvas* canvas) override {
61 canvas->clear(SK_ColorBLACK); 63 canvas->clear(SK_ColorBLACK);
62 64
63 int x = 0, y = 0; 65 int x = 0, y = 0;
64 for (size_t i = 0; i < 4; i++) { 66 for (size_t i = 0; i < 4; i++) {
65 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; 67 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap;
66 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(bitmap->width()/4), 68 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(bitmap->width()/4),
67 SkIntToScalar(bitmap->height()/4), 69 SkIntToScalar(bitmap->height()/4),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 SkBitmap fCheckerboard; 117 SkBitmap fCheckerboard;
116 118
117 typedef GM INHERITED; 119 typedef GM INHERITED;
118 }; 120 };
119 121
120 ////////////////////////////////////////////////////////////////////////////// 122 //////////////////////////////////////////////////////////////////////////////
121 123
122 DEF_GM( return SkNEW(TileImageFilterGM); ) 124 DEF_GM( return SkNEW(TileImageFilterGM); )
123 125
124 } 126 }
OLDNEW
« no previous file with comments | « gm/texteffects.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698