| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
| 6 #include "WebExternalTextureLayerImpl.h" | 6 #include "WebExternalTextureLayerImpl.h" |
| 7 | 7 |
| 8 #include "CCTextureUpdateQueue.h" | 8 #include "CCTextureUpdateQueue.h" |
| 9 #include "TextureLayerChromium.h" | 9 #include "TextureLayerChromium.h" |
| 10 #include "WebLayerImpl.h" | 10 #include "WebLayerImpl.h" |
| 11 #include "webcore_convert.h" |
| 11 #include <public/WebExternalTextureLayerClient.h> | 12 #include <public/WebExternalTextureLayerClient.h> |
| 12 #include <public/WebFloatRect.h> | 13 #include <public/WebFloatRect.h> |
| 13 #include <public/WebSize.h> | 14 #include <public/WebSize.h> |
| 14 | 15 |
| 15 using namespace WebCore; | 16 using namespace WebCore; |
| 16 | 17 |
| 17 namespace WebKit { | 18 namespace WebKit { |
| 18 | 19 |
| 19 WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer
Client* client) | 20 WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer
Client* client) |
| 20 { | 21 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 48 static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); | 49 static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void WebExternalTextureLayerImpl::setFlipped(bool flipped) | 52 void WebExternalTextureLayerImpl::setFlipped(bool flipped) |
| 52 { | 53 { |
| 53 static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); | 54 static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) | 57 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) |
| 57 { | 58 { |
| 58 static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect); | 59 static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(convert(rect
)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 void WebExternalTextureLayerImpl::setOpaque(bool opaque) | 62 void WebExternalTextureLayerImpl::setOpaque(bool opaque) |
| 62 { | 63 { |
| 63 static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque); | 64 static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) | 67 void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) |
| 67 { | 68 { |
| 68 static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(
premultipliedAlpha); | 69 static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(
premultipliedAlpha); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 | 81 |
| 81 class WebTextureUpdaterImpl : public WebTextureUpdater { | 82 class WebTextureUpdaterImpl : public WebTextureUpdater { |
| 82 public: | 83 public: |
| 83 explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) | 84 explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) |
| 84 : m_queue(queue) | 85 : m_queue(queue) |
| 85 { | 86 { |
| 86 } | 87 } |
| 87 | 88 |
| 88 virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture,
WebSize size) OVERRIDE | 89 virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture,
WebSize size) OVERRIDE |
| 89 { | 90 { |
| 90 TextureCopier::Parameters copy = { sourceTexture, destinationTexture, si
ze }; | 91 TextureCopier::Parameters copy = { sourceTexture, destinationTexture, co
nvert(size) }; |
| 91 m_queue.appendCopy(copy); | 92 m_queue.appendCopy(copy); |
| 92 } | 93 } |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 CCTextureUpdateQueue& m_queue; | 96 CCTextureUpdateQueue& m_queue; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue
) | 99 unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue
) |
| 99 { | 100 { |
| 100 ASSERT(m_client); | 101 ASSERT(m_client); |
| 101 WebTextureUpdaterImpl updaterImpl(queue); | 102 WebTextureUpdaterImpl updaterImpl(queue); |
| 102 return m_client->prepareTexture(updaterImpl); | 103 return m_client->prepareTexture(updaterImpl); |
| 103 } | 104 } |
| 104 | 105 |
| 105 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() | 106 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() |
| 106 { | 107 { |
| 107 ASSERT(m_client); | 108 ASSERT(m_client); |
| 108 return m_client->context(); | 109 return m_client->context(); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace WebKit | 112 } // namespace WebKit |
| OLD | NEW |