diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-21 22:33:25 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-21 22:33:25 +0000 |
commit | d3407cdbb58dc92c9647837e67eaf523c286ece2 (patch) | |
tree | 316ee933dabcf190c6ac42eac2a2b28921a9e95c /ui/compositor | |
parent | bc2078352e4c69b1ac28d3c63bd39f5e6b38c776 (diff) | |
download | chromium_src-d3407cdbb58dc92c9647837e67eaf523c286ece2.zip chromium_src-d3407cdbb58dc92c9647837e67eaf523c286ece2.tar.gz chromium_src-d3407cdbb58dc92c9647837e67eaf523c286ece2.tar.bz2 |
Change the scale factor of texture_size from the layer's one to an estimation.
The phantom window appearing in a different DPI device could be wrongly scaled
without doing this, since the original texture is calculated in the original
DPI but rendered in another display.
BUG=145968
TEST=run chromeos-chrome with --aura-host-window-size='0+0-500x500,600+0-500x500*2' --force-compositing-mode on linux, open a web page, and drag the window across the screens.
Review URL: https://chromiumcodereview.appspot.com/10941017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor')
-rw-r--r-- | ui/compositor/compositor.cc | 5 | ||||
-rw-r--r-- | ui/compositor/compositor.h | 4 | ||||
-rw-r--r-- | ui/compositor/layer.cc | 8 |
3 files changed, 11 insertions, 6 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 03a9f2e..b284f7f 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -125,10 +125,11 @@ WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon( return context; } -Texture::Texture(bool flipped, const gfx::Size& size) +Texture::Texture(bool flipped, const gfx::Size& size, float device_scale_factor) : texture_id_(0), flipped_(flipped), - size_(size) { + size_(size), + device_scale_factor_(device_scale_factor) { } Texture::~Texture() { diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 8baada9..0f62979 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -94,12 +94,13 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { // to a layer. class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { public: - Texture(bool flipped, const gfx::Size& size); + Texture(bool flipped, const gfx::Size& size, float device_scale_factor); unsigned int texture_id() const { return texture_id_; } void set_texture_id(unsigned int id) { texture_id_ = id; } bool flipped() const { return flipped_; } gfx::Size size() const { return size_; } + float device_scale_factor() const { return device_scale_factor_; } virtual WebKit::WebGraphicsContext3D* HostContext3D() = 0; protected: @@ -111,6 +112,7 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { unsigned int texture_id_; bool flipped_; gfx::Size size_; // in pixel + float device_scale_factor_; DISALLOW_COPY_AND_ASSIGN(Texture); }; diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index 7e79649..c3856cc 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -749,10 +749,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 / texture_->device_scale_factor()); + } gfx::Size size(std::min(bounds().width(), texture_size.width()), std::min(bounds().height(), texture_size.height())); |