Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 2013723002: Consider ClipPathDisplayItems for GPU veto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test asserts Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/CachedDisplayItem.h" 9 #include "platform/graphics/paint/CachedDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathRecorder.h" 11 #include "platform/graphics/paint/ClipPathRecorder.h"
11 #include "platform/graphics/paint/ClipRecorder.h" 12 #include "platform/graphics/paint/ClipRecorder.h"
12 #include "platform/graphics/paint/DrawingDisplayItem.h" 13 #include "platform/graphics/paint/DrawingDisplayItem.h"
13 #include "platform/graphics/paint/DrawingRecorder.h" 14 #include "platform/graphics/paint/DrawingRecorder.h"
14 #include "platform/graphics/paint/SubsequenceRecorder.h" 15 #include "platform/graphics/paint/SubsequenceRecorder.h"
15 #include "platform/testing/FakeDisplayItemClient.h" 16 #include "platform/testing/FakeDisplayItemClient.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 drawPath(context, client, backgroundDrawingType, 50); 899 drawPath(context, client, backgroundDrawingType, 50);
899 } 900 }
900 getPaintController().commitNewDisplayItems(LayoutSize()); 901 getPaintController().commitNewDisplayItems(LayoutSize());
901 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRasterizat ion()); 902 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRasterizat ion());
902 903
903 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, con tainer)); 904 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, con tainer));
904 getPaintController().commitNewDisplayItems(LayoutSize()); 905 getPaintController().commitNewDisplayItems(LayoutSize());
905 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRasterizat ion()); 906 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRasterizat ion());
906 } 907 }
907 908
909 TEST_F(PaintControllerTest, IsNotSuitableForGpuRasterizationConcaveClipPath)
910 {
911 Path path;
912 path.addLineTo(FloatPoint(50, 50));
913 path.addLineTo(FloatPoint(100, 0));
914 path.addLineTo(FloatPoint(50, 100));
915 path.closeSubpath();
916
917 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
918 GraphicsContext context(getPaintController());
919
920 // Run twice for empty/non-empty m_currentPaintArtifact coverage.
921 for (int i = 0; i < 2; ++i) {
922 for (int j = 0; j < 50; ++j)
923 getPaintController().createAndAppend<BeginClipPathDisplayItem>(clien t, path);
924 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 10 0));
925 for (int j = 0; j < 50; ++j)
926 getPaintController().createAndAppend<EndClipPathDisplayItem>(client) ;
927 getPaintController().commitNewDisplayItems(LayoutSize());
928 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRaster ization());
929 }
930 }
931
908 } // namespace blink 932 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698