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

Side by Side Diff: cc/output/filter_operation.cc

Issue 2231243002: Use CheckedNumeric when converting SkIRect to gfx::Rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/filter_operations_unittest.cc » ('j') | ui/gfx/skia_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (direction == SkImageFilter::kReverse_MapDirection) 354 if (direction == SkImageFilter::kReverse_MapDirection)
355 mapped_drop_shadow_offset = -mapped_drop_shadow_offset; 355 mapped_drop_shadow_offset = -mapped_drop_shadow_offset;
356 result += gfx::Vector2dF(mapped_drop_shadow_offset.x(), 356 result += gfx::Vector2dF(mapped_drop_shadow_offset.x(),
357 mapped_drop_shadow_offset.y()); 357 mapped_drop_shadow_offset.y());
358 result.Union(gfx::RectF(rect)); 358 result.Union(gfx::RectF(rect));
359 return gfx::ToEnclosingRect(result); 359 return gfx::ToEnclosingRect(result);
360 } 360 }
361 case FilterOperation::REFERENCE: { 361 case FilterOperation::REFERENCE: {
362 if (!op.image_filter()) 362 if (!op.image_filter())
363 return rect; 363 return rect;
364 return gfx::SkIRectToRect(op.image_filter()->filterBounds( 364 return gfx::SkIRectToRectChecked(op.image_filter()->filterBounds(
365 gfx::RectToSkIRect(rect), matrix, direction)); 365 gfx::RectToSkIRectChecked(rect), matrix, direction));
366 } 366 }
367 default: 367 default:
368 return rect; 368 return rect;
369 } 369 }
370 } 370 }
371 371
372 } // namespace 372 } // namespace
373 373
374 gfx::Rect FilterOperation::MapRect(const gfx::Rect& rect, 374 gfx::Rect FilterOperation::MapRect(const gfx::Rect& rect,
375 const SkMatrix& matrix) const { 375 const SkMatrix& matrix) const {
376 return MapRectInternal(*this, rect, matrix, 376 return MapRectInternal(*this, rect, matrix,
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
OLDNEW
« no previous file with comments | « no previous file | cc/output/filter_operations_unittest.cc » ('j') | ui/gfx/skia_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698