Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: include/core/SkTileGridPicture.h

Issue 238273012: Staged removal of SkPicture-derived classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: have SkPicture only friend SkPictureRecorder once Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkRTreePicture.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkPicture.h" 11 #include "SkPicture.h"
12 #include "SkPoint.h" 12 #include "SkPoint.h"
13 #include "SkSize.h" 13 #include "SkSize.h"
14 14
15 /** 15 class SkTileGridFactory : public SkBBHFactory {
16 * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower rec ording
17 * and playback costs then rTree, but is less effective at eliminating extraneou s
18 * primitives for arbitrary query rectangles. It is most effective for
19 * tiled playback when the tile structure is known at record time.
20 */
21 class SK_API SkTileGridPicture : public SkPicture {
22 public: 16 public:
23 struct TileGridInfo { 17 struct TileGridInfo {
24 /** Tile placement interval */ 18 /** Tile placement interval */
25 SkISize fTileInterval; 19 SkISize fTileInterval;
26 20
27 /** Pixel coverage overlap between adjacent tiles */ 21 /** Pixel coverage overlap between adjacent tiles */
28 SkISize fMargin; 22 SkISize fMargin;
29 23
30 /** Offset added to device-space bounding box positions to convert 24 /** Offset added to device-space bounding box positions to convert
31 * them to tile-grid space. This can be used to adjust the "phase" 25 * them to tile-grid space. This can be used to adjust the "phase"
32 * of the tile grid to match probable query rectangles that will be 26 * of the tile grid to match probable query rectangles that will be
33 * used to search into the tile grid. As long as the offset is smaller 27 * used to search into the tile grid. As long as the offset is smaller
34 * or equal to the margin, there is no need to extend the domain of 28 * or equal to the margin, there is no need to extend the domain of
35 * the tile grid to prevent data loss. 29 * the tile grid to prevent data loss.
36 */ 30 */
37 SkIPoint fOffset; 31 SkIPoint fOffset;
38 }; 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 /**
47 * 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
49 * primitives for arbitrary query rectangles. It is most effective for
50 * tiled playback when the tile structure is known at record time.
51 */
52 class SK_API SkTileGridPicture : public SkPicture {
53 public:
54 typedef SkTileGridFactory::TileGridInfo TileGridInfo;
55
39 /** 56 /**
40 * Constructor 57 * Constructor
41 * @param width recording canvas width in device pixels 58 * @param width recording canvas width in device pixels
42 * @param height recording canvas height in device pixels 59 * @param height recording canvas height in device pixels
43 * @param info description of the tiling layout 60 * @param info description of the tiling layout
44 */ 61 */
45 SkTileGridPicture(int width, int height, const TileGridInfo& info); 62 SkTileGridPicture(int width, int height, const SkTileGridFactory::TileGridIn fo& info);
46 63
47 virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE; 64 virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
48 65
49 private: 66 private:
50 int fXTileCount, fYTileCount; 67 int fXTileCount, fYTileCount;
51 TileGridInfo fInfo; 68 SkTileGridFactory::TileGridInfo fInfo;
52 69
53 typedef SkPicture INHERITED; 70 typedef SkPicture INHERITED;
54 }; 71 };
55 72
56 class SkTileGridPictureFactory : public SkPictureFactory { 73 class SkTileGridPictureFactory : public SkPictureFactory {
57 public: 74 public:
58 SkTileGridPictureFactory(const SkTileGridPicture::TileGridInfo& info) : fInf o(info) { } 75 SkTileGridPictureFactory(const SkTileGridFactory::TileGridInfo& info) : fInf o(info) { }
59 76
60 virtual SkPicture* create(int width, int height) SK_OVERRIDE { 77 virtual SkPicture* create(int width, int height) SK_OVERRIDE {
61 return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo)); 78 return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo));
62 } 79 }
63 80
64 protected: 81 protected:
65 SkTileGridPicture::TileGridInfo fInfo; 82 SkTileGridFactory::TileGridInfo fInfo;
66 83
67 private: 84 private:
68 typedef SkPictureFactory INHERITED; 85 typedef SkPictureFactory INHERITED;
69 }; 86 };
87 #endif
70 88
71 #endif 89 #endif
OLDNEW
« no previous file with comments | « include/core/SkRTreePicture.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698