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

Side by Side Diff: gm/factory.cpp

Issue 319473003: Clean up Test's resourcePath code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: review 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 | « gm/etc1bitmap.cpp ('k') | gm/gm.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 10 matching lines...) Expand all
21 /** 21 /**
22 * Draw a PNG created by SkBitmapFactory. 22 * Draw a PNG created by SkBitmapFactory.
23 */ 23 */
24 class FactoryGM : public GM { 24 class FactoryGM : public GM {
25 public: 25 public:
26 FactoryGM() {} 26 FactoryGM() {}
27 27
28 protected: 28 protected:
29 virtual void onOnceBeforeDraw() SK_OVERRIDE { 29 virtual void onOnceBeforeDraw() SK_OVERRIDE {
30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo 30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo
31 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str( ), 31 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "plan e.png");
32 "plane.png");
33 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); 32 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str()));
34 if (NULL != data.get()) { 33 if (NULL != data.get()) {
35 // Create a cache which will boot the pixels out anytime the 34 // Create a cache which will boot the pixels out anytime the
36 // bitmap is unlocked. 35 // bitmap is unlocked.
37 SkAutoTUnref<SkDiscardableMemoryPool> pool( 36 SkAutoTUnref<SkDiscardableMemoryPool> pool(
38 SkDiscardableMemoryPool::Create(1)); 37 SkDiscardableMemoryPool::Create(1));
39 SkAssertResult(SkInstallDiscardablePixelRef( 38 SkAssertResult(SkInstallDiscardablePixelRef(
40 SkDecodingImageGenerator::Create( 39 SkDecodingImageGenerator::Create(
41 data, SkDecodingImageGenerator::Options()), 40 data, SkDecodingImageGenerator::Options()),
42 &fBitmap, pool)); 41 &fBitmap, pool));
(...skipping 22 matching lines...) Expand all
65 64
66 typedef GM INHERITED; 65 typedef GM INHERITED;
67 }; 66 };
68 67
69 ////////////////////////////////////////////////////////////////////////////// 68 //////////////////////////////////////////////////////////////////////////////
70 69
71 static GM* MyFactory(void*) { return new FactoryGM; } 70 static GM* MyFactory(void*) { return new FactoryGM; }
72 static GMRegistry reg(MyFactory); 71 static GMRegistry reg(MyFactory);
73 72
74 } // namespace skiagm 73 } // namespace skiagm
OLDNEW
« no previous file with comments | « gm/etc1bitmap.cpp ('k') | gm/gm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698