| 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 } | |
| 2310 }; | 2276 }; |
| 2311 | 2277 |
| 2312 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { | 2278 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { |
| 2313 EXPECT_DEATH(TestChangeDrawing(), ""); | 2279 EXPECT_DEATH(TestChangeDrawing(), ""); |
| 2314 } | 2280 } |
| 2315 | 2281 |
| 2316 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { | 2282 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { |
| 2317 EXPECT_DEATH(TestMoreDrawing(), ""); | 2283 EXPECT_DEATH(TestMoreDrawing(), ""); |
| 2318 } | 2284 } |
| 2319 | 2285 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2349 EXPECT_DEATH(TestChangeNonCacheableInSubsequence(), ""); | 2315 EXPECT_DEATH(TestChangeNonCacheableInSubsequence(), ""); |
| 2350 } | 2316 } |
| 2351 | 2317 |
| 2352 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { | 2318 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { |
| 2353 // We allow invalidated display item clients as long as they would produce the | 2319 // We allow invalidated display item clients as long as they would produce the |
| 2354 // same display items. The cases of changed display items are tested by other | 2320 // same display items. The cases of changed display items are tested by other |
| 2355 // test cases. | 2321 // test cases. |
| 2356 TestInvalidationInSubsequence(); | 2322 TestInvalidationInSubsequence(); |
| 2357 } | 2323 } |
| 2358 | 2324 |
| 2359 TEST_F(PaintControllerUnderInvalidationTest, | |
| 2360 FoldCompositingDrawingInSubsequence) { | |
| 2361 TestFoldCompositingDrawingInSubsequence(); | |
| 2362 } | |
| 2363 | |
| 2364 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2325 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
| 2365 | 2326 |
| 2366 } // namespace blink | 2327 } // namespace blink |
| OLD | NEW |