| 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 "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/resource_update_queue.h" | 7 #include "cc/resource_update_queue.h" |
| 8 #include "cc/texture_layer.h" | 8 #include "cc/texture_layer.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 namespace cc; |
| 15 | 15 |
| 16 namespace WebKit { | 16 namespace WebKit { |
| 17 | 17 |
| 18 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( | 18 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( |
| 19 WebExternalTextureLayerClient* client) | 19 WebExternalTextureLayerClient* client) |
| 20 : client_(client) { | 20 : client_(client) { |
| 21 scoped_refptr<TextureLayer> layer; | 21 scoped_refptr<TextureLayer> layer; |
| 22 if (client_) | 22 if (client_) |
| 23 layer = TextureLayer::create(this); | 23 layer = TextureLayer::Create(this); |
| 24 else | 24 else |
| 25 layer = TextureLayer::create(0); | 25 layer = TextureLayer::Create(NULL); |
| 26 layer->setIsDrawable(true); | 26 layer->SetIsDrawable(true); |
| 27 layer_.reset(new WebLayerImpl(layer)); | 27 layer_.reset(new WebLayerImpl(layer)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { | 30 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { |
| 31 static_cast<TextureLayer*>(layer_->layer())->clearClient(); | 31 static_cast<TextureLayer*>(layer_->layer())->clearClient(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); } | 34 WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); } |
| 35 | 35 |
| 36 void WebExternalTextureLayerImpl::setTextureId(unsigned id) { | 36 void WebExternalTextureLayerImpl::setTextureId(unsigned id) { |
| 37 static_cast<TextureLayer*>(layer_->layer())->setTextureId(id); | 37 static_cast<TextureLayer*>(layer_->layer())->setTextureId(id); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void WebExternalTextureLayerImpl::setFlipped(bool flipped) { | 40 void WebExternalTextureLayerImpl::setFlipped(bool flipped) { |
| 41 static_cast<TextureLayer*>(layer_->layer())->setFlipped(flipped); | 41 static_cast<TextureLayer*>(layer_->layer())->setFlipped(flipped); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) { | 44 void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) { |
| 45 static_cast<TextureLayer*>(layer_->layer()) | 45 static_cast<TextureLayer*>(layer_->layer()) |
| 46 ->setUV(gfx::PointF(rect.x, rect.y), | 46 ->setUV(gfx::PointF(rect.x, rect.y), |
| 47 gfx::PointF(rect.x + rect.width, rect.y + rect.height)); | 47 gfx::PointF(rect.x + rect.width, rect.y + rect.height)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void WebExternalTextureLayerImpl::setOpaque(bool opaque) { | 50 void WebExternalTextureLayerImpl::setOpaque(bool opaque) { |
| 51 static_cast<TextureLayer*>(layer_->layer())->setContentsOpaque(opaque); | 51 static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void WebExternalTextureLayerImpl::setPremultipliedAlpha( | 54 void WebExternalTextureLayerImpl::setPremultipliedAlpha( |
| 55 bool premultiplied_alpha) { | 55 bool premultiplied_alpha) { |
| 56 static_cast<TextureLayer*>(layer_->layer()) | 56 static_cast<TextureLayer*>(layer_->layer()) |
| 57 ->setPremultipliedAlpha(premultiplied_alpha); | 57 ->setPremultipliedAlpha(premultiplied_alpha); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WebExternalTextureLayerImpl::willModifyTexture() { | 60 void WebExternalTextureLayerImpl::willModifyTexture() { |
| 61 static_cast<TextureLayer*>(layer_->layer())->willModifyTexture(); | 61 static_cast<TextureLayer*>(layer_->layer())->willModifyTexture(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 WebTextureUpdaterImpl updater_impl(queue); | 87 WebTextureUpdaterImpl updater_impl(queue); |
| 88 return client_->prepareTexture(updater_impl); | 88 return client_->prepareTexture(updater_impl); |
| 89 } | 89 } |
| 90 | 90 |
| 91 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() { | 91 WebGraphicsContext3D* WebExternalTextureLayerImpl::context() { |
| 92 DCHECK(client_); | 92 DCHECK(client_); |
| 93 return client_->context(); | 93 return client_->context(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace WebKit | 96 } // namespace WebKit |
| OLD | NEW |