| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkTileGrid.h" | 9 #include "SkTileGrid.h" |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // by rounding outwards to the nearest tile boundary so that the resulting t
ile | 74 // by rounding outwards to the nearest tile boundary so that the resulting t
ile |
| 75 // region includes the query rectangle. (using truncating division to "floor
") | 75 // region includes the query rectangle. (using truncating division to "floor
") |
| 76 int tileStartX = adjustedQuery.left() / fInfo.fTileInterval.width(); | 76 int tileStartX = adjustedQuery.left() / fInfo.fTileInterval.width(); |
| 77 int tileEndX = (adjustedQuery.right() + fInfo.fTileInterval.width() - 1) / | 77 int tileEndX = (adjustedQuery.right() + fInfo.fTileInterval.width() - 1) / |
| 78 fInfo.fTileInterval.width(); | 78 fInfo.fTileInterval.width(); |
| 79 int tileStartY = adjustedQuery.top() / fInfo.fTileInterval.height(); | 79 int tileStartY = adjustedQuery.top() / fInfo.fTileInterval.height(); |
| 80 int tileEndY = (adjustedQuery.bottom() + fInfo.fTileInterval.height() - 1) / | 80 int tileEndY = (adjustedQuery.bottom() + fInfo.fTileInterval.height() - 1) / |
| 81 fInfo.fTileInterval.height(); | 81 fInfo.fTileInterval.height(); |
| 82 | 82 |
| 83 tileStartX = SkPin32(tileStartX, 0, fXTileCount - 1); | 83 tileStartX = SkPin32(tileStartX, 0, fXTileCount - 1); |
| 84 tileEndX = SkPin32(tileEndX, 1, fXTileCount); | 84 tileEndX = SkPin32(tileEndX, tileStartX+1, fXTileCount); |
| 85 tileStartY = SkPin32(tileStartY, 0, fYTileCount - 1); | 85 tileStartY = SkPin32(tileStartY, 0, fYTileCount - 1); |
| 86 tileEndY = SkPin32(tileEndY, 1, fYTileCount); | 86 tileEndY = SkPin32(tileEndY, tileStartY+1, fYTileCount); |
| 87 | 87 |
| 88 int queryTileCount = (tileEndX - tileStartX) * (tileEndY - tileStartY); | 88 int queryTileCount = (tileEndX - tileStartX) * (tileEndY - tileStartY); |
| 89 SkASSERT(queryTileCount); | 89 SkASSERT(queryTileCount); |
| 90 if (queryTileCount == 1) { | 90 if (queryTileCount == 1) { |
| 91 *results = this->tile(tileStartX, tileStartY); | 91 *results = this->tile(tileStartX, tileStartY); |
| 92 } else { | 92 } else { |
| 93 results->reset(); | 93 results->reset(); |
| 94 SkTDArray<int> curPositions; | 94 SkTDArray<int> curPositions; |
| 95 curPositions.setCount(queryTileCount); | 95 curPositions.setCount(queryTileCount); |
| 96 // Note: Reserving space for 1024 tile pointers on the stack. If the | 96 // Note: Reserving space for 1024 tile pointers on the stack. If the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 void SkTileGrid::rewindInserts() { | 127 void SkTileGrid::rewindInserts() { |
| 128 SkASSERT(fClient); | 128 SkASSERT(fClient); |
| 129 for (int i = 0; i < fTileCount; ++i) { | 129 for (int i = 0; i < fTileCount; ++i) { |
| 130 while (!fTileData[i].isEmpty() && fClient->shouldRewind(fTileData[i].top
())) { | 130 while (!fTileData[i].isEmpty() && fClient->shouldRewind(fTileData[i].top
())) { |
| 131 fTileData[i].pop(); | 131 fTileData[i].pop(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 } | 134 } |
| OLD | NEW |