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

Side by Side Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread( 272 void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(
273 WebTaskRunner* taskRunner, 273 WebTaskRunner* taskRunner,
274 DOMArrayBuffer* arrayBuffer, 274 DOMArrayBuffer* arrayBuffer,
275 const String& premultiplyAlphaOption, 275 const String& premultiplyAlphaOption,
276 const String& colorSpaceConversionOption) { 276 const String& colorSpaceConversionOption) {
277 ASSERT(!isMainThread()); 277 ASSERT(!isMainThread());
278 278
279 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied; 279 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied;
280 if (premultiplyAlphaOption == "none") 280 if (premultiplyAlphaOption == "none")
281 alphaOp = ImageDecoder::AlphaNotPremultiplied; 281 alphaOp = ImageDecoder::AlphaNotPremultiplied;
282 ImageDecoder::ColorSpaceOption colorSpaceOp = ImageDecoder::ColorSpaceApplied; 282 ImageDecoder::ColorSpaceOption colorSpaceOp =
283 ImageDecoder::ColorSpaceTransformed;
283 if (colorSpaceConversionOption == "none") 284 if (colorSpaceConversionOption == "none")
284 colorSpaceOp = ImageDecoder::ColorSpaceIgnored; 285 colorSpaceOp = ImageDecoder::ColorSpaceIgnored;
285 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( 286 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(
286 SegmentReader::createFromSkData(SkData::MakeWithoutCopy( 287 SegmentReader::createFromSkData(SkData::MakeWithoutCopy(
287 arrayBuffer->data(), arrayBuffer->byteLength())), 288 arrayBuffer->data(), arrayBuffer->byteLength())),
288 true, alphaOp, colorSpaceOp)); 289 true, alphaOp, colorSpaceOp,
290 colorSpaceOp == ImageDecoder::ColorSpaceTransformed
291 ? ImageDecoder::globalTargetColorSpace()
292 : nullptr));
289 sk_sp<SkImage> frame; 293 sk_sp<SkImage> frame;
290 if (decoder) { 294 if (decoder) {
291 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); 295 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder));
292 } 296 }
293 taskRunner->postTask( 297 taskRunner->postTask(
294 BLINK_FROM_HERE, 298 BLINK_FROM_HERE,
295 crossThreadBind(&ImageBitmapFactories::ImageBitmapLoader:: 299 crossThreadBind(&ImageBitmapFactories::ImageBitmapLoader::
296 resolvePromiseOnOriginalThread, 300 resolvePromiseOnOriginalThread,
297 wrapCrossThreadPersistent(this), std::move(frame))); 301 wrapCrossThreadPersistent(this), std::move(frame)));
298 } 302 }
(...skipping 17 matching lines...) Expand all
316 } 320 }
317 m_factory->didFinishLoading(this); 321 m_factory->didFinishLoading(this);
318 } 322 }
319 323
320 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { 324 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) {
321 visitor->trace(m_factory); 325 visitor->trace(m_factory);
322 visitor->trace(m_resolver); 326 visitor->trace(m_resolver);
323 } 327 }
324 328
325 } // namespace blink 329 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698