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

Side by Side Diff: src/codec/SkAndroidCodec.cpp

Issue 1519843002: Change computeOutputColorType() to mimic old behavior (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « no previous file | 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 "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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698