| OLD | NEW |
| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 { | 225 { |
| 226 ASSERT(!isMainThread()); | 226 ASSERT(!isMainThread()); |
| 227 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(static_cast<char*>(
arrayBuffer->data()), static_cast<size_t>(arrayBuffer->byteLength())); | 227 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(static_cast<char*>(
arrayBuffer->data()), static_cast<size_t>(arrayBuffer->byteLength())); |
| 228 | 228 |
| 229 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied; | 229 ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied; |
| 230 if (premultiplyAlphaOption == "none") | 230 if (premultiplyAlphaOption == "none") |
| 231 alphaOp = ImageDecoder::AlphaNotPremultiplied; | 231 alphaOp = ImageDecoder::AlphaNotPremultiplied; |
| 232 ImageDecoder::GammaAndColorProfileOption colorSpaceOp = ImageDecoder::GammaA
ndColorProfileApplied; | 232 ImageDecoder::GammaAndColorProfileOption colorSpaceOp = ImageDecoder::GammaA
ndColorProfileApplied; |
| 233 if (colorSpaceConversionOption == "none") | 233 if (colorSpaceConversionOption == "none") |
| 234 colorSpaceOp = ImageDecoder::GammaAndColorProfileIgnored; | 234 colorSpaceOp = ImageDecoder::GammaAndColorProfileIgnored; |
| 235 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(ImageDecoder::det
ermineImageType(*sharedBuffer), alphaOp, colorSpaceOp)); | 235 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(sharedBuffer.rele
ase(), true, alphaOp, colorSpaceOp)); |
| 236 RefPtr<SkImage> frame; | 236 RefPtr<SkImage> frame; |
| 237 if (decoder) { | 237 if (decoder) { |
| 238 decoder->setData(sharedBuffer.get(), true); | |
| 239 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); | 238 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); |
| 240 } | 239 } |
| 241 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&ImageBitmapFactories:
:ImageBitmapLoader::resolvePromiseOnOriginalThread, wrapCrossThreadPersistent(th
is), frame.release())); | 240 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&ImageBitmapFactories:
:ImageBitmapLoader::resolvePromiseOnOriginalThread, wrapCrossThreadPersistent(th
is), frame.release())); |
| 242 } | 241 } |
| 243 | 242 |
| 244 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas
sRefPtr<SkImage> frame) | 243 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas
sRefPtr<SkImage> frame) |
| 245 { | 244 { |
| 246 if (!frame) { | 245 if (!frame) { |
| 247 rejectPromise(); | 246 rejectPromise(); |
| 248 return; | 247 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 262 m_factory->didFinishLoading(this); | 261 m_factory->didFinishLoading(this); |
| 263 } | 262 } |
| 264 | 263 |
| 265 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) | 264 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) |
| 266 { | 265 { |
| 267 visitor->trace(m_factory); | 266 visitor->trace(m_factory); |
| 268 visitor->trace(m_resolver); | 267 visitor->trace(m_resolver); |
| 269 } | 268 } |
| 270 | 269 |
| 271 } // namespace blink | 270 } // namespace blink |
| OLD | NEW |