summaryrefslogtreecommitdiffstats
path: root/cc/layers/heads_up_display_layer.cc
diff options
context:
space:
mode:
authoregraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-04 14:22:43 +0000
committeregraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-04 14:22:43 +0000
commit97cd022eed90162aa4408632322d84d558c18f34 (patch)
tree552358c92453160b8f3bc403a85d22465adbc0a8 /cc/layers/heads_up_display_layer.cc
parentb8794a1aef3a5bf88c8a689af0782f084ba787bf (diff)
downloadchromium_src-97cd022eed90162aa4408632322d84d558c18f34.zip
chromium_src-97cd022eed90162aa4408632322d84d558c18f34.tar.gz
chromium_src-97cd022eed90162aa4408632322d84d558c18f34.tar.bz2
cc: Fix HudLayer is blurry on high-DPI screens
This change fixes the Hudlayer's resolution on high-DPI screens and refactors scaling of debug rects and widgets. BUG=256286 Review URL: https://chromiumcodereview.appspot.com/18348006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/heads_up_display_layer.cc')
-rw-r--r--cc/layers/heads_up_display_layer.cc38
1 files changed, 20 insertions, 18 deletions
diff --git a/cc/layers/heads_up_display_layer.cc b/cc/layers/heads_up_display_layer.cc
index 4d6351d..de44fac 100644
--- a/cc/layers/heads_up_display_layer.cc
+++ b/cc/layers/heads_up_display_layer.cc
@@ -16,7 +16,7 @@ scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() {
return make_scoped_refptr(new HeadsUpDisplayLayer());
}
-HeadsUpDisplayLayer::HeadsUpDisplayLayer() : Layer() {
+HeadsUpDisplayLayer::HeadsUpDisplayLayer() : ContentsScalingLayer() {
SetBounds(gfx::Size(256, 256));
}
@@ -24,34 +24,36 @@ HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {}
void HeadsUpDisplayLayer::Update(ResourceUpdateQueue*,
const OcclusionTracker*) {
- const LayerTreeDebugState& debug_state = layer_tree_host()->debug_state();
- int max_texture_size =
- layer_tree_host()->GetRendererCapabilities().max_texture_size;
+ gfx::Size device_viewport = layer_tree_host()->device_viewport_size();
+ float device_scale_factor = layer_tree_host()->device_scale_factor();
- int device_viewport_in_layout_pixels_width =
- layer_tree_host()->device_viewport_size().width() /
- layer_tree_host()->device_scale_factor();
- int device_viewport_in_layout_pixels_height =
- layer_tree_host()->device_viewport_size().height() /
- layer_tree_host()->device_scale_factor();
+ gfx::Size device_viewport_in_layout_pixels = gfx::Size(
+ device_viewport.width() / device_scale_factor,
+ device_viewport.height() / device_scale_factor);
gfx::Size bounds;
gfx::Transform matrix;
matrix.MakeIdentity();
- if (debug_state.ShowHudRects()) {
- int width =
- std::min(max_texture_size, device_viewport_in_layout_pixels_width);
- int height =
- std::min(max_texture_size, device_viewport_in_layout_pixels_height);
- bounds = gfx::Size(width, height);
+ if (layer_tree_host()->debug_state().ShowHudRects()) {
+ int max_texture_size =
+ layer_tree_host()->GetRendererCapabilities().max_texture_size;
+ bounds.SetSize(std::min(max_texture_size,
+ device_viewport_in_layout_pixels.width()),
+ std::min(max_texture_size,
+ device_viewport_in_layout_pixels.height()));
} else {
- bounds = gfx::Size(256, 256);
- matrix.Translate(device_viewport_in_layout_pixels_width - 256.0, 0.0);
+ int size = 256;
+ bounds.SetSize(size, size);
+ matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0);
}
SetBounds(bounds);
SetTransform(matrix);
+
+ // The HudLayer used to show up with the wrong bounds for one frame.
+ // This call fixes that the bounds get passed to LayerImpl on the next commit.
+ SavePaintProperties();
}
bool HeadsUpDisplayLayer::DrawsContent() const { return true; }