| 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 "SkCodec_libgif.h" | 8 #include "SkCodec_libgif.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 GifFileType* gifOut = NULL; | 250 GifFileType* gifOut = NULL; |
| 251 if (!ReadHeader(this->stream(), NULL, &gifOut)) { | 251 if (!ReadHeader(this->stream(), NULL, &gifOut)) { |
| 252 return kCouldNotRewind; | 252 return kCouldNotRewind; |
| 253 } else { | 253 } else { |
| 254 SkASSERT(NULL != gifOut); | 254 SkASSERT(NULL != gifOut); |
| 255 fGif.reset(gifOut); | 255 fGif.reset(gifOut); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Check for valid input parameters | 259 // Check for valid input parameters |
| 260 if (opts.fSubset) { |
| 261 // Subsets are not supported. |
| 262 return kUnimplemented; |
| 263 } |
| 260 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 264 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
| 261 return gif_error("Scaling not supported.\n", kInvalidScale); | 265 return gif_error("Scaling not supported.\n", kInvalidScale); |
| 262 } | 266 } |
| 263 if (!conversion_possible(dstInfo, this->getInfo())) { | 267 if (!conversion_possible(dstInfo, this->getInfo())) { |
| 264 return gif_error("Cannot convert input type to output type.\n", | 268 return gif_error("Cannot convert input type to output type.\n", |
| 265 kInvalidConversion); | 269 kInvalidConversion); |
| 266 } | 270 } |
| 267 | 271 |
| 268 // Use this as a container to hold information about any gif extension | 272 // Use this as a container to hold information about any gif extension |
| 269 // blocks. This generally stores transparency and animation instructions. | 273 // blocks. This generally stores transparency and animation instructions. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 // giflib returns an error code if the record type is not known. | 565 // giflib returns an error code if the record type is not known. |
| 562 // We should catch this error immediately. | 566 // We should catch this error immediately. |
| 563 SkASSERT(false); | 567 SkASSERT(false); |
| 564 break; | 568 break; |
| 565 } | 569 } |
| 566 } while (TERMINATE_RECORD_TYPE != recordType); | 570 } while (TERMINATE_RECORD_TYPE != recordType); |
| 567 | 571 |
| 568 return gif_error("Could not find any images to decode in gif file.\n", | 572 return gif_error("Could not find any images to decode in gif file.\n", |
| 569 kInvalidInput); | 573 kInvalidInput); |
| 570 } | 574 } |
| OLD | NEW |