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

Side by Side Diff: gm/displacement.cpp

Issue 1237233004: make colorwheelnative displacement dropshadowimagefilter getposttextpath 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/colorwheel.cpp ('k') | gm/dropshadowimagefilter.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 "SkBitmapSource.h" 8 #include "SkBitmapSource.h"
9 #include "SkDisplacementMapEffect.h" 9 #include "SkDisplacementMapEffect.h"
10 #include "gm.h" 10 #include "gm.h"
(...skipping 20 matching lines...) Expand all
31 make_checkerboard(&fLargeW, 96, 64); 31 make_checkerboard(&fLargeW, 96, 64);
32 make_checkerboard(&fLargeH, 64, 96); 32 make_checkerboard(&fLargeH, 64, 96);
33 } 33 }
34 34
35 void make_bitmap() { 35 void make_bitmap() {
36 fBitmap.allocN32Pixels(80, 80); 36 fBitmap.allocN32Pixels(80, 80);
37 SkCanvas canvas(fBitmap); 37 SkCanvas canvas(fBitmap);
38 canvas.clear(0x00000000); 38 canvas.clear(0x00000000);
39 SkPaint paint; 39 SkPaint paint;
40 paint.setAntiAlias(true); 40 paint.setAntiAlias(true);
41 sk_tool_utils::set_portable_typeface(&paint); 41 sk_tool_utils::set_portable_typeface_always(&paint);
42 paint.setColor(0xFF884422); 42 paint.setColor(sk_tool_utils::color_to_565(0xFF884422));
43 paint.setTextSize(SkIntToScalar(96)); 43 paint.setTextSize(SkIntToScalar(96));
44 const char* str = "g"; 44 const char* str = "g";
45 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(55), paint); 45 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(55), paint);
46 } 46 }
47 47
48 void make_checkerboard(SkBitmap* bitmap, int w, int h) { 48 void make_checkerboard(SkBitmap* bitmap, int w, int h) {
49 bitmap->allocN32Pixels(w, h); 49 bitmap->allocN32Pixels(w, h);
50 SkCanvas canvas(*bitmap); 50 SkCanvas canvas(*bitmap);
51 sk_tool_utils::draw_checkerboard(&canvas, 0xFF244484, 0xFF804020, 8); 51 sk_tool_utils::draw_checkerboard(&canvas, sk_tool_utils::color_to_565(0x FF244484),
52 sk_tool_utils::color_to_565(0xFF804020), 8);
52 } 53 }
53 54
54 virtual SkISize onISize() { 55 virtual SkISize onISize() {
55 return SkISize::Make(500, 500); 56 return SkISize::Make(500, 500);
56 } 57 }
57 58
58 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint) { 59 void drawClippedBitmap(SkCanvas* canvas, int x, int y, const SkPaint& paint) {
59 canvas->save(); 60 canvas->save();
60 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 61 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
61 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS calar(fBitmap.height()))); 62 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), SkIntToS calar(fBitmap.height())));
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 SkBitmap fBitmap, fCheckerboard, fSmall, fLarge, fLargeW, fLargeH; 208 SkBitmap fBitmap, fCheckerboard, fSmall, fLarge, fLargeW, fLargeH;
208 bool fInitialized; 209 bool fInitialized;
209 }; 210 };
210 211
211 ////////////////////////////////////////////////////////////////////////////// 212 //////////////////////////////////////////////////////////////////////////////
212 213
213 static GM* MyFactory(void*) { return new DisplacementMapGM; } 214 static GM* MyFactory(void*) { return new DisplacementMapGM; }
214 static GMRegistry reg(MyFactory); 215 static GMRegistry reg(MyFactory);
215 216
216 } 217 }
OLDNEW
« no previous file with comments | « gm/colorwheel.cpp ('k') | gm/dropshadowimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698