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

Unified Diff: cc/output/filter_operation.cc

Issue 2114303002: cc: Add unit tests for non-identity matrix for FilterOperation::MapRect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after skia roll (https://codereview.chromium.org/2114313002 was detected by this test) Created 4 years, 5 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 | cc/output/filter_operations_unittest.cc » ('j') | cc/output/filter_operations_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/filter_operation.cc
diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc
index 289ca348b7ee58de687148fb8ebd7d1fe216f338..ffb5185806844d5f1a3bf11c1d1ceb2ced8e543a 100644
--- a/cc/output/filter_operation.cc
+++ b/cc/output/filter_operation.cc
@@ -344,18 +344,19 @@ gfx::Rect MapRectInternal(const FilterOperation& op,
SkVector spread = MapStdDeviation(op.amount(), matrix);
float spread_x = std::abs(spread.x());
float spread_y = std::abs(spread.y());
- gfx::Rect result = rect;
+ gfx::RectF result(rect);
result.Inset(-spread_x, -spread_y, -spread_x, -spread_y);
- gfx::Vector2d drop_shadow_offset =
- op.drop_shadow_offset().OffsetFromOrigin();
- if (direction == SkImageFilter::kForward_MapDirection)
- result += drop_shadow_offset;
- else
- result -= drop_shadow_offset;
-
- result.Union(rect);
- return result;
+ gfx::Point drop_shadow_offset = op.drop_shadow_offset();
+ SkVector mapped_drop_shadow_offset;
+ matrix.mapVector(drop_shadow_offset.x(), drop_shadow_offset.y(),
+ &mapped_drop_shadow_offset);
+ if (direction == SkImageFilter::kReverse_MapDirection)
+ mapped_drop_shadow_offset = -mapped_drop_shadow_offset;
+ result += gfx::Vector2dF(mapped_drop_shadow_offset.x(),
+ mapped_drop_shadow_offset.y());
+ result.Union(gfx::RectF(rect));
+ return gfx::ToEnclosingRect(result);
}
case FilterOperation::REFERENCE: {
if (!op.image_filter())
« no previous file with comments | « no previous file | cc/output/filter_operations_unittest.cc » ('j') | cc/output/filter_operations_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698