2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2007 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkPicture_DEFINED
|
|
|
|
#define SkPicture_DEFINED
|
|
|
|
|
2013-02-22 21:38:35 +00:00
|
|
|
#include "SkBitmap.h"
|
2014-06-24 15:29:06 +00:00
|
|
|
#include "SkDrawPictureCallback.h"
|
2013-06-28 21:32:00 +00:00
|
|
|
#include "SkImageDecoder.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
#include "SkRefCnt.h"
|
2014-07-08 13:12:22 +00:00
|
|
|
#include "SkTDArray.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-03-19 21:24:25 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
class GrContext;
|
|
|
|
#endif
|
|
|
|
|
2012-11-01 17:10:32 +00:00
|
|
|
class SkBBoxHierarchy;
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkCanvas;
|
2013-05-21 20:31:23 +00:00
|
|
|
class SkData;
|
2014-07-01 15:47:04 +00:00
|
|
|
class SkPictureData;
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkStream;
|
|
|
|
class SkWStream;
|
|
|
|
|
2013-06-28 21:32:00 +00:00
|
|
|
struct SkPictInfo;
|
|
|
|
|
2014-06-23 19:13:26 +00:00
|
|
|
class SkRecord;
|
|
|
|
|
2014-10-30 23:45:02 +00:00
|
|
|
namespace SkRecords {
|
|
|
|
class CollectLayers;
|
|
|
|
};
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/** \class SkPicture
|
|
|
|
|
|
|
|
The SkPicture class records the drawing commands made to a canvas, to
|
|
|
|
be played back at a later time.
|
|
|
|
*/
|
2014-11-20 17:18:31 +00:00
|
|
|
class SK_API SkPicture : public SkNVRefCnt<SkPicture> {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
2014-03-16 19:46:36 +00:00
|
|
|
// AccelData provides a base class for device-specific acceleration
|
2014-11-12 17:32:34 +00:00
|
|
|
// data. It is added to the picture via EXPERIMENTAL_addAccelData.
|
2014-03-16 19:46:36 +00:00
|
|
|
class AccelData : public SkRefCnt {
|
|
|
|
public:
|
|
|
|
typedef uint8_t Domain;
|
|
|
|
typedef uint32_t Key;
|
|
|
|
|
|
|
|
AccelData(Key key) : fKey(key) { }
|
|
|
|
|
|
|
|
const Key& getKey() const { return fKey; }
|
|
|
|
|
|
|
|
// This entry point allows user's to get a unique domain prefix
|
|
|
|
// for their keys
|
|
|
|
static Domain GenerateDomain();
|
|
|
|
private:
|
|
|
|
Key fKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** PRIVATE / EXPERIMENTAL -- do not call */
|
2014-06-23 19:13:26 +00:00
|
|
|
void EXPERIMENTAL_addAccelData(const AccelData*) const;
|
|
|
|
|
2014-03-16 19:46:36 +00:00
|
|
|
/** PRIVATE / EXPERIMENTAL -- do not call */
|
2014-06-23 19:13:26 +00:00
|
|
|
const AccelData* EXPERIMENTAL_getAccelData(AccelData::Key) const;
|
2014-03-16 19:46:36 +00:00
|
|
|
|
2012-06-25 14:36:28 +00:00
|
|
|
/**
|
2013-02-22 21:38:35 +00:00
|
|
|
* Function signature defining a function that sets up an SkBitmap from encoded data. On
|
|
|
|
* success, the SkBitmap should have its Config, width, height, rowBytes and pixelref set.
|
|
|
|
* If the installed pixelref has decoded the data into pixels, then the src buffer need not be
|
|
|
|
* copied. If the pixelref defers the actual decode until its lockPixels() is called, then it
|
|
|
|
* must make a copy of the src buffer.
|
|
|
|
* @param src Encoded data.
|
|
|
|
* @param length Size of the encoded data, in bytes.
|
|
|
|
* @param dst SkBitmap to install the pixel ref on.
|
|
|
|
* @param bool Whether or not a pixel ref was successfully installed.
|
2012-06-25 14:36:28 +00:00
|
|
|
*/
|
2013-02-22 21:38:35 +00:00
|
|
|
typedef bool (*InstallPixelRefProc)(const void* src, size_t length, SkBitmap* dst);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Recreate a picture that was serialized into a stream.
|
|
|
|
* @param SkStream Serialized picture data.
|
|
|
|
* @param proc Function pointer for installing pixelrefs on SkBitmaps representing the
|
|
|
|
* encoded bitmap data from the stream.
|
2013-06-28 21:32:00 +00:00
|
|
|
* @return A new SkPicture representing the serialized data, or NULL if the stream is
|
|
|
|
* invalid.
|
2013-02-22 21:38:35 +00:00
|
|
|
*/
|
2013-06-28 21:32:00 +00:00
|
|
|
static SkPicture* CreateFromStream(SkStream*,
|
|
|
|
InstallPixelRefProc proc = &SkImageDecoder::DecodeMemory);
|
2013-02-22 21:38:35 +00:00
|
|
|
|
2014-02-07 12:20:04 +00:00
|
|
|
/**
|
|
|
|
* Recreate a picture that was serialized into a buffer. If the creation requires bitmap
|
|
|
|
* decoding, the decoder must be set on the SkReadBuffer parameter by calling
|
|
|
|
* SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuffer().
|
|
|
|
* @param SkReadBuffer Serialized picture data.
|
|
|
|
* @return A new SkPicture representing the serialized data, or NULL if the buffer is
|
|
|
|
* invalid.
|
|
|
|
*/
|
|
|
|
static SkPicture* CreateFromBuffer(SkReadBuffer&);
|
|
|
|
|
2014-11-20 17:18:31 +00:00
|
|
|
~SkPicture();
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2014-09-04 15:42:50 +00:00
|
|
|
/** Replays the drawing commands on the specified canvas. Note that
|
|
|
|
this has the effect of unfurling this picture into the destination
|
|
|
|
canvas. Using the SkCanvas::drawPicture entry point gives the destination
|
|
|
|
canvas the option of just taking a ref.
|
2013-05-20 17:02:41 +00:00
|
|
|
@param canvas the canvas receiving the drawing commands.
|
2014-09-04 15:42:50 +00:00
|
|
|
@param callback a callback that allows interruption of playback
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
2014-09-04 15:42:50 +00:00
|
|
|
void playback(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
|
|
|
|
|
|
|
|
#ifdef SK_LEGACY_PICTURE_DRAW_API
|
|
|
|
void draw(SkCanvas* canvas, SkDrawPictureCallback* callback = NULL) const {
|
|
|
|
this->playback(canvas, callback);
|
|
|
|
}
|
|
|
|
#endif
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2014-08-29 15:03:56 +00:00
|
|
|
#ifdef SK_LEGACY_PICTURE_SIZE_API
|
2014-11-19 16:04:34 +00:00
|
|
|
int width() const { return fCullRect.roundOut().width(); }
|
|
|
|
int height() const { return fCullRect.roundOut().height(); }
|
2014-08-29 15:03:56 +00:00
|
|
|
#endif
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-08-29 15:03:56 +00:00
|
|
|
/** Return the cull rect used when creating this picture: { 0, 0, cullWidth, cullHeight }.
|
|
|
|
It does not necessarily reflect the bounds of what has been recorded into the picture.
|
|
|
|
@return the cull rect used to create this picture
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
2014-11-19 16:04:34 +00:00
|
|
|
SkRect cullRect() const { return fCullRect; }
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-11-21 16:07:41 +00:00
|
|
|
/** Return a non-zero, unique value representing the picture.
|
|
|
|
*/
|
|
|
|
uint32_t uniqueID() const { return fUniqueID; }
|
2014-04-02 23:51:13 +00:00
|
|
|
|
2013-02-22 22:04:19 +00:00
|
|
|
/**
|
2013-05-21 20:31:23 +00:00
|
|
|
* Function to encode an SkBitmap to an SkData. A function with this
|
2014-01-30 18:58:24 +00:00
|
|
|
* signature can be passed to serialize() and SkWriteBuffer.
|
|
|
|
* Returning NULL will tell the SkWriteBuffer to use
|
2013-05-21 20:31:23 +00:00
|
|
|
* SkBitmap::flatten() to store the bitmap.
|
2014-01-08 15:42:01 +00:00
|
|
|
*
|
|
|
|
* @param pixelRefOffset DEPRECATED -- caller assumes it will return 0.
|
2013-05-21 20:31:23 +00:00
|
|
|
* @return SkData If non-NULL, holds encoded data representing the passed
|
|
|
|
* in bitmap. The caller is responsible for calling unref().
|
2013-02-22 22:04:19 +00:00
|
|
|
*/
|
2013-05-21 20:31:23 +00:00
|
|
|
typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm);
|
2013-02-22 22:04:19 +00:00
|
|
|
|
Add the ability to provide function pointers to SkPicture serialization
and deserialization for encoding and decoding bitmaps.
Remove kForceFlattenBitmapPixels_Flag, which is no longer used.
When an SkOrderedReadBuffer needs to read a bitmap, if it does not
have an image decoder, use a dummy bitmap.
In GM, add a tolerance option for color differences, used when
testing picture serialization, so it can assume two images are the
same even though PNG encoding/decoding may have resulted in small
differences.
Create dummy implementations for SkImageDecoder and SkImageEncoder
functions in SkImageDecoder_empty so that a project that does not
want to include the images project it can still build.
Allow ports to build without images project.
In Mac's image encoder, copy 4444 to 8888 before encoding.
Add SkWriter32::reservePad, to provide a pointer to write non 4 byte
aligned data, padded with zeroes.
In bench_ and render_ pictures, pass decode function to SkPicture
creation from a stream.
BUG=https://code.google.com/p/skia/issues/detail?id=842
Review URL: https://codereview.appspot.com/6551071
git-svn-id: http://skia.googlecode.com/svn/trunk@5818 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-10-04 21:46:08 +00:00
|
|
|
/**
|
|
|
|
* Serialize to a stream. If non NULL, encoder will be used to encode
|
|
|
|
* any bitmaps in the picture.
|
2013-05-21 20:31:23 +00:00
|
|
|
* encoder will never be called with a NULL pixelRefOffset.
|
Add the ability to provide function pointers to SkPicture serialization
and deserialization for encoding and decoding bitmaps.
Remove kForceFlattenBitmapPixels_Flag, which is no longer used.
When an SkOrderedReadBuffer needs to read a bitmap, if it does not
have an image decoder, use a dummy bitmap.
In GM, add a tolerance option for color differences, used when
testing picture serialization, so it can assume two images are the
same even though PNG encoding/decoding may have resulted in small
differences.
Create dummy implementations for SkImageDecoder and SkImageEncoder
functions in SkImageDecoder_empty so that a project that does not
want to include the images project it can still build.
Allow ports to build without images project.
In Mac's image encoder, copy 4444 to 8888 before encoding.
Add SkWriter32::reservePad, to provide a pointer to write non 4 byte
aligned data, padded with zeroes.
In bench_ and render_ pictures, pass decode function to SkPicture
creation from a stream.
BUG=https://code.google.com/p/skia/issues/detail?id=842
Review URL: https://codereview.appspot.com/6551071
git-svn-id: http://skia.googlecode.com/svn/trunk@5818 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-10-04 21:46:08 +00:00
|
|
|
*/
|
2014-12-09 16:27:37 +00:00
|
|
|
void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-02-07 12:20:04 +00:00
|
|
|
/**
|
|
|
|
* Serialize to a buffer.
|
|
|
|
*/
|
|
|
|
void flatten(SkWriteBuffer&) const;
|
|
|
|
|
2013-10-24 11:12:47 +00:00
|
|
|
/**
|
|
|
|
* Returns true if any bitmaps may be produced when this SkPicture
|
|
|
|
* is replayed.
|
|
|
|
*/
|
|
|
|
bool willPlayBackBitmaps() const;
|
|
|
|
|
2014-03-03 19:18:39 +00:00
|
|
|
/** Return true if the SkStream/Buffer represents a serialized picture, and
|
|
|
|
fills out SkPictInfo. After this function returns, the data source is not
|
2014-03-04 03:02:32 +00:00
|
|
|
rewound so it will have to be manually reset before passing to
|
2014-03-03 19:18:39 +00:00
|
|
|
CreateFromStream or CreateFromBuffer. Note, CreateFromStream and
|
|
|
|
CreateFromBuffer perform this check internally so these entry points are
|
|
|
|
intended for stand alone tools.
|
|
|
|
If false is returned, SkPictInfo is unmodified.
|
|
|
|
*/
|
|
|
|
static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*);
|
2014-08-29 15:03:56 +00:00
|
|
|
static bool InternalOnly_BufferIsSKP(SkReadBuffer*, SkPictInfo*);
|
2014-03-03 19:18:39 +00:00
|
|
|
|
2014-03-19 21:24:25 +00:00
|
|
|
/** Return true if the picture is suitable for rendering on the GPU.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if SK_SUPPORT_GPU
|
2014-05-30 21:52:52 +00:00
|
|
|
bool suitableForGpuRasterization(GrContext*, const char ** = NULL) const;
|
2014-03-19 21:24:25 +00:00
|
|
|
#endif
|
|
|
|
|
2014-08-15 02:17:18 +00:00
|
|
|
/** Return the approximate number of operations in this picture. This
|
|
|
|
* number may be greater or less than the number of SkCanvas calls
|
|
|
|
* recorded: some calls may be recorded as more than one operation, or some
|
|
|
|
* calls may be optimized away.
|
|
|
|
*/
|
|
|
|
int approximateOpCount() const;
|
|
|
|
|
2014-08-18 19:59:55 +00:00
|
|
|
/** Return true if this picture contains text.
|
|
|
|
*/
|
|
|
|
bool hasText() const;
|
|
|
|
|
2014-11-21 20:20:35 +00:00
|
|
|
// An array of refcounted const SkPicture pointers.
|
|
|
|
class SnapshotArray : ::SkNoncopyable {
|
|
|
|
public:
|
2014-11-24 02:37:14 +00:00
|
|
|
SnapshotArray(const SkPicture* pics[], int count) : fPics(pics), fCount(count) {}
|
|
|
|
~SnapshotArray() { for (int i = 0; i < fCount; i++) { fPics[i]->unref(); } }
|
2014-11-21 19:06:04 +00:00
|
|
|
|
|
|
|
const SkPicture* const* begin() const { return fPics; }
|
2014-11-24 02:37:14 +00:00
|
|
|
int count() const { return fCount; }
|
2014-11-21 19:06:04 +00:00
|
|
|
private:
|
|
|
|
SkAutoTMalloc<const SkPicture*> fPics;
|
2014-11-24 02:37:14 +00:00
|
|
|
int fCount;
|
2014-11-21 19:06:04 +00:00
|
|
|
};
|
|
|
|
|
2014-11-24 16:20:57 +00:00
|
|
|
// Sent via SkMessageBus from destructor.
|
|
|
|
struct DeletionMessage { int32_t fUniqueID; };
|
|
|
|
|
2014-07-08 15:38:18 +00:00
|
|
|
private:
|
2012-11-13 20:41:18 +00:00
|
|
|
// V2 : adds SkPixelRef's generation ID.
|
|
|
|
// V3 : PictInfo tag at beginning, and EOF tag at the end
|
|
|
|
// V4 : move SkPictInfo to be the header
|
|
|
|
// V5 : don't read/write FunctionPtr on cross-process (we can detect that)
|
|
|
|
// V6 : added serialization of SkPath's bounds (and packed its flags tighter)
|
|
|
|
// V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect)
|
|
|
|
// V8 : Add an option for encoding bitmaps
|
|
|
|
// V9 : Allow the reader and writer of an SKP disagree on whether to support
|
|
|
|
// SK_SUPPORT_HINTING_SCALE_FACTOR
|
2012-12-12 20:48:18 +00:00
|
|
|
// V10: add drawRRect, drawOval, clipRRect
|
2013-04-30 02:32:41 +00:00
|
|
|
// V11: modify how readBitmap and writeBitmap store their info.
|
2013-05-31 15:17:50 +00:00
|
|
|
// V12: add conics to SkPath, use new SkPathRef flattening
|
2013-08-16 10:24:37 +00:00
|
|
|
// V13: add flag to drawBitmapRectToRect
|
2013-08-27 16:14:03 +00:00
|
|
|
// parameterize blurs by sigma rather than radius
|
2013-09-26 12:18:23 +00:00
|
|
|
// V14: Add flags word to PathRef serialization
|
2014-04-02 23:51:13 +00:00
|
|
|
// V15: Remove A1 bitmap config (and renumber remaining configs)
|
2013-12-03 16:43:54 +00:00
|
|
|
// V16: Move SkPath's isOval flag to SkPathRef
|
2013-12-13 19:58:46 +00:00
|
|
|
// V17: SkPixelRef now writes SkImageInfo
|
2014-01-08 15:42:01 +00:00
|
|
|
// V18: SkBitmap now records x,y for its pixelref origin, instead of offset.
|
2014-01-23 15:16:05 +00:00
|
|
|
// V19: encode matrices and regions into the ops stream
|
2014-02-07 12:20:04 +00:00
|
|
|
// V20: added bool to SkPictureImageFilter's serialization (to allow SkPicture serialization)
|
2014-02-27 17:40:13 +00:00
|
|
|
// V21: add pushCull, popCull
|
2014-03-05 18:25:20 +00:00
|
|
|
// V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes
|
2014-04-16 12:58:02 +00:00
|
|
|
// V23: SkPaint::FilterLevel became a real enum
|
2014-04-21 13:10:25 +00:00
|
|
|
// V24: SkTwoPointConicalGradient now has fFlipped flag for gradient flipping
|
2014-04-22 15:21:18 +00:00
|
|
|
// V25: SkDashPathEffect now only writes phase and interval array when flattening
|
2014-04-24 16:54:46 +00:00
|
|
|
// V26: Removed boolean from SkColorShader for inheriting color from SkPaint.
|
2014-05-22 12:27:41 +00:00
|
|
|
// V27: Remove SkUnitMapper from gradients (and skia).
|
2014-05-23 13:21:55 +00:00
|
|
|
// V28: No longer call bitmap::flatten inside SkWriteBuffer::writeBitmap.
|
2014-06-30 14:13:28 +00:00
|
|
|
// V29: Removed SaveFlags parameter from save().
|
2014-07-11 17:42:12 +00:00
|
|
|
// V30: Remove redundant SkMatrix from SkLocalMatrixShader.
|
2014-07-30 18:26:46 +00:00
|
|
|
// V31: Add a serialized UniqueID to SkImageFilter.
|
2014-08-14 13:29:02 +00:00
|
|
|
// V32: Removed SkPaintOptionsAndroid from SkPaint
|
2014-08-26 14:56:44 +00:00
|
|
|
// V33: Serialize only public API of effects.
|
|
|
|
// V34: Add SkTextBlob serialization.
|
2014-08-29 15:03:56 +00:00
|
|
|
// V35: Store SkRect (rather then width & height) in header
|
2014-09-29 19:10:27 +00:00
|
|
|
// V36: Remove (obsolete) alphatype from SkColorTable
|
2014-12-04 15:50:14 +00:00
|
|
|
// V37: Added shadow only option to SkDropShadowImageFilter (last version to record CLEAR)
|
|
|
|
// V37: Added PictureResolution and FilterLevel options to SkPictureImageFilter
|
2014-02-18 22:08:16 +00:00
|
|
|
|
|
|
|
// Note: If the picture version needs to be increased then please follow the
|
|
|
|
// steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
|
2014-02-25 02:16:10 +00:00
|
|
|
|
|
|
|
// Only SKPs within the min/current picture version range (inclusive) can be read.
|
2014-12-01 14:56:38 +00:00
|
|
|
static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M39.
|
2014-12-02 19:50:56 +00:00
|
|
|
static const uint32_t CURRENT_PICTURE_VERSION = 38;
|
2012-11-13 20:41:18 +00:00
|
|
|
|
Fixing SkPicture serialization
Fixed a few issues while attempting to use the new
serialization path for SkPicture inside a fuzzer:
- SkReadBuffer and SkValidatingReadBuffer both had a fReader
member instead of sharing the same member, which leads to
problems if a base class function is used
- In SkPicture, a header is now written as a single chunk of
data, so it also has to be read as a single chunk of data
- In the SkPicturePlayback destructor, a bad deserialization
would lead to a crash if we don't safely unref fOpData
- Also in SkPicturePlayback, if we only use a ReadBuffer for
the whole deserialization, additional tags must be added to
parseBufferTag()
- SkValidatingReadBuffer::readBitmap() was broken, but this
path wasn't usen't since the only use case for
SkValidatingReadBuffer is currently image filters and
bitmaps are unflattened as part of the deserialization of
SkBitmapSource
- SkPictureImageFilter was not deserializable. Added it to
SkGlobalInitialization*
- Added a test that exercises the SkPicture serialization /
deserialization code
BUG=skia:
R=senorblanco@google.com, senorblanco@chromium.org, reed@google.com, robertphillips@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/195223003
git-svn-id: http://skia.googlecode.com/svn/trunk@13764 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-12 14:46:41 +00:00
|
|
|
void createHeader(SkPictInfo* info) const;
|
|
|
|
static bool IsValidPictInfo(const SkPictInfo& info);
|
2014-02-07 12:20:04 +00:00
|
|
|
|
2014-11-21 20:20:35 +00:00
|
|
|
// Takes ownership of the SkRecord and (optional) SnapshotArray, refs the (optional) BBH.
|
2014-11-21 19:06:04 +00:00
|
|
|
SkPicture(const SkRect& cullRect, SkRecord*, SnapshotArray*, SkBBoxHierarchy*);
|
2014-08-11 15:08:43 +00:00
|
|
|
|
2014-11-17 14:45:18 +00:00
|
|
|
static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
|
2014-11-18 19:08:05 +00:00
|
|
|
static SkPictureData* Backport(const SkRecord&, const SkPictInfo&,
|
|
|
|
SkPicture const* const drawablePics[], int drawableCount);
|
2014-11-17 14:45:18 +00:00
|
|
|
|
2014-11-20 17:18:31 +00:00
|
|
|
// uint32_t fRefCnt; from SkNVRefCnt<SkPicture>
|
2014-11-21 16:07:41 +00:00
|
|
|
const uint32_t fUniqueID;
|
2014-11-19 16:04:34 +00:00
|
|
|
const SkRect fCullRect;
|
2014-11-17 14:45:18 +00:00
|
|
|
mutable SkAutoTUnref<const AccelData> fAccelData;
|
2014-11-24 22:41:51 +00:00
|
|
|
SkAutoTUnref<const SkRecord> fRecord;
|
|
|
|
SkAutoTUnref<const SkBBoxHierarchy> fBBH;
|
|
|
|
SkAutoTDelete<const SnapshotArray> fDrawablePicts;
|
2014-11-18 19:08:05 +00:00
|
|
|
|
|
|
|
// helpers for fDrawablePicts
|
|
|
|
int drawableCount() const;
|
|
|
|
// will return NULL if drawableCount() returns 0
|
|
|
|
SkPicture const* const* drawablePicts() const;
|
|
|
|
|
|
|
|
struct PathCounter;
|
|
|
|
|
2014-08-20 12:29:41 +00:00
|
|
|
struct Analysis {
|
2014-08-20 15:09:46 +00:00
|
|
|
Analysis() {} // Only used by SkPictureData codepath.
|
|
|
|
explicit Analysis(const SkRecord&);
|
2014-08-20 12:29:41 +00:00
|
|
|
|
|
|
|
bool suitableForGpuRasterization(const char** reason, int sampleCount) const;
|
|
|
|
|
|
|
|
bool fWillPlaybackBitmaps;
|
2014-08-20 15:09:46 +00:00
|
|
|
bool fHasText;
|
2014-08-20 12:29:41 +00:00
|
|
|
int fNumPaintWithPathEffectUses;
|
|
|
|
int fNumFastPathDashEffects;
|
|
|
|
int fNumAAConcavePaths;
|
|
|
|
int fNumAAHairlineConcavePaths;
|
2014-11-04 15:59:01 +00:00
|
|
|
int fNumAADFEligibleConcavePaths;
|
2014-08-20 15:09:46 +00:00
|
|
|
} fAnalysis;
|
2014-11-17 14:45:18 +00:00
|
|
|
|
|
|
|
friend class SkPictureRecorder; // SkRecord-based constructor.
|
|
|
|
friend class GrLayerHoister; // access to fRecord
|
|
|
|
friend class ReplaceDraw;
|
2014-11-19 18:41:14 +00:00
|
|
|
friend class SkPictureUtils;
|
2014-11-24 22:41:51 +00:00
|
|
|
friend class SkRecordedDrawable;
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
2014-11-20 17:18:31 +00:00
|
|
|
SK_COMPILE_ASSERT(sizeof(SkPicture) <= 96, SkPictureSize);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
#endif
|