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

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

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: protected destructor 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 class SkBitmap;
14
15 /**
16 * Calls into SkImageDecoder::DecodeMemoryToTarget to implement a
17 * SkImageGenerator
18 */
19 class SkDecodingImageGenerator : public SkImageGenerator {
20 public:
21 /*
22 * The constructor will take a reference to the SkData.
23 */
24 SkDecodingImageGenerator(SkData* data);
25 virtual ~SkDecodingImageGenerator();
26
27 /**
28 * Return a ref to the encoded (i.e. compressed) representation,
29 * of this data. The caller is responsible for calling unref()
30 * on the data when it is finished.
31 */
32 virtual SkData* refEncodedData() SK_OVERRIDE;
33
34 /**
35 * Return some information about the image, allowing the owner fo
scroggo 2013/11/19 22:19:27 of*
hal.canary 2013/11/20 00:07:10 I'll remove the sub-class's redundant comments.
36 * this ojbect to allocate pixels.
scroggo 2013/11/19 22:19:27 object*
hal.canary 2013/11/20 00:07:10 I'll remove the sub-class's redundant comments.
37 *
38 * @return false if anything goes wrong.
39 */
40 virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE;
41
42 /**
43 * Decode into the given pixels, a block of memory of size at
44 * least (info.fHeight - 1) * rowBytes + (info.fWidth *
45 * bytesPerPixel)
46 *
47 * @param info Should be identical to the info returned by
48 * getInfo so that the implementation can confirm that the
49 * caller knows what it is asking for (config, size).
50 * This contract also allows the caller to specify
scroggo 2013/11/19 22:19:27 These two sentences seem to say opposite things. T
hal.canary 2013/11/20 00:07:10 It is up to the implmentation.
51 * different output-configs, which the implementation can
52 * decide to support or not.
53 *
54 * @return false if anything goes wrong.
55 */
56 virtual bool getPixels(const SkImageInfo& info,
57 void* pixels,
58 size_t rowBytes) SK_OVERRIDE;
59
60 /**
61 * Install the SkData into the destination bitmap, using a new
62 * SkDiscardablePixelRef and a new SkDecodingImageGenerator.
63 */
64 static bool Install(SkData* data, SkBitmap* destination);
65
66 private:
67 SkData* fData;
68 };
69 #endif // SkDecodingImageGenerator_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698