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 "WebLayerImpl.h" | 8 #include "WebLayerImpl.h" |
9 #include "cc/texture_layer.h" | 9 #include "cc/texture_layer.h" |
10 #include "cc/texture_update_queue.h" | 10 #include "cc/texture_update_queue.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayerClient.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayerClient.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
14 #include "webcore_convert.h" | 14 #include "webcore_convert.h" |
15 | 15 |
16 using namespace cc; | 16 using namespace cc; |
17 | 17 |
18 namespace WebKit { | 18 namespace WebKit { |
19 | 19 |
20 WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer
Client* client) | 20 WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer
Client* client) |
21 { | 21 { |
22 return new WebExternalTextureLayerImpl(client); | 22 return new WebExternalTextureLayerImpl(client); |
23 } | 23 } |
24 | 24 |
25 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayer
Client* client) | 25 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayer
Client* client) |
26 : m_client(client) | 26 : m_client(client) |
27 { | 27 { |
28 scoped_refptr<TextureLayerChromium> layer; | 28 scoped_refptr<TextureLayer> layer; |
29 if (m_client) | 29 if (m_client) |
30 layer = TextureLayerChromium::create(this); | 30 layer = TextureLayer::create(this); |
31 else | 31 else |
32 layer = TextureLayerChromium::create(0); | 32 layer = TextureLayer::create(0); |
33 layer->setIsDrawable(true); | 33 layer->setIsDrawable(true); |
34 m_layer.reset(new WebLayerImpl(layer)); | 34 m_layer.reset(new WebLayerImpl(layer)); |
35 } | 35 } |
36 | 36 |
37 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() | 37 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() |
38 { | 38 { |
39 static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient(); | 39 static_cast<TextureLayer*>(m_layer->layer())->clearClient(); |
40 } | 40 } |
41 | 41 |
42 WebLayer* WebExternalTextureLayerImpl::layer() | 42 WebLayer* WebExternalTextureLayerImpl::layer() |
43 { | 43 { |
44 return m_layer.get(); | 44 return m_layer.get(); |
45 } | 45 } |
46 | 46 |
47 void WebExternalTextureLayerImpl::setTextureId(unsigned id) | 47 void WebExternalTextureLayerImpl::setTextureId(unsigned id) |
48 { | 48 { |
49 static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); | 49 static_cast<TextureLayer*>(m_layer->layer())->setTextureId(id); |
50 } | 50 } |
51 | 51 |
52 void WebExternalTextureLayerImpl::setFlipped(bool flipped) | 52 void WebExternalTextureLayerImpl::setFlipped(bool flipped) |
53 { | 53 { |
54 static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); | 54 static_cast<TextureLayer*>(m_layer->layer())->setFlipped(flipped); |
55 } | 55 } |
56 | 56 |
57 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) | 57 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) |
58 { | 58 { |
59 static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(convert(rect
)); | 59 static_cast<TextureLayer*>(m_layer->layer())->setUVRect(convert(rect)); |
60 } | 60 } |
61 | 61 |
62 void WebExternalTextureLayerImpl::setOpaque(bool opaque) | 62 void WebExternalTextureLayerImpl::setOpaque(bool opaque) |
63 { | 63 { |
64 static_cast<TextureLayerChromium*>(m_layer->layer())->setContentsOpaque(opaq
ue); | 64 static_cast<TextureLayer*>(m_layer->layer())->setContentsOpaque(opaque); |
65 } | 65 } |
66 | 66 |
67 void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) | 67 void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) |
68 { | 68 { |
69 static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(
premultipliedAlpha); | 69 static_cast<TextureLayer*>(m_layer->layer())->setPremultipliedAlpha(premulti
pliedAlpha); |
70 } | 70 } |
71 | 71 |
72 void WebExternalTextureLayerImpl::willModifyTexture() | 72 void WebExternalTextureLayerImpl::willModifyTexture() |
73 { | 73 { |
74 static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture(); | 74 static_cast<TextureLayer*>(m_layer->layer())->willModifyTexture(); |
75 } | 75 } |
76 | 76 |
77 void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) | 77 void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) |
78 { | 78 { |
79 static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(ra
teLimit); | 79 static_cast<TextureLayer*>(m_layer->layer())->setRateLimitContext(rateLimit)
; |
80 } | 80 } |
81 | 81 |
82 class WebTextureUpdaterImpl : public WebTextureUpdater { | 82 class WebTextureUpdaterImpl : public WebTextureUpdater { |
83 public: | 83 public: |
84 explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) | 84 explicit WebTextureUpdaterImpl(TextureUpdateQueue& queue) |
85 : m_queue(queue) | 85 : m_queue(queue) |
86 { | 86 { |
87 } | 87 } |
88 | 88 |
89 virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture,
WebSize size) OVERRIDE | 89 virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture,
WebSize size) OVERRIDE |
90 { | 90 { |
91 TextureCopier::Parameters copy = { sourceTexture, destinationTexture, co
nvert(size) }; | 91 TextureCopier::Parameters copy = { sourceTexture, destinationTexture, co
nvert(size) }; |
92 m_queue.appendCopy(copy); | 92 m_queue.appendCopy(copy); |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 CCTextureUpdateQueue& m_queue; | 96 TextureUpdateQueue& m_queue; |
97 }; | 97 }; |
98 | 98 |
99 unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue
) | 99 unsigned WebExternalTextureLayerImpl::prepareTexture(TextureUpdateQueue& queue) |
100 { | 100 { |
101 ASSERT(m_client); | 101 ASSERT(m_client); |
102 WebTextureUpdaterImpl updaterImpl(queue); | 102 WebTextureUpdaterImpl updaterImpl(queue); |
103 return m_client->prepareTexture(updaterImpl); | 103 return m_client->prepareTexture(updaterImpl); |
104 } | 104 } |
105 | 105 |
106 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() | 106 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() |
107 { | 107 { |
108 ASSERT(m_client); | 108 ASSERT(m_client); |
109 return m_client->context(); | 109 return m_client->context(); |
110 } | 110 } |
111 | 111 |
112 } // namespace WebKit | 112 } // namespace WebKit |
OLD | NEW |