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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Fix legacy ImageFrame Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 SkImageGenerator* DecodingImageGenerator::create(SkData* data) { 137 SkImageGenerator* DecodingImageGenerator::create(SkData* data) {
138 RefPtr<SegmentReader> segmentReader = 138 RefPtr<SegmentReader> segmentReader =
139 SegmentReader::createFromSkData(sk_ref_sp(data)); 139 SegmentReader::createFromSkData(sk_ref_sp(data));
140 // We just need the size of the image, so we have to temporarily create an 140 // We just need the size of the image, so we have to temporarily create an
141 // ImageDecoder. Since we only need the size, the premul and gamma settings 141 // ImageDecoder. Since we only need the size, the premul and gamma settings
142 // don't really matter. 142 // don't really matter.
143 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( 143 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(
144 segmentReader, true, ImageDecoder::AlphaPremultiplied, 144 segmentReader, true, ImageDecoder::AlphaPremultiplied,
145 ImageDecoder::GammaAndColorProfileApplied); 145 ImageDecoder::ColorSpaceApplied);
146 if (!decoder || !decoder->isSizeAvailable()) 146 if (!decoder || !decoder->isSizeAvailable())
147 return nullptr; 147 return nullptr;
148 148
149 const IntSize size = decoder->size(); 149 const IntSize size = decoder->size();
150 const SkImageInfo info = 150 const SkImageInfo info =
151 SkImageInfo::MakeN32Premul(size.width(), size.height()); 151 SkImageInfo::MakeN32Premul(size.width(), size.height());
152 152
153 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create( 153 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(
154 SkISize::Make(size.width(), size.height()), false); 154 SkISize::Make(size.width(), size.height()), false);
155 if (!frame) 155 if (!frame)
156 return nullptr; 156 return nullptr;
157 157
158 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, 158 return new DecodingImageGenerator(frame, info, segmentReader.release(), true,
159 0); 159 0);
160 } 160 }
161 161
162 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698