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

Side by Side Diff: src/core/SkBBHFactory.cpp

Issue 845623002: Remove SkTileGrid (except for TileGridInfo). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: kill gridSupported Created 5 years, 11 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 | « samplecode/SamplePictFile.cpp ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBBHFactory.h" 8 #include "SkBBHFactory.h"
9 #include "SkRTree.h" 9 #include "SkRTree.h"
10 #include "SkTileGrid.h"
11 10
12 SkBBoxHierarchy* SkRTreeFactory::operator()(const SkRect& bounds) const { 11 SkBBoxHierarchy* SkRTreeFactory::operator()(const SkRect& bounds) const {
13 SkScalar aspectRatio = bounds.width() / bounds.height(); 12 SkScalar aspectRatio = bounds.width() / bounds.height();
14 return SkNEW_ARGS(SkRTree, (aspectRatio)); 13 return SkNEW_ARGS(SkRTree, (aspectRatio));
15 } 14 }
16
17 SkBBoxHierarchy* SkTileGridFactory::operator()(const SkRect& bounds) const {
18 SkASSERT(fInfo.fMargin.width() >= 0);
19 SkASSERT(fInfo.fMargin.height() >= 0);
20
21 // We want a conservative answer for the size...
22 const SkIRect ibounds = bounds.roundOut();
23 const int width = ibounds.width();
24 const int height = ibounds.height();
25
26 // Note: SkIRects are non-inclusive of the right() column and bottom() row.
27 // For example, an SkIRect at 0,0 with a size of (1,1) will only have
28 // content at pixel (0,0) and will report left=0 and right=1, hence the
29 // "-1"s below.
30 int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInte rval.width();
31 int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileIn terval.height();
32 return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo));
33 }
OLDNEW
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698