OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkDecodingImageGenerator.h" | 9 #include "SkDecodingImageGenerator.h" |
10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 if (kIndex_8_SkColorType == info.colorType()) { | 193 if (kIndex_8_SkColorType == info.colorType()) { |
194 if (kIndex_8_SkColorType != bitmap.colorType()) { | 194 if (kIndex_8_SkColorType != bitmap.colorType()) { |
195 return false; // they asked for Index8, but we didn't receive that
from decoder | 195 return false; // they asked for Index8, but we didn't receive that
from decoder |
196 } | 196 } |
197 SkColorTable* ctable = bitmap.getColorTable(); | 197 SkColorTable* ctable = bitmap.getColorTable(); |
198 if (NULL == ctable) { | 198 if (NULL == ctable) { |
199 return false; | 199 return false; |
200 } | 200 } |
201 const int count = ctable->count(); | 201 const int count = ctable->count(); |
202 memcpy(ctableEntries, ctable->lockColors(), count * sizeof(SkPMColor)); | 202 memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor)); |
203 ctable->unlockColors(); | |
204 *ctableCount = count; | 203 *ctableCount = count; |
205 } | 204 } |
206 return true; | 205 return true; |
207 } | 206 } |
208 | 207 |
209 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], | 208 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], |
210 size_t rowBytes[3], SkYUVColorSpace
* colorSpace) { | 209 size_t rowBytes[3], SkYUVColorSpace
* colorSpace) { |
211 if (!fStream->rewind()) { | 210 if (!fStream->rewind()) { |
212 return false; | 211 return false; |
213 } | 212 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 SkStreamRewindable* stream, | 288 SkStreamRewindable* stream, |
290 const SkDecodingImageGenerator::Options& opts) { | 289 const SkDecodingImageGenerator::Options& opts) { |
291 SkASSERT(stream != NULL); | 290 SkASSERT(stream != NULL); |
292 SkASSERT(stream->unique()); | 291 SkASSERT(stream->unique()); |
293 if ((stream == NULL) || !stream->unique()) { | 292 if ((stream == NULL) || !stream->unique()) { |
294 SkSafeUnref(stream); | 293 SkSafeUnref(stream); |
295 return NULL; | 294 return NULL; |
296 } | 295 } |
297 return CreateDecodingImageGenerator(NULL, stream, opts); | 296 return CreateDecodingImageGenerator(NULL, stream, opts); |
298 } | 297 } |
OLD | NEW |