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

Side by Side Diff: gm/matrixconvolution.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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/lighting.cpp ('k') | gm/morphology.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 "SkColor.h" 9 #include "SkColor.h"
10 #include "SkMatrixConvolutionImageFilter.h" 10 #include "SkMatrixConvolutionImageFilter.h"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 12
13 namespace skiagm { 13 namespace skiagm {
14 14
15 class MatrixConvolutionGM : public GM { 15 class MatrixConvolutionGM : public GM {
16 public: 16 public:
17 MatrixConvolutionGM() : fInitialized(false) { 17 MatrixConvolutionGM() : fInitialized(false) {
18 this->setBGColor(0x00000000); 18 this->setBGColor(0x00000000);
19 } 19 }
20 20
21 protected: 21 protected:
22 virtual SkString onShortName() { 22 virtual SkString onShortName() {
23 return SkString("matrixconvolution"); 23 return SkString("matrixconvolution");
24 } 24 }
25 25
26 void make_bitmap() { 26 void make_bitmap() {
27 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); 27 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
28 fBitmap.allocPixels(); 28 fBitmap.allocPixels();
29 SkDevice device(fBitmap); 29 SkBitmapDevice device(fBitmap);
30 SkCanvas canvas(&device); 30 SkCanvas canvas(&device);
31 canvas.clear(0x00000000); 31 canvas.clear(0x00000000);
32 SkPaint paint; 32 SkPaint paint;
33 paint.setAntiAlias(true); 33 paint.setAntiAlias(true);
34 paint.setColor(0xFFFFFFFF); 34 paint.setColor(0xFFFFFFFF);
35 paint.setTextSize(SkIntToScalar(180)); 35 paint.setTextSize(SkIntToScalar(180));
36 SkPoint pts[2] = { SkPoint::Make(0, 0), 36 SkPoint pts[2] = { SkPoint::Make(0, 0),
37 SkPoint::Make(0, SkIntToScalar(80)) }; 37 SkPoint::Make(0, SkIntToScalar(80)) };
38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; 38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 };
39 SkScalar pos[2] = { 0, SkIntToScalar(80) }; 39 SkScalar pos[2] = { 0, SkIntToScalar(80) };
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkBitmap fBitmap; 89 SkBitmap fBitmap;
90 bool fInitialized; 90 bool fInitialized;
91 }; 91 };
92 92
93 ////////////////////////////////////////////////////////////////////////////// 93 //////////////////////////////////////////////////////////////////////////////
94 94
95 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } 95 static GM* MyFactory(void*) { return new MatrixConvolutionGM; }
96 static GMRegistry reg(MyFactory); 96 static GMRegistry reg(MyFactory);
97 97
98 } 98 }
OLDNEW
« no previous file with comments | « gm/lighting.cpp ('k') | gm/morphology.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698