Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / include / core / SkTileGridPicture.h
index af7f0e2..0196940 100644 (file)
@@ -8,49 +8,57 @@
 #ifndef SkTileGridPicture_DEFINED
 #define SkTileGridPicture_DEFINED
 
+#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
+#include "SkBBHFactory.h"
+#endif
+
+#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
+
 #include "SkPicture.h"
 #include "SkPoint.h"
 #include "SkSize.h"
 
 /**
- * Subclass of SkPicture that override the behavior of the
- * kOptimizeForClippedPlayback_RecordingFlag by creating an SkTileGrid
- * structure rather than an R-Tree. The tile grid has lower recording
- * and playback costs, but is less effective at eliminating extraneous
+ * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower recording
+ * and playback costs then rTree, but is less effective at eliminating extraneous
  * primitives for arbitrary query rectangles. It is most effective for
  * tiled playback when the tile structure is known at record time.
  */
 class SK_API SkTileGridPicture : public SkPicture {
 public:
-    struct TileGridInfo {
-        /** Tile placement interval */
-        SkISize  fTileInterval;
-
-        /** Pixel coverage overlap between adjacent tiles */
-        SkISize  fMargin;
-
-        /** Offset added to device-space bounding box positions to convert
-          * them to tile-grid space. This can be used to adjust the "phase"
-          * of the tile grid to match probable query rectangles that will be
-          * used to search into the tile grid. As long as the offset is smaller
-          * or equal to the margin, there is no need to extend the domain of
-          * the tile grid to prevent data loss.
-          */
-        SkIPoint fOffset;
-    };
+    typedef SkTileGridFactory::TileGridInfo TileGridInfo;
+
     /**
      * Constructor
      * @param width recording canvas width in device pixels
      * @param height recording canvas height in device pixels
      * @param info description of the tiling layout
      */
-    SkTileGridPicture(int width, int height, const TileGridInfo& info);
+    SkTileGridPicture(int width, int height, const SkTileGridFactory::TileGridInfo& info);
 
     virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
 
 private:
     int fXTileCount, fYTileCount;
-    TileGridInfo fInfo;
+    SkTileGridFactory::TileGridInfo fInfo;
+
+    typedef SkPicture INHERITED;
 };
 
+class SkTileGridPictureFactory : public SkPictureFactory {
+public:
+    SkTileGridPictureFactory(const SkTileGridFactory::TileGridInfo& info) : fInfo(info) { }
+
+    virtual SkPicture* create(int width, int height) SK_OVERRIDE {
+        return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo));
+    }
+
+protected:
+    SkTileGridFactory::TileGridInfo fInfo;
+
+private:
+    typedef SkPictureFactory INHERITED;
+};
+#endif
+
 #endif