| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright 2014 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkImageGenerator.h" |
| 9 |
| 10 #ifndef SK_SUPPORT_LEGACY_IMAGEGENERATORAPI |
| 11 bool SkImageGenerator::getInfo(SkImageInfo* info) { |
| 12 SkImageInfo dummy; |
| 13 if (NULL == info) { |
| 14 info = &dummy; |
| 15 } |
| 16 return this->onGetInfo(info); |
| 17 } |
| 18 |
| 19 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, |
| 20 SkPMColor ctable[], int* ctableCount) { |
| 21 if (kIndex_8_SkColorType == info.colorType()) { |
| 22 SkASSERT(ctable); |
| 23 SkASSERT(ctableCount); |
| 24 } else { |
| 25 SkASSERT(NULL == ctable); |
| 26 SkASSERT(NULL == ctableCount); |
| 27 } |
| 28 |
| 29 if (kUnknown_SkColorType == info.colorType()) { |
| 30 return false; |
| 31 } |
| 32 if (NULL == pixels) { |
| 33 return false; |
| 34 } |
| 35 if (rowBytes < info.minRowBytes()) { |
| 36 return false; |
| 37 } |
| 38 |
| 39 bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount
); |
| 40 |
| 41 if (success && (kIndex_8_SkColorType == info.colorType())) { |
| 42 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256); |
| 43 } |
| 44 return success; |
| 45 } |
| 46 |
| 47 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes) { |
| 48 SkASSERT(kIndex_8_SkColorType != info.colorType()); |
| 49 if (kIndex_8_SkColorType == info.colorType()) { |
| 50 return false; |
| 51 } |
| 52 return this->getPixels(info, pixels, rowBytes, NULL, NULL); |
| 53 } |
| 54 #endif |
| 55 |
| 56 ////////////////////////////////////////////////////////////////////////////////
///////////// |
| 57 |
| 58 SkData* SkImageGenerator::onRefEncodedData() { |
| 59 return NULL; |
| 60 } |
| 61 |
| 62 bool SkImageGenerator::onGetInfo(SkImageInfo*) { |
| 63 return false; |
| 64 } |
| 65 |
| 66 bool SkImageGenerator::onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor*
, int*) { |
| 67 return false; |
| 68 } |
| OLD | NEW |