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

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

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: onGetScaledDimensions checks fCodec for natice scale, update comments 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 SkPMColor*, int*) override; 53 SkPMColor*, int*) override;
54 54
55 SkEncodedFormat onGetEncodedFormat() const override { 55 SkEncodedFormat onGetEncodedFormat() const override {
56 return kJPEG_SkEncodedFormat; 56 return kJPEG_SkEncodedFormat;
57 } 57 }
58 58
59 SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Op tions& options, 59 SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Op tions& options,
60 SkPMColor ctable[], int* ctableCount) override; 60 SkPMColor ctable[], int* ctableCount) override;
61 61
62 private: 62 private:
63 SkAutoTDelete<SkSwizzler> fSwizzler;
63 64
64 /* 65 /*
65 * Read enough of the stream to initialize the SkJpegCodec. 66 * Read enough of the stream to initialize the SkJpegCodec.
66 * Returns a bool representing success or failure. 67 * Returns a bool representing success or failure.
67 * 68 *
68 * @param codecOut 69 * @param codecOut
69 * If this returns true, and codecOut was not NULL, 70 * If this returns true, and codecOut was not NULL,
70 * codecOut will be set to a new SkJpegCodec. 71 * codecOut will be set to a new SkJpegCodec.
71 * 72 *
72 * @param decoderMgrOut 73 * @param decoderMgrOut
(...skipping 14 matching lines...) Expand all
87 * Creates an instance of the decoder 88 * Creates an instance of the decoder
88 * Called only by NewFromStream 89 * Called only by NewFromStream
89 * 90 *
90 * @param srcInfo contains the source width and height 91 * @param srcInfo contains the source width and height
91 * @param stream the encoded image data 92 * @param stream the encoded image data
92 * @param decoderMgr holds decompress struct, src manager, and error manager 93 * @param decoderMgr holds decompress struct, src manager, and error manager
93 * takes ownership 94 * takes ownership
94 */ 95 */
95 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de coderMgr); 96 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de coderMgr);
96 97
98 // Helper to set up swizzler.
99 Result initializeSwizzler(const SkImageInfo& requestedInfo, void* dst,
100 size_t rowBytes, const Options&, SkPMColor*, int* ctableCount);
101
97 /* 102 /*
98 * Handles rewinding the input stream if it is necessary 103 * Handles rewinding the input stream if it is necessary
99 */ 104 */
100 bool handleRewind(); 105 bool handleRewind();
101 106
102 /* 107 /*
103 * Checks if the conversion between the input image and the requested output 108 * Checks if the conversion between the input image and the requested output
104 * image has been implemented 109 * image has been implemented
105 * Sets the output color space 110 * Sets the output color space
106 */ 111 */
107 bool setOutputColorSpace(const SkImageInfo& dst); 112 bool setOutputColorSpace(const SkImageInfo& dst);
108 113
109 /* 114 /*
110 * Checks if we can scale to the requested dimensions and scales the dimensi ons 115 * Checks if we can natively scale to the requested dimensions and natively scales the
111 * if possible 116 * dimensions if possible
112 */ 117 */
113 bool scaleToDimensions(uint32_t width, uint32_t height); 118 bool nativelyScaleToDimensions(uint32_t width, uint32_t height);
114 119
115 /* 120 /*
116 * Create the swizzler based on the encoded format 121 * Create the swizzler based on the encoded format
117 */ 122 */
118 void initializeSwizzler(const SkImageInfo& dstInfo, void* dst, size_t dstRow Bytes, 123 void initializeSwizzler(const SkImageInfo& dstInfo, void* dst, size_t dstRow Bytes,
119 const Options& options); 124 const Options& options);
120 125
121 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; 126 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr;
122 127
123 friend class SkJpegScanlineDecoder; 128 friend class SkJpegScanlineDecoder;
124 129
125 typedef SkCodec INHERITED; 130 typedef SkCodec INHERITED;
126 }; 131 };
127 132
128 #endif 133 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698