OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 | 9 |
10 bool SkImageGenerator::getInfo(SkImageInfo* info) { | 10 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
11 SkImageInfo dummy; | 11 SkImageInfo SkImageGenerator::getInfo() { |
12 if (NULL == info) { | 12 SkImageInfo info; |
13 info = &dummy; | 13 if (!this->onGetInfo(&info)) { |
| 14 info = SkImageInfo::MakeUnknown(0, 0); |
14 } | 15 } |
15 return this->onGetInfo(info); | 16 return info; |
16 } | 17 } |
| 18 #endif |
17 | 19 |
18 SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, vo
id* pixels, | 20 SkImageGenerator::Result SkImageGenerator::getPixels(const SkImageInfo& info, vo
id* pixels, |
19 size_t rowBytes, const Opti
ons* options, | 21 size_t rowBytes, const Opti
ons* options, |
20 SkPMColor ctable[], int* ct
ableCount) { | 22 SkPMColor ctable[], int* ct
ableCount) { |
21 if (kUnknown_SkColorType == info.colorType()) { | 23 if (kUnknown_SkColorType == info.colorType()) { |
22 return kInvalidConversion; | 24 return kInvalidConversion; |
23 } | 25 } |
24 if (NULL == pixels) { | 26 if (NULL == pixels) { |
25 return kInvalidParameters; | 27 return kInvalidParameters; |
26 } | 28 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 115 } |
114 return this->onGetYUV8Planes(sizes, planes, rowBytes); | 116 return this->onGetYUV8Planes(sizes, planes, rowBytes); |
115 } | 117 } |
116 | 118 |
117 ////////////////////////////////////////////////////////////////////////////////
///////////// | 119 ////////////////////////////////////////////////////////////////////////////////
///////////// |
118 | 120 |
119 SkData* SkImageGenerator::onRefEncodedData() { | 121 SkData* SkImageGenerator::onRefEncodedData() { |
120 return NULL; | 122 return NULL; |
121 } | 123 } |
122 | 124 |
| 125 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
123 bool SkImageGenerator::onGetInfo(SkImageInfo*) { | 126 bool SkImageGenerator::onGetInfo(SkImageInfo*) { |
124 return false; | 127 return false; |
125 } | 128 } |
| 129 #endif |
126 | 130 |
127 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS | 131 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS |
128 SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo&, void*
, size_t, | 132 SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo&, void*
, size_t, |
129 SkPMColor*, int*) { | 133 SkPMColor*, int*) { |
130 return kUnimplemented; | 134 return kUnimplemented; |
131 } | 135 } |
132 #endif | 136 #endif |
133 | 137 |
134 SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo& info,
void* dst, | 138 SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo& info,
void* dst, |
135 size_t rb, const Options&
options, | 139 size_t rb, const Options&
options, |
136 SkPMColor* colors, int* c
olorCount) { | 140 SkPMColor* colors, int* c
olorCount) { |
137 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS | 141 #ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS |
138 return this->onGetPixels(info, dst, rb, colors, colorCount); | 142 return this->onGetPixels(info, dst, rb, colors, colorCount); |
139 #else | 143 #else |
140 return kUnimplemented; | 144 return kUnimplemented; |
141 #endif | 145 #endif |
142 } | 146 } |
OLD | NEW |