Commit b9c3e559 authored by piman@chromium.org's avatar piman@chromium.org

aura/cc: clip webkit layer size to external texture dimensions

This maps the behavior of the old compositor.

BUG=None
TEST=Resize window with accelerated content. Observe no "trailing" of the content on the borders.


Review URL: http://codereview.chromium.org/8590021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110512 0039d316-1c4b-4281-b951-d872f2087c98
parent 073fe690
...@@ -285,7 +285,6 @@ void Layer::SetExternalTexture(ui::Texture* texture) { ...@@ -285,7 +285,6 @@ void Layer::SetExternalTexture(ui::Texture* texture) {
web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
web_layer_.setOpaque(fills_bounds_opaquely_); web_layer_.setOpaque(fills_bounds_opaquely_);
web_layer_.setOpacity(visible_ ? opacity_ : 0.f); web_layer_.setOpacity(visible_ ? opacity_ : 0.f);
web_layer_.setBounds(bounds_.size());
RecomputeTransform(); RecomputeTransform();
} }
TextureCC* texture_cc = static_cast<TextureCC*>(texture); TextureCC* texture_cc = static_cast<TextureCC*>(texture);
...@@ -638,7 +637,6 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) { ...@@ -638,7 +637,6 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) {
SetNeedsToRecomputeHole(); SetNeedsToRecomputeHole();
#if defined(USE_WEBKIT_COMPOSITOR) #if defined(USE_WEBKIT_COMPOSITOR)
web_layer_.setBounds(bounds.size());
RecomputeTransform(); RecomputeTransform();
RecomputeDrawsContentAndUVRect(); RecomputeDrawsContentAndUVRect();
#endif #endif
...@@ -720,6 +718,7 @@ void Layer::RecomputeDrawsContentAndUVRect() { ...@@ -720,6 +718,7 @@ void Layer::RecomputeDrawsContentAndUVRect() {
!hole_rect_.Contains(gfx::Rect(gfx::Point(0, 0), bounds_.size())); !hole_rect_.Contains(gfx::Rect(gfx::Point(0, 0), bounds_.size()));
if (!web_layer_is_accelerated_) { if (!web_layer_is_accelerated_) {
web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw); web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw);
web_layer_.setBounds(bounds_.size());
} else { } else {
DCHECK(texture_); DCHECK(texture_);
TextureCC* texture_cc = static_cast<TextureCC*>(texture_.get()); TextureCC* texture_cc = static_cast<TextureCC*>(texture_.get());
...@@ -727,12 +726,15 @@ void Layer::RecomputeDrawsContentAndUVRect() { ...@@ -727,12 +726,15 @@ void Layer::RecomputeDrawsContentAndUVRect() {
WebKit::WebExternalTextureLayer texture_layer = WebKit::WebExternalTextureLayer texture_layer =
web_layer_.to<WebKit::WebExternalTextureLayer>(); web_layer_.to<WebKit::WebExternalTextureLayer>();
texture_layer.setTextureId(should_draw ? texture_id : 0); 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()));
WebKit::WebFloatRect rect( WebKit::WebFloatRect rect(
0, 0,
0, 0,
static_cast<float>(bounds_.width())/texture_cc->size().width(), static_cast<float>(size.width())/texture_cc->size().width(),
static_cast<float>(bounds_.height())/texture_cc->size().height()); static_cast<float>(size.height())/texture_cc->size().height());
texture_layer.setUVRect(rect); texture_layer.setUVRect(rect);
web_layer_.setBounds(size);
} }
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment