summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 22:24:30 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 22:24:30 +0000
commit04d5d437b616f94bc8afa9e382820f38864d4812 (patch)
treed1d4ac231556e3e8298310c85834b0e2f600640c /cc/trees
parent97a5a923999b5ada20c7d07e630f5235718a6641 (diff)
downloadchromium_src-04d5d437b616f94bc8afa9e382820f38864d4812.zip
chromium_src-04d5d437b616f94bc8afa9e382820f38864d4812.tar.gz
chromium_src-04d5d437b616f94bc8afa9e382820f38864d4812.tar.bz2
Invert DSF to map from delegated frame to layer space
The size of the frame data from a delegated source will not in general match up exactly with the delegated layer's bounds. Frame sizes and layer bounds are both expressed as integers, but frame sizes are in physical pixels and layer bounds are in device-independent pixels. If the device scale is not an integer, there may not be an exact mapping between the two spaces. For instance, if the layer size is 105 x 211 and the device scale is 1.5, the delegated content is responsible for filling 157.5 x 316.5 physical pixels in the final output. This isn't really possible so what actually happens is the delegated renderer produces a frame with a physical size of 158 x 317 pixels and sends that up to the DRLI. To map this frame into physical space, the DRLI should apply the inverse of the device scale factor to reflect that the frame covers 105.333 x 211.3333 logical pixels. Before this patch, DRLI would attempt to scale the frame by (105/158, 211/317) resulting in the frame being scaled down non-uniformly to try to make 158 x 317 pixels fit into a 157.5 x 316.6 space. This scaling looks bad and ends up mapping pixels partially outside of the layer's logical bounds into the layer's logical bounds. BUG=370074 Review URL: https://codereview.chromium.org/311253004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index abd5e4b..dfef15e 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -486,9 +486,8 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
CreateFrameData(gfx::Rect(0, 0, 20, 20), gfx::Rect(0, 0, 0, 0)));
break;
case 3:
- // Should create a total amount of gfx::Rect(2, 2, 10, 6) damage.
- // The frame size is 20x20 while the layer is 10x10, so this should
- // produce a gfx::Rect(1, 1, 5, 3) damage rect.
+ // Should create a total amount of gfx::Rect(2, 2, 8, 6) damage:
+ // (2, 2, 10, 6) clamped to the root output rect.
SetFrameData(
CreateFrameData(gfx::Rect(0, 0, 20, 20), gfx::Rect(2, 2, 5, 5)));
SetFrameData(
@@ -535,9 +534,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
gfx::Rect(4, 4, 1, 1)));
break;
case 13:
- // Should create gfx::Rect(1, 1, 2, 2) of damage. The frame size is
- // 5x5 and the display size is now set to 10x10, so this should result
- // in a gfx::Rect(2, 2, 4, 4) damage rect.
+ // Should create gfx::Rect(1, 1, 2, 2) of damage.
SetFrameData(
CreateFrameData(gfx::Rect(0, 0, 5, 5), gfx::Rect(1, 1, 2, 2)));
break;
@@ -583,6 +580,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
// ways.
SetFrameData(
CreateFrameData(gfx::Rect(0, 0, 10, 10), gfx::Rect(3, 3, 1, 1)));
+ break;
}
first_draw_for_source_frame_ = true;
}
@@ -616,7 +614,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
EXPECT_EQ(gfx::Rect(10, 10).ToString(), damage_rect.ToString());
break;
case 3:
- EXPECT_EQ(gfx::Rect(1, 1, 5, 3).ToString(), damage_rect.ToString());
+ EXPECT_EQ(gfx::Rect(2, 2, 8, 6).ToString(), damage_rect.ToString());
break;
case 4:
EXPECT_EQ(gfx::Rect().ToString(), damage_rect.ToString());
@@ -646,7 +644,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
EXPECT_EQ(gfx::Rect().ToString(), damage_rect.ToString());
break;
case 13:
- EXPECT_EQ(gfx::Rect(2, 2, 4, 4).ToString(), damage_rect.ToString());
+ EXPECT_EQ(gfx::Rect(1, 1, 2, 2).ToString(), damage_rect.ToString());
break;
case 14:
EXPECT_EQ(gfx::Rect().ToString(), damage_rect.ToString());