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 "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
9 #include "SkCodec.h" | 9 #include "SkCodec.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return kInvalidParameters; | 116 return kInvalidParameters; |
117 } | 117 } |
118 } else { | 118 } else { |
119 if (ctableCount) { | 119 if (ctableCount) { |
120 *ctableCount = 0; | 120 *ctableCount = 0; |
121 } | 121 } |
122 ctableCount = NULL; | 122 ctableCount = NULL; |
123 ctable = NULL; | 123 ctable = NULL; |
124 } | 124 } |
125 | 125 |
| 126 { |
| 127 SkAlphaType canonical; |
| 128 if (!SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &c
anonical) |
| 129 || canonical != info.alphaType()) |
| 130 { |
| 131 return kInvalidConversion; |
| 132 } |
| 133 } |
| 134 |
126 // Default options. | 135 // Default options. |
127 Options optsStorage; | 136 Options optsStorage; |
128 if (NULL == options) { | 137 if (NULL == options) { |
129 options = &optsStorage; | 138 options = &optsStorage; |
130 } | 139 } |
131 const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ct
able, ctableCount); | 140 const Result result = this->onGetPixels(info, pixels, rowBytes, *options, ct
able, ctableCount); |
132 | 141 |
133 if ((kIncompleteInput == result || kSuccess == result) && ctableCount) { | 142 if ((kIncompleteInput == result || kSuccess == result) && ctableCount) { |
134 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256); | 143 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256); |
135 } | 144 } |
136 return result; | 145 return result; |
137 } | 146 } |
138 | 147 |
139 SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
rowBytes) { | 148 SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t
rowBytes) { |
140 return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL); | 149 return this->getPixels(info, pixels, rowBytes, NULL, NULL, NULL); |
141 } | 150 } |
OLD | NEW |