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

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

Issue 1040453002: Add SkPngChunkReader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Peeker -> SkChunkReader, passed to constructor. Created 5 years, 8 months 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/core/SkChunkReader.h » ('j') | include/core/SkChunkReader.h » ('J')
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 SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
11 #include "SkEncodedFormat.h" 11 #include "SkEncodedFormat.h"
12 #include "SkImageGenerator.h" 12 #include "SkImageGenerator.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkRefCnt.h"
scroggo 2015/03/27 19:19:58 No longer needed.
scroggo 2015/04/01 14:53:48 Done.
14 #include "SkScanlineDecoder.h" 15 #include "SkScanlineDecoder.h"
15 #include "SkSize.h" 16 #include "SkSize.h"
16 #include "SkStream.h" 17 #include "SkStream.h"
17 #include "SkTemplates.h" 18 #include "SkTemplates.h"
18 #include "SkTypes.h" 19 #include "SkTypes.h"
19 20
20 class SkData; 21 class SkData;
22 class SkChunkReader;
21 23
22 /** 24 /**
23 * Abstraction layer directly on top of an image codec. 25 * Abstraction layer directly on top of an image codec.
24 */ 26 */
25 class SkCodec : public SkImageGenerator { 27 class SkCodec : public SkImageGenerator {
26 public: 28 public:
27 /** 29 /**
28 * If this stream represents an encoded image that we know how to decode, 30 * If this stream represents an encoded image that we know how to decode,
29 * return an SkCodec that can decode it. Otherwise return NULL. 31 * return an SkCodec that can decode it. Otherwise return NULL.
30 * 32 *
31 * If NULL is returned, the stream is deleted immediately. Otherwise, the 33 * If NULL is returned, the stream is deleted immediately. Otherwise, the
32 * SkCodec takes ownership of it, and will delete it when done with it. 34 * SkCodec takes ownership of it, and will delete it when done with it.
33 */ 35 */
34 static SkCodec* NewFromStream(SkStream*); 36 static SkCodec* NewFromStream(SkStream*, SkChunkReader* = NULL);
35 37
36 /** 38 /**
37 * If this data represents an encoded image that we know how to decode, 39 * If this data represents an encoded image that we know how to decode,
38 * return an SkCodec that can decode it. Otherwise return NULL. 40 * return an SkCodec that can decode it. Otherwise return NULL.
39 * 41 *
40 * Will take a ref if it returns a codec, else will not affect the data. 42 * Will take a ref if it returns a codec, else will not affect the data.
41 */ 43 */
42 static SkCodec* NewFromData(SkData*); 44 static SkCodec* NewFromData(SkData*, SkChunkReader* = NULL);
43 45
44 /** 46 /**
45 * Return a size that approximately supports the desired scale factor. 47 * Return a size that approximately supports the desired scale factor.
46 * The codec may not be able to scale efficiently to the exact scale 48 * The codec may not be able to scale efficiently to the exact scale
47 * factor requested, so return a size that approximates that scale. 49 * factor requested, so return a size that approximates that scale.
48 * 50 *
49 * FIXME: Move to SkImageGenerator? 51 * FIXME: Move to SkImageGenerator?
50 */ 52 */
51 SkISize getScaledDimensions(float desiredScale) const { 53 SkISize getScaledDimensions(float desiredScale) const {
52 return this->onGetScaledDimensions(desiredScale); 54 return this->onGetScaledDimensions(desiredScale);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO 165 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO
164 const SkImageInfo fInfo; 166 const SkImageInfo fInfo;
165 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO 167 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO
166 SkAutoTDelete<SkStream> fStream; 168 SkAutoTDelete<SkStream> fStream;
167 bool fNeedsRewind; 169 bool fNeedsRewind;
168 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; 170 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder;
169 171
170 typedef SkImageGenerator INHERITED; 172 typedef SkImageGenerator INHERITED;
171 }; 173 };
172 #endif // SkCodec_DEFINED 174 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkChunkReader.h » ('j') | include/core/SkChunkReader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698