| 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 12 matching lines...) Expand all Loading... |
| 23 fGridBounds = SkIRect::MakeXYWH(0, 0, fInfo.fTileInterval.width() * fXTileCo
unt, | 23 fGridBounds = SkIRect::MakeXYWH(0, 0, fInfo.fTileInterval.width() * fXTileCo
unt, |
| 24 fInfo.fTileInterval.height() * fYTileCount); | 24 fInfo.fTileInterval.height() * fYTileCount); |
| 25 fNextDatumFunction = nextDatumFunction; | 25 fNextDatumFunction = nextDatumFunction; |
| 26 fTileData = SkNEW_ARRAY(SkTDArray<void *>, fTileCount); | 26 fTileData = SkNEW_ARRAY(SkTDArray<void *>, fTileCount); |
| 27 } | 27 } |
| 28 | 28 |
| 29 SkTileGrid::~SkTileGrid() { | 29 SkTileGrid::~SkTileGrid() { |
| 30 SkDELETE_ARRAY(fTileData); | 30 SkDELETE_ARRAY(fTileData); |
| 31 } | 31 } |
| 32 | 32 |
| 33 int SkTileGrid::tileCount(int x, int y) { |
| 34 return this->tile(x, y).count(); |
| 35 } |
| 36 |
| 33 SkTDArray<void *>& SkTileGrid::tile(int x, int y) { | 37 SkTDArray<void *>& SkTileGrid::tile(int x, int y) { |
| 34 return fTileData[y * fXTileCount + x]; | 38 return fTileData[y * fXTileCount + x]; |
| 35 } | 39 } |
| 36 | 40 |
| 37 void SkTileGrid::insert(void* data, const SkIRect& bounds, bool) { | 41 void SkTileGrid::insert(void* data, const SkIRect& bounds, bool) { |
| 38 SkASSERT(!bounds.isEmpty()); | 42 SkASSERT(!bounds.isEmpty()); |
| 39 SkIRect dilatedBounds = bounds; | 43 SkIRect dilatedBounds = bounds; |
| 40 dilatedBounds.outset(fInfo.fMargin.width(), fInfo.fMargin.height()); | 44 dilatedBounds.outset(fInfo.fMargin.width(), fInfo.fMargin.height()); |
| 41 dilatedBounds.offset(fInfo.fOffset); | 45 dilatedBounds.offset(fInfo.fOffset); |
| 42 if (!SkIRect::Intersects(dilatedBounds, fGridBounds)) { | 46 if (!SkIRect::Intersects(dilatedBounds, fGridBounds)) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 124 } |
| 121 | 125 |
| 122 void SkTileGrid::rewindInserts() { | 126 void SkTileGrid::rewindInserts() { |
| 123 SkASSERT(fClient); | 127 SkASSERT(fClient); |
| 124 for (int i = 0; i < fTileCount; ++i) { | 128 for (int i = 0; i < fTileCount; ++i) { |
| 125 while (!fTileData[i].isEmpty() && fClient->shouldRewind(fTileData[i].top
())) { | 129 while (!fTileData[i].isEmpty() && fClient->shouldRewind(fTileData[i].top
())) { |
| 126 fTileData[i].pop(); | 130 fTileData[i].pop(); |
| 127 } | 131 } |
| 128 } | 132 } |
| 129 } | 133 } |
| OLD | NEW |