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

Unified Diff: ui/compositor/layer.cc

Issue 10941017: Change the scale factor of texture_size from the layer's one to an estimation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 71daa33f74c9af71352b6bd8f0ed44a8292b9412..104f79b7f2db3af537f18e1c51a8e7c633309705 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -751,10 +751,17 @@ 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 {
+ // Scale the texture's size but the layer's scale factor can be different
+ // from the one of the texture in some cases, such like phantom windows
+ // on a hi-DPI device while its original window is in a normal DPI. Thus
+ // estimate the scale factor from the size of the texture and the layer.
oshima 2012/09/18 21:20:45 can you update the comment to be more generic (wit
Jun Mukai 2012/09/19 19:26:56 Removed that part.
+ float scale_factor =
+ static_cast<float>(bounds().width()) / texture_->size().width();
+ texture_size = texture_->size().Scale(scale_factor);
+ }
gfx::Size size(std::min(bounds().width(), texture_size.width()),
std::min(bounds().height(), texture_size.height()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698