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 #ifndef SkTileGridPicture_DEFINED | 8 #ifndef SkTileGridPicture_DEFINED |
9 #define SkTileGridPicture_DEFINED | 9 #define SkTileGridPicture_DEFINED |
10 | 10 |
| 11 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS |
| 12 #include "SkBBHFactory.h" |
| 13 #endif |
| 14 |
| 15 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES |
| 16 |
11 #include "SkPicture.h" | 17 #include "SkPicture.h" |
12 #include "SkPoint.h" | 18 #include "SkPoint.h" |
13 #include "SkSize.h" | 19 #include "SkSize.h" |
14 | 20 |
15 class SkTileGridFactory : public SkBBHFactory { | |
16 public: | |
17 struct TileGridInfo { | |
18 /** Tile placement interval */ | |
19 SkISize fTileInterval; | |
20 | |
21 /** Pixel coverage overlap between adjacent tiles */ | |
22 SkISize fMargin; | |
23 | |
24 /** Offset added to device-space bounding box positions to convert | |
25 * them to tile-grid space. This can be used to adjust the "phase" | |
26 * of the tile grid to match probable query rectangles that will be | |
27 * used to search into the tile grid. As long as the offset is smaller | |
28 * or equal to the margin, there is no need to extend the domain of | |
29 * the tile grid to prevent data loss. | |
30 */ | |
31 SkIPoint fOffset; | |
32 }; | |
33 | |
34 SkTileGridFactory(const TileGridInfo& info) : fInfo(info) { } | |
35 | |
36 virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE
; | |
37 | |
38 private: | |
39 TileGridInfo fInfo; | |
40 | |
41 typedef SkBBHFactory INHERITED; | |
42 }; | |
43 | |
44 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES | |
45 | |
46 /** | 21 /** |
47 * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower rec
ording | 22 * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower rec
ording |
48 * and playback costs then rTree, but is less effective at eliminating extraneou
s | 23 * and playback costs then rTree, but is less effective at eliminating extraneou
s |
49 * primitives for arbitrary query rectangles. It is most effective for | 24 * primitives for arbitrary query rectangles. It is most effective for |
50 * tiled playback when the tile structure is known at record time. | 25 * tiled playback when the tile structure is known at record time. |
51 */ | 26 */ |
52 class SK_API SkTileGridPicture : public SkPicture { | 27 class SK_API SkTileGridPicture : public SkPicture { |
53 public: | 28 public: |
54 typedef SkTileGridFactory::TileGridInfo TileGridInfo; | 29 typedef SkTileGridFactory::TileGridInfo TileGridInfo; |
55 | 30 |
(...skipping 24 matching lines...) Expand all Loading... |
80 | 55 |
81 protected: | 56 protected: |
82 SkTileGridFactory::TileGridInfo fInfo; | 57 SkTileGridFactory::TileGridInfo fInfo; |
83 | 58 |
84 private: | 59 private: |
85 typedef SkPictureFactory INHERITED; | 60 typedef SkPictureFactory INHERITED; |
86 }; | 61 }; |
87 #endif | 62 #endif |
88 | 63 |
89 #endif | 64 #endif |
OLD | NEW |