override getTypeName() instead of using table
This should let getTypeName() and serialization work even when deserialization factories haven't been registered. I've made getTypeName() pure virtual like getFactory(), and moved all the overrides into SK_FLATTENABLE_HOOKS, cleaning up all the various ways we've done it before. All the subclasses override getTypeName() and getFactory() privately, so there should be no need to document them? Change-Id: I723cb20099d250c2f2a10be266e3aacc6a061937 Reviewed-on: https://skia-review.googlesource.com/c/163543 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
e7fd8c30cc
commit
4fee323522
@ -10,7 +10,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkShader.h"
|
||||
|
||||
@ -33,8 +32,6 @@ public:
|
||||
return sk_sp<SkImageFilter>(new FailImageFilter);
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
|
||||
|
||||
protected:
|
||||
FailImageFilter() : INHERITED(nullptr, 0, nullptr) {}
|
||||
|
||||
@ -47,6 +44,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(FailImageFilter)
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
};
|
||||
|
||||
@ -71,7 +70,6 @@ public:
|
||||
return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input)));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -84,6 +82,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(IdentityImageFilter)
|
||||
IdentityImageFilter(sk_sp<SkImageFilter> input) : INHERITED(&input, 1, nullptr) {}
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
}
|
||||
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
SkDrawable();
|
||||
|
@ -52,21 +52,8 @@ public:
|
||||
|
||||
/**
|
||||
* Returns the name of the object's class.
|
||||
*
|
||||
* Subclasses should override this function if they intend to provide
|
||||
* support for flattening without using the global registry.
|
||||
*
|
||||
* If the flattenable is registered, there is no need to override.
|
||||
*/
|
||||
virtual const char* getTypeName() const {
|
||||
#ifdef SK_DISABLE_READBUFFER
|
||||
// Should not be reachable by PathKit WebAssembly Code.
|
||||
SkASSERT(false);
|
||||
return nullptr;
|
||||
#else
|
||||
return FactoryToName(getFactory());
|
||||
#endif
|
||||
}
|
||||
virtual const char* getTypeName() const = 0;
|
||||
|
||||
static Factory NameToFactory(const char name[]);
|
||||
static const char* FactoryToName(Factory);
|
||||
@ -110,4 +97,15 @@ private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(type) \
|
||||
SkFlattenable::Register(#type, \
|
||||
type::CreateProc, \
|
||||
type::GetFlattenableType());
|
||||
|
||||
#define SK_FLATTENABLE_HOOKS(type) \
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
|
||||
friend class SkFlattenable::PrivateInitializer; \
|
||||
Factory getFactory() const override { return type::CreateProc; } \
|
||||
const char* getTypeName() const override { return #type; }
|
||||
|
||||
#endif
|
||||
|
@ -58,8 +58,6 @@ public:
|
||||
*/
|
||||
static sk_sp<SkPathEffect> Make(const SkPath& path, SkScalar advance, SkScalar phase, Style);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
@ -70,8 +68,7 @@ protected:
|
||||
SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkPath1DPathEffect)
|
||||
|
||||
SkPath fPath; // copied from constructor
|
||||
SkScalar fAdvance; // copied from constructor
|
||||
|
@ -60,8 +60,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
|
||||
: Sk2DPathEffect(matrix), fWidth(width) {
|
||||
@ -73,8 +71,7 @@ protected:
|
||||
void nextSpan(int u, int v, int ucount, SkPath*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkLine2DPathEffect)
|
||||
|
||||
SkScalar fWidth;
|
||||
|
||||
@ -91,8 +88,6 @@ public:
|
||||
return sk_sp<SkPathEffect>(new SkPath2DPathEffect(matrix, path));
|
||||
}
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkPath2DPathEffect(const SkMatrix&, const SkPath&);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
@ -100,8 +95,7 @@ protected:
|
||||
void next(const SkPoint&, int u, int v, SkPath*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkPath2DPathEffect)
|
||||
|
||||
SkPath fPath;
|
||||
|
||||
|
@ -17,8 +17,6 @@ public:
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -29,11 +27,11 @@ protected:
|
||||
bool affectsTransparentBlack() const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColorFilterImageFilter)
|
||||
|
||||
SkColorFilterImageFilter(sk_sp<SkColorFilter> cf,
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
sk_sp<SkColorFilter> fColorFilter;
|
||||
|
||||
|
@ -17,8 +17,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect& src) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
explicit SkComposeImageFilter(sk_sp<SkImageFilter> inputs[2]) : INHERITED(inputs, 2, nullptr) {
|
||||
SkASSERT(inputs[0].get());
|
||||
@ -32,8 +30,7 @@ protected:
|
||||
bool onCanHandleComplexCTM() const override { return true; }
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkComposeImageFilter)
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
};
|
||||
|
@ -25,22 +25,20 @@ public:
|
||||
return radius > 0 ? sk_sp<SkPathEffect>(new SkCornerPathEffect(radius)) : nullptr;
|
||||
}
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
bool exposedInAndroidJavaAPI() const override { return true; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
~SkCornerPathEffect() override;
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
explicit SkCornerPathEffect(SkScalar radius);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkCornerPathEffect)
|
||||
|
||||
SkScalar fRadius;
|
||||
|
||||
typedef SkPathEffect INHERITED;
|
||||
|
@ -32,8 +32,6 @@ public:
|
||||
*/
|
||||
static sk_sp<SkPathEffect> Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist = 0);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
bool exposedInAndroidJavaAPI() const override { return true; }
|
||||
#endif
|
||||
@ -46,8 +44,7 @@ protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkDiscretePathEffect)
|
||||
|
||||
SkScalar fSegLength, fPerterb;
|
||||
|
||||
|
@ -39,8 +39,6 @@ public:
|
||||
SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix& ctm,
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
SkIPoint* offset) const override;
|
||||
@ -52,8 +50,7 @@ protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkDisplacementMapEffect)
|
||||
|
||||
ChannelSelectorType fXChannelSelector;
|
||||
ChannelSelectorType fYChannelSelector;
|
||||
|
@ -31,8 +31,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect&) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -42,11 +40,11 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkDropShadowImageFilter)
|
||||
|
||||
SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
|
||||
ShadowMode shadowMode, sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkScalar fDx, fDy, fSigmaX, fSigmaY;
|
||||
SkColor fColor;
|
||||
|
@ -22,8 +22,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect& src) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
@ -35,13 +33,13 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkImageSource)
|
||||
|
||||
explicit SkImageSource(sk_sp<SkImage>);
|
||||
SkImageSource(sk_sp<SkImage>,
|
||||
const SkRect& srcRect,
|
||||
const SkRect& dstRect,
|
||||
SkFilterQuality);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
sk_sp<SkImage> fImage;
|
||||
SkRect fSrcRect, fDstRect;
|
||||
|
@ -75,9 +75,6 @@ public:
|
||||
|
||||
bool asABlurShadow(BlurShadowRec* rec) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer);
|
||||
|
||||
protected:
|
||||
sk_sp<SkDrawLooper> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
@ -86,6 +83,8 @@ protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLayerDrawLooper)
|
||||
|
||||
struct Rec {
|
||||
Rec* fNext;
|
||||
SkPaint fPaint;
|
||||
|
@ -36,17 +36,15 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLumaColorFilter)
|
||||
|
||||
SkLumaColorFilter();
|
||||
void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
|
||||
bool shaderIsOpaque) const override;
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
typedef SkColorFilter INHERITED;
|
||||
};
|
||||
|
@ -18,8 +18,6 @@ public:
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkMagnifierImageFilter(const SkRect& srcRect,
|
||||
SkScalar inset,
|
||||
@ -32,8 +30,7 @@ protected:
|
||||
sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkMagnifierImageFilter)
|
||||
|
||||
SkRect fSrcRect;
|
||||
SkScalar fInset;
|
||||
|
@ -68,8 +68,6 @@ public:
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
|
||||
const SkScalar* kernel,
|
||||
@ -90,8 +88,7 @@ protected:
|
||||
bool affectsTransparentBlack() const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkMatrixConvolutionImageFilter)
|
||||
|
||||
SkISize fKernelSize;
|
||||
SkScalar* fKernel;
|
||||
|
@ -25,8 +25,6 @@ public:
|
||||
return Make(array, 2, cropRect);
|
||||
}
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -35,9 +33,9 @@ protected:
|
||||
bool onCanHandleComplexCTM() const override { return true; }
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkMergeImageFilter)
|
||||
|
||||
SkMergeImageFilter(sk_sp<SkImageFilter>* const filters, int count, const CropRect* cropRect);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
};
|
||||
|
@ -62,18 +62,16 @@ public:
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
Op op() const override { return kDilate_Op; }
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkDilateImageFilter)
|
||||
|
||||
SkDilateImageFilter(int radiusX, int radiusY,
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect)
|
||||
: INHERITED(radiusX, radiusY, input, cropRect) {}
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
typedef SkMorphologyImageFilter INHERITED;
|
||||
};
|
||||
@ -85,17 +83,15 @@ public:
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
Op op() const override { return kErode_Op; }
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkErodeImageFilter)
|
||||
|
||||
SkErodeImageFilter(int radiusX, int radiusY,
|
||||
sk_sp<SkImageFilter> input, const CropRect* cropRect)
|
||||
: INHERITED(radiusX, radiusY, input, cropRect) {}
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
typedef SkMorphologyImageFilter INHERITED;
|
||||
};
|
||||
|
@ -20,8 +20,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect& src) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -31,9 +29,9 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkOffsetImageFilter)
|
||||
|
||||
SkOffsetImageFilter(SkScalar dx, SkScalar dy, sk_sp<SkImageFilter> input, const CropRect*);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkVector fOffset;
|
||||
|
||||
|
@ -32,14 +32,14 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer);
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
static void InitializeFlattenables();
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkOverdrawColorFilter)
|
||||
|
||||
SkOverdrawColorFilter(const SkPMColor colors[kNumColors]) {
|
||||
memcpy(fColors, colors, kNumColors * sizeof(SkPMColor));
|
||||
}
|
||||
|
@ -27,8 +27,6 @@ public:
|
||||
|
||||
bool affectsTransparentBlack() const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -36,9 +34,9 @@ protected:
|
||||
sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkPaintImageFilter)
|
||||
|
||||
SkPaintImageFilter(const SkPaint& paint, const CropRect* rect);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkPaint fPaint;
|
||||
|
||||
|
@ -26,8 +26,6 @@ public:
|
||||
static sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture, const SkRect& cropRect);
|
||||
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
/* Constructs an SkPictureImageFilter object from an SkReadBuffer.
|
||||
* Note: If the SkPictureImageFilter object construction requires bitmap
|
||||
@ -41,10 +39,10 @@ protected:
|
||||
sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkPictureImageFilter)
|
||||
|
||||
explicit SkPictureImageFilter(sk_sp<SkPicture> picture);
|
||||
SkPictureImageFilter(sk_sp<SkPicture> picture, const SkRect& cropRect, sk_sp<SkColorSpace>);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
sk_sp<SkPicture> fPicture;
|
||||
SkRect fCropRect;
|
||||
|
@ -28,8 +28,6 @@ public:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
SkRect computeFastBounds(const SkRect& src) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
|
||||
@ -38,10 +36,10 @@ protected:
|
||||
sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkTileImageFilter)
|
||||
|
||||
SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, sk_sp<SkImageFilter> input)
|
||||
: INHERITED(&input, 1, nullptr), fSrcRect(srcRect), fDstRect(dstRect) {}
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkRect fSrcRect;
|
||||
SkRect fDstRect;
|
||||
|
@ -27,15 +27,13 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkToSRGBColorFilter)
|
||||
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
SkToSRGBColorFilter(sk_sp<SkColorSpace>);
|
||||
void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
|
||||
bool shaderIsOpaque) const override;
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
sk_sp<SkColorSpace> fSrcColorSpace;
|
||||
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix)
|
||||
: Sk2DPathEffect(matrix), fRadius(radius) {}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
|
||||
|
||||
protected:
|
||||
void next(const SkPoint& loc, int u, int v, SkPath* dst) const override {
|
||||
dst->addCircle(loc.fX, loc.fY, fRadius);
|
||||
@ -53,6 +51,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(Dot2DPathEffect)
|
||||
|
||||
SkScalar fRadius;
|
||||
|
||||
typedef Sk2DPathEffect INHERITED;
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
SkTDArray<SkPoint>* pts)
|
||||
: Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
|
||||
class Registrar {
|
||||
public:
|
||||
Registrar() {
|
||||
@ -60,6 +59,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(Dot2DPathEffect)
|
||||
|
||||
SkScalar fRadius;
|
||||
SkTDArray<SkPoint>* fPts;
|
||||
|
||||
@ -84,9 +85,9 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE)
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(InverseFillPE)
|
||||
|
||||
typedef SkPathEffect INHERITED;
|
||||
};
|
||||
|
||||
|
@ -34,9 +34,9 @@ We have a macro for this:
|
||||
|
||||
<!--?prettify?-->
|
||||
~~~~
|
||||
public:
|
||||
private:
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNewClass)
|
||||
SK_FLATTENABLE_HOOKS(SkNewClass)
|
||||
~~~~
|
||||
|
||||
4: If your class is declared in a `.cpp` file or in a private header file, create a
|
||||
|
@ -859,14 +859,14 @@ public:
|
||||
typedef Context INHERITED;
|
||||
};
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk3DShader)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override {
|
||||
buffer.writeFlattenable(fProxy.get());
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(Sk3DShader)
|
||||
|
||||
sk_sp<SkShader> fProxy;
|
||||
|
||||
typedef SkShaderBase INHERITED;
|
||||
|
@ -70,7 +70,6 @@ public:
|
||||
void computeFastBounds(const SkRect&, SkRect*) const override;
|
||||
bool asABlur(BlurRec*) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
|
||||
|
||||
protected:
|
||||
FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&,
|
||||
@ -89,6 +88,7 @@ protected:
|
||||
bool ignoreXform() const { return !fRespectCTM; }
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkBlurMaskFilterImpl)
|
||||
// To avoid unseemly allocation requests (esp. for finite platforms like
|
||||
// handset) we limit the radius so something manageable. (as opposed to
|
||||
// a request like 10,000)
|
||||
|
@ -121,8 +121,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeColorFilter)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override {
|
||||
buffer.writeFlattenable(fOuter.get());
|
||||
@ -130,6 +128,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkComposeColorFilter)
|
||||
|
||||
SkComposeColorFilter(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner,
|
||||
int composedFilterCount)
|
||||
: fOuter(std::move(outer))
|
||||
@ -216,8 +216,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSRGBGammaColorFilter)
|
||||
|
||||
void onAppendStages(SkRasterPipeline* p, SkColorSpace*, SkArenaAlloc* alloc,
|
||||
bool shaderIsOpaque) const override {
|
||||
if (!shaderIsOpaque) {
|
||||
@ -242,6 +240,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkSRGBGammaColorFilter)
|
||||
|
||||
const Direction fDir;
|
||||
|
||||
friend class SkColorFilter;
|
||||
|
@ -28,16 +28,14 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColorMatrixFilterRowMajor255)
|
||||
|
||||
void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
|
||||
bool shaderIsOpaque) const override;
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkScalar fMatrix[20];
|
||||
float fTranspose[20]; // for Sk4s
|
||||
|
@ -77,8 +77,6 @@ public:
|
||||
|
||||
bool isOpaque() const override { return fIsOpaque; }
|
||||
|
||||
// For serialization. This will never be called.
|
||||
Factory getFactory() const override { SK_ABORT("not reached"); return nullptr; }
|
||||
|
||||
protected:
|
||||
#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
|
||||
@ -93,6 +91,10 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
// For serialization. This will never be called.
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
Matrix43 fM43;
|
||||
const bool fIsOpaque;
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The Android Open Source Project
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkFlattenablePriv_DEFINED
|
||||
#define SkFlattenablePriv_DEFINED
|
||||
|
||||
#include "SkFlattenable.h"
|
||||
|
||||
/*
|
||||
* Flattening is straight-forward:
|
||||
* 1. call getFactory() so we have a function-ptr to recreate the subclass
|
||||
* 2. call flatten(buffer) to write out enough data for the factory to read
|
||||
*
|
||||
* Unflattening is easy for the caller: new_instance = factory(buffer)
|
||||
*
|
||||
* The complexity of supporting this is as follows.
|
||||
*
|
||||
* If your subclass wants to control unflattening, use this macro in your declaration:
|
||||
* SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS
|
||||
* This will provide a getFactory(), and require that the subclass implements CreateProc.
|
||||
*/
|
||||
|
||||
#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
|
||||
SkFlattenable::Register(#flattenable, \
|
||||
flattenable::CreateProc, \
|
||||
flattenable::GetFlattenableType());
|
||||
|
||||
#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
|
||||
private: \
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
|
||||
friend class SkFlattenable::PrivateInitializer; \
|
||||
public: \
|
||||
Factory getFactory() const override { return flattenable::CreateProc; }
|
||||
|
||||
#endif
|
@ -11,7 +11,6 @@
|
||||
#include "SkColorShader.h"
|
||||
#include "SkComposeShader.h"
|
||||
#include "SkEmptyShader.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageShader.h"
|
||||
#include "SkLocalMatrixShader.h"
|
||||
#include "SkMatrixImageFilter.h"
|
||||
|
@ -19,8 +19,6 @@ class SkLocalMatrixImageFilter : public SkImageFilter {
|
||||
public:
|
||||
static sk_sp<SkImageFilter> Make(const SkMatrix& localM, sk_sp<SkImageFilter> input);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -30,9 +28,9 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLocalMatrixImageFilter)
|
||||
|
||||
SkLocalMatrixImageFilter(const SkMatrix& localM, sk_sp<SkImageFilter> input);
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
|
||||
SkMatrix fLocalM;
|
||||
|
||||
|
@ -394,7 +394,6 @@ public:
|
||||
}
|
||||
|
||||
SkMask::Format getFormat() const override { return SkMask::kA8_Format; }
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeMF)
|
||||
|
||||
protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
@ -415,6 +414,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkComposeMF)
|
||||
|
||||
sk_sp<SkMaskFilter> fOuter;
|
||||
sk_sp<SkMaskFilter> fInner;
|
||||
|
||||
@ -482,7 +483,7 @@ public:
|
||||
|
||||
SkMask::Format getFormat() const override { return SkMask::kA8_Format; }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCombineMF)
|
||||
SK_FLATTENABLE_HOOKS(SkCombineMF)
|
||||
|
||||
protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
@ -631,7 +632,7 @@ public:
|
||||
|
||||
SkMask::Format getFormat() const override { return as_MFB(fFilter)->getFormat(); }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixMF)
|
||||
SK_FLATTENABLE_HOOKS(SkMatrixMF)
|
||||
|
||||
protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
|
@ -32,8 +32,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect&) const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkMatrixImageFilter(const SkMatrix& transform,
|
||||
SkFilterQuality,
|
||||
@ -47,8 +45,7 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkMatrixImageFilter)
|
||||
|
||||
SkMatrix fTransform;
|
||||
SkFilterQuality fFilterQuality;
|
||||
|
@ -20,8 +20,6 @@ public:
|
||||
bool asColorMode(SkColor*, SkBlendMode*) const override;
|
||||
uint32_t getFlags() const override;
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
@ -38,8 +36,7 @@ protected:
|
||||
sk_sp<SkColorFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkModeColorFilter)
|
||||
|
||||
SkColor fColor;
|
||||
SkBlendMode fMode;
|
||||
|
@ -21,12 +21,12 @@ public:
|
||||
SkNormalSource::Provider* asProvider(const SkShaderBase::ContextRec& rec,
|
||||
SkArenaAlloc* alloc) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalFlatSourceImpl)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buf) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkNormalFlatSourceImpl)
|
||||
|
||||
class Provider : public SkNormalSource::Provider {
|
||||
public:
|
||||
Provider();
|
||||
|
@ -23,8 +23,6 @@ public:
|
||||
SkNormalSource::Provider* asProvider(const SkShaderBase::ContextRec& rec,
|
||||
SkArenaAlloc* alloc) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalMapSourceImpl)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buf) const override;
|
||||
|
||||
@ -32,6 +30,8 @@ protected:
|
||||
SkMatrix* normTotalInverse) const;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkNormalMapSourceImpl)
|
||||
|
||||
class Provider : public SkNormalSource::Provider {
|
||||
public:
|
||||
Provider(const SkNormalMapSourceImpl& source, SkShaderBase::Context* mapContext);
|
||||
|
@ -94,8 +94,6 @@ public:
|
||||
return sk_sp<SkPathEffect>(new SkComposePathEffect(outer, inner));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
bool exposedInAndroidJavaAPI() const override { return true; }
|
||||
#endif
|
||||
@ -116,6 +114,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkComposePathEffect)
|
||||
|
||||
// illegal
|
||||
SkComposePathEffect(const SkComposePathEffect&);
|
||||
SkComposePathEffect& operator=(const SkComposePathEffect&);
|
||||
@ -154,7 +154,7 @@ public:
|
||||
return sk_sp<SkPathEffect>(new SkSumPathEffect(first, second));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
|
||||
SK_FLATTENABLE_HOOKS(SkSumPathEffect)
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
bool exposedInAndroidJavaAPI() const override { return true; }
|
||||
|
@ -24,10 +24,6 @@ public:
|
||||
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
SkRect onGetBounds() override { return fBounds; }
|
||||
|
||||
@ -36,6 +32,8 @@ protected:
|
||||
SkPicture* onNewPictureSnapshot() override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkRecordedDrawable)
|
||||
|
||||
sk_sp<SkRecord> fRecord;
|
||||
sk_sp<SkBBoxHierarchy> fBBH;
|
||||
std::unique_ptr<SkDrawableList> fDrawableList;
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
// TODO: might want to remember we're a lighting color filter through serialization?
|
||||
void flatten(SkWriteBuffer& buf) const override { return fMatrixFilter->flatten(buf); }
|
||||
Factory getFactory() const override { return fMatrixFilter->getFactory(); }
|
||||
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
|
||||
@ -73,6 +73,9 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
Factory getFactory() const override { return fMatrixFilter->getFactory(); }
|
||||
const char* getTypeName() const override { return fMatrixFilter->getTypeName(); }
|
||||
|
||||
SkColor fMul, fAdd;
|
||||
sk_sp<SkColorFilter> fMatrixFilter;
|
||||
|
||||
|
@ -14,8 +14,6 @@ class SkDashImpl : public SkPathEffect {
|
||||
public:
|
||||
SkDashImpl(const SkScalar intervals[], int count, SkScalar phase);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
bool exposedInAndroidJavaAPI() const override { return true; }
|
||||
#endif
|
||||
@ -31,8 +29,7 @@ protected:
|
||||
DashType onAsADash(DashInfo* info) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkDashImpl)
|
||||
|
||||
SkScalar* fIntervals;
|
||||
int32_t fCount;
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "SkDashImpl.h"
|
||||
#include "SkDashPathPriv.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkStrokeRec.h"
|
||||
#include "SkTo.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#ifndef SkEmbossMaskFilter_DEFINED
|
||||
#define SkEmbossMaskFilter_DEFINED
|
||||
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkMaskFilterBase.h"
|
||||
|
||||
/** \class SkEmbossMaskFilter
|
||||
@ -33,13 +32,13 @@ public:
|
||||
bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
|
||||
SkIPoint* margin) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
|
||||
|
||||
protected:
|
||||
SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkEmbossMaskFilter)
|
||||
|
||||
Light fLight;
|
||||
SkScalar fBlurSigma;
|
||||
|
||||
|
@ -45,12 +45,12 @@ public:
|
||||
SkArenaAlloc* scratch,
|
||||
bool shaderIsOpaque) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkHighContrast_Filter)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkHighContrast_Filter)
|
||||
|
||||
SkHighContrastConfig fConfig;
|
||||
|
||||
friend class SkHighContrastFilter;
|
||||
|
@ -14,15 +14,13 @@ class SkOpPE : public SkPathEffect {
|
||||
public:
|
||||
SkOpPE(sk_sp<SkPathEffect> one, sk_sp<SkPathEffect> two, SkPathOp op);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkOpPE)
|
||||
|
||||
sk_sp<SkPathEffect> fOne;
|
||||
sk_sp<SkPathEffect> fTwo;
|
||||
@ -35,15 +33,12 @@ class SkMatrixPE : public SkPathEffect {
|
||||
public:
|
||||
SkMatrixPE(const SkMatrix&);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkMatrixPE)
|
||||
|
||||
SkMatrix fMatrix;
|
||||
|
||||
@ -54,16 +49,13 @@ class SkStrokePE : public SkPathEffect {
|
||||
public:
|
||||
SkStrokePE(SkScalar width, SkPaint::Join, SkPaint::Cap, SkScalar miter);
|
||||
|
||||
Factory getFactory() const override { return CreateProc; }
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
// TODO: override onComputeFastBounds (I think)
|
||||
|
||||
private:
|
||||
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
||||
friend class SkFlattenable::PrivateInitializer;
|
||||
SK_FLATTENABLE_HOOKS(SkStrokePE)
|
||||
|
||||
SkScalar fWidth,
|
||||
fMiter;
|
||||
|
@ -27,8 +27,6 @@ public:
|
||||
|
||||
bool asABlur(BlurRec*) const override { return false; }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkShaderMF)
|
||||
|
||||
protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(const GrFPArgs&) const override;
|
||||
@ -36,6 +34,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkShaderMF)
|
||||
|
||||
sk_sp<SkShader> fShader;
|
||||
|
||||
SkShaderMF(SkReadBuffer&);
|
||||
|
@ -91,8 +91,6 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter)
|
||||
|
||||
enum {
|
||||
kA_Flag = 1 << 0,
|
||||
kR_Flag = 1 << 1,
|
||||
@ -129,6 +127,8 @@ protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkTable_ColorFilter)
|
||||
|
||||
mutable const SkBitmap* fBitmap; // lazily allocated
|
||||
|
||||
uint8_t fStorage[256 * 4];
|
||||
|
@ -18,14 +18,14 @@ public:
|
||||
SkMask::Format getFormat() const override;
|
||||
bool filterMask(SkMask*, const SkMask&, const SkMatrix&, SkIPoint*) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilterImpl)
|
||||
|
||||
protected:
|
||||
~SkTableMaskFilterImpl() override;
|
||||
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkTableMaskFilterImpl)
|
||||
|
||||
SkTableMaskFilterImpl();
|
||||
|
||||
uint8_t fTable[256];
|
||||
|
@ -8,7 +8,6 @@
|
||||
#ifndef SkTrimImpl_DEFINED
|
||||
#define SkTrimImpl_DEFINED
|
||||
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkPathEffect.h"
|
||||
|
||||
#include "SkTrimPathEffect.h"
|
||||
@ -17,13 +16,13 @@ class SkTrimPE : public SkPathEffect {
|
||||
public:
|
||||
SkTrimPE(SkScalar startT, SkScalar stopT, SkTrimPathEffect::Mode);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTrimPE)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkTrimPE)
|
||||
|
||||
const SkScalar fStartT,
|
||||
fStopT;
|
||||
const SkTrimPathEffect::Mode fMode;
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
SkScalar outerThreshold, sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect = nullptr);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
|
||||
friend void SkAlphaThresholdFilter::InitializeFlattenables();
|
||||
|
||||
protected:
|
||||
@ -49,6 +48,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkAlphaThresholdFilterImpl)
|
||||
|
||||
SkRegion fRegion;
|
||||
SkScalar fInnerThreshold;
|
||||
SkScalar fOuterThreshold;
|
||||
|
@ -51,8 +51,6 @@ public:
|
||||
sk_sp<SkImageFilter> inputs[2], const CropRect* cropRect)
|
||||
: INHERITED(inputs, 2, cropRect), fK{k1, k2, k3, k4}, fEnforcePMColor(enforcePMColor) {}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ArithmeticImageFilterImpl)
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
SkIPoint* offset) const override;
|
||||
@ -83,6 +81,8 @@ protected:
|
||||
sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(ArithmeticImageFilterImpl)
|
||||
|
||||
bool affectsTransparentBlack() const override { return !SkScalarNearlyZero(fK[3]); }
|
||||
|
||||
const float fK[4];
|
||||
|
@ -41,8 +41,6 @@ public:
|
||||
|
||||
SkRect computeFastBounds(const SkRect&) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilterImpl)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
@ -52,6 +50,8 @@ protected:
|
||||
MapDirection, const SkIRect* inputRect) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkBlurImageFilterImpl)
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
friend class SkImageFilter;
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "SkBitmap.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "SkBitmap.h"
|
||||
#include "SkColorData.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkPoint3.h"
|
||||
#include "SkReadBuffer.h"
|
||||
@ -529,7 +528,6 @@ public:
|
||||
sk_sp<SkImageFilter>,
|
||||
const CropRect*);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiffuseLightingImageFilter)
|
||||
SkScalar kd() const { return fKD; }
|
||||
|
||||
protected:
|
||||
@ -550,6 +548,7 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkDiffuseLightingImageFilter)
|
||||
friend class SkLightingImageFilter;
|
||||
SkScalar fKD;
|
||||
|
||||
@ -563,8 +562,6 @@ public:
|
||||
SkScalar ks, SkScalar shininess,
|
||||
sk_sp<SkImageFilter>, const CropRect*);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSpecularLightingImageFilter)
|
||||
|
||||
SkScalar ks() const { return fKS; }
|
||||
SkScalar shininess() const { return fShininess; }
|
||||
|
||||
@ -587,6 +584,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkSpecularLightingImageFilter)
|
||||
|
||||
SkScalar fKS;
|
||||
SkScalar fShininess;
|
||||
friend class SkLightingImageFilter;
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkBitmap.h"
|
||||
#include "SkColorData.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "SkBitmap.h"
|
||||
#include "SkColorData.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
#include "SkSpecialSurface.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkBitmap.h"
|
||||
#include "SkColorData.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkOpts.h"
|
||||
#include "SkReadBuffer.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "SkOffsetImageFilter.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkPaint.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorSpaceXformCanvas.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageSource.h"
|
||||
#include "SkPicturePriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "SkTileImageFilter.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkMatrix.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorData.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilterPriv.h"
|
||||
#include "SkReadBuffer.h"
|
||||
#include "SkSpecialImage.h"
|
||||
@ -35,8 +34,6 @@ public:
|
||||
SkXfermodeImageFilter_Base(SkBlendMode mode, sk_sp<SkImageFilter> inputs[2],
|
||||
const CropRect* cropRect);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter_Base)
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
|
||||
SkIPoint* offset) const override;
|
||||
@ -64,6 +61,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkXfermodeImageFilter_Base)
|
||||
|
||||
static sk_sp<SkFlattenable> LegacyArithmeticCreateProc(SkReadBuffer& buffer);
|
||||
|
||||
SkBlendMode fMode;
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
}
|
||||
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath&, SkStrokeRec* , const SkRect*) const override;
|
||||
|
@ -26,11 +26,11 @@ public:
|
||||
|
||||
void computeFastBounds(const SkRect&, SkRect*) const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(GrSDFMaskFilterImpl)
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(GrSDFMaskFilterImpl)
|
||||
|
||||
typedef SkMaskFilter INHERITED;
|
||||
friend void gr_register_sdf_maskfilter_createproc();
|
||||
};
|
||||
|
@ -5,7 +5,6 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkAlphaThresholdFilter.h"
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkColorFilterImageFilter.h"
|
||||
|
@ -21,14 +21,14 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterShader)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
bool onAppendStages(const StageRec&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColorFilterShader)
|
||||
|
||||
sk_sp<SkShader> fShader;
|
||||
sk_sp<SkColorFilter> fFilter;
|
||||
|
||||
|
@ -50,8 +50,6 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
|
||||
|
||||
protected:
|
||||
SkColorShader(SkReadBuffer&);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
@ -71,6 +69,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColorShader)
|
||||
|
||||
SkColor fColor;
|
||||
|
||||
typedef SkShaderBase INHERITED;
|
||||
@ -107,8 +107,6 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColor4Shader)
|
||||
|
||||
protected:
|
||||
SkColor4Shader(SkReadBuffer&);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
@ -124,6 +122,8 @@ protected:
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkColor4Shader)
|
||||
|
||||
sk_sp<SkColorSpace> fColorSpace;
|
||||
const SkColor4f fColor4;
|
||||
const SkColor fCachedByteColor;
|
||||
|
@ -35,8 +35,6 @@ public:
|
||||
bool asACompose(ComposeRec* rec) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader)
|
||||
|
||||
protected:
|
||||
SkComposeShader(SkReadBuffer&);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
@ -44,6 +42,8 @@ protected:
|
||||
bool onAppendStages(const StageRec&) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkComposeShader)
|
||||
|
||||
sk_sp<SkShader> fDst;
|
||||
sk_sp<SkShader> fSrc;
|
||||
const float fLerpT;
|
||||
|
@ -20,8 +20,6 @@ class SkEmptyShader : public SkShaderBase {
|
||||
public:
|
||||
SkEmptyShader() {}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
|
||||
|
||||
protected:
|
||||
#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
|
||||
Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const override {
|
||||
@ -40,6 +38,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkEmptyShader)
|
||||
|
||||
typedef SkShaderBase INHERITED;
|
||||
};
|
||||
|
||||
|
@ -23,13 +23,13 @@ public:
|
||||
|
||||
bool isOpaque() const override;
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageShader)
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkImageShader)
|
||||
|
||||
SkImageShader(sk_sp<SkImage>,
|
||||
SkShader::TileMode tx,
|
||||
SkShader::TileMode ty,
|
||||
|
@ -80,8 +80,6 @@ public:
|
||||
typedef Context INHERITED;
|
||||
};
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingShaderImpl)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
|
||||
@ -90,6 +88,8 @@ protected:
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLightingShaderImpl)
|
||||
|
||||
sk_sp<SkShader> fDiffuseShader;
|
||||
sk_sp<SkNormalSource> fNormalSource;
|
||||
sk_sp<SkLights> fLights;
|
||||
|
@ -8,7 +8,6 @@
|
||||
#ifndef SkLightingShader_DEFINED
|
||||
#define SkLightingShader_DEFINED
|
||||
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkLights.h"
|
||||
#include "SkShader.h"
|
||||
|
||||
|
@ -38,8 +38,6 @@ public:
|
||||
return fProxyShader;
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
@ -57,6 +55,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLocalMatrixShader)
|
||||
|
||||
sk_sp<SkShader> fProxyShader;
|
||||
|
||||
typedef SkShaderBase INHERITED;
|
||||
|
@ -365,8 +365,6 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShaderImpl)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
#ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
|
||||
@ -374,6 +372,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkPerlinNoiseShaderImpl)
|
||||
|
||||
const SkPerlinNoiseShaderImpl::Type fType;
|
||||
const SkScalar fBaseFrequencyX;
|
||||
const SkScalar fBaseFrequencyY;
|
||||
|
@ -28,8 +28,6 @@ public:
|
||||
static sk_sp<SkShader> Make(sk_sp<SkPicture>, TileMode, TileMode, const SkMatrix*,
|
||||
const SkRect*);
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader)
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
@ -44,6 +42,8 @@ protected:
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkPictureShader)
|
||||
|
||||
SkPictureShader(sk_sp<SkPicture>, TileMode, TileMode, const SkMatrix*, const SkRect*,
|
||||
sk_sp<SkColorSpace>);
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define SkShaderBase_DEFINED
|
||||
|
||||
#include "SkFilterQuality.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkMask.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkNoncopyable.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkColorSpacePriv.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkConvertPixels.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkFloatBits.h"
|
||||
#include "SkGradientShaderPriv.h"
|
||||
#include "SkHalf.h"
|
||||
|
@ -19,8 +19,6 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient)
|
||||
|
||||
protected:
|
||||
SkLinearGradient(SkReadBuffer& buffer);
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
@ -36,6 +34,8 @@ protected:
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkLinearGradient)
|
||||
|
||||
class LinearGradient4fContext;
|
||||
|
||||
friend class SkGradientShader;
|
||||
|
@ -19,8 +19,6 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRadialGradient)
|
||||
|
||||
protected:
|
||||
SkRadialGradient(SkReadBuffer& buffer);
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
@ -30,6 +28,8 @@ protected:
|
||||
SkRasterPipeline* postPipeline) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkRadialGradient)
|
||||
|
||||
const SkPoint fCenter;
|
||||
const SkScalar fRadius;
|
||||
|
||||
|
@ -24,8 +24,6 @@ public:
|
||||
|
||||
SkScalar getTScale() const { return fTScale; }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
@ -34,6 +32,8 @@ protected:
|
||||
SkRasterPipeline* postPipeline) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkSweepGradient)
|
||||
|
||||
const SkPoint fCenter;
|
||||
const SkScalar fTBias,
|
||||
fTScale;
|
||||
|
@ -64,8 +64,6 @@ public:
|
||||
Type getType() const { return fType; }
|
||||
const FocalData& getFocalData() const { return fFocalData; }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointConicalGradient)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer& buffer) const override;
|
||||
sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
|
||||
@ -74,6 +72,8 @@ protected:
|
||||
SkRasterPipeline* postPipeline) const override;
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkTwoPointConicalGradient)
|
||||
|
||||
SkTwoPointConicalGradient(const SkPoint& c0, SkScalar r0,
|
||||
const SkPoint& c1, SkScalar r1,
|
||||
const Descriptor&, Type, const SkMatrix&, const FocalData&);
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "SkColorData.h"
|
||||
#include "SkDevice.h"
|
||||
#include "SkDrawShadowInfo.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRandom.h"
|
||||
@ -45,8 +44,6 @@ public:
|
||||
GrContext*, const GrColorSpaceInfo&) const override;
|
||||
#endif
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkGaussianColorFilter)
|
||||
|
||||
protected:
|
||||
void flatten(SkWriteBuffer&) const override {}
|
||||
void onAppendStages(SkRasterPipeline* pipeline, SkColorSpace* dstCS, SkArenaAlloc* alloc,
|
||||
@ -54,6 +51,8 @@ protected:
|
||||
pipeline->append(SkRasterPipeline::gauss_a_to_rgba);
|
||||
}
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(SkGaussianColorFilter)
|
||||
|
||||
SkGaussianColorFilter() : INHERITED() {}
|
||||
|
||||
typedef SkColorFilter INHERITED;
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "SkClipOp.h"
|
||||
#include "SkClipOpPriv.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkImageFilter.h"
|
||||
#include "SkImageInfo.h"
|
||||
#include "SkMalloc.h"
|
||||
@ -838,8 +837,6 @@ class ZeroBoundsImageFilter : public SkImageFilter {
|
||||
public:
|
||||
static sk_sp<SkImageFilter> Make() { return sk_sp<SkImageFilter>(new ZeroBoundsImageFilter); }
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ZeroBoundsImageFilter)
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage*, const Context&, SkIPoint*) const override {
|
||||
return nullptr;
|
||||
@ -851,6 +848,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(ZeroBoundsImageFilter)
|
||||
|
||||
ZeroBoundsImageFilter() : INHERITED(nullptr, 0, nullptr) {}
|
||||
|
||||
typedef SkImageFilter INHERITED;
|
||||
|
@ -1154,6 +1154,7 @@ void test_path_effect_makes_rrect(skiatest::Reporter* reporter, const Geo& geo)
|
||||
|
||||
static sk_sp<SkPathEffect> Make() { return sk_sp<SkPathEffect>(new RRectPathEffect); }
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*,
|
||||
@ -1235,6 +1236,7 @@ void test_unknown_path_effect(skiatest::Reporter* reporter, const Geo& geo) {
|
||||
public:
|
||||
static sk_sp<SkPathEffect> Make() { return sk_sp<SkPathEffect>(new AddLineTosPathEffect); }
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*,
|
||||
@ -1281,6 +1283,7 @@ void test_make_hairline_path_effect(skiatest::Reporter* reporter, const Geo& geo
|
||||
return sk_sp<SkPathEffect>(new MakeHairlinePathEffect);
|
||||
}
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec* strokeRec,
|
||||
@ -1363,6 +1366,7 @@ void test_path_effect_makes_empty_shape(skiatest::Reporter* reporter, const Geo&
|
||||
return sk_sp<SkPathEffect>(new EmptyPathEffect(invert));
|
||||
}
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*,
|
||||
const SkRect* cullR) const override {
|
||||
@ -1448,6 +1452,7 @@ void test_path_effect_fails(skiatest::Reporter* reporter, const Geo& geo) {
|
||||
public:
|
||||
static sk_sp<SkPathEffect> Make() { return sk_sp<SkPathEffect>(new FailurePathEffect); }
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
protected:
|
||||
bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*,
|
||||
const SkRect* cullR) const override {
|
||||
|
@ -57,8 +57,6 @@ public:
|
||||
return sk_sp<SkImageFilter>(new MatrixTestImageFilter(reporter, expectedMatrix));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
|
||||
|
||||
protected:
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context& ctx,
|
||||
SkIPoint* offset) const override {
|
||||
@ -75,6 +73,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(MatrixTestImageFilter)
|
||||
|
||||
MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix)
|
||||
: INHERITED(nullptr, 0, nullptr)
|
||||
, fReporter(reporter)
|
||||
@ -100,7 +100,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
|
||||
SK_FLATTENABLE_HOOKS(FailImageFilter)
|
||||
|
||||
private:
|
||||
typedef SkImageFilter INHERITED;
|
||||
@ -289,6 +289,7 @@ public:
|
||||
|
||||
private:
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* src, const Context&,
|
||||
SkIPoint* offset) const override {
|
||||
@ -1831,6 +1832,7 @@ DEF_TEST(ImageFilterColorSpaceDAG, reporter) {
|
||||
TestFilter() : INHERITED(nullptr, 0, nullptr) {}
|
||||
|
||||
Factory getFactory() const override { return nullptr; }
|
||||
const char* getTypeName() const override { return nullptr; }
|
||||
|
||||
size_t cloneCount() const { return fCloneCount; }
|
||||
|
||||
|
@ -359,7 +359,6 @@ public:
|
||||
return sk_sp<DummyImageFilter>(new DummyImageFilter(visited));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter)
|
||||
bool visited() const { return fVisited; }
|
||||
|
||||
protected:
|
||||
@ -374,6 +373,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(DummyImageFilter)
|
||||
DummyImageFilter(bool visited) : INHERITED(nullptr, 0, nullptr), fVisited(visited) {}
|
||||
|
||||
mutable bool fVisited;
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkDrawLooper.h"
|
||||
#include "SkFlattenablePriv.h"
|
||||
#include "SkLightingImageFilter.h"
|
||||
#include "SkPoint3.h"
|
||||
#include "SkTypes.h"
|
||||
@ -30,9 +29,9 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestLooper)
|
||||
|
||||
private:
|
||||
SK_FLATTENABLE_HOOKS(TestLooper)
|
||||
|
||||
class TestDrawLooperContext : public SkDrawLooper::Context {
|
||||
public:
|
||||
TestDrawLooperContext() : fOnce(true) {}
|
||||
|
Loading…
Reference in New Issue
Block a user