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

Side by Side Diff: gm/ninepatchstretch.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/morphology.cpp ('k') | gm/offsetimagefilter.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 2011 Google Inc. 2 * Copyright 2011 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 9
10 static void make_bitmap(SkBitmap* bitmap, SkIRect* center) { 10 static void make_bitmap(SkBitmap* bitmap, SkIRect* center) {
11 const int kFixed = 28; 11 const int kFixed = 28;
12 const int kStretchy = 8; 12 const int kStretchy = 8;
13 const int kSize = 2*kFixed + kStretchy; 13 const int kSize = 2*kFixed + kStretchy;
14 14
15 bitmap->allocN32Pixels(kSize, kSize); 15 bitmap->allocN32Pixels(kSize, kSize);
16 SkCanvas canvas(*bitmap); 16 SkBaseDevice* dev = new SkBitmapDevice(*bitmap);
17
18 SkCanvas canvas(dev);
19 dev->unref();
17 canvas.clear(SK_ColorTRANSPARENT); 20 canvas.clear(SK_ColorTRANSPARENT);
18 21
19 SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize)); 22 SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
20 const SkScalar strokeWidth = SkIntToScalar(6); 23 const SkScalar strokeWidth = SkIntToScalar(6);
21 const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2; 24 const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2;
22 25
23 center->setXYWH(kFixed, kFixed, kStretchy, kStretchy); 26 center->setXYWH(kFixed, kFixed, kStretchy, kStretchy);
24 27
25 SkPaint paint; 28 SkPaint paint;
26 paint.setAntiAlias(true); 29 paint.setAntiAlias(true);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 private: 91 private:
89 typedef GM INHERITED; 92 typedef GM INHERITED;
90 }; 93 };
91 94
92 ////////////////////////////////////////////////////////////////////////////// 95 //////////////////////////////////////////////////////////////////////////////
93 96
94 static GM* MyFactory(void*) { return new NinePatchStretchGM; } 97 static GM* MyFactory(void*) { return new NinePatchStretchGM; }
95 static GMRegistry reg(MyFactory); 98 static GMRegistry reg(MyFactory);
96 99
97 } 100 }
OLDNEW
« no previous file with comments | « gm/morphology.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698