Index: ui/gfx/compositor/layer.cc |
diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc |
index 2220f82b6c8023a0640a47100e2ea41738185684..ff1eef675caf79979b45dbf8c2b86e6a66c8da1c 100644 |
--- a/ui/gfx/compositor/layer.cc |
+++ b/ui/gfx/compositor/layer.cc |
@@ -22,8 +22,6 @@ |
#include "ui/gfx/interpolated_transform.h" |
#include "ui/gfx/point3.h" |
-#include "ui/gfx/compositor/compositor_cc.h" |
- |
namespace { |
const float EPSILON = 1e-3f; |
@@ -222,17 +220,21 @@ void Layer::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
RecomputeDebugBorderColor(); |
} |
-void Layer::SetExternalTexture(ui::Texture* texture) { |
+void Layer::SetExternalTexture(Texture* texture) { |
layer_updated_externally_ = !!texture; |
texture_ = texture; |
if (web_layer_is_accelerated_ != layer_updated_externally_) { |
// Switch to a different type of layer. |
web_layer_.removeAllChildren(); |
WebKit::WebLayer new_layer; |
- if (layer_updated_externally_) |
- new_layer = WebKit::WebExternalTextureLayer::create(); |
- else |
+ if (layer_updated_externally_) { |
+ WebKit::WebExternalTextureLayer texture_layer = |
+ WebKit::WebExternalTextureLayer::create(); |
+ texture_layer.setFlipped(texture_->flipped()); |
+ new_layer = texture_layer; |
+ } else { |
new_layer = WebKit::WebContentLayer::create(this); |
+ } |
if (parent_) { |
DCHECK(!parent_->web_layer_.isNull()); |
parent_->web_layer_.replaceChild(web_layer_, new_layer); |
@@ -250,20 +252,9 @@ void Layer::SetExternalTexture(ui::Texture* texture) { |
RecomputeTransform(); |
RecomputeDebugBorderColor(); |
} |
- if (texture) { |
- TextureCC* texture_cc = static_cast<TextureCC*>(texture); |
- texture_cc->Update(); |
- WebKit::WebExternalTextureLayer texture_layer = |
- web_layer_.to<WebKit::WebExternalTextureLayer>(); |
- texture_layer.setFlipped(texture_cc->flipped()); |
- } |
RecomputeDrawsContentAndUVRect(); |
} |
-void Layer::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { |
- NOTREACHED(); |
-} |
- |
void Layer::SchedulePaint(const gfx::Rect& invalid_rect) { |
WebKit::WebFloatRect web_rect( |
invalid_rect.x(), |
@@ -467,18 +458,18 @@ void Layer::RecomputeDrawsContentAndUVRect() { |
web_layer_.setBounds(bounds_.size()); |
} else { |
DCHECK(texture_); |
- TextureCC* texture_cc = static_cast<TextureCC*>(texture_.get()); |
- unsigned int texture_id = texture_cc->texture_id(); |
+ unsigned int texture_id = texture_->texture_id(); |
WebKit::WebExternalTextureLayer texture_layer = |
web_layer_.to<WebKit::WebExternalTextureLayer>(); |
texture_layer.setTextureId(should_draw ? texture_id : 0); |
- gfx::Size size(std::min(bounds_.width(), texture_cc->size().width()), |
- std::min(bounds_.height(), texture_cc->size().height())); |
+ gfx::Size texture_size = texture_->size(); |
+ gfx::Size size(std::min(bounds_.width(), texture_size.width()), |
+ std::min(bounds_.height(), texture_size.height())); |
WebKit::WebFloatRect rect( |
0, |
0, |
- static_cast<float>(size.width())/texture_cc->size().width(), |
- static_cast<float>(size.height())/texture_cc->size().height()); |
+ static_cast<float>(size.width())/texture_size.width(), |
+ static_cast<float>(size.height())/texture_size.height()); |
texture_layer.setUVRect(rect); |
web_layer_.setBounds(size); |
} |