Chromium Code Reviews| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 } | 459 } |
| 460 | 460 |
| 461 unsigned long ImageBitmap::height() const | 461 unsigned long ImageBitmap::height() const |
| 462 { | 462 { |
| 463 if (!m_image) | 463 if (!m_image) |
| 464 return 0; | 464 return 0; |
| 465 ASSERT(m_image->height() > 0); | 465 ASSERT(m_image->height() > 0); |
| 466 return m_image->height(); | 466 return m_image->height(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 // This function is used in WebGL's texImage, if it returns true, WebGL will a | |
|
Justin Novosad
2016/06/09 20:21:29
"will do a"
xidachen
2016/06/10 15:36:08
Done.
| |
| 470 // GPU-GPU texture copy. So this function returns true only when it has a mailbo x. | |
| 471 bool ImageBitmap::isTextureBacked() const | |
| 472 { | |
| 473 return m_image && m_image->hasMailbox(); | |
|
Justin Novosad
2016/06/09 20:21:29
What about the case where we have no mailbox, but
xidachen
2016/06/10 15:36:08
Changed the implementation to indicate whether bit
| |
| 474 } | |
| 475 | |
| 469 IntSize ImageBitmap::size() const | 476 IntSize ImageBitmap::size() const |
| 470 { | 477 { |
| 471 if (!m_image) | 478 if (!m_image) |
| 472 return IntSize(); | 479 return IntSize(); |
| 473 ASSERT(m_image->width() > 0 && m_image->height() > 0); | 480 ASSERT(m_image->width() > 0 && m_image->height() > 0); |
| 474 return IntSize(m_image->width(), m_image->height()); | 481 return IntSize(m_image->width(), m_image->height()); |
| 475 } | 482 } |
| 476 | 483 |
| 477 ScriptPromise ImageBitmap::createImageBitmap(ScriptState* scriptState, EventTarg et& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& optio ns, ExceptionState& exceptionState) | 484 ScriptPromise ImageBitmap::createImageBitmap(ScriptState* scriptState, EventTarg et& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& optio ns, ExceptionState& exceptionState) |
| 478 { | 485 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 519 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 513 { | 520 { |
| 514 return FloatSize(width(), height()); | 521 return FloatSize(width(), height()); |
| 515 } | 522 } |
| 516 | 523 |
| 517 DEFINE_TRACE(ImageBitmap) | 524 DEFINE_TRACE(ImageBitmap) |
| 518 { | 525 { |
| 519 } | 526 } |
| 520 | 527 |
| 521 } // namespace blink | 528 } // namespace blink |
| OLD | NEW |