| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return; | 337 return; |
| 338 m_image->setOriginClean(image->originClean()); | 338 m_image->setOriginClean(image->originClean()); |
| 339 m_image->setPremultiplied(premultiplyAlpha); | 339 m_image->setPremultiplied(premultiplyAlpha); |
| 340 } | 340 } |
| 341 | 341 |
| 342 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) | 342 ImageBitmap::ImageBitmap(PassRefPtr<StaticBitmapImage> image) |
| 343 { | 343 { |
| 344 m_image = image; | 344 m_image = image; |
| 345 } | 345 } |
| 346 | 346 |
| 347 ImageBitmap::ImageBitmap(WebExternalTextureMailbox& mailbox) |
| 348 { |
| 349 m_image = StaticBitmapImage::create(mailbox); |
| 350 } |
| 351 |
| 347 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() | 352 PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() |
| 348 { | 353 { |
| 349 ASSERT(!isNeutered()); | 354 ASSERT(!isNeutered()); |
| 350 m_isNeutered = true; | 355 m_isNeutered = true; |
| 351 return m_image.release(); | 356 return m_image.release(); |
| 352 } | 357 } |
| 353 | 358 |
| 354 ImageBitmap::~ImageBitmap() | 359 ImageBitmap::~ImageBitmap() |
| 355 { | 360 { |
| 356 } | 361 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 { | 394 { |
| 390 IntRect normalizedCropRect = normalizeRect(cropRect); | 395 IntRect normalizedCropRect = normalizeRect(cropRect); |
| 391 return new ImageBitmap(image, normalizedCropRect, options); | 396 return new ImageBitmap(image, normalizedCropRect, options); |
| 392 } | 397 } |
| 393 | 398 |
| 394 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) | 399 ImageBitmap* ImageBitmap::create(PassRefPtr<StaticBitmapImage> image) |
| 395 { | 400 { |
| 396 return new ImageBitmap(image); | 401 return new ImageBitmap(image); |
| 397 } | 402 } |
| 398 | 403 |
| 404 ImageBitmap* ImageBitmap::create(WebExternalTextureMailbox& mailbox) |
| 405 { |
| 406 return new ImageBitmap(mailbox); |
| 407 } |
| 408 |
| 399 void ImageBitmap::close() | 409 void ImageBitmap::close() |
| 400 { | 410 { |
| 401 if (!m_image || m_isNeutered) | 411 if (!m_image || m_isNeutered) |
| 402 return; | 412 return; |
| 403 m_image.clear(); | 413 m_image.clear(); |
| 404 m_isNeutered = true; | 414 m_isNeutered = true; |
| 405 } | 415 } |
| 406 | 416 |
| 407 // static | 417 // static |
| 408 ImageBitmap* ImageBitmap::take(ScriptPromiseResolver*, sk_sp<SkImage> image) | 418 ImageBitmap* ImageBitmap::take(ScriptPromiseResolver*, sk_sp<SkImage> image) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 489 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 480 { | 490 { |
| 481 return FloatSize(width(), height()); | 491 return FloatSize(width(), height()); |
| 482 } | 492 } |
| 483 | 493 |
| 484 DEFINE_TRACE(ImageBitmap) | 494 DEFINE_TRACE(ImageBitmap) |
| 485 { | 495 { |
| 486 } | 496 } |
| 487 | 497 |
| 488 } // namespace blink | 498 } // namespace blink |
| OLD | NEW |