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

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

Issue 1407543003: Preliminary paint property walk implementation for SPv2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert forAllFrameViews change in FrameView.cpp. I don't know what I was thinking. Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "platform/graphics/paint/PaintChunker.h" 6 #include "platform/graphics/paint/PaintChunker.h"
7 7
8 #include "platform/RuntimeEnabledFeatures.h" 8 #include "platform/RuntimeEnabledFeatures.h"
9 #include <gmock/gmock.h> 9 #include <gmock/gmock.h>
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 TEST_F(PaintChunkerTest, BuildMultipleChunksWithSinglePropertyChanging) 81 TEST_F(PaintChunkerTest, BuildMultipleChunksWithSinglePropertyChanging)
82 { 82 {
83 PaintChunker chunker; 83 PaintChunker chunker;
84 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties()); 84 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties());
85 chunker.incrementDisplayItemIndex(); 85 chunker.incrementDisplayItemIndex();
86 chunker.incrementDisplayItemIndex(); 86 chunker.incrementDisplayItemIndex();
87 87
88 PaintChunkProperties simpleTransform; 88 PaintChunkProperties simpleTransform;
89 simpleTransform.transform = adoptRef(new TransformPaintPropertyNode(Transfor mationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7))); 89 simpleTransform.transform = TransformPaintPropertyNode::create(Transformatio nMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
90 90
91 chunker.updateCurrentPaintChunkProperties(simpleTransform); 91 chunker.updateCurrentPaintChunkProperties(simpleTransform);
92 chunker.incrementDisplayItemIndex(); 92 chunker.incrementDisplayItemIndex();
93 93
94 PaintChunkProperties anotherTransform; 94 PaintChunkProperties anotherTransform;
95 anotherTransform.transform = adoptRef(new TransformPaintPropertyNode(Transfo rmationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7))); 95 anotherTransform.transform = TransformPaintPropertyNode::create(Transformati onMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
96 chunker.updateCurrentPaintChunkProperties(anotherTransform); 96 chunker.updateCurrentPaintChunkProperties(anotherTransform);
97 chunker.incrementDisplayItemIndex(); 97 chunker.incrementDisplayItemIndex();
98 98
99 Vector<PaintChunk> chunks = chunker.releasePaintChunks(); 99 Vector<PaintChunk> chunks = chunker.releasePaintChunks();
100 100
101 EXPECT_THAT(chunks, ElementsAre( 101 EXPECT_THAT(chunks, ElementsAre(
102 PaintChunk(0, 2, rootPaintChunkProperties()), 102 PaintChunk(0, 2, rootPaintChunkProperties()),
103 PaintChunk(2, 3, simpleTransform), 103 PaintChunk(2, 3, simpleTransform),
104 PaintChunk(3, 4, anotherTransform))); 104 PaintChunk(3, 4, anotherTransform)));
105 } 105 }
106 106
107 TEST_F(PaintChunkerTest, BuildLinearChunksFromNestedTransforms) 107 TEST_F(PaintChunkerTest, BuildLinearChunksFromNestedTransforms)
108 { 108 {
109 // Test that "nested" transforms linearize using the following 109 // Test that "nested" transforms linearize using the following
110 // sequence of transforms and display items: 110 // sequence of transforms and display items:
111 // <root xform>, <paint>, <a xform>, <paint>, <paint>, </a xform>, <paint>, </root xform> 111 // <root xform>, <paint>, <a xform>, <paint>, <paint>, </a xform>, <paint>, </root xform>
112 PaintChunker chunker; 112 PaintChunker chunker;
113 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties()); 113 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties());
114 chunker.incrementDisplayItemIndex(); 114 chunker.incrementDisplayItemIndex();
115 115
116 PaintChunkProperties simpleTransform; 116 PaintChunkProperties simpleTransform;
117 simpleTransform.transform = adoptRef(new TransformPaintPropertyNode(Transfor mationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7))); 117 simpleTransform.transform = TransformPaintPropertyNode::create(Transformatio nMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
118 chunker.updateCurrentPaintChunkProperties(simpleTransform); 118 chunker.updateCurrentPaintChunkProperties(simpleTransform);
119 chunker.incrementDisplayItemIndex(); 119 chunker.incrementDisplayItemIndex();
120 chunker.incrementDisplayItemIndex(); 120 chunker.incrementDisplayItemIndex();
121 121
122 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties()); 122 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties());
123 chunker.incrementDisplayItemIndex(); 123 chunker.incrementDisplayItemIndex();
124 124
125 Vector<PaintChunk> chunks = chunker.releasePaintChunks(); 125 Vector<PaintChunk> chunks = chunker.releasePaintChunks();
126 126
127 EXPECT_THAT(chunks, ElementsAre( 127 EXPECT_THAT(chunks, ElementsAre(
128 PaintChunk(0, 1, rootPaintChunkProperties()), 128 PaintChunk(0, 1, rootPaintChunkProperties()),
129 PaintChunk(1, 3, simpleTransform), 129 PaintChunk(1, 3, simpleTransform),
130 PaintChunk(3, 4, rootPaintChunkProperties()))); 130 PaintChunk(3, 4, rootPaintChunkProperties())));
131 } 131 }
132 132
133 TEST_F(PaintChunkerTest, ChangingPropertiesWithoutItems) 133 TEST_F(PaintChunkerTest, ChangingPropertiesWithoutItems)
134 { 134 {
135 // Test that properties can change without display items being generated. 135 // Test that properties can change without display items being generated.
136 PaintChunker chunker; 136 PaintChunker chunker;
137 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties()); 137 chunker.updateCurrentPaintChunkProperties(rootPaintChunkProperties());
138 chunker.incrementDisplayItemIndex(); 138 chunker.incrementDisplayItemIndex();
139 139
140 PaintChunkProperties firstTransform; 140 PaintChunkProperties firstTransform;
141 firstTransform.transform = adoptRef(new TransformPaintPropertyNode(Transform ationMatrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7))); 141 firstTransform.transform = TransformPaintPropertyNode::create(Transformation Matrix(0, 1, 2, 3, 4, 5), FloatPoint3D(9, 8, 7));
142 chunker.updateCurrentPaintChunkProperties(firstTransform); 142 chunker.updateCurrentPaintChunkProperties(firstTransform);
143 143
144 PaintChunkProperties secondTransform; 144 PaintChunkProperties secondTransform;
145 secondTransform.transform = adoptRef(new TransformPaintPropertyNode(Transfor mationMatrix(9, 8, 7, 6, 5, 4), FloatPoint3D(3, 2, 1))); 145 secondTransform.transform = TransformPaintPropertyNode::create(Transformatio nMatrix(9, 8, 7, 6, 5, 4), FloatPoint3D(3, 2, 1));
146 chunker.updateCurrentPaintChunkProperties(secondTransform); 146 chunker.updateCurrentPaintChunkProperties(secondTransform);
147 147
148 chunker.incrementDisplayItemIndex(); 148 chunker.incrementDisplayItemIndex();
149 Vector<PaintChunk> chunks = chunker.releasePaintChunks(); 149 Vector<PaintChunk> chunks = chunker.releasePaintChunks();
150 150
151 EXPECT_THAT(chunks, ElementsAre( 151 EXPECT_THAT(chunks, ElementsAre(
152 PaintChunk(0, 1, rootPaintChunkProperties()), 152 PaintChunk(0, 1, rootPaintChunkProperties()),
153 PaintChunk(1, 2, secondTransform))); 153 PaintChunk(1, 2, secondTransform)));
154 } 154 }
155 155
156 // TODO(pdr): Add more tests once we have more paint properties. 156 // TODO(pdr): Add more tests once we have more paint properties.
157 157
158 } // namespace 158 } // namespace
159 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698