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

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

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: changes from scroggo Created 7 years, 1 month 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 | « gyp/tests.gyp ('k') | src/images/SkDecodingImageGenerator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkImageGenerator_DEFINED
9 #define SkImageGenerator_DEFINED
10
11 #include "SkImageInfo.h"
12
13 class SkData;
14
15 /**
16 * An interface that allows a SkDiscardablePixelRef to decode and
scroggo 2013/11/20 14:21:53 Since this is an interface that does not necessari
17 * re-decode an image as needed.
18 */
19 class SkImageGenerator {
20 public:
21 /**
22 * The SkDiscardablePixelRef which takes ownership of this
23 * SkImageGenerator will call the image generator's destructor.
24 */
25 virtual ~SkImageGenerator() { }
26
27 /**
28 * Return a ref to the encoded (i.e. compressed) representation,
29 * of this data.
30 *
31 * If non-NULL is returned, the caller is responsible for calling
32 * unref() on the data when it is finished.
33 */
34 virtual SkData* refEncodedData() { return NULL; }
35
36 /**
37 * Return some information about the image, allowing the owner of
38 * this object to allocate pixels.
39 *
40 * @return false if anything goes wrong.
41 */
42 virtual bool getInfo(SkImageInfo* info) = 0;
43
44 /**
45 * Decode into the given pixels, a block of memory of size at
46 * least (info.fHeight - 1) * rowBytes + (info.fWidth *
47 * bytesPerPixel)
48 *
49 * @param info Should be identical to the info returned by
scroggo 2013/11/20 14:21:53 I still think this line should be changed, since t
50 * getInfo so that the implementation can confirm that the
51 * caller knows what it is asking for (config, size).
52 * This contract also allows the caller to specify
53 * different output-configs, which the implementation can
54 * decide to support or not.
55 *
56 * @return false if anything goes wrong.
57 */
58 virtual bool getPixels(const SkImageInfo& info,
59 void* pixels,
60 size_t rowBytes) = 0;
61 };
62
63 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « gyp/tests.gyp ('k') | src/images/SkDecodingImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698