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 "SkAndroidCodec.h" | 8 #include "SkAndroidCodec.h" |
9 #include "SkCodec.h" | 9 #include "SkCodec.h" |
10 #include "SkCodecPriv.h" | 10 #include "SkCodecPriv.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 break; | 72 break; |
73 case kRGB_565_SkColorType: | 73 case kRGB_565_SkColorType: |
74 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { | 74 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { |
75 return kRGB_565_SkColorType; | 75 return kRGB_565_SkColorType; |
76 } | 76 } |
77 break; | 77 break; |
78 default: | 78 default: |
79 break; | 79 break; |
80 } | 80 } |
81 | 81 |
82 // Android has limited support for kGray_8 (using kAlpha_8). We will not | |
83 // use kGray_8 for Android unless they specifically ask for it. | |
84 if (kGray_8_SkColorType == suggestedColorType) { | |
msarett
2015/12/11 16:41:13
As you stated in another review, we need this to m
| |
85 return kN32_SkColorType; | |
86 } | |
87 | |
88 // This may be kN32_SkColorType or kIndex_8_SkColorType. | |
82 return suggestedColorType; | 89 return suggestedColorType; |
83 } | 90 } |
84 | 91 |
85 SkAlphaType SkAndroidCodec::computeOutputAlphaType(bool requestedUnpremul) { | 92 SkAlphaType SkAndroidCodec::computeOutputAlphaType(bool requestedUnpremul) { |
86 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { | 93 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { |
87 return kOpaque_SkAlphaType; | 94 return kOpaque_SkAlphaType; |
88 } | 95 } |
89 return requestedUnpremul ? kUnpremul_SkAlphaType : kPremul_SkAlphaType; | 96 return requestedUnpremul ? kUnpremul_SkAlphaType : kPremul_SkAlphaType; |
90 } | 97 } |
91 | 98 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 } | 168 } |
162 } | 169 } |
163 | 170 |
164 return this->onGetAndroidPixels(info, pixels, rowBytes, *options); | 171 return this->onGetAndroidPixels(info, pixels, rowBytes, *options); |
165 } | 172 } |
166 | 173 |
167 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels, | 174 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels, |
168 size_t rowBytes) { | 175 size_t rowBytes) { |
169 return this->getAndroidPixels(info, pixels, rowBytes, nullptr); | 176 return this->getAndroidPixels(info, pixels, rowBytes, nullptr); |
170 } | 177 } |
OLD | NEW |