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
|
|
|
*/
|
|
|
|
|
2018-07-13 12:21:59 +00:00
|
|
|
/* Generated by tools/bookmaker from include/core/SkPicture.h and docs/SkPicture_Reference.bmh
|
2018-08-10 17:11:06 +00:00
|
|
|
on 2018-08-10 12:59:44. Additional documentation and examples can be found at:
|
2018-07-13 12:21:59 +00:00
|
|
|
https://skia.org/user/api/SkPicture_Reference
|
|
|
|
|
|
|
|
You may edit either file directly. Structural changes to public interfaces require
|
|
|
|
editing both files. After editing docs/SkPicture_Reference.bmh, run:
|
|
|
|
bookmaker -b docs -i include/core/SkPicture.h -p
|
|
|
|
to create an updated version of this file.
|
|
|
|
*/
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkPicture_DEFINED
|
|
|
|
#define SkPicture_DEFINED
|
|
|
|
|
|
|
|
#include "SkRefCnt.h"
|
2016-03-24 17:41:47 +00:00
|
|
|
#include "SkRect.h"
|
2015-05-19 18:11:26 +00:00
|
|
|
#include "SkTypes.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
class SkCanvas;
|
2016-08-11 10:55:15 +00:00
|
|
|
class SkData;
|
2017-12-05 20:11:24 +00:00
|
|
|
struct SkDeserialProcs;
|
2016-08-11 10:55:15 +00:00
|
|
|
class SkImage;
|
2017-12-05 20:11:24 +00:00
|
|
|
struct SkSerialProcs;
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkStream;
|
|
|
|
class SkWStream;
|
2013-06-28 21:32:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/** \class SkPicture
|
2018-08-10 17:11:06 +00:00
|
|
|
SkPicture records drawing commands made to SkCanvas. The command stream may be
|
|
|
|
played in whole or in part at a later time.
|
|
|
|
|
|
|
|
SkPicture is an abstract class. SkPicture may be generated by SkPictureRecorder
|
|
|
|
or SkDrawable, or from SkPicture previously saved to SkData or SkStream.
|
|
|
|
|
|
|
|
SkPicture may contain any SkCanvas drawing command, as well as one or more
|
|
|
|
SkCanvas matrix or SkCanvas clip. SkPicture has a cull SkRect, which is used as
|
|
|
|
a bounding box hint. To limit SkPicture bounds, use SkCanvas clip when
|
|
|
|
recording or drawing SkPicture.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
2015-05-20 17:55:49 +00:00
|
|
|
class SK_API SkPicture : public SkRefCnt {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
2017-12-15 20:42:14 +00:00
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Recreates SkPicture that was serialized into a stream. Returns constructed SkPicture
|
|
|
|
if successful; otherwise, returns nullptr. Fails if data does not permit
|
|
|
|
constructing valid SkPicture.
|
|
|
|
|
2018-10-31 14:54:50 +00:00
|
|
|
procs->fPictureProc permits supplying a custom function to decode SkPicture.
|
|
|
|
If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx
|
|
|
|
may be used to provide user context to procs->fPictureProc; procs->fPictureProc
|
2018-08-10 17:11:06 +00:00
|
|
|
is called with a pointer to data, data byte length, and user context.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@param stream container for serial data
|
|
|
|
@param procs custom serial data decoders; may be nullptr
|
|
|
|
@return SkPicture constructed from stream data
|
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
static sk_sp<SkPicture> MakeFromStream(SkStream* stream,
|
|
|
|
const SkDeserialProcs* procs = nullptr);
|
2018-07-13 12:21:59 +00:00
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Recreates SkPicture that was serialized into data. Returns constructed SkPicture
|
|
|
|
if successful; otherwise, returns nullptr. Fails if data does not permit
|
|
|
|
constructing valid SkPicture.
|
|
|
|
|
2018-10-31 14:54:50 +00:00
|
|
|
procs->fPictureProc permits supplying a custom function to decode SkPicture.
|
|
|
|
If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx
|
|
|
|
may be used to provide user context to procs->fPictureProc; procs->fPictureProc
|
2018-08-10 17:11:06 +00:00
|
|
|
is called with a pointer to data, data byte length, and user context.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@param data container for serial data
|
|
|
|
@param procs custom serial data decoders; may be nullptr
|
|
|
|
@return SkPicture constructed from data
|
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
static sk_sp<SkPicture> MakeFromData(const SkData* data,
|
|
|
|
const SkDeserialProcs* procs = nullptr);
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
@param data pointer to serial data
|
|
|
|
@param size size of data
|
|
|
|
@param procs custom serial data decoders; may be nullptr
|
|
|
|
@return SkPicture constructed from data
|
|
|
|
*/
|
2017-12-20 19:12:07 +00:00
|
|
|
static sk_sp<SkPicture> MakeFromData(const void* data, size_t size,
|
2018-06-11 20:25:43 +00:00
|
|
|
const SkDeserialProcs* procs = nullptr);
|
2014-02-07 12:20:04 +00:00
|
|
|
|
2018-07-13 12:21:59 +00:00
|
|
|
/** \class SkPicture::AbortCallback
|
2018-08-10 17:11:06 +00:00
|
|
|
AbortCallback is an abstract class. An implementation of AbortCallback may
|
|
|
|
passed as a parameter to SkPicture::playback, to stop it before all drawing
|
|
|
|
commands have been processed.
|
|
|
|
|
|
|
|
If AbortCallback::abort returns true, SkPicture::playback is interrupted.
|
2015-01-07 15:28:41 +00:00
|
|
|
*/
|
|
|
|
class SK_API AbortCallback {
|
|
|
|
public:
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
/** Has no effect.
|
|
|
|
|
|
|
|
@return abstract class cannot be instantiated
|
|
|
|
*/
|
2015-01-07 15:28:41 +00:00
|
|
|
AbortCallback() {}
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
/** Has no effect.
|
|
|
|
*/
|
2015-01-07 15:28:41 +00:00
|
|
|
virtual ~AbortCallback() {}
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
/** Stops SkPicture playback when some condition is met. A subclass of
|
2018-08-10 17:11:06 +00:00
|
|
|
AbortCallback provides an override for abort() that can stop SkPicture::playback.
|
|
|
|
|
|
|
|
The part of SkPicture drawn when aborted is undefined. SkPicture instantiations are
|
|
|
|
free to stop drawing at different points during playback.
|
|
|
|
|
|
|
|
If the abort happens inside one or more calls to SkCanvas::save(), stack
|
|
|
|
of SkCanvas matrix and SkCanvas clip values is restored to its state before
|
|
|
|
SkPicture::playback was called.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@return true to stop playback
|
|
|
|
*/
|
2015-01-07 15:28:41 +00:00
|
|
|
virtual bool abort() = 0;
|
|
|
|
};
|
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Replays the drawing commands on the specified canvas. In the case that the
|
|
|
|
commands are recorded, each command in the SkPicture is sent separately to canvas.
|
|
|
|
|
|
|
|
To add a single command to draw SkPicture to recording canvas, call
|
|
|
|
SkCanvas::drawPicture instead.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@param canvas receiver of drawing commands
|
|
|
|
@param callback allows interruption of playback
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
virtual void playback(SkCanvas* canvas, AbortCallback* callback = nullptr) const = 0;
|
2015-05-18 20:47:17 +00:00
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Returns cull SkRect for this picture, passed in when SkPicture was created.
|
|
|
|
Returned SkRect does not specify clipping SkRect for SkPicture; cull is hint
|
|
|
|
of SkPicture bounds.
|
|
|
|
|
|
|
|
SkPicture is free to discard recorded drawing commands that fall outside
|
|
|
|
cull.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@return bounds passed when SkPicture was created
|
|
|
|
*/
|
2015-05-19 18:11:26 +00:00
|
|
|
virtual SkRect cullRect() const = 0;
|
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Returns a non-zero value unique among SkPicture in Skia process.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@return identifier for SkPicture
|
|
|
|
*/
|
2018-12-04 14:05:26 +00:00
|
|
|
uint32_t uniqueID() const { return fUniqueID; }
|
2014-04-02 23:51:13 +00:00
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Returns storage containing SkData describing SkPicture, using optional custom
|
|
|
|
encoders.
|
|
|
|
|
2018-10-31 14:54:50 +00:00
|
|
|
procs->fPictureProc permits supplying a custom function to encode SkPicture.
|
|
|
|
If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx
|
|
|
|
may be used to provide user context to procs->fPictureProc; procs->fPictureProc
|
2018-08-10 17:11:06 +00:00
|
|
|
is called with a pointer to SkPicture and user context.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@param procs custom serial data encoders; may be nullptr
|
|
|
|
@return storage containing serialized SkPicture
|
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
sk_sp<SkData> serialize(const SkSerialProcs* procs = nullptr) const;
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
/** Writes picture to stream, using optional custom encoders.
|
|
|
|
|
2018-10-31 14:54:50 +00:00
|
|
|
procs->fPictureProc permits supplying a custom function to encode SkPicture.
|
|
|
|
If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx
|
|
|
|
may be used to provide user context to procs->fPictureProc; procs->fPictureProc
|
2018-08-10 17:11:06 +00:00
|
|
|
is called with a pointer to SkPicture and user context.
|
|
|
|
|
2018-07-13 12:21:59 +00:00
|
|
|
@param stream writable serial data stream
|
|
|
|
@param procs custom serial data encoders; may be nullptr
|
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
void serialize(SkWStream* stream, const SkSerialProcs* procs = nullptr) const;
|
2017-12-20 19:12:07 +00:00
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Returns a placeholder SkPicture. Result does not draw, and contains only
|
|
|
|
cull SkRect, a hint of its bounds. Result is immutable; it cannot be changed
|
|
|
|
later. Result identifier is unique.
|
|
|
|
|
|
|
|
Returned placeholder can be intercepted during playback to insert other
|
|
|
|
commands into SkCanvas draw stream.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@param cull placeholder dimensions
|
|
|
|
@return placeholder with unique identifier
|
|
|
|
*/
|
2018-01-26 14:49:48 +00:00
|
|
|
static sk_sp<SkPicture> MakePlaceholder(SkRect cull);
|
|
|
|
|
2018-08-10 17:11:06 +00:00
|
|
|
/** Returns the approximate number of operations in SkPicture. Returned value
|
|
|
|
may be greater or less than the number of SkCanvas calls
|
|
|
|
recorded: some calls may be recorded as more than one operation, other
|
2018-07-13 12:21:59 +00:00
|
|
|
calls may be optimized away.
|
|
|
|
|
|
|
|
@return approximate operation count
|
|
|
|
*/
|
2018-01-27 17:30:04 +00:00
|
|
|
virtual int approximateOpCount() const = 0;
|
|
|
|
|
2018-07-13 12:21:59 +00:00
|
|
|
/** Returns the approximate byte size of SkPicture. Does not include large objects
|
2018-08-10 17:11:06 +00:00
|
|
|
referenced by SkPicture.
|
2018-07-13 12:21:59 +00:00
|
|
|
|
|
|
|
@return approximate size
|
|
|
|
*/
|
2017-12-25 00:50:57 +00:00
|
|
|
virtual size_t approximateBytesUsed() const = 0;
|
|
|
|
|
2015-05-19 18:11:26 +00:00
|
|
|
private:
|
|
|
|
// Subclass whitelist.
|
|
|
|
SkPicture();
|
|
|
|
friend class SkBigPicture;
|
|
|
|
friend class SkEmptyPicture;
|
2018-06-11 20:25:43 +00:00
|
|
|
friend class SkPicturePriv;
|
2015-05-19 18:11:26 +00:00
|
|
|
template <typename> friend class SkMiniPicture;
|
Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #25 id:480001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
win_chromium_compile_dbg_ng
FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\skia\src\core\skia.SkBitmapHeap.obj.rsp /c ..\..\third_party\skia\src\core\SkBitmapHeap.cpp /Foobj\third_party\skia\src\core\skia.SkBitmapHeap.obj /Fdobj\skia\skia.cc.pdb
e:\b\build\slave\win\build\src\third_party\skia\include\core\skpicture.h(176) : error C2487: 'CURRENT_PICTURE_VERSION' : member of dll interface class may not be declared with dll interface
Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
> - serialization and deserialization
> - unique IDs
>
> Everything else is left to the subclasses:
> - playback(), cullRect()
> - hasBitmap(), hasText(), suitableForGPU(), etc.
> - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
> picture_overhead_draw: 450ns -> 350ns
> picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b
>
> Latest blink_linux_rel:
>
> http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248
>
> Committed: https://skia.googlesource.com/skia/+/15877b6eae33a9282458bdb904a6d00440eca0ec
TBR=reed@google.com,robertphillips@google.com,fmalita@chromium.org,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1130283004
2015-05-18 21:53:43 +00:00
|
|
|
|
2018-06-11 20:25:43 +00:00
|
|
|
void serialize(SkWStream*, const SkSerialProcs*, class SkRefCntSet* typefaces) const;
|
|
|
|
static sk_sp<SkPicture> MakeFromStream(SkStream*, const SkDeserialProcs*,
|
|
|
|
class SkTypefacePlayback*);
|
2015-08-18 15:29:59 +00:00
|
|
|
friend class SkPictureData;
|
|
|
|
|
2017-12-20 19:09:20 +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
|
|
|
|
rewound so it will have to be manually reset before passing to
|
2018-01-26 14:49:48 +00:00
|
|
|
MakeFromStream or MakeFromBuffer. Note, MakeFromStream and
|
|
|
|
MakeFromBuffer perform this check internally so these entry points are
|
2017-12-20 19:09:20 +00:00
|
|
|
intended for stand alone tools.
|
|
|
|
If false is returned, SkPictInfo is unmodified.
|
|
|
|
*/
|
2018-06-11 20:25:43 +00:00
|
|
|
static bool StreamIsSKP(SkStream*, struct SkPictInfo*);
|
|
|
|
static bool BufferIsSKP(class SkReadBuffer*, struct SkPictInfo*);
|
|
|
|
friend bool SkPicture_StreamIsSKP(SkStream*, struct SkPictInfo*);
|
|
|
|
|
|
|
|
// Returns NULL if this is not an SkBigPicture.
|
|
|
|
virtual const class SkBigPicture* asSkBigPicture() const { return nullptr; }
|
2017-12-20 19:09:20 +00:00
|
|
|
|
2015-05-19 18:11:26 +00:00
|
|
|
friend struct SkPathCounter;
|
Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #25 id:480001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
win_chromium_compile_dbg_ng
FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\skia\src\core\skia.SkBitmapHeap.obj.rsp /c ..\..\third_party\skia\src\core\SkBitmapHeap.cpp /Foobj\third_party\skia\src\core\skia.SkBitmapHeap.obj /Fdobj\skia\skia.cc.pdb
e:\b\build\slave\win\build\src\third_party\skia\include\core\skpicture.h(176) : error C2487: 'CURRENT_PICTURE_VERSION' : member of dll interface class may not be declared with dll interface
Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
> - serialization and deserialization
> - unique IDs
>
> Everything else is left to the subclasses:
> - playback(), cullRect()
> - hasBitmap(), hasText(), suitableForGPU(), etc.
> - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
> picture_overhead_draw: 450ns -> 350ns
> picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b
>
> Latest blink_linux_rel:
>
> http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248
>
> Committed: https://skia.googlesource.com/skia/+/15877b6eae33a9282458bdb904a6d00440eca0ec
TBR=reed@google.com,robertphillips@google.com,fmalita@chromium.org,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1130283004
2015-05-18 21:53:43 +00:00
|
|
|
|
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)
|
2014-12-09 21:07:22 +00:00
|
|
|
// V38: Added PictureResolution option to SkPictureImageFilter
|
|
|
|
// V39: Added FilterLevel option to SkPictureImageFilter
|
2015-03-18 20:14:54 +00:00
|
|
|
// V40: Remove UniqueID serialization from SkImageFilter.
|
2015-04-10 15:39:58 +00:00
|
|
|
// V41: Added serialization of SkBitmapSource's filterQuality parameter
|
2015-05-20 19:05:15 +00:00
|
|
|
// V42: Added a bool to SkPictureShader serialization to indicate did-we-serialize-a-picture?
|
2015-06-22 19:48:26 +00:00
|
|
|
// V43: Added DRAW_IMAGE and DRAW_IMAGE_RECT opt codes to serialized data
|
2016-03-05 00:36:20 +00:00
|
|
|
// V44: Move annotations from paint to drawAnnotation
|
2016-04-08 19:19:50 +00:00
|
|
|
// V45: Add invNormRotation to SkLightingShader.
|
2016-07-07 19:47:17 +00:00
|
|
|
// V46: Add drawTextRSXform
|
2016-08-10 23:25:25 +00:00
|
|
|
// V47: Add occluder rect to SkBlurMaskFilter
|
2016-08-30 18:58:33 +00:00
|
|
|
// V48: Read and write extended SkTextBlobs.
|
2016-09-28 18:27:28 +00:00
|
|
|
// V49: Gradients serialized as SkColor4f + SkColorSpace
|
2016-10-06 00:33:02 +00:00
|
|
|
// V50: SkXfermode -> SkBlendMode
|
2016-10-28 19:42:34 +00:00
|
|
|
// V51: more SkXfermode -> SkBlendMode
|
2017-03-13 13:03:24 +00:00
|
|
|
// V52: Remove SkTextBlob::fRunCount
|
2017-04-28 17:48:37 +00:00
|
|
|
// V53: SaveLayerRec clip mask
|
2017-06-09 14:51:52 +00:00
|
|
|
// V54: ComposeShader can use a Mode or a Lerp
|
2017-06-19 03:35:57 +00:00
|
|
|
// V55: Drop blendmode[] from MergeImageFilter
|
2017-07-11 03:20:33 +00:00
|
|
|
// V56: Add TileMode in SkBlurImageFilter.
|
2017-08-01 20:38:08 +00:00
|
|
|
// V57: Sweep tiling info.
|
2017-10-18 20:22:35 +00:00
|
|
|
// V58: No more 2pt conical flipping.
|
2017-11-09 21:50:20 +00:00
|
|
|
// V59: No more LocalSpace option on PictureImageFilter
|
2018-01-03 16:32:13 +00:00
|
|
|
// V60: Remove flags in picture header
|
2018-01-18 20:19:13 +00:00
|
|
|
// V61: Change SkDrawPictureRec to take two colors rather than two alphas
|
2018-03-08 21:29:12 +00:00
|
|
|
// V62: Don't negate size of custom encoded images (don't write origin x,y either)
|
2018-05-29 19:41:27 +00:00
|
|
|
// V63: Store image bounds (including origin) instead of just width/height to support subsets
|
2018-08-17 12:10:27 +00:00
|
|
|
// V64: Remove occluder feature from blur maskFilter
|
2018-12-18 22:38:18 +00:00
|
|
|
// V65: Float4 paint color
|
|
|
|
// V66: Add saveBehind
|
2018-12-21 21:19:24 +00:00
|
|
|
// V67: Blobs serialize fonts instead of paints
|
2019-01-04 19:01:06 +00:00
|
|
|
// V68: Paint doesn't serialize font-related stuff
|
2014-02-18 22:08:16 +00:00
|
|
|
|
2014-02-25 02:16:10 +00:00
|
|
|
// Only SKPs within the min/current picture version range (inclusive) can be read.
|
2018-01-03 18:17:18 +00:00
|
|
|
static const uint32_t MIN_PICTURE_VERSION = 56; // august 2017
|
2019-01-04 19:01:06 +00:00
|
|
|
static const uint32_t CURRENT_PICTURE_VERSION = 68;
|
2012-11-13 20:41:18 +00:00
|
|
|
|
2016-10-07 19:50:53 +00:00
|
|
|
static_assert(MIN_PICTURE_VERSION <= 62, "Remove kFontAxes_bad from SkFontDescriptor.cpp");
|
|
|
|
|
2018-06-11 20:25:43 +00:00
|
|
|
static bool IsValidPictInfo(const struct SkPictInfo& info);
|
|
|
|
static sk_sp<SkPicture> Forwardport(const struct SkPictInfo&,
|
|
|
|
const class SkPictureData*,
|
|
|
|
class SkReadBuffer* buffer);
|
Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #22 id:420001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
speculative revert to fix failures in DEPS roll
Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
> - serialization and deserialization
> - unique IDs
>
> Everything else is left to the subclasses:
> - playback(), cullRect()
> - hasBitmap(), hasText(), suitableForGPU(), etc.
> - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
> picture_overhead_draw: 450ns -> 350ns
> picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b
TBR=reed@google.com,robertphillips@google.com,mtklein@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1130333002
2015-05-08 00:30:13 +00:00
|
|
|
|
2018-06-11 20:25:43 +00:00
|
|
|
struct SkPictInfo createHeader() const;
|
|
|
|
class SkPictureData* backport() const;
|
2014-11-17 14:45:18 +00:00
|
|
|
|
2018-12-04 14:05:26 +00:00
|
|
|
uint32_t fUniqueID;
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|