gfx/skia/trunk/include/core/SkTileGridPicture.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/core/SkTileGridPicture.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/*
     1.5 + * Copyright 2012 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkTileGridPicture_DEFINED
    1.12 +#define SkTileGridPicture_DEFINED
    1.13 +
    1.14 +#include "SkPicture.h"
    1.15 +#include "SkPoint.h"
    1.16 +#include "SkSize.h"
    1.17 +
    1.18 +/**
    1.19 + * Subclass of SkPicture that override the behavior of the
    1.20 + * kOptimizeForClippedPlayback_RecordingFlag by creating an SkTileGrid
    1.21 + * structure rather than an R-Tree. The tile grid has lower recording
    1.22 + * and playback costs, but is less effective at eliminating extraneous
    1.23 + * primitives for arbitrary query rectangles. It is most effective for
    1.24 + * tiled playback when the tile structure is known at record time.
    1.25 + */
    1.26 +class SK_API SkTileGridPicture : public SkPicture {
    1.27 +public:
    1.28 +    struct TileGridInfo {
    1.29 +        /** Tile placement interval */
    1.30 +        SkISize  fTileInterval;
    1.31 +
    1.32 +        /** Pixel coverage overlap between adjacent tiles */
    1.33 +        SkISize  fMargin;
    1.34 +
    1.35 +        /** Offset added to device-space bounding box positions to convert
    1.36 +          * them to tile-grid space. This can be used to adjust the "phase"
    1.37 +          * of the tile grid to match probable query rectangles that will be
    1.38 +          * used to search into the tile grid. As long as the offset is smaller
    1.39 +          * or equal to the margin, there is no need to extend the domain of
    1.40 +          * the tile grid to prevent data loss.
    1.41 +          */
    1.42 +        SkIPoint fOffset;
    1.43 +    };
    1.44 +    /**
    1.45 +     * Constructor
    1.46 +     * @param width recording canvas width in device pixels
    1.47 +     * @param height recording canvas height in device pixels
    1.48 +     * @param info description of the tiling layout
    1.49 +     */
    1.50 +    SkTileGridPicture(int width, int height, const TileGridInfo& info);
    1.51 +
    1.52 +    virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
    1.53 +
    1.54 +private:
    1.55 +    int fXTileCount, fYTileCount;
    1.56 +    TileGridInfo fInfo;
    1.57 +};
    1.58 +
    1.59 +#endif

mercurial