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

Side by Side Diff: gm/extractbitmap.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/dropshadowimagefilter.cpp ('k') | gm/filterbitmap.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 namespace skiagm { 14 namespace skiagm {
15 15
16 static void create_bitmap(SkBitmap* bitmap) { 16 static void create_bitmap(SkBitmap* bitmap) {
17 const int W = 100; 17 const int W = 100;
18 const int H = 100; 18 const int H = 100;
19 bitmap->setConfig(SkBitmap::kARGB_8888_Config, W, H); 19 bitmap->allocN32Pixels(W, H);
20 bitmap->allocPixels();
21 20
22 SkCanvas canvas(*bitmap); 21 SkCanvas canvas(*bitmap);
23 canvas.drawColor(SK_ColorRED); 22 canvas.drawColor(SK_ColorRED);
24 SkPaint paint; 23 SkPaint paint;
25 paint.setColor(SK_ColorBLUE); 24 paint.setColor(SK_ColorBLUE);
26 canvas.drawCircle(SkIntToScalar(W)/2, SkIntToScalar(H)/2, SkIntToScalar(W)/2 , paint); 25 canvas.drawCircle(SkIntToScalar(W)/2, SkIntToScalar(H)/2, SkIntToScalar(W)/2 , paint);
27 } 26 }
28 27
29 class ExtractBitmapGM : public GM { 28 class ExtractBitmapGM : public GM {
30 public: 29 public:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 private: 94 private:
96 typedef GM INHERITED; 95 typedef GM INHERITED;
97 }; 96 };
98 97
99 ////////////////////////////////////////////////////////////////////////////// 98 //////////////////////////////////////////////////////////////////////////////
100 99
101 static GM* MyFactory(void*) { return new ExtractBitmapGM; } 100 static GM* MyFactory(void*) { return new ExtractBitmapGM; }
102 static GMRegistry reg(MyFactory); 101 static GMRegistry reg(MyFactory);
103 102
104 } 103 }
OLDNEW
« no previous file with comments | « gm/dropshadowimagefilter.cpp ('k') | gm/filterbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698