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 "SkBitmapRegionCanvas.h" | 8 #include "SkBitmapRegionCanvas.h" |
9 #include "SkBitmapRegionCodec.h" | 9 #include "SkBitmapRegionCodec.h" |
10 #include "SkBitmapRegionDecoder.h" | 10 #include "SkBitmapRegionDecoder.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 SkASSERT(SkCodec::kTopDown_SkScanlineOrder == codec->getScanlineOrde
r() || | 47 SkASSERT(SkCodec::kTopDown_SkScanlineOrder == codec->getScanlineOrde
r() || |
48 SkCodec::kNone_SkScanlineOrder == codec->getScanlineOrder())
; | 48 SkCodec::kNone_SkScanlineOrder == codec->getScanlineOrder())
; |
49 | 49 |
50 return new SkBitmapRegionCanvas(codec.detach()); | 50 return new SkBitmapRegionCanvas(codec.detach()); |
51 } | 51 } |
52 case kAndroidCodec_Strategy: { | 52 case kAndroidCodec_Strategy: { |
53 SkAutoTDelete<SkAndroidCodec> codec = | 53 SkAutoTDelete<SkAndroidCodec> codec = |
54 SkAndroidCodec::NewFromStream(streamDeleter.detach()); | 54 SkAndroidCodec::NewFromStream(streamDeleter.detach()); |
55 if (nullptr == codec) { | 55 if (nullptr == codec) { |
56 SkCodecPrintf("Error: Failed to create codec.\n"); | 56 SkCodecPrintf("Error: Failed to create codec.\n"); |
57 return nullptr; | 57 return NULL; |
58 } | 58 } |
59 | 59 |
60 SkEncodedFormat format = codec->getEncodedFormat(); | 60 SkEncodedFormat format = codec->getEncodedFormat(); |
61 switch (format) { | 61 switch (format) { |
62 case SkEncodedFormat::kJPEG_SkEncodedFormat: | 62 case SkEncodedFormat::kJPEG_SkEncodedFormat: |
63 case SkEncodedFormat::kPNG_SkEncodedFormat: | 63 case SkEncodedFormat::kPNG_SkEncodedFormat: |
64 case SkEncodedFormat::kWEBP_SkEncodedFormat: | 64 case SkEncodedFormat::kWEBP_SkEncodedFormat: |
65 break; | 65 break; |
66 default: | 66 default: |
67 return nullptr; | 67 return nullptr; |
68 } | 68 } |
69 | 69 |
70 return new SkBitmapRegionCodec(codec.detach()); | 70 return new SkBitmapRegionCodec(codec.detach()); |
71 } | 71 } |
72 default: | 72 default: |
73 SkASSERT(false); | 73 SkASSERT(false); |
74 return nullptr; | 74 return nullptr; |
75 } | 75 } |
76 } | 76 } |
OLD | NEW |