Chromium Code Reviews| Index: ui/compositor/layer.cc |
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
| index 7e7964900876cb70a32b835c53a83ef05d51e087..39c1ff47dede7f83d4649f95b4a54da3c8a8d5a4 100644 |
| --- a/ui/compositor/layer.cc |
| +++ b/ui/compositor/layer.cc |
| @@ -65,7 +65,8 @@ Layer::Layer() |
| delegate_(NULL), |
| web_layer_(NULL), |
| scale_content_(true), |
| - device_scale_factor_(1.0f) { |
| + device_scale_factor_(1.0f), |
| + device_scale_factor_for_texture_(1.0f) { |
| CreateWebLayer(); |
| } |
| @@ -87,7 +88,8 @@ Layer::Layer(LayerType type) |
| layer_mask_back_link_(NULL), |
| delegate_(NULL), |
| scale_content_(true), |
| - device_scale_factor_(1.0f) { |
| + device_scale_factor_(1.0f), |
| + device_scale_factor_for_texture_(1.0f) { |
| CreateWebLayer(); |
| } |
| @@ -378,6 +380,7 @@ void Layer::SetExternalTexture(Texture* texture) { |
| DCHECK_EQ(type_, LAYER_TEXTURED); |
| layer_updated_externally_ = !!texture; |
| texture_ = texture; |
| + device_scale_factor_for_texture_ = device_scale_factor_; |
|
piman
2012/09/20 23:20:07
mmh, that may solve the problem in a given case, b
Jun Mukai
2012/09/21 00:53:55
hmm, then added the device_scale_factor to ui::Tex
|
| if (web_layer_is_accelerated_ != layer_updated_externally_) { |
| // Switch to a different type of layer. |
| web_layer_->removeAllChildren(); |
| @@ -749,10 +752,12 @@ void Layer::RecomputeDrawsContentAndUVRect() { |
| DCHECK(texture_); |
| gfx::Size texture_size; |
| - if (scale_content_) |
| + if (scale_content_) { |
| texture_size = texture_->size(); |
| - else |
| - texture_size = ConvertSizeToDIP(this, texture_->size()); |
| + } else { |
| + texture_size = |
| + texture_->size().Scale(1.0f / device_scale_factor_for_texture_); |
| + } |
| gfx::Size size(std::min(bounds().width(), texture_size.width()), |
| std::min(bounds().height(), texture_size.height())); |