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

Side by Side Diff: gm/ninepatchstretch.cpp

Issue 159723006: add peekPixels to canvas (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
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 SkBaseDevice* dev = new SkBitmapDevice(*bitmap); 16 SkCanvas canvas(*bitmap);
17
18 SkCanvas canvas(dev);
19 dev->unref();
20 canvas.clear(SK_ColorTRANSPARENT); 17 canvas.clear(SK_ColorTRANSPARENT);
21 18
22 SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize)); 19 SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
23 const SkScalar strokeWidth = SkIntToScalar(6); 20 const SkScalar strokeWidth = SkIntToScalar(6);
24 const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2; 21 const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2;
25 22
26 center->setXYWH(kFixed, kFixed, kStretchy, kStretchy); 23 center->setXYWH(kFixed, kFixed, kStretchy, kStretchy);
27 24
28 SkPaint paint; 25 SkPaint paint;
29 paint.setAntiAlias(true); 26 paint.setAntiAlias(true);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 private: 88 private:
92 typedef GM INHERITED; 89 typedef GM INHERITED;
93 }; 90 };
94 91
95 ////////////////////////////////////////////////////////////////////////////// 92 //////////////////////////////////////////////////////////////////////////////
96 93
97 static GM* MyFactory(void*) { return new NinePatchStretchGM; } 94 static GM* MyFactory(void*) { return new NinePatchStretchGM; }
98 static GMRegistry reg(MyFactory); 95 static GMRegistry reg(MyFactory);
99 96
100 } 97 }
OLDNEW
« no previous file with comments | « gm/morphology.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | include/core/SkCanvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698