Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 816273002: remove dead SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (fHasAlpha) { 296 if (fHasAlpha) {
297 if (colorType != kARGB_4444_SkColorType) { 297 if (colorType != kARGB_4444_SkColorType) {
298 colorType = kN32_SkColorType; 298 colorType = kN32_SkColorType;
299 } 299 }
300 } else { 300 } else {
301 if (colorType != kRGB_565_SkColorType && colorType != kARGB_4444_SkColor Type) { 301 if (colorType != kRGB_565_SkColorType && colorType != kARGB_4444_SkColor Type) {
302 colorType = kN32_SkColorType; 302 colorType = kN32_SkColorType;
303 } 303 }
304 } 304 }
305 305
306 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
307 if (!this->chooseFromOneChoice(colorType, width, height)) {
308 return false;
309 }
310 #endif
311
312 SkAlphaType alphaType = kOpaque_SkAlphaType; 306 SkAlphaType alphaType = kOpaque_SkAlphaType;
313 if (SkToBool(fHasAlpha)) { 307 if (SkToBool(fHasAlpha)) {
314 if (this->getRequireUnpremultipliedColors()) { 308 if (this->getRequireUnpremultipliedColors()) {
315 alphaType = kUnpremul_SkAlphaType; 309 alphaType = kUnpremul_SkAlphaType;
316 } else { 310 } else {
317 alphaType = kPremul_SkAlphaType; 311 alphaType = kPremul_SkAlphaType;
318 } 312 }
319 } 313 }
320 return decodedBitmap->setInfo(SkImageInfo::Make(width, height, colorType, al phaType)); 314 return decodedBitmap->setInfo(SkImageInfo::Make(width, height, colorType, al phaType));
321 } 315 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (!setDecodeConfig(bitmap, width, height)) { 377 if (!setDecodeConfig(bitmap, width, height)) {
384 return false; 378 return false;
385 } 379 }
386 // alloc from native heap if it is a temp bitmap. (prevent GC) 380 // alloc from native heap if it is a temp bitmap. (prevent GC)
387 bool allocResult = (bitmap == decodedBitmap) 381 bool allocResult = (bitmap == decodedBitmap)
388 ? allocPixelRef(bitmap, NULL) 382 ? allocPixelRef(bitmap, NULL)
389 : bitmap->tryAllocPixels(); 383 : bitmap->tryAllocPixels();
390 if (!allocResult) { 384 if (!allocResult) {
391 return return_false(*decodedBitmap, "allocPixelRef"); 385 return return_false(*decodedBitmap, "allocPixelRef");
392 } 386 }
393 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
394 } else {
395 // This is also called in setDecodeConfig in above block.
396 // i.e., when bitmap->isNull() is true.
397 if (!chooseFromOneChoice(bitmap->colorType(), width, height)) {
398 return false;
399 }
400 #endif
401 } 387 }
402 388
403 SkAutoLockPixels alp(*bitmap); 389 SkAutoLockPixels alp(*bitmap);
404 WebPDecoderConfig config; 390 WebPDecoderConfig config;
405 if (!webp_get_config_resize_crop(&config, bitmap, rect, 391 if (!webp_get_config_resize_crop(&config, bitmap, rect,
406 this->shouldPremultiply())) { 392 this->shouldPremultiply())) {
407 return false; 393 return false;
408 } 394 }
409 395
410 // Decode the WebP image data stream using WebP incremental decoding for 396 // Decode the WebP image data stream using WebP incremental decoding for
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 return SkImageDecoder::kUnknown_Format; 673 return SkImageDecoder::kUnknown_Format;
688 } 674 }
689 675
690 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { 676 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
691 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L; 677 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L;
692 } 678 }
693 679
694 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); 680 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
695 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); 681 static SkImageDecoder_FormatReg gFormatReg(get_format_webp);
696 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); 682 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698