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

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

Issue 2243153002: Webp has_alpha is a hint only (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « 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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkWebpCodec.h" 9 #include "SkWebpCodec.h"
10 #include "SkTemplates.h" 10 #include "SkTemplates.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (SkToBool(features.has_alpha)) { 83 if (SkToBool(features.has_alpha)) {
84 color = SkEncodedInfo::kYUVA_Color; 84 color = SkEncodedInfo::kYUVA_Color;
85 alpha = SkEncodedInfo::kUnpremul_Alpha; 85 alpha = SkEncodedInfo::kUnpremul_Alpha;
86 } else { 86 } else {
87 color = SkEncodedInfo::kYUV_Color; 87 color = SkEncodedInfo::kYUV_Color;
88 alpha = SkEncodedInfo::kOpaque_Alpha; 88 alpha = SkEncodedInfo::kOpaque_Alpha;
89 } 89 }
90 break; 90 break;
91 case 2: 91 case 2:
92 // This is the lossless format (BGRA). 92 // This is the lossless format (BGRA).
93 // FIXME: Should we check the has_alpha flag here? It looks
94 // like the image is encoded with an alpha channel
95 // regardless of whether or not the alpha flag is set.
96 color = SkEncodedInfo::kBGRA_Color; 93 color = SkEncodedInfo::kBGRA_Color;
97 alpha = SkEncodedInfo::kUnpremul_Alpha; 94 alpha = SkEncodedInfo::kUnpremul_Alpha;
98 break; 95 break;
99 default: 96 default:
100 return nullptr; 97 return nullptr;
101 } 98 }
102 99
103 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8); 100 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8);
104 return new SkWebpCodec(features.width, features.height, info, streamDeleter. release()); 101 return new SkWebpCodec(features.width, features.height, info, streamDeleter. release());
105 } 102 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 default: 268 default:
272 return kInvalidInput; 269 return kInvalidInput;
273 } 270 }
274 } 271 }
275 } 272 }
276 273
277 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, SkStr eam* stream) 274 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, SkStr eam* stream)
278 // The spec says an unmarked image is sRGB, so we return that space here. 275 // The spec says an unmarked image is sRGB, so we return that space here.
279 // TODO: Add support for parsing ICC profiles from webps. 276 // TODO: Add support for parsing ICC profiles from webps.
280 : INHERITED(width, height, info, stream, SkColorSpace::NewNamed(SkColorSpace ::kSRGB_Named)) {} 277 : INHERITED(width, height, info, stream, SkColorSpace::NewNamed(SkColorSpace ::kSRGB_Named)) {}
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