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 bool ImageBitmap::isTextureBacked() const | |
| 470 { | |
| 471 return (!m_image->hasSkImage() || m_image->hasContext3DProvider()); | |
|
Justin Novosad
2016/06/07 15:11:07
This is hard to read. The "!m_image->hasSkImage()"
xidachen
2016/06/07 17:49:53
I actually tried that before and it is a bit compl
| |
| 472 } | |
| 473 | |
| 469 IntSize ImageBitmap::size() const | 474 IntSize ImageBitmap::size() const |
| 470 { | 475 { |
| 471 if (!m_image) | 476 if (!m_image) |
| 472 return IntSize(); | 477 return IntSize(); |
| 473 ASSERT(m_image->width() > 0 && m_image->height() > 0); | 478 ASSERT(m_image->width() > 0 && m_image->height() > 0); |
| 474 return IntSize(m_image->width(), m_image->height()); | 479 return IntSize(m_image->width(), m_image->height()); |
| 475 } | 480 } |
| 476 | 481 |
| 477 ScriptPromise ImageBitmap::createImageBitmap(ScriptState* scriptState, EventTarg et& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& optio ns, ExceptionState& exceptionState) | 482 ScriptPromise ImageBitmap::createImageBitmap(ScriptState* scriptState, EventTarg et& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& optio ns, ExceptionState& exceptionState) |
| 478 { | 483 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 FloatSize ImageBitmap::elementSize(const FloatSize&) const | 517 FloatSize ImageBitmap::elementSize(const FloatSize&) const |
| 513 { | 518 { |
| 514 return FloatSize(width(), height()); | 519 return FloatSize(width(), height()); |
| 515 } | 520 } |
| 516 | 521 |
| 517 DEFINE_TRACE(ImageBitmap) | 522 DEFINE_TRACE(ImageBitmap) |
| 518 { | 523 { |
| 519 } | 524 } |
| 520 | 525 |
| 521 } // namespace blink | 526 } // namespace blink |
| OLD | NEW |