| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" | 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
| 10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
| (...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 SubsequenceRecorder r(context, container); | 2266 SubsequenceRecorder r(context, container); |
| 2267 DrawRect(context, content, kBackgroundDrawingType, | 2267 DrawRect(context, content, kBackgroundDrawingType, |
| 2268 FloatRect(100, 100, 300, 300)); | 2268 FloatRect(100, 100, 300, 300)); |
| 2269 } | 2269 } |
| 2270 GetPaintController().CommitNewDisplayItems(); | 2270 GetPaintController().CommitNewDisplayItems(); |
| 2271 | 2271 |
| 2272 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 2272 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 2273 DisplayItemClient::EndShouldKeepAliveAllClients(); | 2273 DisplayItemClient::EndShouldKeepAliveAllClients(); |
| 2274 #endif | 2274 #endif |
| 2275 } | 2275 } |
| 2276 |
| 2277 void TestFoldCompositingDrawingInSubsequence() { |
| 2278 FakeDisplayItemClient container("container"); |
| 2279 FakeDisplayItemClient content("content"); |
| 2280 GraphicsContext context(GetPaintController()); |
| 2281 |
| 2282 { |
| 2283 SubsequenceRecorder subsequence(context, container); |
| 2284 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); |
| 2285 DrawRect(context, content, kBackgroundDrawingType, |
| 2286 FloatRect(100, 100, 300, 300)); |
| 2287 } |
| 2288 GetPaintController().CommitNewDisplayItems(); |
| 2289 EXPECT_EQ( |
| 2290 1u, |
| 2291 GetPaintController().GetPaintArtifact().GetDisplayItemList().size()); |
| 2292 |
| 2293 { |
| 2294 EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( |
| 2295 context, container)); |
| 2296 SubsequenceRecorder subsequence(context, container); |
| 2297 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); |
| 2298 DrawRect(context, content, kBackgroundDrawingType, |
| 2299 FloatRect(100, 100, 300, 300)); |
| 2300 } |
| 2301 GetPaintController().CommitNewDisplayItems(); |
| 2302 EXPECT_EQ( |
| 2303 1u, |
| 2304 GetPaintController().GetPaintArtifact().GetDisplayItemList().size()); |
| 2305 |
| 2306 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 2307 DisplayItemClient::EndShouldKeepAliveAllClients(); |
| 2308 #endif |
| 2309 } |
| 2276 }; | 2310 }; |
| 2277 | 2311 |
| 2278 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { | 2312 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { |
| 2279 EXPECT_DEATH(TestChangeDrawing(), ""); | 2313 EXPECT_DEATH(TestChangeDrawing(), ""); |
| 2280 } | 2314 } |
| 2281 | 2315 |
| 2282 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { | 2316 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { |
| 2283 EXPECT_DEATH(TestMoreDrawing(), ""); | 2317 EXPECT_DEATH(TestMoreDrawing(), ""); |
| 2284 } | 2318 } |
| 2285 | 2319 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2315 EXPECT_DEATH(TestChangeNonCacheableInSubsequence(), ""); | 2349 EXPECT_DEATH(TestChangeNonCacheableInSubsequence(), ""); |
| 2316 } | 2350 } |
| 2317 | 2351 |
| 2318 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { | 2352 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { |
| 2319 // We allow invalidated display item clients as long as they would produce the | 2353 // We allow invalidated display item clients as long as they would produce the |
| 2320 // same display items. The cases of changed display items are tested by other | 2354 // same display items. The cases of changed display items are tested by other |
| 2321 // test cases. | 2355 // test cases. |
| 2322 TestInvalidationInSubsequence(); | 2356 TestInvalidationInSubsequence(); |
| 2323 } | 2357 } |
| 2324 | 2358 |
| 2359 TEST_F(PaintControllerUnderInvalidationTest, |
| 2360 FoldCompositingDrawingInSubsequence) { |
| 2361 TestFoldCompositingDrawingInSubsequence(); |
| 2362 } |
| 2363 |
| 2325 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2364 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
| 2326 | 2365 |
| 2327 } // namespace blink | 2366 } // namespace blink |
| OLD | NEW |