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

Side by Side Diff: gm/factory.cpp

Issue 93703004: Change SkDecodingImageGenerator API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « no previous file | resources/encoding/randPixels.bmp » ('j') | src/images/SkDecodingImageGenerator.h » ('J')
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 17 matching lines...) Expand all
28 virtual void onOnceBeforeDraw() SK_OVERRIDE { 28 virtual void onOnceBeforeDraw() SK_OVERRIDE {
29 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo 29 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl ane-by-ddoo
30 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str( ), 30 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str( ),
31 "plane.png"); 31 "plane.png");
32 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); 32 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str()));
33 if (NULL != data.get()) { 33 if (NULL != data.get()) {
34 // Create a cache which will boot the pixels out anytime the 34 // Create a cache which will boot the pixels out anytime the
35 // bitmap is unlocked. 35 // bitmap is unlocked.
36 SkAutoTUnref<SkDiscardableMemoryPool> pool( 36 SkAutoTUnref<SkDiscardableMemoryPool> pool(
37 SkNEW_ARGS(SkDiscardableMemoryPool, (1))); 37 SkNEW_ARGS(SkDiscardableMemoryPool, (1)));
38 SkAssertResult(SkDecodingImageGenerator::Install(data, 38 SkAssertResult(
39 &fBitmap, pool)); 39 SkDecodingImageGenerator::Install(data, &fBitmap, NULL, pool));
40 } 40 }
41 } 41 }
42 42
43 virtual SkString onShortName() { 43 virtual SkString onShortName() {
44 return SkString("factory"); 44 return SkString("factory");
45 } 45 }
46 46
47 virtual SkISize onISize() { 47 virtual SkISize onISize() {
48 return make_isize(640, 480); 48 return make_isize(640, 480);
49 } 49 }
(...skipping 12 matching lines...) Expand all
62 62
63 typedef GM INHERITED; 63 typedef GM INHERITED;
64 }; 64 };
65 65
66 ////////////////////////////////////////////////////////////////////////////// 66 //////////////////////////////////////////////////////////////////////////////
67 67
68 static GM* MyFactory(void*) { return new FactoryGM; } 68 static GM* MyFactory(void*) { return new FactoryGM; }
69 static GMRegistry reg(MyFactory); 69 static GMRegistry reg(MyFactory);
70 70
71 } 71 }
OLDNEW
« no previous file with comments | « no previous file | resources/encoding/randPixels.bmp » ('j') | src/images/SkDecodingImageGenerator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698