Index: cc/trees/layer_tree_host_unittest.cc |
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc |
index 6b572d3e028481589e2008d7c4a3950c0c3f3f83..daea323efb52dd7c552e40ab9817a5d54a32d1ff 100644 |
--- a/cc/trees/layer_tree_host_unittest.cc |
+++ b/cc/trees/layer_tree_host_unittest.cc |
@@ -6568,8 +6568,19 @@ class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { |
FakePictureLayer::Create(&client_); |
content_layer->AddChild(content_child_layer); |
+ std::unique_ptr<RecordingSource> recording_source = |
+ FakeRecordingSource::CreateFilledRecordingSource(gfx::Size(100, 100)); |
+ PaintFlags paint1, paint2; |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 0, 100, 90), paint1); |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 90, 100, 10), paint2); |
+ client_.set_fill_with_nonsolid_color(true); |
+ static_cast<FakeRecordingSource*>(recording_source.get())->Rerecord(); |
+ |
scoped_refptr<FakePictureLayer> mask_layer = |
- FakePictureLayer::Create(&client_); |
+ FakePictureLayer::CreateWithRecordingSource( |
+ &client_, std::move(recording_source)); |
content_layer->SetMaskLayer(mask_layer.get()); |
gfx::Size root_size(100, 100); |
@@ -6621,9 +6632,16 @@ class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { |
// coords in the mask are scaled by 10/50 and 20/50. |
// The surface is clipped to (20,10) so the mask texture coords are offset |
// by 20/50 and 10/50 |
- EXPECT_EQ(gfx::ScaleRect(gfx::RectF(20.f, 10.f, 10.f, 20.f), 1.f / 50.f) |
- .ToString(), |
- render_pass_quad->mask_uv_rect.ToString()); |
+ if (host_impl->settings().enable_mask_tiling) { |
enne (OOO)
2017/03/28 14:10:22
Hmm. What's the end state of mask tiling? I assu
sunxd
2017/03/29 16:00:24
The flag is going away once we fix the AA and filt
enne (OOO)
2017/03/29 16:07:25
Ok, then it sounds like we needs two kinds of test
sunxd
2017/03/30 13:56:37
I can, but the flag will go away shortly. Single t
sunxd
2017/04/04 13:58:04
As this change blocks AA patch, can I write the te
|
+ EXPECT_EQ( |
+ gfx::RectF(20.f / 128.f, 10.f / 128.f, 10.f / 128.f, 20.f / 128.f) |
enne (OOO)
2017/03/28 14:10:22
Where does 128 come from? I'm guessing that's roun
sunxd
2017/03/29 16:00:24
It's an unchecked round up with 64. While 64 is de
enne (OOO)
2017/03/29 16:07:25
Can you make this based on the resource size, or s
sunxd
2017/03/30 13:56:37
Done.
|
+ .ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } else { |
+ EXPECT_EQ(gfx::ScaleRect(gfx::RectF(20.f, 10.f, 10.f, 20.f), 1.f / 50.f) |
+ .ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } |
EndTest(); |
return draw_result; |
} |
@@ -6659,8 +6677,19 @@ class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { |
FakePictureLayer::Create(&client_); |
scaling_layer->AddChild(content_layer); |
+ std::unique_ptr<RecordingSource> recording_source = |
+ FakeRecordingSource::CreateFilledRecordingSource(gfx::Size(100, 100)); |
+ PaintFlags paint1, paint2; |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 0, 100, 10), paint1); |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 10, 100, 90), paint2); |
+ client_.set_fill_with_nonsolid_color(true); |
+ static_cast<FakeRecordingSource*>(recording_source.get())->Rerecord(); |
+ |
scoped_refptr<FakePictureLayer> mask_layer = |
- FakePictureLayer::Create(&client_); |
+ FakePictureLayer::CreateWithRecordingSource( |
+ &client_, std::move(recording_source)); |
content_layer->SetMaskLayer(mask_layer.get()); |
gfx::Size root_size(100, 100); |
@@ -6703,16 +6732,28 @@ class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { |
// mask, that should fully map onto the quad. |
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), |
render_pass_quad->rect.ToString()); |
- EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
- render_pass_quad->mask_uv_rect.ToString()); |
+ if (host_impl->settings().enable_mask_tiling) { |
+ EXPECT_EQ( |
+ gfx::RectF(0.f, 0.f, 100.f / 128.f, 100.f / 128.f).ToString(), |
enne (OOO)
2017/03/28 14:10:22
Are there any unit tests that have multiple mask t
sunxd
2017/03/29 16:00:24
I think this test is testing multiple tiles if the
enne (OOO)
2017/03/29 16:07:25
As I said above, can you make it work with both ki
sunxd
2017/03/30 13:56:37
Acknowledged.
|
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } else { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } |
break; |
case 1: |
// Applying a DSF should change the render surface size, but won't |
// affect which part of the mask is used. |
EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(), |
render_pass_quad->rect.ToString()); |
- EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
- render_pass_quad->mask_uv_rect.ToString()); |
+ if (host_impl->settings().enable_mask_tiling) { |
+ EXPECT_EQ( |
+ gfx::RectF(0.f, 0.f, 100.f / 128.f, 100.f / 128.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } else { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } |
EndTest(); |
break; |
} |
@@ -6748,8 +6789,19 @@ class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { |
FakePictureLayer::Create(&client_); |
root->AddChild(content_layer); |
+ std::unique_ptr<RecordingSource> recording_source = |
+ FakeRecordingSource::CreateFilledRecordingSource(gfx::Size(100, 100)); |
+ PaintFlags paint1, paint2; |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 0, 100, 90), paint1); |
+ static_cast<FakeRecordingSource*>(recording_source.get()) |
+ ->add_draw_rect_with_flags(gfx::Rect(0, 90, 100, 10), paint2); |
+ client_.set_fill_with_nonsolid_color(true); |
+ static_cast<FakeRecordingSource*>(recording_source.get())->Rerecord(); |
+ |
scoped_refptr<FakePictureLayer> mask_layer = |
- FakePictureLayer::Create(&client_); |
+ FakePictureLayer::CreateWithRecordingSource( |
+ &client_, std::move(recording_source)); |
content_layer->SetMaskLayer(mask_layer.get()); |
gfx::Size root_size(100, 100); |
@@ -6787,16 +6839,26 @@ class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { |
// Check that the mask fills the surface. |
EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), |
render_pass_quad->rect.ToString()); |
- EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
- render_pass_quad->mask_uv_rect.ToString()); |
+ if (host_impl->settings().enable_mask_tiling) { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 50.f / 128.f, 50.f / 128.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } else { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } |
break; |
case 1: |
// Applying a DSF should change the render surface size, but won't |
// affect which part of the mask is used. |
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), |
render_pass_quad->rect.ToString()); |
- EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
- render_pass_quad->mask_uv_rect.ToString()); |
+ if (host_impl->settings().enable_mask_tiling) { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 50.f / 128.f, 50.f / 128.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } else { |
+ EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
+ render_pass_quad->mask_uv_rect.ToString()); |
+ } |
EndTest(); |
break; |
} |