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

Side by Side Diff: gm/matrixconvolution.cpp

Issue 163823002: Revert of add peekPixels to SkCanvas and SkSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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.allocN32Pixels(80, 80); 27 fBitmap.allocN32Pixels(80, 80);
28 SkCanvas canvas(fBitmap); 28 SkBitmapDevice device(fBitmap);
29 SkCanvas canvas(&device);
29 canvas.clear(0x00000000); 30 canvas.clear(0x00000000);
30 SkPaint paint; 31 SkPaint paint;
31 paint.setAntiAlias(true); 32 paint.setAntiAlias(true);
32 paint.setColor(0xFFFFFFFF); 33 paint.setColor(0xFFFFFFFF);
33 paint.setTextSize(SkIntToScalar(180)); 34 paint.setTextSize(SkIntToScalar(180));
34 SkPoint pts[2] = { SkPoint::Make(0, 0), 35 SkPoint pts[2] = { SkPoint::Make(0, 0),
35 SkPoint::Make(0, SkIntToScalar(80)) }; 36 SkPoint::Make(0, SkIntToScalar(80)) };
36 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; 37 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 };
37 SkScalar pos[2] = { 0, SkIntToScalar(80) }; 38 SkScalar pos[2] = { 0, SkIntToScalar(80) };
38 paint.setShader(SkGradientShader::CreateLinear( 39 paint.setShader(SkGradientShader::CreateLinear(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SkBitmap fBitmap; 107 SkBitmap fBitmap;
107 bool fInitialized; 108 bool fInitialized;
108 }; 109 };
109 110
110 ////////////////////////////////////////////////////////////////////////////// 111 //////////////////////////////////////////////////////////////////////////////
111 112
112 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } 113 static GM* MyFactory(void*) { return new MatrixConvolutionGM; }
113 static GMRegistry reg(MyFactory); 114 static GMRegistry reg(MyFactory);
114 115
115 } 116 }
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