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

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

Issue 111713002: Sk_API for SkImageGenerator and SkInstallDiscardablePixelRef (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase 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 | src/images/SkDecodingImageGenerator.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 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"
11 #include "SkImageInfo.h" 12 #include "SkImageInfo.h"
12 13
14 class SkBitmap;
13 class SkData; 15 class SkData;
16 class SkImageGenerator;
17
18 /**
19 * Takes ownership of SkImageGenerator. If this method fails for
20 * whatever reason, it will return false and immediatetely delete
21 * the generator. If it succeeds, it will modify destination
22 * bitmap.
23 *
24 * If this fails or when the SkDiscardablePixelRef that is
25 * installed into destination is destroyed, it will call
26 * SkDELETE() on the generator. Therefore, generator should be
27 * allocated with SkNEW() or SkNEW_ARGS().
28 *
29 * @param destination Upon success, this bitmap will be
30 * configured and have a pixelref installed.
31 *
32 * @param factory If not NULL, this object will be used as a
33 * source of discardable memory when decoding. If NULL, then
34 * SkDiscardableMemory::Create() will be called.
35 *
36 * @return true iff successful.
37 */
38 SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator* generator,
39 SkBitmap* destination,
40 SkDiscardableMemory::Factory* factory = NULL);
41
14 42
15 /** 43 /**
16 * An interface that allows a purgeable PixelRef (such as a 44 * An interface that allows a purgeable PixelRef (such as a
17 * SkDiscardablePixelRef) to decode and re-decode an image as needed. 45 * SkDiscardablePixelRef) to decode and re-decode an image as needed.
18 */ 46 */
19 class SkImageGenerator { 47 class SK_API SkImageGenerator {
20 public: 48 public:
21 /** 49 /**
22 * The PixelRef which takes ownership of this SkImageGenerator 50 * The PixelRef which takes ownership of this SkImageGenerator
23 * will call the image generator's destructor. 51 * will call the image generator's destructor.
24 */ 52 */
25 virtual ~SkImageGenerator() { } 53 virtual ~SkImageGenerator() { }
26 54
27 /** 55 /**
28 * Return a ref to the encoded (i.e. compressed) representation, 56 * Return a ref to the encoded (i.e. compressed) representation,
29 * of this data. 57 * of this data.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 * 90 *
63 * @return false if anything goes wrong or if the image info is 91 * @return false if anything goes wrong or if the image info is
64 * unsupported. 92 * unsupported.
65 */ 93 */
66 virtual bool getPixels(const SkImageInfo& info, 94 virtual bool getPixels(const SkImageInfo& info,
67 void* pixels, 95 void* pixels,
68 size_t rowBytes) = 0; 96 size_t rowBytes) = 0;
69 }; 97 };
70 98
71 #endif // SkImageGenerator_DEFINED 99 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698