d393b17cf3
This CL sets the stage for retracting the SkPicture::kOptimizeForClippedPlayback_RecordingFlag flag from the public API (more work needs to be done in Blink & Chrome). In the new world the only way to set this flag (and thus instantiate an SkPicture-derived class) is by passing a factory to the SkPictureRecorder class. This is to get all clients always using factories so that we can then change the factory call used (i.e., so the factory just creates a BBH) and do away with the SkPicture-derived classes. BUG=skia:2315 R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/239703006 git-svn-id: http://skia.googlecode.com/svn/trunk@14221 2bbb7eff-a529-9590-31e7-b0007b416f81
72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
/*
|
|
* Copyright 2012 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkTileGridPicture_DEFINED
|
|
#define SkTileGridPicture_DEFINED
|
|
|
|
#include "SkPicture.h"
|
|
#include "SkPoint.h"
|
|
#include "SkSize.h"
|
|
|
|
/**
|
|
* 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;
|
|
};
|
|
/**
|
|
* 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);
|
|
|
|
virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
|
|
|
|
private:
|
|
int fXTileCount, fYTileCount;
|
|
TileGridInfo fInfo;
|
|
|
|
typedef SkPicture INHERITED;
|
|
};
|
|
|
|
class SkTileGridPictureFactory : public SkPictureFactory {
|
|
public:
|
|
SkTileGridPictureFactory(const SkTileGridPicture::TileGridInfo& info) : fInfo(info) { }
|
|
|
|
virtual SkPicture* create(int width, int height) SK_OVERRIDE {
|
|
return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo));
|
|
}
|
|
|
|
protected:
|
|
SkTileGridPicture::TileGridInfo fInfo;
|
|
|
|
private:
|
|
typedef SkPictureFactory INHERITED;
|
|
};
|
|
|
|
#endif
|