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

Side by Side Diff: gm/offsetimagefilter.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/ninepatchstretch.cpp ('k') | gm/peekpixels.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 "gm.h" 8 #include "gm.h"
9 #include "SkOffsetImageFilter.h" 9 #include "SkOffsetImageFilter.h"
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 10 matching lines...) Expand all
21 this->setBGColor(0xFF000000); 21 this->setBGColor(0xFF000000);
22 } 22 }
23 23
24 protected: 24 protected:
25 virtual SkString onShortName() { 25 virtual SkString onShortName() {
26 return SkString("offsetimagefilter"); 26 return SkString("offsetimagefilter");
27 } 27 }
28 28
29 void make_bitmap() { 29 void make_bitmap() {
30 fBitmap.allocN32Pixels(80, 80); 30 fBitmap.allocN32Pixels(80, 80);
31 SkCanvas canvas(fBitmap); 31 SkBitmapDevice device(fBitmap);
32 SkCanvas canvas(&device);
32 canvas.clear(0x00000000); 33 canvas.clear(0x00000000);
33 SkPaint paint; 34 SkPaint paint;
34 paint.setAntiAlias(true); 35 paint.setAntiAlias(true);
35 paint.setColor(0xD000D000); 36 paint.setColor(0xD000D000);
36 paint.setTextSize(SkIntToScalar(96)); 37 paint.setTextSize(SkIntToScalar(96));
37 const char* str = "e"; 38 const char* str = "e";
38 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint); 39 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint);
39 } 40 }
40 41
41 void make_checkerboard() { 42 void make_checkerboard() {
42 fCheckerboard.allocN32Pixels(80, 80); 43 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
43 SkCanvas canvas(fCheckerboard); 44 fCheckerboard.allocPixels();
45 SkBitmapDevice device(fCheckerboard);
46 SkCanvas canvas(&device);
44 canvas.clear(0x00000000); 47 canvas.clear(0x00000000);
45 SkPaint darkPaint; 48 SkPaint darkPaint;
46 darkPaint.setColor(0xFF404040); 49 darkPaint.setColor(0xFF404040);
47 SkPaint lightPaint; 50 SkPaint lightPaint;
48 lightPaint.setColor(0xFFA0A0A0); 51 lightPaint.setColor(0xFFA0A0A0);
49 for (int y = 0; y < 80; y += 16) { 52 for (int y = 0; y < 80; y += 16) {
50 for (int x = 0; x < 80; x += 16) { 53 for (int x = 0; x < 80; x += 16) {
51 canvas.save(); 54 canvas.save();
52 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); 55 canvas.translate(SkIntToScalar(x), SkIntToScalar(y));
53 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); 56 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 SkBitmap fBitmap, fCheckerboard; 112 SkBitmap fBitmap, fCheckerboard;
110 bool fInitialized; 113 bool fInitialized;
111 }; 114 };
112 115
113 ////////////////////////////////////////////////////////////////////////////// 116 //////////////////////////////////////////////////////////////////////////////
114 117
115 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } 118 static GM* MyFactory(void*) { return new OffsetImageFilterGM; }
116 static GMRegistry reg(MyFactory); 119 static GMRegistry reg(MyFactory);
117 120
118 } 121 }
OLDNEW
« no previous file with comments | « gm/ninepatchstretch.cpp ('k') | gm/peekpixels.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698