summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/browser_plugin/browser_plugin.cc3
-rw-r--r--content/renderer/browser_plugin/browser_plugin_compositing_helper.cc14
-rw-r--r--content/renderer/browser_plugin/browser_plugin_compositing_helper.h3
3 files changed, 16 insertions, 4 deletions
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 573ff76..0f86211 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -405,7 +405,8 @@ void BrowserPlugin::OnBuffersSwapped(int instance_id,
compositing_helper_->OnBuffersSwapped(size,
mailbox_name,
gpu_route_id,
- gpu_host_id);
+ gpu_host_id,
+ GetDeviceScaleFactor());
}
void BrowserPlugin::OnGuestContentWindowReady(int instance_id,
diff --git a/content/renderer/browser_plugin/browser_plugin_compositing_helper.cc b/content/renderer/browser_plugin/browser_plugin_compositing_helper.cc
index 7c14969..597e218 100644
--- a/content/renderer/browser_plugin/browser_plugin_compositing_helper.cc
+++ b/content/renderer/browser_plugin/browser_plugin_compositing_helper.cc
@@ -152,7 +152,8 @@ void BrowserPluginCompositingHelper::OnBuffersSwapped(
const gfx::Size& size,
const std::string& mailbox_name,
int gpu_route_id,
- int gpu_host_id) {
+ int gpu_host_id,
+ float device_scale_factor) {
// If the guest crashed but the GPU process didn't, we may still have
// a transport surface waiting on an ACK, which we must send to
// avoid leaking.
@@ -188,7 +189,16 @@ void BrowserPluginCompositingHelper::OnBuffersSwapped(
// or introduce a gutter around it.
if (buffer_size_ != size) {
buffer_size_ = size;
- texture_layer_->setBounds(buffer_size_);
+ // The container size is in DIP, so is the layer size.
+ // Buffer size is in physical pixels, so we need to adjust
+ // it by the device scale factor.
+ float inverse_scale_factor = 1.0f / device_scale_factor;
+ gfx::SizeF scaledSize(size);
+ scaledSize.Scale(inverse_scale_factor);
+ gfx::Size device_scale_adjusted_size(
+ static_cast<int>(scaledSize.width()),
+ static_cast<int>(scaledSize.height()));
+ texture_layer_->setBounds(device_scale_adjusted_size);
}
bool current_mailbox_valid = !mailbox_name.empty();
diff --git a/content/renderer/browser_plugin/browser_plugin_compositing_helper.h b/content/renderer/browser_plugin/browser_plugin_compositing_helper.h
index a11956d..998b739 100644
--- a/content/renderer/browser_plugin/browser_plugin_compositing_helper.h
+++ b/content/renderer/browser_plugin/browser_plugin_compositing_helper.h
@@ -38,7 +38,8 @@ class CONTENT_EXPORT BrowserPluginCompositingHelper :
void OnBuffersSwapped(const gfx::Size& size,
const std::string& mailbox_name,
int gpu_route_id,
- int gpu_host_id);
+ int gpu_host_id,
+ float device_scale_factor);
void UpdateVisibility(bool);
protected:
// Friend RefCounted so that the dtor can be non-public.