| OLD | NEW |
| 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 "SkCodecImageGenerator.h" | 8 #include "SkCodecImageGenerator.h" |
| 9 | 9 |
| 10 SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) { | 10 SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alph
aType, profileType); | 32 return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alph
aType, profileType); |
| 33 } | 33 } |
| 34 | 34 |
| 35 SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data) | 35 SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data) |
| 36 : INHERITED(fix_info(*codec)) | 36 : INHERITED(fix_info(*codec)) |
| 37 , fCodec(codec) | 37 , fCodec(codec) |
| 38 , fData(SkRef(data)) | 38 , fData(SkRef(data)) |
| 39 {} | 39 {} |
| 40 | 40 |
| 41 SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) { | 41 SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) { |
| 42 #ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX |
| 43 if (whitelist && !whitelist->includes(fCodec->getEncodedFormat())) { |
| 44 return nullptr; |
| 45 } |
| 46 #endif |
| 42 return SkRef(fData.get()); | 47 return SkRef(fData.get()); |
| 43 } | 48 } |
| 44 | 49 |
| 45 bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s
ize_t rowBytes, | 50 bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s
ize_t rowBytes, |
| 46 SkPMColor ctable[], int* ctableCount) { | 51 SkPMColor ctable[], int* ctableCount) { |
| 47 | 52 |
| 48 SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr,
ctable, | 53 SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr,
ctable, |
| 49 ctableCount); | 54 ctableCount); |
| 50 switch (result) { | 55 switch (result) { |
| 51 case SkCodec::kSuccess: | 56 case SkCodec::kSuccess: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 65 SkCodec::Result result = fCodec->getYUV8Planes(sizeInfo, planes); | 70 SkCodec::Result result = fCodec->getYUV8Planes(sizeInfo, planes); |
| 66 | 71 |
| 67 switch (result) { | 72 switch (result) { |
| 68 case SkCodec::kSuccess: | 73 case SkCodec::kSuccess: |
| 69 case SkCodec::kIncompleteInput: | 74 case SkCodec::kIncompleteInput: |
| 70 return true; | 75 return true; |
| 71 default: | 76 default: |
| 72 return false; | 77 return false; |
| 73 } | 78 } |
| 74 } | 79 } |
| OLD | NEW |