Commit 16684158 authored by aelias@chromium.org's avatar aelias@chromium.org

Clobber frame_data->device_scale_factor to 1 on Android.

On Android, the browser compositor lies to CC about the
device_scale_factor (always setting it to 1), because it places its
layers in physical pixel space.  Because of that, the delegated device
scale inversion added in https://codereview.chromium.org/311253004 does
the wrong thing.  Rather than cancelling the inversion with other
transforms, the simplest fix is to lie about the frame_data
device_scale_factor as well.

BUG=383572,383436,384134
NOTRY=true

Review URL: https://codereview.chromium.org/336433003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276882 0039d316-1c4b-4281-b951-d872f2087c98
parent 255d4a9c
......@@ -154,6 +154,13 @@ bool HardwareRenderer::DrawGL(bool stencil_enabled,
DCHECK(!input->frame.gl_frame_data);
DCHECK(!input->frame.software_frame_data);
// DelegatedRendererLayerImpl applies the inverse device_scale_factor of the
// renderer frame, assuming that the browser compositor will scale
// it back up to device scale. But on Android we put our browser layers in
// physical pixels and set our browser CC device_scale_factor to 1, so this
// suppresses the transform.
input->frame.delegated_frame_data->device_scale_factor = 1.0f;
bool size_changed =
input->width != view_width_ || input->height != view_height_;
view_width_ = input->width;
......
......@@ -683,9 +683,6 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
delegated_layer->SetHideLayerAndSubtree(true);
delegated_layer->SetIsDrawable(true);
delegated_layer->SetContentsOpaque(true);
gfx::Transform layer_scale(
device_scale_factor, 0.f, 0.f, device_scale_factor, 0.f, 0.f);
delegated_layer->SetTransform(layer_scale);
compositor->AttachLayerForReadback(delegated_layer);
readback_layer = delegated_layer;
......@@ -785,6 +782,14 @@ void RenderWidgetHostViewAndroid::SwapDelegatedFrame(
last_output_surface_id_ = output_surface_id;
}
// DelegatedRendererLayerImpl applies the inverse device_scale_factor of the
// renderer frame, assuming that the browser compositor will scale
// it back up to device scale. But on Android we put our browser layers in
// physical pixels and set our browser CC device_scale_factor to 1, so this
// suppresses the transform. This line may need to be removed when fixing
// http://crbug.com/384134 or http://crbug.com/310763
frame_data->device_scale_factor = 1.0f;
if (!has_content) {
DestroyDelegatedContent();
} else {
......@@ -809,19 +814,6 @@ void RenderWidgetHostViewAndroid::SwapDelegatedFrame(
layer_->SetContentsOpaque(true);
layer_->SetBounds(content_size_in_layer_);
layer_->SetNeedsDisplay();
// DelegatedRendererLayer scales the frame data from physical space to DIPs
// by inverting the frame's device scale factor, assuming that the browser
// compositor will map from DIPs back to physical pixels using its own
// device scale factor. However, the Android browser compositor always uses
// a device scale factor of 1.0, so we have to transform the delegated
// layer by the device scale to get it into the same physical pixel space as
// the rest of the UI.
const gfx::Display& display =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
float device_scale_factor = display.device_scale_factor();
gfx::Transform layer_scale(
device_scale_factor, 0.f, 0.f, device_scale_factor, 0.f, 0.f);
layer_->SetTransform(layer_scale);
}
base::Closure ack_callback =
......
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