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

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

Issue 1763043002: Add ColorspaceConversion in ImageBitmapOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change tolerance to 13 Created 4 years, 9 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
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTask Runner* taskRunner) 217 void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTask Runner* taskRunner)
218 { 218 {
219 ASSERT(!isMainThread()); 219 ASSERT(!isMainThread());
220 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr ayBufferResult()->data(), static_cast<size_t>(m_loader.arrayBufferResult()->byte Length())); 220 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arr ayBufferResult()->data(), static_cast<size_t>(m_loader.arrayBufferResult()->byte Length()));
221 221
222 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied; 222 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied;
223 if (m_options.premultiplyAlpha() == "none") 223 if (m_options.premultiplyAlpha() == "none")
224 alphaOp = ImageDecoder::AlphaNotPremultiplied; 224 alphaOp = ImageDecoder::AlphaNotPremultiplied;
225 OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, Im ageDecoder::GammaAndColorProfileApplied)); 225 ImageDecoder::GammaAndColorProfileOption colorspaceOp = ImageDecoder::GammaA ndColorProfileApplied;
226 if (m_options.colorspaceConversion() == "none")
227 colorspaceOp = ImageDecoder::GammaAndColorProfileIgnored;
228 OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, co lorspaceOp));
226 RefPtr<SkImage> frame; 229 RefPtr<SkImage> frame;
227 if (decoder) { 230 if (decoder) {
228 decoder->setData(sharedBuffer.get(), true); 231 decoder->setData(sharedBuffer.get(), true);
229 frame = ImageBitmap::getSkImageFromDecoder(decoder.release()); 232 frame = ImageBitmap::getSkImageFromDecoder(decoder.release());
230 } 233 }
231 taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories:: ImageBitmapLoader::resolvePromiseOnOriginalThread, AllowCrossThreadAccess(this), frame.release())); 234 taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories:: ImageBitmapLoader::resolvePromiseOnOriginalThread, AllowCrossThreadAccess(this), frame.release()));
232 } 235 }
233 236
234 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas sRefPtr<SkImage> frame) 237 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas sRefPtr<SkImage> frame)
235 { 238 {
(...skipping 24 matching lines...) Expand all
260 m_factory->didFinishLoading(this); 263 m_factory->didFinishLoading(this);
261 } 264 }
262 265
263 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) 266 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader)
264 { 267 {
265 visitor->trace(m_factory); 268 visitor->trace(m_factory);
266 visitor->trace(m_resolver); 269 visitor->trace(m_resolver);
267 } 270 }
268 271
269 } // namespace blink 272 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698