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

Side by Side Diff: src/codec/SkJpegCodec.h

Issue 1288483002: Consolidate SkCodec functions for handling rewind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
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 SkJpegCodec_DEFINED 8 #ifndef SkJpegCodec_DEFINED
9 #define SkJpegCodec_DEFINED 9 #define SkJpegCodec_DEFINED
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 /* 58 /*
59 * Initiates the jpeg decode 59 * Initiates the jpeg decode
60 */ 60 */
61 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes , const Options&, 61 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes , const Options&,
62 SkPMColor*, int*) override; 62 SkPMColor*, int*) override;
63 63
64 SkEncodedFormat onGetEncodedFormat() const override { 64 SkEncodedFormat onGetEncodedFormat() const override {
65 return kJPEG_SkEncodedFormat; 65 return kJPEG_SkEncodedFormat;
66 } 66 }
67 67
68 bool onRewind() override;
69
68 private: 70 private:
69 71
70 /* 72 /*
71 * Read enough of the stream to initialize the SkJpegCodec. 73 * Read enough of the stream to initialize the SkJpegCodec.
72 * Returns a bool representing success or failure. 74 * Returns a bool representing success or failure.
73 * 75 *
74 * @param codecOut 76 * @param codecOut
75 * If this returns true, and codecOut was not NULL, 77 * If this returns true, and codecOut was not NULL,
76 * codecOut will be set to a new SkJpegCodec. 78 * codecOut will be set to a new SkJpegCodec.
77 * 79 *
(...skipping 16 matching lines...) Expand all
94 * Called only by NewFromStream 96 * Called only by NewFromStream
95 * 97 *
96 * @param srcInfo contains the source width and height 98 * @param srcInfo contains the source width and height
97 * @param stream the encoded image data 99 * @param stream the encoded image data
98 * @param decoderMgr holds decompress struct, src manager, and error manager 100 * @param decoderMgr holds decompress struct, src manager, and error manager
99 * takes ownership 101 * takes ownership
100 */ 102 */
101 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de coderMgr); 103 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de coderMgr);
102 104
103 /* 105 /*
104 * Handles rewinding the input stream if it is necessary
105 */
106 bool handleRewind();
107
108 /*
109 * Checks if the conversion between the input image and the requested output 106 * Checks if the conversion between the input image and the requested output
110 * image has been implemented 107 * image has been implemented
111 * Sets the output color space 108 * Sets the output color space
112 */ 109 */
113 bool setOutputColorSpace(const SkImageInfo& dst); 110 bool setOutputColorSpace(const SkImageInfo& dst);
114 111
115 /* 112 /*
116 * Checks if we can scale to the requested dimensions and scales the dimensi ons 113 * Checks if we can scale to the requested dimensions and scales the dimensi ons
117 * if possible 114 * if possible
118 */ 115 */
119 bool scaleToDimensions(uint32_t width, uint32_t height); 116 bool scaleToDimensions(uint32_t width, uint32_t height);
120 117
121 /* 118 /*
122 * Create the swizzler based on the encoded format 119 * Create the swizzler based on the encoded format
123 */ 120 */
124 void initializeSwizzler(const SkImageInfo& dstInfo, void* dst, size_t dstRow Bytes, 121 void initializeSwizzler(const SkImageInfo& dstInfo, void* dst, size_t dstRow Bytes,
125 const Options& options); 122 const Options& options);
126 123
127 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; 124 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr;
128 125
129 friend class SkJpegScanlineDecoder; 126 friend class SkJpegScanlineDecoder;
130 127
131 typedef SkCodec INHERITED; 128 typedef SkCodec INHERITED;
132 }; 129 };
133 130
134 #endif 131 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698