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 "SkTileGrid.h" | 8 #include "SkTileGrid.h" |
9 | 9 |
10 SkTileGrid::SkTileGrid(int xTiles, int yTiles, const SkTileGridFactory::TileGrid
Info& info) | 10 SkTileGrid::SkTileGrid(int xTiles, int yTiles, const SkTileGridFactory::TileGrid
Info& info) |
11 : fXTiles(xTiles) | 11 : fXTiles(xTiles) |
12 , fYTiles(yTiles) | 12 , fYTiles(yTiles) |
13 , fInfo(info) | 13 , fInfo(info) |
14 , fCount(0) | |
15 , fTiles(SkNEW_ARRAY(SkTDArray<unsigned>, xTiles * yTiles)) { | 14 , fTiles(SkNEW_ARRAY(SkTDArray<unsigned>, xTiles * yTiles)) { |
16 // Margin is offset by 1 as a provision for AA and | 15 // Margin is offset by 1 as a provision for AA and |
17 // to cancel-out the outset applied by getClipDeviceBounds. | 16 // to cancel-out the outset applied by getClipDeviceBounds. |
18 fInfo.fMargin.fHeight++; | 17 fInfo.fMargin.fHeight++; |
19 fInfo.fMargin.fWidth++; | 18 fInfo.fMargin.fWidth++; |
20 } | 19 } |
21 | 20 |
22 SkTileGrid::~SkTileGrid() { | 21 SkTileGrid::~SkTileGrid() { |
23 SkDELETE_ARRAY(fTiles); | 22 SkDELETE_ARRAY(fTiles); |
24 } | 23 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // We did find an earliest op. Output it, and step forward every tile th
at contains it. | 138 // We did find an earliest op. Output it, and step forward every tile th
at contains it. |
140 results->push(earliest); | 139 results->push(earliest); |
141 for (int i = 0; i < starts.count(); i++) { | 140 for (int i = 0; i < starts.count(); i++) { |
142 if (starts[i] < ends[i] && *starts[i] == earliest) { | 141 if (starts[i] < ends[i] && *starts[i] == earliest) { |
143 starts[i]++; | 142 starts[i]++; |
144 } | 143 } |
145 } | 144 } |
146 } | 145 } |
147 } | 146 } |
148 | 147 |
149 void SkTileGrid::clear() { | |
150 for (int i = 0; i < fXTiles * fYTiles; i++) { | |
151 fTiles[i].reset(); | |
152 } | |
153 } | |
154 | |
OLD | NEW |