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

Unified Diff: ui/gfx/compositor/layer.cc

Issue 8536005: aura/cc: Fix accelerated content size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/compositor/layer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/layer.cc
diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc
index 2b98d44e7a61015df987bcbf31fb4d9513761a49..d62c27de6b11a50c836a69306ab5a1ad34a70c61 100644
--- a/ui/gfx/compositor/layer.cc
+++ b/ui/gfx/compositor/layer.cc
@@ -279,9 +279,10 @@ void Layer::SetExternalTexture(ui::Texture* texture) {
}
TextureCC* texture_cc = static_cast<TextureCC*>(texture);
texture_cc->Update();
- web_layer_.to<WebKit::WebExternalTextureLayer>().setFlipped(
- texture_cc->flipped());
- RecomputeDrawsContent();
+ WebKit::WebExternalTextureLayer texture_layer =
+ web_layer_.to<WebKit::WebExternalTextureLayer>();
+ texture_layer.setFlipped(texture_cc->flipped());
+ RecomputeDrawsContentAndUVRect();
#endif
}
@@ -477,7 +478,7 @@ void Layer::RecomputeHole() {
texture_ = NULL;
#if defined(USE_WEBKIT_COMPOSITOR)
- RecomputeDrawsContent();
+ RecomputeDrawsContentAndUVRect();
#endif
}
@@ -578,7 +579,7 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) {
#if defined(USE_WEBKIT_COMPOSITOR)
web_layer_.setBounds(bounds.size());
RecomputeTransform();
- RecomputeDrawsContent();
+ RecomputeDrawsContentAndUVRect();
#endif
}
@@ -655,7 +656,7 @@ void Layer::CreateWebLayer() {
web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
web_layer_.setOpaque(true);
web_layer_is_accelerated_ = false;
- RecomputeDrawsContent();
+ RecomputeDrawsContentAndUVRect();
}
void Layer::RecomputeTransform() {
@@ -664,7 +665,7 @@ void Layer::RecomputeTransform() {
web_layer_.setTransform(transform.matrix());
}
-void Layer::RecomputeDrawsContent() {
+void Layer::RecomputeDrawsContentAndUVRect() {
DCHECK(!web_layer_.isNull());
bool should_draw = type_ == LAYER_HAS_TEXTURE &&
!hole_rect_.Contains(gfx::Rect(gfx::Point(0, 0), bounds_.size()));
@@ -672,14 +673,17 @@ void Layer::RecomputeDrawsContent() {
web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw);
} else {
DCHECK(texture_);
-#if defined(USE_WEBKIT_COMPOSITOR)
- unsigned int texture_id =
- static_cast<TextureCC*>(texture_.get())->texture_id();
-#else
- unsigned int texture_id = 0;
-#endif
- web_layer_.to<WebKit::WebExternalTextureLayer>().setTextureId(
- should_draw ? texture_id : 0);
+ TextureCC* texture_cc = static_cast<TextureCC*>(texture_.get());
+ unsigned int texture_id = texture_cc->texture_id();
+ WebKit::WebExternalTextureLayer texture_layer =
+ web_layer_.to<WebKit::WebExternalTextureLayer>();
+ texture_layer.setTextureId(should_draw ? texture_id : 0);
+ WebKit::WebFloatRect rect(
+ 0,
+ 0,
+ static_cast<float>(bounds_.width())/texture_cc->size().width(),
+ static_cast<float>(bounds_.height())/texture_cc->size().height());
+ texture_layer.setUVRect(rect);
}
}
#endif
« no previous file with comments | « ui/gfx/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698