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

Side by Side Diff: src/codec/SkCodec_wbmp.cpp

Issue 1381483002: Call rewindIfNeeded in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Rebase Created 5 years, 2 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 | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkJpegCodec.cpp » ('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 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SkEncodedFormat SkWbmpCodec::onGetEncodedFormat() const { 103 SkEncodedFormat SkWbmpCodec::onGetEncodedFormat() const {
104 return kWBMP_SkEncodedFormat; 104 return kWBMP_SkEncodedFormat;
105 } 105 }
106 106
107 SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info, 107 SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
108 void* dst, 108 void* dst,
109 size_t rowBytes, 109 size_t rowBytes,
110 const Options& options, 110 const Options& options,
111 SkPMColor ctable[], 111 SkPMColor ctable[],
112 int* ctableCount) { 112 int* ctableCount) {
113 if (!this->rewindIfNeeded()) {
114 return kCouldNotRewind;
115 }
116 if (options.fSubset) { 113 if (options.fSubset) {
117 // Subsets are not supported. 114 // Subsets are not supported.
118 return kUnimplemented; 115 return kUnimplemented;
119 } 116 }
120 if (info.dimensions() != this->getInfo().dimensions()) { 117 if (info.dimensions() != this->getInfo().dimensions()) {
121 return kInvalidScale; 118 return kInvalidScale;
122 } 119 }
123 120
124 if (!valid_alpha(info.alphaType(), this->getInfo().alphaType())) { 121 if (!valid_alpha(info.alphaType(), this->getInfo().alphaType())) {
125 return kInvalidConversion; 122 return kInvalidConversion;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return rowResult; 170 return rowResult;
174 } 171 }
175 fSwizzler->swizzle(dstRow, fSrcBuffer.get()); 172 fSwizzler->swizzle(dstRow, fSrcBuffer.get());
176 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes); 173 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes);
177 } 174 }
178 return kSuccess; 175 return kSuccess;
179 } 176 }
180 177
181 SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, 178 SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
182 const Options& options, SkPMColor inputColorTable[], int* inputColorCoun t) { 179 const Options& options, SkPMColor inputColorTable[], int* inputColorCoun t) {
183 if (!this->rewindIfNeeded()) {
184 return kCouldNotRewind;
185 }
186 if (options.fSubset) { 180 if (options.fSubset) {
187 // Subsets are not supported. 181 // Subsets are not supported.
188 return kUnimplemented; 182 return kUnimplemented;
189 } 183 }
190 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 184 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
191 if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstI nfo)) { 185 if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstI nfo)) {
192 return kInvalidScale; 186 return kInvalidScale;
193 } 187 }
194 } 188 }
195 189
(...skipping 14 matching lines...) Expand all
210 get_color_ptr(fColorTable.get()), options)); 204 get_color_ptr(fColorTable.get()), options));
211 if (nullptr == fSwizzler.get()) { 205 if (nullptr == fSwizzler.get()) {
212 return kInvalidConversion; 206 return kInvalidConversion;
213 } 207 }
214 208
215 fSrcBuffer.reset(fSrcRowBytes); 209 fSrcBuffer.reset(fSrcRowBytes);
216 210
217 return kSuccess; 211 return kSuccess;
218 } 212 }
219 213
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698