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

Unified Diff: cc/playback/filter_display_item.cc

Issue 2297213003: Fix CSS reference filters with negative transformed children. (Closed)
Patch Set: Created 4 years, 4 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 | « cc/playback/filter_display_item.h ('k') | cc/playback/largest_display_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/filter_display_item.cc
diff --git a/cc/playback/filter_display_item.cc b/cc/playback/filter_display_item.cc
index 224d1c80457b790390649679a0cdc7218b108c38..e369e06e31effedfc9ad7fc0ffd372f09d29025b 100644
--- a/cc/playback/filter_display_item.cc
+++ b/cc/playback/filter_display_item.cc
@@ -21,8 +21,9 @@
namespace cc {
FilterDisplayItem::FilterDisplayItem(const FilterOperations& filters,
- const gfx::RectF& bounds) {
- SetNew(filters, bounds);
+ const gfx::RectF& bounds,
+ const gfx::PointF& origin) {
+ SetNew(filters, bounds, origin);
}
FilterDisplayItem::FilterDisplayItem(const proto::DisplayItem& proto) {
@@ -33,16 +34,18 @@ FilterDisplayItem::FilterDisplayItem(const proto::DisplayItem& proto) {
// TODO(dtrainor): Support deserializing FilterOperations (crbug.com/541321).
FilterOperations filters;
-
- SetNew(filters, bounds);
+ gfx::PointF origin(.0f, .0f); // TODO(senorblanco): Support origin.
+ SetNew(filters, bounds, origin);
}
FilterDisplayItem::~FilterDisplayItem() {}
void FilterDisplayItem::SetNew(const FilterOperations& filters,
- const gfx::RectF& bounds) {
+ const gfx::RectF& bounds,
+ const gfx::PointF& origin) {
filters_ = filters;
bounds_ = bounds;
+ origin_ = origin;
}
void FilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
@@ -57,18 +60,19 @@ void FilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
void FilterDisplayItem::Raster(SkCanvas* canvas,
SkPicture::AbortCallback* callback) const {
canvas->save();
- canvas->translate(bounds_.x(), bounds_.y());
+ canvas->translate(origin_.x(), origin_.y());
sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter(
filters_, gfx::SizeF(bounds_.width(), bounds_.height()));
- SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height());
+ SkRect boundaries = RectFToSkRect(bounds_);
+ boundaries.offset(-origin_.x(), -origin_.y());
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
paint.setImageFilter(std::move(image_filter));
canvas->saveLayer(&boundaries, &paint);
- canvas->translate(-bounds_.x(), -bounds_.y());
+ canvas->translate(-origin_.x(), -origin_.y());
}
void FilterDisplayItem::AsValueInto(
« no previous file with comments | « cc/playback/filter_display_item.h ('k') | cc/playback/largest_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698