| 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 25 matching lines...) Expand all Loading... |
| 36 int sampleSize, | 36 int sampleSize, |
| 37 bool ditherImage); | 37 bool ditherImage); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 SkData* onRefEncodedData() SK_OVERRIDE; | 40 SkData* onRefEncodedData() SK_OVERRIDE; |
| 41 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 41 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { |
| 42 *info = fInfo; | 42 *info = fInfo; |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 virtual Result onGetPixels(const SkImageInfo& info, | 45 virtual Result onGetPixels(const SkImageInfo& info, |
| 46 void* pixels, size_t rowBytes, | 46 void* pixels, size_t rowBytes, const Options&, |
| 47 SkPMColor ctable[], int* ctableCount) SK_OVERRIDE
; | 47 SkPMColor ctable[], int* ctableCount) SK_OVERRIDE
; |
| 48 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 48 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
| 49 SkYUVColorSpace* colorSpace) SK_OVERRIDE; | 49 SkYUVColorSpace* colorSpace) SK_OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 typedef SkImageGenerator INHERITED; | 52 typedef SkImageGenerator INHERITED; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Special allocator used by getPixels(). Uses preallocated memory | 56 * Special allocator used by getPixels(). Uses preallocated memory |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 size_t length = fStream->getLength(); | 142 size_t length = fStream->getLength(); |
| 143 if (length) { | 143 if (length) { |
| 144 fData = SkData::NewFromStream(fStream, length); | 144 fData = SkData::NewFromStream(fStream, length); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 return SkSafeRef(fData); | 147 return SkSafeRef(fData); |
| 148 } | 148 } |
| 149 | 149 |
| 150 SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo&
info, | 150 SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo&
info, |
| 151 void* pixels, size_t rowBytes, SkPMColor ctableEntries[], int* ctableCou
nt) { | 151 void* pixels, size_t rowBytes, const Options& options, SkPMColor ctableE
ntries[], |
| 152 int* ctableCount) { |
| 152 if (fInfo != info) { | 153 if (fInfo != info) { |
| 153 // The caller has specified a different info. This is an | 154 // The caller has specified a different info. This is an |
| 154 // error for this kind of SkImageGenerator. Use the Options | 155 // error for this kind of SkImageGenerator. Use the Options |
| 155 // to change the settings. | 156 // to change the settings. |
| 156 if (info.dimensions() != fInfo.dimensions()) { | 157 if (info.dimensions() != fInfo.dimensions()) { |
| 157 return kInvalidScale; | 158 return kInvalidScale; |
| 158 } | 159 } |
| 159 return kInvalidConversion; | 160 return kInvalidConversion; |
| 160 } | 161 } |
| 161 | 162 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 291 |
| 291 SkImageGenerator* SkDecodingImageGenerator::Create( | 292 SkImageGenerator* SkDecodingImageGenerator::Create( |
| 292 SkStreamRewindable* stream, | 293 SkStreamRewindable* stream, |
| 293 const SkDecodingImageGenerator::Options& opts) { | 294 const SkDecodingImageGenerator::Options& opts) { |
| 294 SkASSERT(stream != NULL); | 295 SkASSERT(stream != NULL); |
| 295 if (stream == NULL) { | 296 if (stream == NULL) { |
| 296 return NULL; | 297 return NULL; |
| 297 } | 298 } |
| 298 return CreateDecodingImageGenerator(NULL, stream, opts); | 299 return CreateDecodingImageGenerator(NULL, stream, opts); |
| 299 } | 300 } |
| OLD | NEW |