| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 gfx::Rect MapRectInternal(const FilterOperation& op, | 330 gfx::Rect MapRectInternal(const FilterOperation& op, |
| 331 const gfx::Rect& rect, | 331 const gfx::Rect& rect, |
| 332 const SkMatrix& matrix, | 332 const SkMatrix& matrix, |
| 333 SkImageFilter::MapDirection direction) { | 333 SkImageFilter::MapDirection direction) { |
| 334 switch (op.type()) { | 334 switch (op.type()) { |
| 335 case FilterOperation::BLUR: { | 335 case FilterOperation::BLUR: { |
| 336 SkVector spread = MapStdDeviation(op.amount(), matrix); | 336 SkVector spread = MapStdDeviation(op.amount(), matrix); |
| 337 float spread_x = std::abs(spread.x()); | 337 float spread_x = std::abs(spread.x()); |
| 338 float spread_y = std::abs(spread.y()); | 338 float spread_y = std::abs(spread.y()); |
| 339 gfx::Rect result = rect; | 339 gfx::RectF result(rect); |
| 340 result.Inset(-spread_x, -spread_y, -spread_x, -spread_y); | 340 result.Inset(-spread_x, -spread_y, -spread_x, -spread_y); |
| 341 return result; | 341 return gfx::ToEnclosingRect(result); |
| 342 } | 342 } |
| 343 case FilterOperation::DROP_SHADOW: { | 343 case FilterOperation::DROP_SHADOW: { |
| 344 SkVector spread = MapStdDeviation(op.amount(), matrix); | 344 SkVector spread = MapStdDeviation(op.amount(), matrix); |
| 345 float spread_x = std::abs(spread.x()); | 345 float spread_x = std::abs(spread.x()); |
| 346 float spread_y = std::abs(spread.y()); | 346 float spread_y = std::abs(spread.y()); |
| 347 gfx::RectF result(rect); | 347 gfx::RectF result(rect); |
| 348 result.Inset(-spread_x, -spread_y, -spread_x, -spread_y); | 348 result.Inset(-spread_x, -spread_y, -spread_x, -spread_y); |
| 349 | 349 |
| 350 gfx::Point drop_shadow_offset = op.drop_shadow_offset(); | 350 gfx::Point drop_shadow_offset = op.drop_shadow_offset(); |
| 351 SkVector mapped_drop_shadow_offset; | 351 SkVector mapped_drop_shadow_offset; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 377 SkImageFilter::kForward_MapDirection); | 377 SkImageFilter::kForward_MapDirection); |
| 378 } | 378 } |
| 379 | 379 |
| 380 gfx::Rect FilterOperation::MapRectReverse(const gfx::Rect& rect, | 380 gfx::Rect FilterOperation::MapRectReverse(const gfx::Rect& rect, |
| 381 const SkMatrix& matrix) const { | 381 const SkMatrix& matrix) const { |
| 382 return MapRectInternal(*this, rect, matrix, | 382 return MapRectInternal(*this, rect, matrix, |
| 383 SkImageFilter::kReverse_MapDirection); | 383 SkImageFilter::kReverse_MapDirection); |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace cc | 386 } // namespace cc |
| OLD | NEW |