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

Side by Side Diff: samplecode/SamplePicture.cpp

Issue 295243006: hide discardable factory from public imagegenerator api (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDecodingImageGenerator.h" 10 #include "SkDecodingImageGenerator.h"
(...skipping 23 matching lines...) Expand all
34 34
35 /////////////////////////////////////////////////////////////////////////////// 35 ///////////////////////////////////////////////////////////////////////////////
36 36
37 static SkBitmap load_bitmap() { 37 static SkBitmap load_bitmap() {
38 SkBitmap bm; 38 SkBitmap bm;
39 SkString directory = skiagm::GM::GetResourcePath(); 39 SkString directory = skiagm::GM::GetResourcePath();
40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png"); 40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png");
41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); 41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str()));
42 if (data.get() != NULL) { 42 if (data.get() != NULL) {
43 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create( 43 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create(
44 data, SkDecodingImageGenerator::Options()), &bm, NULL); 44 data, SkDecodingImageGenerator::Options()), &bm);
45 } 45 }
46 return bm; 46 return bm;
47 } 47 }
48 48
49 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { 49 static void drawCircle(SkCanvas* canvas, int r, SkColor color) {
50 SkPaint paint; 50 SkPaint paint;
51 paint.setAntiAlias(true); 51 paint.setAntiAlias(true);
52 paint.setColor(color); 52 paint.setColor(color);
53 53
54 canvas->drawCircle(SkIntToScalar(r), SkIntToScalar(r), SkIntToScalar(r), 54 canvas->drawCircle(SkIntToScalar(r), SkIntToScalar(r), SkIntToScalar(r),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SkPicture* fPicture; 192 SkPicture* fPicture;
193 SkPicture* fSubPicture; 193 SkPicture* fSubPicture;
194 194
195 typedef SampleView INHERITED; 195 typedef SampleView INHERITED;
196 }; 196 };
197 197
198 ////////////////////////////////////////////////////////////////////////////// 198 //////////////////////////////////////////////////////////////////////////////
199 199
200 static SkView* MyFactory() { return new PictureView; } 200 static SkView* MyFactory() { return new PictureView; }
201 static SkViewRegister reg(MyFactory); 201 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698