OLD | NEW |
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 "SkRTreePicture.h" | 8 #include "SkRTreePicture.h" |
9 | 9 |
10 #include "SkRTree.h" | 10 #include "SkRTree.h" |
11 | 11 |
| 12 SkBBoxHierarchy* SkRTreeFactory::operator()(int width, int height) const { |
| 13 // These values were empirically determined to produce reasonable |
| 14 // performance in most cases. |
| 15 static const int kRTreeMinChildren = 6; |
| 16 static const int kRTreeMaxChildren = 11; |
| 17 |
| 18 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width), |
| 19 SkIntToScalar(height)); |
| 20 bool sortDraws = false; // Do not sort draw calls when bulk loading. |
| 21 |
| 22 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren, |
| 23 aspectRatio, sortDraws); |
| 24 } |
| 25 |
| 26 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES |
12 | 27 |
13 SkBBoxHierarchy* SkRTreePicture::createBBoxHierarchy() const { | 28 SkBBoxHierarchy* SkRTreePicture::createBBoxHierarchy() const { |
14 // These values were empirically determined to produce reasonable | 29 // These values were empirically determined to produce reasonable |
15 // performance in most cases. | 30 // performance in most cases. |
16 static const int kRTreeMinChildren = 6; | 31 static const int kRTreeMinChildren = 6; |
17 static const int kRTreeMaxChildren = 11; | 32 static const int kRTreeMaxChildren = 11; |
18 | 33 |
19 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth), | 34 SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth), |
20 SkIntToScalar(fHeight)); | 35 SkIntToScalar(fHeight)); |
21 bool sortDraws = false; // Do not sort draw calls when bulk loading. | 36 bool sortDraws = false; // Do not sort draw calls when bulk loading. |
22 | 37 |
23 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren, | 38 return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren, |
24 aspectRatio, sortDraws); | 39 aspectRatio, sortDraws); |
25 } | 40 } |
| 41 |
| 42 #endif |
OLD | NEW |