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

Side by Side Diff: samplecode/SamplePicture.cpp

Issue 346453002: Refactor how we handle resources path in Tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix rebase conflict 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
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | samplecode/SampleSubpixelTranslate.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"
9
10 #include "Resources.h"
8 #include "SampleCode.h" 11 #include "SampleCode.h"
12 #include "SkCanvas.h"
13 #include "SkColorFilter.h"
14 #include "SkColorPriv.h"
9 #include "SkData.h" 15 #include "SkData.h"
10 #include "SkDecodingImageGenerator.h" 16 #include "SkDecodingImageGenerator.h"
11 #include "SkDumpCanvas.h" 17 #include "SkDumpCanvas.h"
12 #include "SkView.h"
13 #include "SkCanvas.h"
14 #include "SkGradientShader.h" 18 #include "SkGradientShader.h"
15 #include "SkGraphics.h" 19 #include "SkGraphics.h"
16 #include "SkImageDecoder.h" 20 #include "SkImageDecoder.h"
17 #include "SkOSFile.h" 21 #include "SkOSFile.h"
18 #include "SkPath.h" 22 #include "SkPath.h"
19 #include "SkPicture.h" 23 #include "SkPicture.h"
20 #include "SkPictureRecorder.h" 24 #include "SkPictureRecorder.h"
21 #include "SkRandom.h" 25 #include "SkRandom.h"
22 #include "SkRegion.h" 26 #include "SkRegion.h"
23 #include "SkShader.h" 27 #include "SkShader.h"
24 #include "SkUtils.h" 28 #include "SkStream.h"
25 #include "SkColorPriv.h"
26 #include "SkColorFilter.h"
27 #include "SkTime.h" 29 #include "SkTime.h"
28 #include "SkTypeface.h" 30 #include "SkTypeface.h"
31 #include "SkUtils.h"
32 #include "SkView.h"
33 #include "SkXMLParser.h"
29 #include "SkXfermode.h" 34 #include "SkXfermode.h"
30 #include "SkStream.h"
31 #include "SkXMLParser.h"
32
33 #include "gm.h"
34 35
35 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
36 37
37 static SkBitmap load_bitmap() { 38 static SkBitmap load_bitmap() {
38 SkBitmap bm; 39 SkBitmap bm;
39 SkString directory = skiagm::GM::GetResourcePath(); 40 SkString resourcePath = GetResourcePath();
40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png"); 41 SkString path = SkOSPath::SkPathJoin(resourcePath.c_str(), "mandrill_512.png ");
41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); 42 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str()));
42 if (data.get() != NULL) { 43 if (data.get() != NULL) {
43 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create( 44 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create(
44 data, SkDecodingImageGenerator::Options()), &bm); 45 data, SkDecodingImageGenerator::Options()), &bm);
45 } 46 }
46 return bm; 47 return bm;
47 } 48 }
48 49
49 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { 50 static void drawCircle(SkCanvas* canvas, int r, SkColor color) {
50 SkPaint paint; 51 SkPaint paint;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SkPicture* fPicture; 193 SkPicture* fPicture;
193 SkPicture* fSubPicture; 194 SkPicture* fSubPicture;
194 195
195 typedef SampleView INHERITED; 196 typedef SampleView INHERITED;
196 }; 197 };
197 198
198 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
199 200
200 static SkView* MyFactory() { return new PictureView; } 201 static SkView* MyFactory() { return new PictureView; }
201 static SkViewRegister reg(MyFactory); 202 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | samplecode/SampleSubpixelTranslate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698