| 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, al
phaOp, colorSpaceOp)); |
| 236 RefPtr<SkImage> frame; | 236 RefPtr<SkImage> frame; |
| 237 if (decoder) { | 237 if (decoder) { |
| 238 decoder->setData(sharedBuffer.get(), true); | 238 decoder->setData(sharedBuffer.get(), true); |
| 239 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); | 239 frame = ImageBitmap::getSkImageFromDecoder(std::move(decoder)); |
| 240 } | 240 } |
| 241 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&ImageBitmapFactories:
:ImageBitmapLoader::resolvePromiseOnOriginalThread, wrapCrossThreadPersistent(th
is), frame.release())); | 241 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&ImageBitmapFactories:
:ImageBitmapLoader::resolvePromiseOnOriginalThread, wrapCrossThreadPersistent(th
is), frame.release())); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas
sRefPtr<SkImage> frame) | 244 void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(Pas
sRefPtr<SkImage> frame) |
| 245 { | 245 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 262 m_factory->didFinishLoading(this); | 262 m_factory->didFinishLoading(this); |
| 263 } | 263 } |
| 264 | 264 |
| 265 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) | 265 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) |
| 266 { | 266 { |
| 267 visitor->trace(m_factory); | 267 visitor->trace(m_factory); |
| 268 visitor->trace(m_resolver); | 268 visitor->trace(m_resolver); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |