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

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

Issue 500373005: Remove SkQuadTree. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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/SkQuadTree.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 "SkQuadTree.h"
10 #include "SkRTree.h" 9 #include "SkRTree.h"
11 #include "SkTileGrid.h" 10 #include "SkTileGrid.h"
12 11
13 12
14 SkBBoxHierarchy* SkQuadTreeFactory::operator()(int width, int height) const {
15 return SkNEW_ARGS(SkQuadTree, (SkIRect::MakeWH(width, height)));
16 }
17
18 SkBBoxHierarchy* SkRTreeFactory::operator()(int width, int height) const { 13 SkBBoxHierarchy* SkRTreeFactory::operator()(int width, int height) const {
19 // These values were empirically determined to produce reasonable 14 // These values were empirically determined to produce reasonable
20 // performance in most cases. 15 // performance in most cases.
21 static const int kRTreeMinChildren = 6; 16 static const int kRTreeMinChildren = 6;
22 static const int kRTreeMaxChildren = 11; 17 static const int kRTreeMaxChildren = 11;
23 18
24 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width), 19 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width),
25 SkIntToScalar(height)); 20 SkIntToScalar(height));
26 bool sortDraws = false; // Do not sort draw calls when bulk loading. 21 bool sortDraws = false; // Do not sort draw calls when bulk loading.
27 22
28 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren, 23 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
29 aspectRatio, sortDraws); 24 aspectRatio, sortDraws);
30 } 25 }
31 26
32 SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const { 27 SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const {
33 SkASSERT(fInfo.fMargin.width() >= 0); 28 SkASSERT(fInfo.fMargin.width() >= 0);
34 SkASSERT(fInfo.fMargin.height() >= 0); 29 SkASSERT(fInfo.fMargin.height() >= 0);
35 // Note: SkIRects are non-inclusive of the right() column and bottom() row. 30 // Note: SkIRects are non-inclusive of the right() column and bottom() row.
36 // For example, an SkIRect at 0,0 with a size of (1,1) will only have 31 // For example, an SkIRect at 0,0 with a size of (1,1) will only have
37 // content at pixel (0,0) and will report left=0 and right=1, hence the 32 // content at pixel (0,0) and will report left=0 and right=1, hence the
38 // "-1"s below. 33 // "-1"s below.
39 int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInte rval.width(); 34 int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInte rval.width();
40 int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileIn terval.height(); 35 int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileIn terval.height();
41 return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo)); 36 return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo));
42 } 37 }
OLDNEW
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | src/core/SkQuadTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698