OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 this->resource_provider_->SetPixels( | 1216 this->resource_provider_->SetPixels( |
1217 mask_resource_id, | 1217 mask_resource_id, |
1218 reinterpret_cast<uint8_t*>(bitmap.getPixels()), | 1218 reinterpret_cast<uint8_t*>(bitmap.getPixels()), |
1219 mask_rect, | 1219 mask_rect, |
1220 mask_rect, | 1220 mask_rect, |
1221 gfx::Vector2d()); | 1221 gfx::Vector2d()); |
1222 } | 1222 } |
1223 | 1223 |
1224 // This RenderPassDrawQuad does not include the full |viewport_rect| which is | 1224 // This RenderPassDrawQuad does not include the full |viewport_rect| which is |
1225 // the size of the child render pass. | 1225 // the size of the child render pass. |
1226 gfx::Rect sub_rect = gfx::Rect(50, 50, 100, 100); | 1226 gfx::Rect sub_rect = gfx::Rect(50, 50, 200, 100); |
1227 EXPECT_NE(sub_rect.x(), child_pass->output_rect.x()); | 1227 EXPECT_NE(sub_rect.x(), child_pass->output_rect.x()); |
1228 EXPECT_NE(sub_rect.y(), child_pass->output_rect.y()); | 1228 EXPECT_NE(sub_rect.y(), child_pass->output_rect.y()); |
1229 EXPECT_NE(sub_rect.right(), child_pass->output_rect.right()); | 1229 EXPECT_NE(sub_rect.right(), child_pass->output_rect.right()); |
1230 EXPECT_NE(sub_rect.bottom(), child_pass->output_rect.bottom()); | 1230 EXPECT_NE(sub_rect.bottom(), child_pass->output_rect.bottom()); |
1231 EXPECT_TRUE(child_pass->output_rect.Contains(sub_rect)); | |
1232 | 1231 |
1233 // Set up a mask on the RenderPassDrawQuad. | 1232 // Set up a mask on the RenderPassDrawQuad. |
1234 RenderPassDrawQuad* mask_quad = | 1233 RenderPassDrawQuad* mask_quad = |
1235 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 1234 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
1236 mask_quad->SetNew(root_pass_shared_state, | 1235 mask_quad->SetNew(root_pass_shared_state, |
1237 sub_rect, | 1236 sub_rect, |
1238 sub_rect, | 1237 sub_rect, |
1239 child_pass_id, | 1238 child_pass_id, |
1240 mask_resource_id, | 1239 mask_resource_id, |
1241 gfx::RectF(1.f, 1.f), // mask_uv_rect | 1240 gfx::RectF(0.5f, 0.5f, 2.f, 1.f), // mask_uv_rect |
1242 FilterOperations(), // foreground filters | 1241 FilterOperations(), // foreground filters |
1243 gfx::Vector2dF(), // filters scale | 1242 gfx::Vector2dF(), // filters scale |
1244 FilterOperations()); // background filters | 1243 FilterOperations()); // background filters |
1245 | 1244 |
1246 // White background behind the masked render pass. | 1245 // White background behind the masked render pass. |
1247 SolidColorDrawQuad* white = | 1246 SolidColorDrawQuad* white = |
1248 root_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 1247 root_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
1249 white->SetNew(root_pass_shared_state, | 1248 white->SetNew(root_pass_shared_state, |
1250 viewport_rect, | 1249 viewport_rect, |
1251 viewport_rect, | 1250 viewport_rect, |
1252 SK_ColorWHITE, | 1251 SK_ColorWHITE, |
1253 false); | 1252 false); |
1254 | 1253 |
1255 RenderPassList pass_list; | 1254 RenderPassList pass_list; |
1256 pass_list.push_back(child_pass.Pass()); | 1255 pass_list.push_back(child_pass.Pass()); |
1257 pass_list.push_back(root_pass.Pass()); | 1256 pass_list.push_back(root_pass.Pass()); |
1258 | 1257 |
1259 EXPECT_TRUE(this->RunPixelTest( | 1258 EXPECT_TRUE(this->RunPixelTest( |
1260 &pass_list, | 1259 &pass_list, |
1261 base::FilePath(FILE_PATH_LITERAL("image_mask_of_layer.png")), | 1260 base::FilePath(FILE_PATH_LITERAL("mask_bottom_right.png")), |
1262 ExactPixelComparator(true))); | 1261 ExactPixelComparator(true))); |
1263 } | 1262 } |
1264 | 1263 |
1265 template <typename RendererType> | 1264 template <typename RendererType> |
1266 class RendererPixelTestWithBackgroundFilter | 1265 class RendererPixelTestWithBackgroundFilter |
1267 : public RendererPixelTest<RendererType> { | 1266 : public RendererPixelTest<RendererType> { |
1268 protected: | 1267 protected: |
1269 void SetUpRenderPassList() { | 1268 void SetUpRenderPassList() { |
1270 gfx::Rect device_viewport_rect(this->device_viewport_size_); | 1269 gfx::Rect device_viewport_rect(this->device_viewport_size_); |
1271 | 1270 |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 EXPECT_TRUE(this->RunPixelTest( | 2200 EXPECT_TRUE(this->RunPixelTest( |
2202 &pass_list, | 2201 &pass_list, |
2203 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2202 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
2204 FuzzyPixelOffByOneComparator(true))); | 2203 FuzzyPixelOffByOneComparator(true))); |
2205 } | 2204 } |
2206 | 2205 |
2207 #endif // !defined(OS_ANDROID) | 2206 #endif // !defined(OS_ANDROID) |
2208 | 2207 |
2209 } // namespace | 2208 } // namespace |
2210 } // namespace cc | 2209 } // namespace cc |
OLD | NEW |