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

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

Issue 1192363005: Move all clip display item parameters to the constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/paint/ClipDisplayItem.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/ClipDisplayItem.cpp
diff --git a/Source/platform/graphics/paint/ClipDisplayItem.cpp b/Source/platform/graphics/paint/ClipDisplayItem.cpp
index 55293b6f755147d2f975a4c9a5b664ba37657860..c992dc3a821cb032819e0c7bddf4ea0fe1540cd9 100644
--- a/Source/platform/graphics/paint/ClipDisplayItem.cpp
+++ b/Source/platform/graphics/paint/ClipDisplayItem.cpp
@@ -16,15 +16,26 @@ void ClipDisplayItem::replay(GraphicsContext& context)
{
context.save();
context.clipRect(m_clipRect, NotAntiAliased, SkRegion::kIntersect_Op);
- for (FloatRoundedRect roundedRect : m_roundedRectClips)
+
+ if (!m_roundedRectClips)
+ return;
+
+ for (const FloatRoundedRect& roundedRect : *m_roundedRectClips)
context.clipRoundedRect(roundedRect, SkRegion::kIntersect_Op);
}
void ClipDisplayItem::appendToWebDisplayItemList(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].radii();
+ if (!m_roundedRectClips) {
+ WebVector<SkRRect> webRoundedRects;
+ list->appendClipItem(m_clipRect, webRoundedRects);
+ return;
+ }
+
+ Vector<FloatRoundedRect>& roundedRects = *m_roundedRectClips;
+ WebVector<SkRRect> webRoundedRects(roundedRects.size());
+ for (size_t i = 0; i < roundedRects.size(); ++i) {
+ FloatRoundedRect::Radii rectRadii = roundedRects[i].radii();
SkVector skRadii[4];
skRadii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(rectRadii.topLeft().width()),
SkIntToScalar(rectRadii.topLeft().height()));
@@ -35,7 +46,7 @@ void ClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const
skRadii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(rectRadii.bottomLeft().width()),
SkIntToScalar(rectRadii.bottomLeft().height()));
SkRRect skRoundedRect;
- skRoundedRect.setRectRadii(m_roundedRectClips[i].rect(), skRadii);
+ skRoundedRect.setRectRadii(roundedRects[i].rect(), skRadii);
webRoundedRects[i] = skRoundedRect;
}
list->appendClipItem(m_clipRect, webRoundedRects);
« no previous file with comments | « Source/platform/graphics/paint/ClipDisplayItem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698