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

Side by Side Diff: gm/xfermodeimagefilter.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/texdata.cpp ('k') | gm/xfermodes3.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 "SkArithmeticMode.h" 9 #include "SkArithmeticMode.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 protected: 26 protected:
27 virtual SkString onShortName() { 27 virtual SkString onShortName() {
28 return SkString("xfermodeimagefilter"); 28 return SkString("xfermodeimagefilter");
29 } 29 }
30 30
31 void make_bitmap() { 31 void make_bitmap() {
32 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); 32 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
33 fBitmap.allocPixels(); 33 fBitmap.allocPixels();
34 SkDevice device(fBitmap); 34 SkBitmapDevice device(fBitmap);
35 SkCanvas canvas(&device); 35 SkCanvas canvas(&device);
36 canvas.clear(0x00000000); 36 canvas.clear(0x00000000);
37 SkPaint paint; 37 SkPaint paint;
38 paint.setAntiAlias(true); 38 paint.setAntiAlias(true);
39 paint.setColor(0xD000D000); 39 paint.setColor(0xD000D000);
40 paint.setTextSize(SkIntToScalar(96)); 40 paint.setTextSize(SkIntToScalar(96));
41 const char* str = "e"; 41 const char* str = "e";
42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint); 42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint);
43 } 43 }
44 44
45 void make_checkerboard() { 45 void make_checkerboard() {
46 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); 46 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
47 fCheckerboard.allocPixels(); 47 fCheckerboard.allocPixels();
48 SkDevice device(fCheckerboard); 48 SkBitmapDevice device(fCheckerboard);
49 SkCanvas canvas(&device); 49 SkCanvas canvas(&device);
50 canvas.clear(0x00000000); 50 canvas.clear(0x00000000);
51 SkPaint darkPaint; 51 SkPaint darkPaint;
52 darkPaint.setColor(0xFF404040); 52 darkPaint.setColor(0xFF404040);
53 SkPaint lightPaint; 53 SkPaint lightPaint;
54 lightPaint.setColor(0xFFA0A0A0); 54 lightPaint.setColor(0xFFA0A0A0);
55 for (int y = 0; y < 80; y += 16) { 55 for (int y = 0; y < 80; y += 16) {
56 for (int x = 0; x < 80; x += 16) { 56 for (int x = 0; x < 80; x += 16) {
57 canvas.save(); 57 canvas.save();
58 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); 58 canvas.translate(SkIntToScalar(x), SkIntToScalar(y));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 SkBitmap fBitmap, fCheckerboard; 195 SkBitmap fBitmap, fCheckerboard;
196 bool fInitialized; 196 bool fInitialized;
197 }; 197 };
198 198
199 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
200 200
201 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; } 201 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; }
202 static GMRegistry reg(MyFactory); 202 static GMRegistry reg(MyFactory);
203 203
204 } 204 }
OLDNEW
« no previous file with comments | « gm/texdata.cpp ('k') | gm/xfermodes3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698