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

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

Issue 1961693002: Avoid unneeded RoundedInnerRectClipper rect clips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp
index 357e1f7bb5b06666d9dc8610a0dab9eecff518ee..75a305bfdb9358b3d288b1650c9c7911e3306c71 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.cpp
@@ -14,7 +14,13 @@ namespace blink {
void ClipDisplayItem::replay(GraphicsContext& context) const
{
context.save();
- context.clipRect(m_clipRect, AntiAliased);
+
+ // RoundedInnerRectClipper only cares about rounded-rect clips,
+ // and passes an "infinite" rect clip; there is no reason to apply this clip.
+ // TODO(fmalita): convert RoundedInnerRectClipper to a better suited
+ // DisplayItem so we don't have to special-case its semantics.
+ if (m_clipRect != LayoutRect::infiniteIntRect())
+ context.clipRect(m_clipRect, AntiAliased);
for (const FloatRoundedRect& roundedRect : m_roundedRectClips)
context.clipRoundedRect(roundedRect);
@@ -23,21 +29,9 @@ void ClipDisplayItem::replay(GraphicsContext& context) const
void ClipDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, WebDisplayItemList* list) const
{
WebVector<SkRRect> webRoundedRects(m_roundedRectClips.size());
- for (size_t i = 0; i < m_roundedRectClips.size(); ++i) {
- FloatRoundedRect::Radii rectRadii = m_roundedRectClips[i].getRadii();
- SkVector skRadii[4];
- skRadii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(rectRadii.topLeft().width()),
- SkIntToScalar(rectRadii.topLeft().height()));
- skRadii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(rectRadii.topRight().width()),
- SkIntToScalar(rectRadii.topRight().height()));
- skRadii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(rectRadii.bottomRight().width()),
- SkIntToScalar(rectRadii.bottomRight().height()));
- skRadii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(rectRadii.bottomLeft().width()),
- SkIntToScalar(rectRadii.bottomLeft().height()));
- SkRRect skRoundedRect;
- skRoundedRect.setRectRadii(m_roundedRectClips[i].rect(), skRadii);
- webRoundedRects[i] = skRoundedRect;
- }
+ for (size_t i = 0; i < m_roundedRectClips.size(); ++i)
+ webRoundedRects[i] = m_roundedRectClips[i];
+
list->appendClipItem(visualRect, m_clipRect, webRoundedRects);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698