Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webkit/compositor_bindings/web_external_texture_layer_impl.cc

Issue 12496013: Move compositor bindings implementations out of WebKit::, fix style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "webkit/compositor_bindings/web_external_texture_layer_impl.h" 5 #include "webkit/compositor_bindings/web_external_texture_layer_impl.h"
6 6
7 #include "cc/layers/texture_layer.h" 7 #include "cc/layers/texture_layer.h"
8 #include "cc/resources/resource_update_queue.h" 8 #include "cc/resources/resource_update_queue.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL ayerClient.h" 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL ayerClient.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
12 #include "webkit/compositor_bindings/web_layer_impl.h" 12 #include "webkit/compositor_bindings/web_layer_impl.h"
13 13
14 using namespace cc; 14 using cc::TextureLayer;
15 using cc::ResourceUpdateQueue;
15 16
16 namespace WebKit { 17 namespace webkit {
17 18
18 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( 19 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(
19 WebExternalTextureLayerClient* client) 20 WebKit::WebExternalTextureLayerClient* client)
20 : client_(client) { 21 : client_(client) {
21 scoped_refptr<TextureLayer> layer; 22 scoped_refptr<TextureLayer> layer;
22 if (client_) 23 if (client_)
23 layer = TextureLayer::Create(this); 24 layer = TextureLayer::Create(this);
24 else 25 else
25 layer = TextureLayer::Create(NULL); 26 layer = TextureLayer::Create(NULL);
26 layer->SetIsDrawable(true); 27 layer->SetIsDrawable(true);
27 layer_.reset(new WebLayerImpl(layer)); 28 layer_.reset(new WebLayerImpl(layer));
28 } 29 }
29 30
30 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { 31 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() {
31 static_cast<TextureLayer*>(layer_->layer())->ClearClient(); 32 static_cast<TextureLayer*>(layer_->layer())->ClearClient();
32 } 33 }
33 34
34 WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); } 35 WebKit::WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); }
35 36
36 void WebExternalTextureLayerImpl::setTextureId(unsigned id) { 37 void WebExternalTextureLayerImpl::setTextureId(unsigned id) {
37 static_cast<TextureLayer*>(layer_->layer())->SetTextureId(id); 38 static_cast<TextureLayer*>(layer_->layer())->SetTextureId(id);
38 } 39 }
39 40
40 void WebExternalTextureLayerImpl::setFlipped(bool flipped) { 41 void WebExternalTextureLayerImpl::setFlipped(bool flipped) {
41 static_cast<TextureLayer*>(layer_->layer())->SetFlipped(flipped); 42 static_cast<TextureLayer*>(layer_->layer())->SetFlipped(flipped);
42 } 43 }
43 44
44 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) { 45 void WebExternalTextureLayerImpl::setUVRect(const WebKit::WebFloatRect& rect) {
45 static_cast<TextureLayer*>(layer_->layer())->SetUV( 46 static_cast<TextureLayer*>(layer_->layer())->SetUV(
46 gfx::PointF(rect.x, rect.y), 47 gfx::PointF(rect.x, rect.y),
47 gfx::PointF(rect.x + rect.width, rect.y + rect.height)); 48 gfx::PointF(rect.x + rect.width, rect.y + rect.height));
48 } 49 }
49 50
50 void WebExternalTextureLayerImpl::setOpaque(bool opaque) { 51 void WebExternalTextureLayerImpl::setOpaque(bool opaque) {
51 static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque); 52 static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque);
52 } 53 }
53 54
54 void WebExternalTextureLayerImpl::setPremultipliedAlpha( 55 void WebExternalTextureLayerImpl::setPremultipliedAlpha(
55 bool premultiplied_alpha) { 56 bool premultiplied_alpha) {
56 static_cast<TextureLayer*>(layer_->layer())->SetPremultipliedAlpha( 57 static_cast<TextureLayer*>(layer_->layer())->SetPremultipliedAlpha(
57 premultiplied_alpha); 58 premultiplied_alpha);
58 } 59 }
59 60
60 void WebExternalTextureLayerImpl::willModifyTexture() { 61 void WebExternalTextureLayerImpl::willModifyTexture() {
61 static_cast<TextureLayer*>(layer_->layer())->WillModifyTexture(); 62 static_cast<TextureLayer*>(layer_->layer())->WillModifyTexture();
62 } 63 }
63 64
64 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { 65 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) {
65 static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); 66 static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit);
66 } 67 }
67 68
68 class WebTextureUpdaterImpl : public WebTextureUpdater { 69 class WebTextureUpdaterImpl : public WebKit::WebTextureUpdater {
69 public: 70 public:
70 explicit WebTextureUpdaterImpl(ResourceUpdateQueue& queue) : queue_(queue) {} 71 explicit WebTextureUpdaterImpl(ResourceUpdateQueue* queue) : queue_(queue) {}
71 72
72 virtual void appendCopy(unsigned source_texture, 73 virtual void appendCopy(unsigned source_texture,
73 unsigned destination_texture, 74 unsigned destination_texture,
74 WebSize size) OVERRIDE { 75 WebKit::WebSize size) OVERRIDE {
75 TextureCopier::Parameters copy = { source_texture, destination_texture, 76 cc::TextureCopier::Parameters copy = { source_texture, destination_texture,
76 size }; 77 size };
77 queue_.appendCopy(copy); 78 queue_->appendCopy(copy);
78 } 79 }
79 80
80 private: 81 private:
81 ResourceUpdateQueue& queue_; 82 ResourceUpdateQueue* queue_;
82 }; 83 };
83 84
84 unsigned WebExternalTextureLayerImpl::prepareTexture( 85 unsigned WebExternalTextureLayerImpl::prepareTexture(
85 ResourceUpdateQueue& queue) { 86 ResourceUpdateQueue& queue) {
86 DCHECK(client_); 87 DCHECK(client_);
87 WebTextureUpdaterImpl updater_impl(queue); 88 WebTextureUpdaterImpl updater_impl(&queue);
88 return client_->prepareTexture(updater_impl); 89 return client_->prepareTexture(updater_impl);
89 } 90 }
90 91
91 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() { 92 WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::context() {
92 DCHECK(client_); 93 DCHECK(client_);
93 return client_->context(); 94 return client_->context();
94 } 95 }
95 96
96 } // namespace WebKit 97 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698