OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/ImageBitmap.h" | 5 #include "core/frame/ImageBitmap.h" |
6 | 6 |
7 #include "core/html/HTMLCanvasElement.h" | 7 #include "core/html/HTMLCanvasElement.h" |
8 #include "core/html/HTMLVideoElement.h" | 8 #include "core/html/HTMLVideoElement.h" |
9 #include "core/html/ImageData.h" | 9 #include "core/html/ImageData.h" |
10 #include "platform/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect, con
st ImageBitmapOptions& options) | 244 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect, con
st ImageBitmapOptions& options) |
245 { | 245 { |
246 ASSERT(canvas->isPaintable()); | 246 ASSERT(canvas->isPaintable()); |
247 bool flipY; | 247 bool flipY; |
248 bool premultiplyAlpha; | 248 bool premultiplyAlpha; |
249 parseOptions(options, flipY, premultiplyAlpha); | 249 parseOptions(options, flipY, premultiplyAlpha); |
250 | 250 |
251 // canvas is always premultiplied, so set the last parameter to true and con
vert to un-premul later | 251 // canvas is always premultiplied, so set the last parameter to true and con
vert to un-premul later |
252 m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration).get(
), cropRect, flipY, true); | 252 m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration), cro
pRect, flipY, true); |
253 if (!m_image) | 253 if (!m_image) |
254 return; | 254 return; |
255 if (!premultiplyAlpha) | 255 if (!premultiplyAlpha) |
256 m_image = StaticBitmapImage::create(premulSkImageToUnPremul(m_image->ima
geForCurrentFrame().get())); | 256 m_image = StaticBitmapImage::create(premulSkImageToUnPremul(m_image->ima
geForCurrentFrame().get())); |
257 m_image->setOriginClean(canvas->originClean()); | 257 m_image->setOriginClean(canvas->originClean()); |
258 m_image->setPremultiplied(premultiplyAlpha); | 258 m_image->setPremultiplied(premultiplyAlpha); |
259 } | 259 } |
260 | 260 |
261 ImageBitmap::ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32
_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean) | 261 ImageBitmap::ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32
_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean) |
262 { | 262 { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 528 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
529 { | 529 { |
530 return FloatSize(width(), height()); | 530 return FloatSize(width(), height()); |
531 } | 531 } |
532 | 532 |
533 DEFINE_TRACE(ImageBitmap) | 533 DEFINE_TRACE(ImageBitmap) |
534 { | 534 { |
535 } | 535 } |
536 | 536 |
537 } // namespace blink | 537 } // namespace blink |
OLD | NEW |