Chromium Code Reviews| 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..6541433fcfd52d97ceac4757f4184fb421425deb 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 SkPoint& 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); |
| + SkPoint origin = SkPoint::Make(0, 0); // 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 SkPoint& 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()); |
|
wkorman
2016/08/26 17:45:52
Are we still using bounds_.x/y anywhere? If not ma
Stephen White
2016/08/26 19:22:01
Yes, we still need a full rect as well as an origi
wkorman
2016/08/26 19:35:25
Ah, I searched for bounds_ and missed boundaries!
|
| } |
| void FilterDisplayItem::AsValueInto( |