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

Side by Side Diff: gm/morphology.cpp

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « gm/modecolorfilters.cpp ('k') | gm/ninepatchstretch.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 #include "SkMorphologyImageFilter.h" 9 #include "SkMorphologyImageFilter.h"
10 10
11 #define WIDTH 700 11 #define WIDTH 700
12 #define HEIGHT 560 12 #define HEIGHT 560
13 13
14 namespace skiagm { 14 namespace skiagm {
15 15
16 class MorphologyGM : public GM { 16 class MorphologyGM : public GM {
17 public: 17 public:
18 MorphologyGM() { 18 MorphologyGM() {
19 this->setBGColor(0xFF000000); 19 this->setBGColor(0xFF000000);
20 fOnce = false; 20 fOnce = false;
21 } 21 }
22 22
23 protected: 23 protected:
24 virtual SkString onShortName() { 24 virtual SkString onShortName() {
25 return SkString("morphology"); 25 return SkString("morphology");
26 } 26 }
27 27
28 void make_bitmap() { 28 void make_bitmap() {
29 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 135, 135); 29 fBitmap.allocN32Pixels(135, 135);
30 fBitmap.allocPixels();
31 SkBitmapDevice device(fBitmap); 30 SkBitmapDevice device(fBitmap);
32 SkCanvas canvas(&device); 31 SkCanvas canvas(&device);
33 canvas.clear(0x0); 32 canvas.clear(0x0);
34 SkPaint paint; 33 SkPaint paint;
35 paint.setAntiAlias(true); 34 paint.setAntiAlias(true);
36 const char* str1 = "ABC"; 35 const char* str1 = "ABC";
37 const char* str2 = "XYZ"; 36 const char* str2 = "XYZ";
38 paint.setColor(0xFFFFFFFF); 37 paint.setColor(0xFFFFFFFF);
39 paint.setTextSize(64); 38 paint.setTextSize(64);
40 canvas.drawText(str1, strlen(str1), 10, 55, paint); 39 canvas.drawText(str1, strlen(str1), 10, 55, paint);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 SkBitmap fBitmap; 97 SkBitmap fBitmap;
99 bool fOnce; 98 bool fOnce;
100 }; 99 };
101 100
102 ////////////////////////////////////////////////////////////////////////////// 101 //////////////////////////////////////////////////////////////////////////////
103 102
104 static GM* MyFactory(void*) { return new MorphologyGM; } 103 static GM* MyFactory(void*) { return new MorphologyGM; }
105 static GMRegistry reg(MyFactory); 104 static GMRegistry reg(MyFactory);
106 105
107 } 106 }
OLDNEW
« no previous file with comments | « gm/modecolorfilters.cpp ('k') | gm/ninepatchstretch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698