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

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

Issue 1838603002: Mark webps as sRGB (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Accept any profileType Created 4 years, 8 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SkImageInfo info; 78 SkImageInfo info;
79 if (webp_parse_header(stream, &info)) { 79 if (webp_parse_header(stream, &info)) {
80 return new SkWebpCodec(info, streamDeleter.release()); 80 return new SkWebpCodec(info, streamDeleter.release());
81 } 81 }
82 return nullptr; 82 return nullptr;
83 } 83 }
84 84
85 // This version is slightly different from SkCodecPriv's version of conversion_p ossible. It 85 // This version is slightly different from SkCodecPriv's version of conversion_p ossible. It
86 // supports both byte orders for 8888. 86 // supports both byte orders for 8888.
87 static bool webp_conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) { 87 static bool webp_conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) {
88 if (dst.profileType() != src.profileType()) { 88 // FIXME: skbug.com/4895
89 return false; 89 // Currently, we ignore the SkColorProfileType on the SkImageInfo. We
90 } 90 // will treat the encoded data as linear regardless of what the client
scroggo 2016/04/07 12:35:54 linear? I thought this CL's whole purpose was to t
msarett 2016/04/07 13:03:52 Well, we want to mark them as sRGB. I think treat
91 // requests.
91 92
92 if (!valid_alpha(dst.alphaType(), src.alphaType())) { 93 if (!valid_alpha(dst.alphaType(), src.alphaType())) {
93 return false; 94 return false;
94 } 95 }
95 96
96 switch (dst.colorType()) { 97 switch (dst.colorType()) {
97 // Both byte orders are supported. 98 // Both byte orders are supported.
98 case kBGRA_8888_SkColorType: 99 case kBGRA_8888_SkColorType:
99 case kRGBA_8888_SkColorType: 100 case kRGBA_8888_SkColorType:
100 return true; 101 return true;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 case VP8_STATUS_SUSPENDED: 246 case VP8_STATUS_SUSPENDED:
246 // Break out of the switch statement. Continue the loop. 247 // Break out of the switch statement. Continue the loop.
247 break; 248 break;
248 default: 249 default:
249 return kInvalidInput; 250 return kInvalidInput;
250 } 251 }
251 } 252 }
252 } 253 }
253 254
254 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream) 255 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream)
255 : INHERITED(info, stream) {} 256 // The spec says an unmarked image is sRGB, so we return that space here.
257 // TODO: Add support for parsing ICC profiles from webps.
258 : INHERITED(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