OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef SkTileGridPicture_DEFINED | |
9 #define SkTileGridPicture_DEFINED | |
10 | |
11 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS | |
12 #include "SkBBHFactory.h" | |
13 #endif | |
14 | |
15 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES | |
16 | |
17 #include "SkPicture.h" | |
18 #include "SkPoint.h" | |
19 #include "SkSize.h" | |
20 | |
21 /** | |
22 * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower rec
ording | |
23 * and playback costs then rTree, but is less effective at eliminating extraneou
s | |
24 * primitives for arbitrary query rectangles. It is most effective for | |
25 * tiled playback when the tile structure is known at record time. | |
26 */ | |
27 class SK_API SkTileGridPicture : public SkPicture { | |
28 public: | |
29 typedef SkTileGridFactory::TileGridInfo TileGridInfo; | |
30 | |
31 /** | |
32 * Constructor | |
33 * @param width recording canvas width in device pixels | |
34 * @param height recording canvas height in device pixels | |
35 * @param info description of the tiling layout | |
36 */ | |
37 SkTileGridPicture(int width, int height, const SkTileGridFactory::TileGridIn
fo& info); | |
38 | |
39 virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE; | |
40 | |
41 private: | |
42 int fXTileCount, fYTileCount; | |
43 SkTileGridFactory::TileGridInfo fInfo; | |
44 | |
45 typedef SkPicture INHERITED; | |
46 }; | |
47 | |
48 class SkTileGridPictureFactory : public SkPictureFactory { | |
49 public: | |
50 SkTileGridPictureFactory(const SkTileGridFactory::TileGridInfo& info) : fInf
o(info) { } | |
51 | |
52 virtual SkPicture* create(int width, int height) SK_OVERRIDE { | |
53 return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo)); | |
54 } | |
55 | |
56 protected: | |
57 SkTileGridFactory::TileGridInfo fInfo; | |
58 | |
59 private: | |
60 typedef SkPictureFactory INHERITED; | |
61 }; | |
62 #endif | |
63 | |
64 #endif | |
OLD | NEW |