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

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

Issue 2556723003: Merge color options into ColorBehavior (Closed)
Patch Set: Feedback 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 = 282 bool ignoreColorSpace = false;
283 ImageDecoder::ColorSpaceTransformed;
284 if (colorSpaceConversionOption == "none") 283 if (colorSpaceConversionOption == "none")
285 colorSpaceOp = ImageDecoder::ColorSpaceIgnored; 284 ignoreColorSpace = true;
286 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( 285 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(
287 SegmentReader::createFromSkData(SkData::MakeWithoutCopy( 286 SegmentReader::createFromSkData(SkData::MakeWithoutCopy(
288 arrayBuffer->data(), arrayBuffer->byteLength())), 287 arrayBuffer->data(), arrayBuffer->byteLength())),
289 true, alphaOp, colorSpaceOp, 288 true, alphaOp,
290 colorSpaceOp == ImageDecoder::ColorSpaceTransformed 289 ignoreColorSpace ? ColorBehavior::ignore()
291 ? ImageDecoder::globalTargetColorSpace() 290 : ColorBehavior::transformToGlobalTarget()));
292 : nullptr));
293 sk_sp<SkImage> frame; 291 sk_sp<SkImage> frame;
294 if (decoder) { 292 if (decoder) {
295 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); 293 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder));
296 } 294 }
297 taskRunner->postTask( 295 taskRunner->postTask(
298 BLINK_FROM_HERE, 296 BLINK_FROM_HERE,
299 crossThreadBind(&ImageBitmapFactories::ImageBitmapLoader:: 297 crossThreadBind(&ImageBitmapFactories::ImageBitmapLoader::
300 resolvePromiseOnOriginalThread, 298 resolvePromiseOnOriginalThread,
301 wrapCrossThreadPersistent(this), std::move(frame))); 299 wrapCrossThreadPersistent(this), std::move(frame)));
302 } 300 }
(...skipping 17 matching lines...) Expand all
320 } 318 }
321 m_factory->didFinishLoading(this); 319 m_factory->didFinishLoading(this);
322 } 320 }
323 321
324 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { 322 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) {
325 visitor->trace(m_factory); 323 visitor->trace(m_factory);
326 visitor->trace(m_resolver); 324 visitor->trace(m_resolver);
327 } 325 }
328 326
329 } // namespace blink 327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698