Staging for cleanup of SkPicture-related headers

https://codereview.chromium.org/243173002



git-svn-id: http://skia.googlecode.com/svn/trunk@14258 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2014-04-18 18:04:41 +00:00
parent 7b8999b504
commit 770963f23f
46 changed files with 297 additions and 207 deletions

View File

@ -9,6 +9,7 @@
#include "SkColor.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkPoint.h"
#include "SkRect.h"
#include "SkString.h"

View File

@ -9,6 +9,7 @@
#include "SkColor.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkPoint.h"
#include "SkRandom.h"
#include "SkRect.h"

View File

@ -20,6 +20,7 @@
#include "SkImageEncoder.h"
#include "SkOSFile.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkString.h"
#include "SkSurface.h"

View File

@ -7,6 +7,7 @@
*/
#include "SkDebugger.h"
#include "SkPictureRecorder.h"
#include "SkString.h"

View File

@ -2,9 +2,9 @@
#include "DMWriteTask.h"
#include "DMUtil.h"
#include "SkBBHFactory.h"
#include "SkCommandLineFlags.h"
#include "SkPicture.h"
#include "SkRTreePicture.h"
DEFINE_bool(replay, true, "If true, run picture replay tests.");
DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree.");

View File

@ -2,9 +2,9 @@
#include "DMWriteTask.h"
#include "DMUtil.h"
#include "SkBBHFactory.h"
#include "SkCommandLineFlags.h"
#include "SkPicture.h"
#include "SkTileGridPicture.h"
// TODO(mtklein): Tile grid tests are currently failing. (Skia issue 1198). When fixed, -> true.
DEFINE_bool(tileGrid, false, "If true, run picture replay tests with a tile grid.");

View File

@ -1,6 +1,7 @@
#include "DMUtil.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
namespace DM {

View File

@ -10,6 +10,7 @@
#include "gm.h"
#include "SkCanvas.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
namespace skiagm {

View File

@ -34,16 +34,14 @@
#include "SkOSFile.h"
#include "SkPDFRasterizer.h"
#include "SkPicture.h"
#include "SkQuadTreePicture.h"
#include "SkPictureRecorder.h"
#include "SkRefCnt.h"
#include "SkRTreePicture.h"
#include "SkScalar.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkSurface.h"
#include "SkTArray.h"
#include "SkTDict.h"
#include "SkTileGridPicture.h"
#include "SamplePipeControllers.h"
#ifdef SK_DEBUG

View File

@ -8,6 +8,7 @@
#include "gm.h"
#include "SkDebugCanvas.h"
#include "SkPictureFlat.h"
#include "SkPictureRecorder.h"
#define WARN(msg) \
SkDebugf("%s:%d: %s\n", __FILE__, __LINE__, msg);

View File

@ -13,6 +13,7 @@
#include "SkPath.h"
#include "SkPathOps.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkRect.h"
namespace skiagm {

View File

@ -8,6 +8,7 @@
#include "gm.h"
#include "SkPictureImageFilter.h"
#include "SkPictureRecorder.h"
// This GM exercises the SkPictureImageFilter ImageFilter class.

View File

@ -10,6 +10,7 @@
#include "SkBitmap.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkShader.h"
namespace skiagm {

View File

@ -298,6 +298,7 @@
'SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD',
'SK_SUPPORT_DEPRECATED_RECORD_FLAGS',
'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
'SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS',
],
}],

View File

@ -13,6 +13,7 @@
'<(skia_src_path)/core/SkAdvancedTypefaceMetrics.cpp',
'<(skia_src_path)/core/SkAlphaRuns.cpp',
'<(skia_src_path)/core/SkAntiRun.h',
'<(skia_src_path)/core/SkBBHFactory.cpp',
'<(skia_src_path)/core/SkBBoxHierarchy.h',
'<(skia_src_path)/core/SkBBoxRecord.cpp',
'<(skia_src_path)/core/SkBBoxRecord.h',
@ -133,6 +134,7 @@
'<(skia_src_path)/core/SkPicturePlayback.h',
'<(skia_src_path)/core/SkPictureRecord.cpp',
'<(skia_src_path)/core/SkPictureRecord.h',
'<(skia_src_path)/core/SkPictureRecorder.cpp',
'<(skia_src_path)/core/SkPictureShader.cpp',
'<(skia_src_path)/core/SkPictureShader.h',
'<(skia_src_path)/core/SkPictureStateTree.cpp',
@ -219,6 +221,7 @@
'<(skia_src_path)/pipe/SkGPipeWrite.cpp',
'<(skia_include_path)/core/SkAdvancedTypefaceMetrics.h',
'<(skia_include_path)/core/SkBBHFactory.h',
'<(skia_include_path)/core/SkBitmap.h',
'<(skia_include_path)/core/SkBitmapDevice.h',
'<(skia_include_path)/core/SkBlitRow.h',
@ -271,6 +274,7 @@
'<(skia_include_path)/core/SkPathMeasure.h',
'<(skia_include_path)/core/SkPathRef.h',
'<(skia_include_path)/core/SkPicture.h',
'<(skia_include_path)/core/SkPictureRecorder.h',
'<(skia_include_path)/core/SkPixelRef.h',
'<(skia_include_path)/core/SkPoint.h',
'<(skia_include_path)/core/SkPreConfig.h',

View File

@ -20,6 +20,7 @@
'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
'SK_SUPPORT_LEGACY_N32_NAME',
'SK_SUPPORT_LEGACY_PROCXFERMODE',
'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
],
},
}

View File

@ -0,0 +1,69 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkBBHFactory_DEFINED
#define SkBBHFactory_DEFINED
#include "SkSize.h"
#include "SkPoint.h"
class SkBBoxHierarchy;
class SkBBHFactory {
public:
/**
* Allocate a new SkBBoxHierarchy. Return NULL on failure.
*/
virtual SkBBoxHierarchy* operator()(int width, int height) const = 0;
virtual ~SkBBHFactory() {};
};
class SkQuadTreeFactory : public SkBBHFactory {
public:
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
typedef SkBBHFactory INHERITED;
};
class SkRTreeFactory : public SkBBHFactory {
public:
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
typedef SkBBHFactory INHERITED;
};
class SkTileGridFactory : public SkBBHFactory {
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;
};
SkTileGridFactory(const TileGridInfo& info) : fInfo(info) { }
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
TileGridInfo fInfo;
typedef SkBBHFactory INHERITED;
};
#endif

View File

@ -434,106 +434,8 @@ private:
#endif
class SkBBHFactory {
public:
/**
* Allocate a new SkBBoxHierarchy. Return NULL on failure.
*/
virtual SkBBoxHierarchy* operator()(int width, int height) const = 0;
virtual ~SkBBHFactory() {};
};
class SK_API SkPictureRecorder : SkNoncopyable {
public:
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkPictureRecorder(SkPictureFactory* factory = NULL) {
fFactory.reset(factory);
if (NULL != fFactory.get()) {
fFactory.get()->ref();
}
}
/** Returns the canvas that records the drawing commands.
@param width the base width for the picture, as if the recording
canvas' bitmap had this width.
@param height the base width for the picture, as if the recording
canvas' bitmap had this height.
@param recordFlags optional flags that control recording.
@return the canvas.
*/
SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0) {
if (NULL != fFactory) {
fPicture.reset(fFactory->create(width, height));
recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
} else {
fPicture.reset(SkNEW(SkPicture));
}
return fPicture->beginRecording(width, height, recordFlags);
}
#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
#include "SkPictureRecorder.h"
#endif
/** Returns the canvas that records the drawing commands.
@param width the base width for the picture, as if the recording
canvas' bitmap had this width.
@param height the base width for the picture, as if the recording
canvas' bitmap had this height.
@param bbhFactory factory to create desired acceleration structure
@param recordFlags optional flags that control recording.
@return the canvas.
*/
// TODO: allow default parameters once the other beginRecoding entry point is gone
SkCanvas* beginRecording(int width, int height,
SkBBHFactory* bbhFactory /* = NULL */,
uint32_t recordFlags /* = 0 */) {
fPicture.reset(SkNEW(SkPicture));
return fPicture->beginRecording(width, height, bbhFactory, recordFlags);
}
/** Returns the recording canvas if one is active, or NULL if recording is
not active. This does not alter the refcnt on the canvas (if present).
*/
SkCanvas* getRecordingCanvas() {
if (NULL != fPicture.get()) {
return fPicture->getRecordingCanvas();
}
return NULL;
}
/** Signal that the caller is done recording. This invalidates the canvas
returned by beginRecording/getRecordingCanvas, and returns the
created SkPicture. Note that the returned picture has its creation
ref which the caller must take ownership of.
*/
SkPicture* endRecording() {
if (NULL != fPicture.get()) {
fPicture->endRecording();
return fPicture.detach();
}
return NULL;
}
/** Enable/disable all the picture recording optimizations (i.e.,
those in SkPictureRecord). It is mainly intended for testing the
existing optimizations (i.e., to actually have the pattern
appear in an .skp we have to disable the optimization). Call right
after 'beginRecording'.
*/
void internalOnly_EnableOpts(bool enableOpts) {
if (NULL != fPicture.get()) {
fPicture->internalOnly_EnableOpts(enableOpts);
}
}
private:
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkAutoTUnref<SkPictureFactory> fFactory;
#endif
SkAutoTUnref<SkPicture> fPicture;
typedef SkNoncopyable INHERITED;
};
#endif

View File

@ -0,0 +1,107 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPictureRecorder_DEFINED
#define SkPictureRecorder_DEFINED
#include "SkBBHFactory.h"
#include "SkPicture.h"
#include "SkRefCnt.h"
class SkCanvas;
class SK_API SkPictureRecorder : SkNoncopyable {
public:
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkPictureRecorder(SkPictureFactory* factory = NULL) {
fFactory.reset(factory);
if (NULL != fFactory.get()) {
fFactory.get()->ref();
}
}
/** Returns the canvas that records the drawing commands.
@param width the base width for the picture, as if the recording
canvas' bitmap had this width.
@param height the base width for the picture, as if the recording
canvas' bitmap had this height.
@param recordFlags optional flags that control recording.
@return the canvas.
*/
SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0) {
if (NULL != fFactory) {
fPicture.reset(fFactory->create(width, height));
recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
} else {
fPicture.reset(SkNEW(SkPicture));
}
return fPicture->beginRecording(width, height, recordFlags);
}
#endif
/** Returns the canvas that records the drawing commands.
@param width the base width for the picture, as if the recording
canvas' bitmap had this width.
@param height the base width for the picture, as if the recording
canvas' bitmap had this height.
@param bbhFactory factory to create desired acceleration structure
@param recordFlags optional flags that control recording.
@return the canvas.
*/
// TODO: allow default parameters once the other beginRecoding entry point is gone
SkCanvas* beginRecording(int width, int height,
SkBBHFactory* bbhFactory /* = NULL */,
uint32_t recordFlags /* = 0 */);
/** Returns the recording canvas if one is active, or NULL if recording is
not active. This does not alter the refcnt on the canvas (if present).
*/
SkCanvas* getRecordingCanvas() {
if (NULL != fPicture.get()) {
return fPicture->getRecordingCanvas();
}
return NULL;
}
/** Signal that the caller is done recording. This invalidates the canvas
returned by beginRecording/getRecordingCanvas, and returns the
created SkPicture. Note that the returned picture has its creation
ref which the caller must take ownership of.
*/
SkPicture* endRecording() {
if (NULL != fPicture.get()) {
fPicture->endRecording();
return fPicture.detach();
}
return NULL;
}
/** Enable/disable all the picture recording optimizations (i.e.,
those in SkPictureRecord). It is mainly intended for testing the
existing optimizations (i.e., to actually have the pattern
appear in an .skp we have to disable the optimization). Call right
after 'beginRecording'.
*/
void internalOnly_EnableOpts(bool enableOpts) {
if (NULL != fPicture.get()) {
fPicture->internalOnly_EnableOpts(enableOpts);
}
}
private:
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkAutoTUnref<SkPictureFactory> fFactory;
#endif
SkAutoTUnref<SkPicture> fPicture;
typedef SkNoncopyable INHERITED;
};
#endif

View File

@ -8,16 +8,14 @@
#ifndef SkRTreePicture_DEFINED
#define SkRTreePicture_DEFINED
#include "SkPicture.h"
class SkRTreeFactory : public SkBBHFactory {
public:
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
typedef SkBBHFactory INHERITED;
};
#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
#include "SkBBHFactory.h"
#endif
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
#include "SkPicture.h"
/**
* Subclass of SkPicture that creates an RTree acceleration structure.
*/

View File

@ -8,41 +8,16 @@
#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"
class SkTileGridFactory : public SkBBHFactory {
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;
};
SkTileGridFactory(const TileGridInfo& info) : fInfo(info) { }
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
TileGridInfo fInfo;
typedef SkBBHFactory INHERITED;
};
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
/**
* 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

View File

@ -26,6 +26,7 @@
#include "SkLayerRasterizer.h"
#include "SkMath.h"
#include "SkPath.h"
#include "SkPictureRecorder.h"
#include "SkRegion.h"
#include "SkShader.h"
#include "SkComposeShader.h"

View File

@ -14,6 +14,7 @@
#include "SkImageEncoder.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkStream.h"
#include "SkTSort.h"
#include "SkTime.h"

View File

@ -11,6 +11,7 @@
#include "SkOSMenu.h"
#include "SkPath.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkScalar.h"
#include "SkTDArray.h"
#include "SkTouchGesture.h"

View File

@ -15,12 +15,10 @@
#include "SkOSFile.h"
#include "SkPath.h"
#include "SkPicture.h"
#include "SkQuadTreePicture.h"
#include "SkPictureRecorder.h"
#include "SkRandom.h"
#include "SkRegion.h"
#include "SkRTreePicture.h"
#include "SkShader.h"
#include "SkTileGridPicture.h"
#include "SkUtils.h"
#include "SkColorPriv.h"
#include "SkColorFilter.h"

View File

@ -17,6 +17,7 @@
#include "SkOSFile.h"
#include "SkPath.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkRandom.h"
#include "SkRegion.h"
#include "SkShader.h"

View File

@ -10,6 +10,7 @@
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkPictureRecorder.h"
#include "SkRegion.h"
#include "SkShader.h"
#include "SkUtils.h"

44
src/core/SkBBHFactory.cpp Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBBHFactory.h"
#include "SkPictureStateTree.h"
#include "SkQuadTree.h"
#include "SkRTree.h"
#include "SkTileGrid.h"
SkBBoxHierarchy* SkQuadTreeFactory::operator()(int width, int height) const {
return SkNEW_ARGS(SkQuadTree, (SkIRect::MakeWH(width, height)));
}
SkBBoxHierarchy* SkRTreeFactory::operator()(int width, int height) const {
// These values were empirically determined to produce reasonable
// performance in most cases.
static const int kRTreeMinChildren = 6;
static const int kRTreeMaxChildren = 11;
SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width),
SkIntToScalar(height));
bool sortDraws = false; // Do not sort draw calls when bulk loading.
return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
aspectRatio, sortDraws);
}
SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const {
SkASSERT(fInfo.fMargin.width() >= 0);
SkASSERT(fInfo.fMargin.height() >= 0);
// Note: SkIRects are non-inclusive of the right() column and bottom() row.
// For example, an SkIRect at 0,0 with a size of (1,1) will only have
// content at pixel (0,0) and will report left=0 and right=1, hence the
// "-1"s below.
int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInterval.width();
int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileInterval.height();
return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo,
SkTileGridNextDatum<SkPictureStateTree::Draw>));
}

View File

@ -11,6 +11,7 @@
#include "SkPicturePlayback.h"
#include "SkPictureRecord.h"
#include "SkBBHFactory.h"
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkChunkAlloc.h"

View File

@ -0,0 +1,15 @@
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkPictureRecorder.h"
SkCanvas* SkPictureRecorder::beginRecording(int width, int height,
SkBBHFactory* bbhFactory /* = NULL */,
uint32_t recordFlags /* = 0 */) {
fPicture.reset(SkNEW(SkPicture));
return fPicture->beginRecording(width, height, bbhFactory, recordFlags);
}

View File

@ -5,16 +5,12 @@
* found in the LICENSE file.
*/
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
#include "SkQuadTreePicture.h"
#include "SkQuadTree.h"
SkBBoxHierarchy* SkQuadTreeFactory::operator()(int width, int height) const {
return SkNEW_ARGS(SkQuadTree, (SkIRect::MakeWH(width, height)));
}
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkBBoxHierarchy* SkQuadTreePicture::createBBoxHierarchy() const {
return SkNEW_ARGS(SkQuadTree, (fBounds));
}

View File

@ -8,17 +8,13 @@
#ifndef SkQuadTreePicture_DEFINED
#define SkQuadTreePicture_DEFINED
#include "SkPicture.h"
class SkQuadTreeFactory : public SkBBHFactory {
public:
virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
private:
typedef SkBBHFactory INHERITED;
};
#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
#include "SkBBHFactory.h"
#endif
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
#include "SkPicture.h"
#include "SkRect.h"
/**

View File

@ -5,26 +5,12 @@
* found in the LICENSE file.
*/
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
#include "SkRTreePicture.h"
#include "SkRTree.h"
SkBBoxHierarchy* SkRTreeFactory::operator()(int width, int height) const {
// These values were empirically determined to produce reasonable
// performance in most cases.
static const int kRTreeMinChildren = 6;
static const int kRTreeMaxChildren = 11;
SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width),
SkIntToScalar(height));
bool sortDraws = false; // Do not sort draw calls when bulk loading.
return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
aspectRatio, sortDraws);
}
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkBBoxHierarchy* SkRTreePicture::createBBoxHierarchy() const {
// These values were empirically determined to produce reasonable
// performance in most cases.

View File

@ -9,9 +9,9 @@
#ifndef SkTileGrid_DEFINED
#define SkTileGrid_DEFINED
#include "SkBBHFactory.h"
#include "SkBBoxHierarchy.h"
#include "SkPictureStateTree.h"
#include "SkTileGridPicture.h" // for TileGridInfo
/**
* Subclass of SkBBoxHierarchy that stores elements in buckets that correspond

View File

@ -5,27 +5,13 @@
* found in the LICENSE file.
*/
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
#include "SkTileGridPicture.h"
#include "SkPictureStateTree.h"
#include "SkTileGrid.h"
SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const {
SkASSERT(fInfo.fMargin.width() >= 0);
SkASSERT(fInfo.fMargin.height() >= 0);
// Note: SkIRects are non-inclusive of the right() column and bottom() row.
// For example, an SkIRect at 0,0 with a size of (1,1) will only have
// content at pixel (0,0) and will report left=0 and right=1, hence the
// "-1"s below.
int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInterval.width();
int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileInterval.height();
return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo,
SkTileGridNextDatum<SkPictureStateTree::Draw>));
}
#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
SkTileGridPicture::SkTileGridPicture(int width, int height,
const SkTileGridFactory::TileGridInfo& info) {
SkASSERT(info.fMargin.width() >= 0);

View File

@ -55,6 +55,7 @@
#include "SkPath.h"
#include "SkPicture.h"
#include "SkPictureRecord.h"
#include "SkPictureRecorder.h"
#include "SkProxyCanvas.h"
#include "SkRect.h"
#include "SkRegion.h"

View File

@ -24,7 +24,7 @@
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkPicture.h"
#include "SkRTreePicture.h"
#include "SkPictureRecorder.h"
#include "SkRect.h"
#include "SkTileImageFilter.h"
#include "SkXfermodeImageFilter.h"

View File

@ -15,14 +15,12 @@
#include "SkImageGenerator.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkPictureUtils.h"
#include "SkQuadTreePicture.h"
#include "SkRRect.h"
#include "SkRandom.h"
#include "SkRTreePicture.h"
#include "SkShader.h"
#include "SkStream.h"
#include "SkTileGrid.h"
#include "Test.h"
static const int gColorScale = 30;

View File

@ -9,6 +9,7 @@
#include "SkBitmapSource.h"
#include "SkCanvas.h"
#include "SkMallocPixelRef.h"
#include "SkPictureRecorder.h"
#include "SkTemplates.h"
#include "SkWriteBuffer.h"
#include "SkValidatingReadBuffer.h"

View File

@ -7,8 +7,8 @@
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkPictureRecorder.h"
#include "SkTileGrid.h"
#include "SkTileGridPicture.h"
#include "Test.h"
enum Tile {

View File

@ -24,16 +24,13 @@
#include "SkMatrix.h"
#include "SkOSFile.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkPictureUtils.h"
#include "SkPixelRef.h"
#include "SkQuadTree.h"
#include "SkQuadTreePicture.h"
#include "SkRTreePicture.h"
#include "SkScalar.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkTemplates.h"
#include "SkTileGridPicture.h"
#include "SkTDArray.h"
#include "SkThreadUtils.h"
#include "SkTypes.h"

View File

@ -15,13 +15,13 @@
#include "SkMath.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkRect.h"
#include "SkRefCnt.h"
#include "SkRunnable.h"
#include "SkString.h"
#include "SkTDArray.h"
#include "SkThreadPool.h"
#include "SkTileGridPicture.h"
#include "SkTypes.h"
#if SK_SUPPORT_GPU

View File

@ -10,12 +10,10 @@
#include "SkGraphics.h"
#include "SkOSFile.h"
#include "SkPicture.h"
#include "SkQuadTreePicture.h"
#include "SkPictureRecorder.h"
#include "SkRecording.h"
#include "SkRTreePicture.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkTileGridPicture.h"
#include "SkTime.h"
#include "LazyDecodeBitmap.h"

View File

@ -15,6 +15,7 @@
#include "SkPicture.h"
#include "SkPicturePlayback.h"
#include "SkPictureRecord.h"
#include "SkPictureRecorder.h"
#include "SkStream.h"
#include "picture_utils.h"
#include "path_utils.h"

View File

@ -16,6 +16,7 @@
#include "SkMath.h"
#include "SkOSFile.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkStream.h"
#include "SkString.h"
#include "PictureRenderer.h"

View File

@ -12,6 +12,7 @@
#include "SkCommandLineFlags.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkScalar.h"
#include "SkStream.h"