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

Unified Diff: third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp

Issue 2894843002: Revert of Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: rebase TestExpectations Created 3 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
Index: third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp
diff --git a/third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp b/third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp
index 679508e31296dcf766004ad5ecab44537e777f82..caf6483657acd2bb2b4e5c294fea6c1f5ceaf8ef 100644
--- a/third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp
@@ -51,30 +51,31 @@ BoxReflection BoxReflectionForPaintLayer(const PaintLayer& layer,
break;
}
+ sk_sp<PaintRecord> mask;
const NinePieceImage& mask_nine_piece = reflect_style->Mask();
- if (!mask_nine_piece.HasImage())
- return BoxReflection(direction, offset, nullptr, FloatRect());
+ if (mask_nine_piece.HasImage()) {
+ LayoutRect mask_rect(LayoutPoint(), frame_layout_rect.Size());
+ LayoutRect mask_bounding_rect(mask_rect);
+ mask_bounding_rect.Expand(style.ImageOutsets(mask_nine_piece));
+ FloatRect mask_bounding_float_rect(mask_bounding_rect);
- LayoutRect mask_rect(LayoutPoint(), frame_layout_rect.Size());
- LayoutRect mask_bounding_rect(mask_rect);
- mask_bounding_rect.Expand(style.ImageOutsets(mask_nine_piece));
- FloatRect mask_bounding_float_rect(mask_bounding_rect);
-
- // TODO(jbroman): PaintRecordBuilder + DrawingRecorder seems excessive.
- // If NinePieceImagePainter operated on SkCanvas, we'd only need a
- // PictureRecorder here.
- PaintRecordBuilder builder(mask_bounding_float_rect);
- {
- GraphicsContext& context = builder.Context();
- DrawingRecorder drawing_recorder(context, layer.GetLayoutObject(),
- DisplayItem::kReflectionMask,
- mask_bounding_float_rect);
- NinePieceImagePainter().Paint(builder.Context(), layer.GetLayoutObject(),
- mask_rect, style, mask_nine_piece,
- SkBlendMode::kSrcOver);
+ // TODO(jbroman): PaintRecordBuilder + DrawingRecorder seems excessive.
+ // If NinePieceImagePainter operated on SkCanvas, we'd only need a
+ // PictureRecorder here.
+ PaintRecordBuilder builder(mask_bounding_float_rect);
+ {
+ GraphicsContext& context = builder.Context();
+ DrawingRecorder drawing_recorder(context, layer.GetLayoutObject(),
+ DisplayItem::kReflectionMask,
+ mask_bounding_float_rect);
+ NinePieceImagePainter().Paint(builder.Context(), layer.GetLayoutObject(),
+ mask_rect, style, mask_nine_piece,
+ SkBlendMode::kSrcOver);
+ }
+ mask = builder.EndRecording();
}
- return BoxReflection(direction, offset, builder.EndRecording(),
- mask_bounding_float_rect);
+
+ return BoxReflection(direction, offset, std::move(mask));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698