| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 value->AppendInteger(it.rect().width()); | 309 value->AppendInteger(it.rect().width()); |
| 310 value->AppendInteger(it.rect().height()); | 310 value->AppendInteger(it.rect().height()); |
| 311 } | 311 } |
| 312 value->EndArray(); | 312 value->EndArray(); |
| 313 } | 313 } |
| 314 break; | 314 break; |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 static SkVector MapStdDeviation(float std_deviation, const SkMatrix& matrix) { | 318 static SkVector MapStdDeviation(float std_deviation, const SkMatrix& matrix) { |
| 319 // Corresponds to SpreadForStdDeviation in filter_operations.cc. |
| 319 SkVector sigma = SkVector::Make(std_deviation, std_deviation); | 320 SkVector sigma = SkVector::Make(std_deviation, std_deviation); |
| 320 matrix.mapVectors(&sigma, 1); | 321 matrix.mapVectors(&sigma, 1); |
| 321 return sigma * SkIntToScalar(3); | 322 return sigma * SkIntToScalar(3); |
| 322 } | 323 } |
| 323 | 324 |
| 324 gfx::Rect FilterOperation::MapRect(const gfx::Rect& rect, | 325 gfx::Rect FilterOperation::MapRect(const gfx::Rect& rect, |
| 325 const SkMatrix& matrix) const { | 326 const SkMatrix& matrix) const { |
| 326 switch (type_) { | 327 switch (type_) { |
| 327 case FilterOperation::BLUR: { | 328 case FilterOperation::BLUR: { |
| 328 SkVector spread = MapStdDeviation(amount(), matrix); | 329 SkVector spread = MapStdDeviation(amount(), matrix); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 345 SkIRect out_rect = image_filter()->filterBounds( | 346 SkIRect out_rect = image_filter()->filterBounds( |
| 346 in_rect, matrix, SkImageFilter::kForward_MapDirection); | 347 in_rect, matrix, SkImageFilter::kForward_MapDirection); |
| 347 return gfx::SkIRectToRect(out_rect); | 348 return gfx::SkIRectToRect(out_rect); |
| 348 } | 349 } |
| 349 default: | 350 default: |
| 350 return rect; | 351 return rect; |
| 351 } | 352 } |
| 352 } | 353 } |
| 353 | 354 |
| 354 } // namespace cc | 355 } // namespace cc |
| OLD | NEW |