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 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 SubsequenceRecorder r(context, container); | 2221 SubsequenceRecorder r(context, container); |
2222 drawRect(context, content, backgroundDrawingType, | 2222 drawRect(context, content, backgroundDrawingType, |
2223 FloatRect(100, 100, 300, 300)); | 2223 FloatRect(100, 100, 300, 300)); |
2224 } | 2224 } |
2225 getPaintController().commitNewDisplayItems(); | 2225 getPaintController().commitNewDisplayItems(); |
2226 | 2226 |
2227 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 2227 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
2228 DisplayItemClient::endShouldKeepAliveAllClients(); | 2228 DisplayItemClient::endShouldKeepAliveAllClients(); |
2229 #endif | 2229 #endif |
2230 } | 2230 } |
2231 | |
2232 void testFoldCompositingDrawingInSubsequence() { | |
2233 FakeDisplayItemClient container("container"); | |
2234 FakeDisplayItemClient content("content"); | |
2235 GraphicsContext context(getPaintController()); | |
2236 | |
2237 { | |
2238 SubsequenceRecorder subsequence(context, container); | |
2239 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); | |
2240 drawRect(context, content, backgroundDrawingType, | |
2241 FloatRect(100, 100, 300, 300)); | |
2242 } | |
2243 getPaintController().commitNewDisplayItems(); | |
2244 EXPECT_EQ(3u, | |
2245 getPaintController().paintArtifact().getDisplayItemList().size()); | |
2246 | |
2247 { | |
2248 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | |
2249 context, container)); | |
2250 SubsequenceRecorder subsequence(context, container); | |
2251 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); | |
2252 drawRect(context, content, backgroundDrawingType, | |
2253 FloatRect(100, 100, 300, 300)); | |
2254 } | |
2255 getPaintController().commitNewDisplayItems(); | |
2256 EXPECT_EQ(3u, | |
2257 getPaintController().paintArtifact().getDisplayItemList().size()); | |
2258 | |
2259 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | |
2260 DisplayItemClient::endShouldKeepAliveAllClients(); | |
2261 #endif | |
2262 } | |
2263 }; | 2231 }; |
2264 | 2232 |
2265 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { | 2233 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { |
2266 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); | 2234 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); |
2267 } | 2235 } |
2268 | 2236 |
2269 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { | 2237 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { |
2270 EXPECT_DEATH(testMoreDrawing(), ""); | 2238 EXPECT_DEATH(testMoreDrawing(), ""); |
2271 } | 2239 } |
2272 | 2240 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 "under-invalidation: display item changed"); | 2275 "under-invalidation: display item changed"); |
2308 } | 2276 } |
2309 | 2277 |
2310 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { | 2278 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { |
2311 // We allow invalidated display item clients as long as they would produce the | 2279 // We allow invalidated display item clients as long as they would produce the |
2312 // same display items. The cases of changed display items are tested by other | 2280 // same display items. The cases of changed display items are tested by other |
2313 // test cases. | 2281 // test cases. |
2314 testInvalidationInSubsequence(); | 2282 testInvalidationInSubsequence(); |
2315 } | 2283 } |
2316 | 2284 |
2317 TEST_F(PaintControllerUnderInvalidationTest, | |
2318 FoldCompositingDrawingInSubsequence) { | |
2319 testFoldCompositingDrawingInSubsequence(); | |
2320 } | |
2321 | |
2322 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2285 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
2323 | 2286 |
2324 } // namespace blink | 2287 } // namespace blink |
OLD | NEW |