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

Side by Side Diff: src/images/SkDecodingImageGenerator.h

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
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 SkDecodingImageGenerator_DEFINED
9 #define SkDecodingImageGenerator_DEFINED
10
11 #include "SkImageGenerator.h"
12
13 /**
14 * Calls into SkImageDecoder::DecodeMemoryToTarget to implement a
15 * SkImageGenerator
16 */
17 class SkDecodingImageGenerator : public SkImageGenerator {
18 public:
19 /*
20 * The constructor will take a reference to the SkData.
21 */
22 SkDecodingImageGenerator(SkData* data);
23 virtual ~SkDecodingImageGenerator();
24
25 /**
26 * Return a ref to the encoded (i.e. compressed) representation,
27 * of this data. The caller is responsible for calling unref()
28 * on the data when it is finished.
29 */
30 virtual SkData* refEncodedData() SK_OVERRIDE;
31
32 /**
33 * Return some information about the image, allowing the owner fo
34 * this ojbect to allocate pixels.
35 *
36 * @return false if anything goes wrong.
37 */
38 virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE;
39
40 /**
41 * Decode into the given pixels, a block of memory of size at
42 * least (info.fHeight - 1) * rowBytes + (info.fWidth *
43 * bytesPerPixel)
44 *
45 * @param info Should be identical to the info returned by
46 * getInfo so that the implementation can confirm that the
47 * caller knows what it is asking for (config, size).
48 * This contract also allows the caller to specify
49 * different output-configs, which the implementation can
50 * decide to support or not.
51 *
52 * @return false if anything goes wrong.
53 */
54 virtual bool getPixels(const SkImageInfo& info,
Alpha Left Google 2013/11/19 02:00:48 There should be a frame index here for animated im
hal.canary 2013/11/19 02:06:29 Alpha, you should make a subclass of SkImageGenera
55 void* pixels,
56 size_t rowBytes) SK_OVERRIDE;
57 private:
58 SkData* fData;
59 };
60 #endif // SkDecodingImageGenerator_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698