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

Unified Diff: src/core/SkTileGrid.cpp

Issue 511613002: Convert BBH APIs to use SkRect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another in BBH test Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTileGrid.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTileGrid.cpp
diff --git a/src/core/SkTileGrid.cpp b/src/core/SkTileGrid.cpp
index 17102f50e2f75929f9e63cc71f8c55e33a5c0de1..84dc949b36727fe4ac0b9fb74c56dbf2115f0c4a 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
« no previous file with comments | « src/core/SkTileGrid.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698