diff options
author | mtklein <mtklein@chromium.org> | 2014-08-27 10:39:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-27 10:39:42 -0700 |
commit | 533eb782edaa0b6fece6166d3001edf72ec39f11 (patch) | |
tree | a4d863ff13725c8c8c33c9b50d63ec74c54deff1 /src/core/SkTileGrid.cpp | |
parent | 3031350e05d8ef8c67a5e9ce8e5c428c8560eb50 (diff) |
Convert BBH APIs to use SkRect.
Still TODO: convert internals of SkTileGrid.cpp and SkRTree.cpp to work in floats too.
NOTREECHECKS=true
BUG=skia:1021
R=robertphillips@google.com, reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/511613002
Diffstat (limited to 'src/core/SkTileGrid.cpp')
-rw-r--r-- | src/core/SkTileGrid.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/SkTileGrid.cpp b/src/core/SkTileGrid.cpp index 17102f50e2..84dc949b36 100644 --- a/src/core/SkTileGrid.cpp +++ b/src/core/SkTileGrid.cpp @@ -23,13 +23,15 @@ SkTileGrid::~SkTileGrid() { SkDELETE_ARRAY(fTiles); } -void SkTileGrid::insert(void* data, const SkIRect& bounds, bool) { - SkASSERT(!bounds.isEmpty()); - SkIRect dilatedBounds = bounds; - - // Dilating the largest SkIRect will overflow. Other nearly-largest rects may overflow too, - // but we don't make active use of them like we do the largest. - if (!bounds.isLargest()) { +void SkTileGrid::insert(void* data, const SkRect& fbounds, bool) { + SkASSERT(!fbounds.isEmpty()); + SkIRect dilatedBounds; + if (fbounds.isLargest()) { + // Dilating the largest SkIRect will overflow. Other nearly-largest rects may overflow too, + // but we don't make active use of them like we do the largest. + dilatedBounds.setLargest(); + } else { + fbounds.roundOut(&dilatedBounds); dilatedBounds.outset(fInfo.fMargin.width(), fInfo.fMargin.height()); dilatedBounds.offset(fInfo.fOffset); } @@ -67,8 +69,9 @@ static int divide_ceil(int x, int y) { // require 512 tiles of size 256 x 256 pixels. static const int kStackAllocationTileCount = 1024; -void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) const { - SkIRect adjusted = query; +void SkTileGrid::search(const SkRect& query, SkTDArray<void*>* results) const { + SkIRect adjusted; + query.roundOut(&adjusted); // The inset is to counteract the outset that was applied in 'insert' // The outset/inset is to optimize for lookups of size |