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

Side by Side Diff: tools/SkBitmapRegionDecoderInterface.cpp

Issue 1405273004: Make DMSrcSink fail fatally when decodeRegion() fails for BRDSrcs (Closed) Base URL: https://skia.googlesource.com/skia.git@brd-new-apis
Patch Set: Created 5 years, 1 month 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 | « dm/DMSrcSink.cpp ('k') | no next file » | 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 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 "SkBitmapRegionCanvas.h" 8 #include "SkBitmapRegionCanvas.h"
9 #include "SkBitmapRegionCodec.h" 9 #include "SkBitmapRegionCodec.h"
10 #include "SkBitmapRegionDecoderInterface.h" 10 #include "SkBitmapRegionDecoderInterface.h"
(...skipping 26 matching lines...) Expand all
37 return nullptr; 37 return nullptr;
38 } 38 }
39 return new SkBitmapRegionSampler(decoder, width, height); 39 return new SkBitmapRegionSampler(decoder, width, height);
40 } 40 }
41 case kCanvas_Strategy: { 41 case kCanvas_Strategy: {
42 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(streamDeleter.de tach())); 42 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(streamDeleter.de tach()));
43 if (nullptr == codec) { 43 if (nullptr == codec) {
44 SkCodecPrintf("Error: Failed to create decoder.\n"); 44 SkCodecPrintf("Error: Failed to create decoder.\n");
45 return nullptr; 45 return nullptr;
46 } 46 }
47
48 if (SkEncodedFormat::kWEBP_SkEncodedFormat == codec->getEncodedForma t()) {
49 // FIXME: Support webp using a special case. Webp does not supp ort
50 // scanline decoding.
51 return nullptr;
52 }
53
47 switch (codec->getScanlineOrder()) { 54 switch (codec->getScanlineOrder()) {
48 case SkCodec::kTopDown_SkScanlineOrder: 55 case SkCodec::kTopDown_SkScanlineOrder:
49 case SkCodec::kNone_SkScanlineOrder: 56 case SkCodec::kNone_SkScanlineOrder:
50 break; 57 break;
51 default: 58 default:
52 SkCodecPrintf("Error: Scanline ordering not supported.\n"); 59 SkCodecPrintf("Error: Scanline ordering not supported.\n");
53 return nullptr; 60 return nullptr;
54 } 61 }
55 return new SkBitmapRegionCanvas(codec.detach()); 62 return new SkBitmapRegionCanvas(codec.detach());
56 } 63 }
57 case kAndroidCodec_Strategy: { 64 case kAndroidCodec_Strategy: {
58 SkAutoTDelete<SkAndroidCodec> codec = 65 SkAutoTDelete<SkAndroidCodec> codec =
59 SkAndroidCodec::NewFromStream(streamDeleter.detach()); 66 SkAndroidCodec::NewFromStream(streamDeleter.detach());
60 if (NULL == codec) { 67 if (NULL == codec) {
61 SkCodecPrintf("Error: Failed to create codec.\n"); 68 SkCodecPrintf("Error: Failed to create codec.\n");
62 return NULL; 69 return NULL;
63 } 70 }
64 return new SkBitmapRegionCodec(codec.detach()); 71 return new SkBitmapRegionCodec(codec.detach());
65 } 72 }
66 default: 73 default:
67 SkASSERT(false); 74 SkASSERT(false);
68 return nullptr; 75 return nullptr;
69 } 76 }
70 } 77 }
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698