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

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

Issue 1040453002: Add SkPngChunkReader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkImageDecoder_empty 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 | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkImageDecoder.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 SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
11 #include "../private/SkTemplates.h" 11 #include "../private/SkTemplates.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkEncodedFormat.h" 13 #include "SkEncodedFormat.h"
14 #include "SkImageInfo.h" 14 #include "SkImageInfo.h"
15 #include "SkSize.h" 15 #include "SkSize.h"
16 #include "SkStream.h" 16 #include "SkStream.h"
17 #include "SkTypes.h" 17 #include "SkTypes.h"
18 18
19 class SkData; 19 class SkData;
20 class SkPngChunkReader;
20 class SkSampler; 21 class SkSampler;
21 22
22 /** 23 /**
23 * Abstraction layer directly on top of an image codec. 24 * Abstraction layer directly on top of an image codec.
24 */ 25 */
25 class SkCodec : SkNoncopyable { 26 class SkCodec : SkNoncopyable {
26 public: 27 public:
27 /** 28 /**
28 * If this stream represents an encoded image that we know how to decode, 29 * If this stream represents an encoded image that we know how to decode,
29 * return an SkCodec that can decode it. Otherwise return NULL. 30 * return an SkCodec that can decode it. Otherwise return NULL.
30 * 31 *
32 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if
33 * the image is a png.
34 *
31 * If NULL is returned, the stream is deleted immediately. Otherwise, the 35 * 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. 36 * SkCodec takes ownership of it, and will delete it when done with it.
33 */ 37 */
34 static SkCodec* NewFromStream(SkStream*); 38 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL);
35 39
36 /** 40 /**
37 * If this data represents an encoded image that we know how to decode, 41 * If this data represents an encoded image that we know how to decode,
38 * return an SkCodec that can decode it. Otherwise return NULL. 42 * return an SkCodec that can decode it. Otherwise return NULL.
39 * 43 *
44 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if
45 * the image is a png.
46 *
40 * Will take a ref if it returns a codec, else will not affect the data. 47 * Will take a ref if it returns a codec, else will not affect the data.
41 */ 48 */
42 static SkCodec* NewFromData(SkData*); 49 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL);
43 50
44 virtual ~SkCodec(); 51 virtual ~SkCodec();
45 52
46 /** 53 /**
47 * Return the ImageInfo associated with this codec. 54 * Return the ImageInfo associated with this codec.
48 */ 55 */
49 const SkImageInfo& getInfo() const { return fSrcInfo; } 56 const SkImageInfo& getInfo() const { return fSrcInfo; }
50 57
51 /** 58 /**
52 * Return a size that approximately supports the desired scale factor. 59 * Return a size that approximately supports the desired scale factor.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 * May create a sampler, if one is not currently being used. Otherwise, doe s 587 * May create a sampler, if one is not currently being used. Otherwise, doe s
581 * not affect ownership. 588 * not affect ownership.
582 * 589 *
583 * Only valid during scanline decoding. 590 * Only valid during scanline decoding.
584 */ 591 */
585 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } 592 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; }
586 593
587 friend class SkSampledCodec; 594 friend class SkSampledCodec;
588 }; 595 };
589 #endif // SkCodec_DEFINED 596 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698