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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp

Issue 2729243002: Improve performance of GeometryMapper cache. (Closed)
Patch Set: none Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
index 35ef1a0108a6167f1d37205ac67bcca1f71393dc..c1375c5bf31c7296d1a499fee25528e506d0153d 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -31,15 +31,20 @@ class GeometryMapperTest : public ::testing::Test,
return state;
}
- GeometryMapper::TransformCache& getTransformCache(
- const PropertyTreeState& propertyTreeState) {
- return geometryMapper->getTransformCache(propertyTreeState.transform());
+ const FloatClipRect* getClip(
+ const ClipPaintPropertyNode* descendantClip,
+ const PropertyTreeState& ancestorPropertyTreeState) {
+ GeometryMapperClipCache::ClipAndTransform clipAndTransform(
+ ancestorPropertyTreeState.clip(),
+ ancestorPropertyTreeState.transform());
+ return descendantClip->getClipCache().getCachedClip(clipAndTransform);
}
- GeometryMapper::ClipCache& getClipCache(
- const PropertyTreeState& propertyTreeState) {
- return geometryMapper->getClipCache(propertyTreeState.clip(),
- propertyTreeState.transform());
+ const TransformationMatrix* getTransform(
+ const TransformPaintPropertyNode* descendantTransform,
+ const TransformPaintPropertyNode* ancestorTransform) {
+ return descendantTransform->getTransformCache().getCachedTransform(
+ ancestorTransform);
}
const TransformPaintPropertyNode* lowestCommonAncestor(
@@ -140,19 +145,19 @@ const static float kTestEpsilon = 1e-6;
ancestorPropertyTreeState.transform())); \
if (ancestorPropertyTreeState.transform() != \
localPropertyTreeState.transform()) { \
- EXPECT_EQ(expectedTransformToAncestor, \
- getTransformCache(ancestorPropertyTreeState) \
- .at(localPropertyTreeState.transform())); \
+ const TransformationMatrix* transformForTesting = \
+ getTransform(localPropertyTreeState.transform(), \
+ ancestorPropertyTreeState.transform()); \
+ CHECK(transformForTesting); \
+ EXPECT_EQ(expectedTransformToAncestor, *transformForTesting); \
} \
if (ancestorPropertyTreeState.clip() != localPropertyTreeState.clip()) { \
- EXPECT_EQ(expectedClipInAncestorSpace, \
- getClipCache(ancestorPropertyTreeState) \
- .at(localPropertyTreeState.clip())) \
+ const FloatClipRect* outputClipForTesting = \
+ getClip(localPropertyTreeState.clip(), ancestorPropertyTreeState); \
+ DCHECK(outputClipForTesting); \
+ EXPECT_EQ(expectedClipInAncestorSpace, *outputClipForTesting) \
<< expectedClipInAncestorSpace.rect().toString() << " " \
- << getClipCache(ancestorPropertyTreeState) \
- .at(localPropertyTreeState.clip()) \
- .rect() \
- .toString(); \
+ << outputClipForTesting->rect().toString(); \
} \
} while (false)
@@ -265,8 +270,9 @@ TEST_F(GeometryMapperTest, NestedTransforms) {
rootPropertyTreeState(), hasRadius);
// Check the cached matrix for the intermediate transform.
- EXPECT_EQ(rotateTransform,
- getTransformCache(rootPropertyTreeState()).at(transform1.get()));
+ EXPECT_EQ(
+ rotateTransform,
+ *getTransform(transform1.get(), rootPropertyTreeState().transform()));
}
TEST_F(GeometryMapperTest, NestedTransformsScaleAndTranslation) {
@@ -296,10 +302,8 @@ TEST_F(GeometryMapperTest, NestedTransformsScaleAndTranslation) {
rootPropertyTreeState(), hasRadius);
// Check the cached matrix for the intermediate transform.
- EXPECT_EQ(scaleTransform,
- getTransformCache(rootPropertyTreeState())
-
- .at(transform1.get()));
+ EXPECT_EQ(scaleTransform, *getTransform(transform1.get(),
+ rootPropertyTreeState().transform()));
}
TEST_F(GeometryMapperTest, NestedTransformsIntermediateDestination) {

Powered by Google App Engine
This is Rietveld 408576698