OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkRTree.h" | 8 #include "SkRTree.h" |
9 #include "SkTSort.h" | 9 #include "SkTSort.h" |
10 | 10 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ++numBranches; | 338 ++numBranches; |
339 // If the remainder isn't enough to fill a node, we'll need to add f
ewer nodes to | 339 // If the remainder isn't enough to fill a node, we'll need to add f
ewer nodes to |
340 // some other branches to make up for it | 340 // some other branches to make up for it |
341 if (remainder >= fMinChildren) { | 341 if (remainder >= fMinChildren) { |
342 remainder = 0; | 342 remainder = 0; |
343 } else { | 343 } else { |
344 remainder = fMinChildren - remainder; | 344 remainder = fMinChildren - remainder; |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 int numStrips = SkScalarCeil(SkScalarSqrt(SkIntToScalar(numBranches) * | 348 int numStrips = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(numBranches
) * |
349 SkScalarInvert(fAspectRatio))); | 349 SkScalarInvert(fAspectRatio))); |
350 int numTiles = SkScalarCeil(SkIntToScalar(numBranches) / | 350 int numTiles = SkScalarCeilToInt(SkIntToScalar(numBranches) / |
351 SkIntToScalar(numStrips)); | 351 SkIntToScalar(numStrips)); |
352 int currentBranch = 0; | 352 int currentBranch = 0; |
353 | 353 |
354 for (int i = 0; i < numStrips; ++i) { | 354 for (int i = 0; i < numStrips; ++i) { |
355 // Once again, if we are told to do so, we sort by x. | 355 // Once again, if we are told to do so, we sort by x. |
356 if (fSortWhenBulkLoading) { | 356 if (fSortWhenBulkLoading) { |
357 int begin = currentBranch; | 357 int begin = currentBranch; |
358 int end = currentBranch + numTiles * fMaxChildren - SkMin32(rema
inder, | 358 int end = currentBranch + numTiles * fMaxChildren - SkMin32(rema
inder, |
359 (fMaxChildren - fMinChildren) * numTiles); | 359 (fMaxChildren - fMinChildren) * numTiles); |
360 if (end > branches->count()) { | 360 if (end > branches->count()) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 // Expand 'out' to include 'joinWith' | 474 // Expand 'out' to include 'joinWith' |
475 static inline void join_no_empty_check(const SkIRect& joinWith, SkIRect* out) { | 475 static inline void join_no_empty_check(const SkIRect& joinWith, SkIRect* out) { |
476 // since we check for empty bounds on insert, we know we'll never have empty
rects | 476 // since we check for empty bounds on insert, we know we'll never have empty
rects |
477 // and we can save the empty check that SkIRect::join requires | 477 // and we can save the empty check that SkIRect::join requires |
478 if (joinWith.fLeft < out->fLeft) { out->fLeft = joinWith.fLeft; } | 478 if (joinWith.fLeft < out->fLeft) { out->fLeft = joinWith.fLeft; } |
479 if (joinWith.fTop < out->fTop) { out->fTop = joinWith.fTop; } | 479 if (joinWith.fTop < out->fTop) { out->fTop = joinWith.fTop; } |
480 if (joinWith.fRight > out->fRight) { out->fRight = joinWith.fRight; } | 480 if (joinWith.fRight > out->fRight) { out->fRight = joinWith.fRight; } |
481 if (joinWith.fBottom > out->fBottom) { out->fBottom = joinWith.fBottom; } | 481 if (joinWith.fBottom > out->fBottom) { out->fBottom = joinWith.fBottom; } |
482 } | 482 } |
OLD | NEW |