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

Side by Side Diff: include/codec/SkAndroidCodec.h

Issue 1487583003: Allow SkAndroidCodec to use SkPngChunkReader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments on Patch Set 2 Created 5 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
« no previous file with comments | « no previous file | include/codec/SkCodec.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 SkAndroidCodec_DEFINED 8 #ifndef SkAndroidCodec_DEFINED
9 #define SkAndroidCodec_DEFINED 9 #define SkAndroidCodec_DEFINED
10 10
11 #include "SkCodec.h" 11 #include "SkCodec.h"
12 #include "SkEncodedFormat.h" 12 #include "SkEncodedFormat.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkTypes.h" 14 #include "SkTypes.h"
15 15
16 /** 16 /**
17 * Abstract interface defining image codec functionality that is necessary for 17 * Abstract interface defining image codec functionality that is necessary for
18 * Android. 18 * Android.
19 */ 19 */
20 class SkAndroidCodec : SkNoncopyable { 20 class SkAndroidCodec : SkNoncopyable {
21 public: 21 public:
22 /** 22 /**
23 * If this stream represents an encoded image that we know how to decode, 23 * If this stream represents an encoded image that we know how to decode,
24 * return an SkAndroidCodec that can decode it. Otherwise return NULL. 24 * return an SkAndroidCodec that can decode it. Otherwise return NULL.
25 * 25 *
26 * The SkPngChunkReader handles unknown chunks in PNGs.
27 * See SkCodec.h for more details.
28 *
26 * If NULL is returned, the stream is deleted immediately. Otherwise, the 29 * If NULL is returned, the stream is deleted immediately. Otherwise, the
27 * SkCodec takes ownership of it, and will delete it when done with it. 30 * SkCodec takes ownership of it, and will delete it when done with it.
28 */ 31 */
29 static SkAndroidCodec* NewFromStream(SkStream*); 32 static SkAndroidCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL);
30 33
31 /** 34 /**
32 * If this data represents an encoded image that we know how to decode, 35 * If this data represents an encoded image that we know how to decode,
33 * return an SkAndroidCodec that can decode it. Otherwise return NULL. 36 * return an SkAndroidCodec that can decode it. Otherwise return NULL.
34 * 37 *
38 * The SkPngChunkReader handles unknown chunks in PNGs.
39 * See SkCodec.h for more details.
40 *
35 * Will take a ref if it returns a codec, else will not affect the data. 41 * Will take a ref if it returns a codec, else will not affect the data.
36 */ 42 */
37 static SkAndroidCodec* NewFromData(SkData*); 43 static SkAndroidCodec* NewFromData(SkData*, SkPngChunkReader* = NULL);
38 44
39 virtual ~SkAndroidCodec() {} 45 virtual ~SkAndroidCodec() {}
40 46
41 47
42 const SkImageInfo& getInfo() const { return fInfo; } 48 const SkImageInfo& getInfo() const { return fInfo; }
43 49
44 /** 50 /**
45 * Format of the encoded data. 51 * Format of the encoded data.
46 */ 52 */
47 SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat() ; } 53 SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat() ; }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, 221 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels,
216 size_t rowBytes, const AndroidOptions& options) = 0; 222 size_t rowBytes, const AndroidOptions& options) = 0;
217 223
218 private: 224 private:
219 225
220 // This will always be a reference to the info that is contained by the 226 // This will always be a reference to the info that is contained by the
221 // embedded SkCodec. 227 // embedded SkCodec.
222 const SkImageInfo& fInfo; 228 const SkImageInfo& fInfo;
223 }; 229 };
224 #endif // SkAndroidCodec_DEFINED 230 #endif // SkAndroidCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/codec/SkCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698