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

Side by Side Diff: include/core/SkImageGenerator.h

Issue 295243006: hide discardable factory from public imagegenerator api (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 2013 Google Inc. 2 * Copyright 2013 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 #ifndef SkImageGenerator_DEFINED 8 #ifndef SkImageGenerator_DEFINED
9 #define SkImageGenerator_DEFINED 9 #define SkImageGenerator_DEFINED
10 10
11 #include "SkDiscardableMemory.h"
12 #include "SkImageInfo.h" 11 #include "SkImageInfo.h"
13 12
14 class SkBitmap; 13 class SkBitmap;
15 class SkData; 14 class SkData;
16 class SkImageGenerator; 15 class SkImageGenerator;
17 16
18 /** 17 /**
19 * Takes ownership of SkImageGenerator. If this method fails for 18 * Takes ownership of SkImageGenerator. If this method fails for
20 * whatever reason, it will return false and immediatetely delete 19 * whatever reason, it will return false and immediatetely delete
21 * the generator. If it succeeds, it will modify destination 20 * the generator. If it succeeds, it will modify destination
22 * bitmap. 21 * bitmap.
23 * 22 *
24 * If generator is NULL, will safely return false. 23 * If generator is NULL, will safely return false.
25 * 24 *
26 * If this fails or when the SkDiscardablePixelRef that is 25 * If this fails or when the SkDiscardablePixelRef that is
27 * installed into destination is destroyed, it will call 26 * installed into destination is destroyed, it will call
28 * SkDELETE() on the generator. Therefore, generator should be 27 * SkDELETE() on the generator. Therefore, generator should be
29 * allocated with SkNEW() or SkNEW_ARGS(). 28 * allocated with SkNEW() or SkNEW_ARGS().
30 * 29 *
31 * @param destination Upon success, this bitmap will be 30 * @param destination Upon success, this bitmap will be
32 * configured and have a pixelref installed. 31 * configured and have a pixelref installed.
33 * 32 *
34 * @param factory If not NULL, this object will be used as a 33 * @param factory If not NULL, this object will be used as a
hal.canary 2014/05/23 19:25:01 remove me
reed1 2014/05/27 12:13:27 Done.
35 * source of discardable memory when decoding. If NULL, then 34 * source of discardable memory when decoding. If NULL, then
36 * SkDiscardableMemory::Create() will be called. 35 * SkDiscardableMemory::Create() will be called.
37 * 36 *
38 * @return true iff successful. 37 * @return true iff successful.
39 */ 38 */
40 SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, 39 SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap* destinatio n);
41 SkBitmap* destination,
42 SkDiscardableMemory::Factory* factory = NULL);
43 40
44 41
45 /** 42 /**
46 * An interface that allows a purgeable PixelRef (such as a 43 * An interface that allows a purgeable PixelRef (such as a
47 * SkDiscardablePixelRef) to decode and re-decode an image as needed. 44 * SkDiscardablePixelRef) to decode and re-decode an image as needed.
48 */ 45 */
49 class SK_API SkImageGenerator { 46 class SK_API SkImageGenerator {
50 public: 47 public:
51 /** 48 /**
52 * The PixelRef which takes ownership of this SkImageGenerator 49 * The PixelRef which takes ownership of this SkImageGenerator
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * 89 *
93 * @return false if anything goes wrong or if the image info is 90 * @return false if anything goes wrong or if the image info is
94 * unsupported. 91 * unsupported.
95 */ 92 */
96 virtual bool getPixels(const SkImageInfo& info, 93 virtual bool getPixels(const SkImageInfo& info,
97 void* pixels, 94 void* pixels,
98 size_t rowBytes) = 0; 95 size_t rowBytes) = 0;
99 }; 96 };
100 97
101 #endif // SkImageGenerator_DEFINED 98 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « gm/factory.cpp ('k') | samplecode/SampleEncode.cpp » ('j') | src/core/SkImageGeneratorPriv.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698