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 #ifndef SkTileGrid_DEFINED | 9 #ifndef SkTileGrid_DEFINED |
10 #define SkTileGrid_DEFINED | 10 #define SkTileGrid_DEFINED |
(...skipping 17 matching lines...) Expand all Loading... |
28 enum { | 28 enum { |
29 // Number of tiles for which data is allocated on the stack in | 29 // Number of tiles for which data is allocated on the stack in |
30 // SkTileGrid::search. If malloc becomes a bottleneck, we may consider | 30 // SkTileGrid::search. If malloc becomes a bottleneck, we may consider |
31 // increasing this number. Typical large web page, say 2k x 16k, would | 31 // increasing this number. Typical large web page, say 2k x 16k, would |
32 // require 512 tiles of size 256 x 256 pixels. | 32 // require 512 tiles of size 256 x 256 pixels. |
33 kStackAllocationTileCount = 1024 | 33 kStackAllocationTileCount = 1024 |
34 }; | 34 }; |
35 | 35 |
36 typedef void* (*SkTileGridNextDatumFunctionPtr)(SkTDArray<void*>** tileData,
SkAutoSTArray<kStackAllocationTileCount, int>& tileIndices); | 36 typedef void* (*SkTileGridNextDatumFunctionPtr)(SkTDArray<void*>** tileData,
SkAutoSTArray<kStackAllocationTileCount, int>& tileIndices); |
37 | 37 |
38 SkTileGrid(int xTileCount, int yTileCount, const SkTileGridPicture::TileGrid
Info& info, | 38 SkTileGrid(int xTileCount, int yTileCount, const SkTileGridFactory::TileGrid
Info& info, |
39 SkTileGridNextDatumFunctionPtr nextDatumFunction); | 39 SkTileGridNextDatumFunctionPtr nextDatumFunction); |
40 | 40 |
41 virtual ~SkTileGrid(); | 41 virtual ~SkTileGrid(); |
42 | 42 |
43 /** | 43 /** |
44 * Insert a data pointer and corresponding bounding box | 44 * Insert a data pointer and corresponding bounding box |
45 * @param data The data pointer, may be NULL | 45 * @param data The data pointer, may be NULL |
46 * @param bounds The bounding box, should not be empty | 46 * @param bounds The bounding box, should not be empty |
47 * @param defer Ignored, TileArray does not defer insertions | 47 * @param defer Ignored, TileArray does not defer insertions |
48 */ | 48 */ |
(...skipping 22 matching lines...) Expand all Loading... |
71 enum { | 71 enum { |
72 kTileFinished = -1, | 72 kTileFinished = -1, |
73 }; | 73 }; |
74 | 74 |
75 int tileCount(int x, int y); // For testing only. | 75 int tileCount(int x, int y); // For testing only. |
76 | 76 |
77 private: | 77 private: |
78 SkTDArray<void*>& tile(int x, int y); | 78 SkTDArray<void*>& tile(int x, int y); |
79 | 79 |
80 int fXTileCount, fYTileCount, fTileCount; | 80 int fXTileCount, fYTileCount, fTileCount; |
81 SkTileGridPicture::TileGridInfo fInfo; | 81 SkTileGridFactory::TileGridInfo fInfo; |
82 SkTDArray<void*>* fTileData; | 82 SkTDArray<void*>* fTileData; |
83 int fInsertionCount; | 83 int fInsertionCount; |
84 SkIRect fGridBounds; | 84 SkIRect fGridBounds; |
85 SkTileGridNextDatumFunctionPtr fNextDatumFunction; | 85 SkTileGridNextDatumFunctionPtr fNextDatumFunction; |
86 | 86 |
87 typedef SkBBoxHierarchy INHERITED; | 87 typedef SkBBoxHierarchy INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 /** | 90 /** |
91 * Generic implementation for SkTileGridNextDatumFunctionPtr. user code may inst
antiate | 91 * Generic implementation for SkTileGridNextDatumFunctionPtr. user code may inst
antiate |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 tileIndices[tile] = SkTileGrid::kTileFinished; | 133 tileIndices[tile] = SkTileGrid::kTileFinished; |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 return minVal; | 137 return minVal; |
138 } | 138 } |
139 return NULL; | 139 return NULL; |
140 } | 140 } |
141 | 141 |
142 #endif | 142 #endif |
OLD | NEW |