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