static void appendFlattenable(SkString* str, const SkFlattenable* ptr,
const char name[]) {
if (ptr) {
- SkString info;
- if (ptr->toDumpString(&info)) {
- str->appendf("%s\n", info.c_str());
- } else {
- str->appendf("%s: %p\n", name, ptr);
- }
+ str->appendf("%s: %p\n", name, ptr);
}
}
readPath, diffPath);
}
- if ((ERROR_NONE == testErrors) && doSerialize) {
+ if ((ERROR_NONE == testErrors) && doSerialize &&
+ !(gmFlags & GM::kSkipPicture_Flag)) {
testErrors |= test_picture_serialization(gm, gRec[i],
forwardRenderedBitmap,
readPath, diffPath);
'../include/effects/SkDashPathEffect.h',
'../include/effects/SkDiscretePathEffect.h',
'../include/effects/SkDrawExtraPathEffect.h',
- '../include/effects/SkEffects.h',
'../include/effects/SkEmbossMaskFilter.h',
'../include/effects/SkGradientShader.h',
'../include/effects/SkGroupShape.h',
'../src/effects/SkCornerPathEffect.cpp',
'../src/effects/SkDashPathEffect.cpp',
'../src/effects/SkDiscretePathEffect.cpp',
- '../src/effects/SkEffects.cpp',
'../src/effects/SkEmbossMask.cpp',
'../src/effects/SkEmbossMask.h',
'../src/effects/SkEmbossMask_Table.h',
*/
static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
protected:
SkColorFilter() {}
SkColorFilter(SkFlattenableReadBuffer& rb) : INHERITED(rb) {}
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
protected:
SkColorShader(SkFlattenableReadBuffer&);
virtual Factory getFactory() SK_OVERRIDE;
private:
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
SkColor fColor; // ignored if fInheritColor is true
SkPMColor fPMColor; // cached after setContext()
virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkEmptyShader, (buffer));
+ }
+
protected:
SkEmptyShader(SkFlattenableReadBuffer&);
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-#define SK_DECLARE_FLATTENABLE_REGISTRAR()
-
#define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable) \
static SkFlattenable::Registrar g##flattenable##Reg(#flattenable, \
- flattenable::CreateProc);
-
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable)
+ flattenable::CreateProc);
#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
static SkFlattenable::Registrar g##flattenable##Reg(#flattenable, \
- flattenable::CreateProc);
+ flattenable::CreateProc);
+
+#define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable)
#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
#else
-#define SK_DECLARE_FLATTENABLE_REGISTRAR() static void Init();
+#define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable)
+#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
+ SkFlattenable::Registrar(#flattenable, flattenable::CreateProc);
-#define SK_DEFINE_FLATTENABLE_REGISTRAR(flattenable) \
- void flattenable::Init() { \
- SkFlattenable::Registrar(#flattenable, CreateProc); \
- }
+#define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() static void InitializeFlattenables();
#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable) \
- void flattenable::Init() {
-
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
- SkFlattenable::Registrar(#flattenable, flattenable::CreateProc);
-
+ void flattenable::InitializeFlattenables() {
+
#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
}
*/
virtual void flatten(SkFlattenableWriteBuffer&);
- /** Set the string to describe the sublass and return true. If this is not
- overridden, ignore the string param and return false.
- */
- virtual bool toDumpString(SkString*) const;
-
static Factory NameToFactory(const char name[]);
static const char* FactoryToName(Factory);
static void Register(const char name[], Factory);
-
+
class Registrar {
public:
Registrar(const char name[], Factory factory) {
SkFlattenable::Register(name, factory);
}
};
-
+
protected:
SkFlattenable(SkFlattenableReadBuffer&) {}
*/
virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width) = 0;
- SK_DECLARE_FLATTENABLE_REGISTRAR()
private:
// illegal
SkPathEffect(const SkPathEffect&);
// public for Registrar
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
virtual void onDraw(SkCanvas*);
return AsMode(xfer, mode);
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
protected:
SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {}
return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkPath1DPathEffect(SkFlattenableReadBuffer& buffer);
// protected so that subclasses can call this during unflattening
Sk2DPathEffect(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
private:
SkMatrix fMatrix, fInverse;
// illegal
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
return SkNEW_ARGS(SkAvoidXfermode, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkAvoidXfermode(SkFlattenableReadBuffer&);
return SkNEW_ARGS(SkBlurDrawLooper, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkBlurDrawLooper(SkFlattenableReadBuffer&);
// overrides from SkFlattenable
return SkNEW_ARGS(SkBlurImageFilter, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
explicit SkBlurImageFilter(SkFlattenableReadBuffer& buffer);
SkScalar ambient, SkScalar specular,
SkScalar blurRadius);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
private:
SkBlurMaskFilter(); // can't be instantiated
};
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
// overrides for SkFlattenable
virtual Factory getFactory();
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkCornerPathEffect(SkFlattenableReadBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkDashPathEffect(SkFlattenableReadBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkDiscretePathEffect(SkFlattenableReadBuffer&);
+++ /dev/null
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkEffects_DEFINED
-#define SkEffects_DEFINED
-
-class SkEffects {
-public:
- static void Init();
-};
-
-#endif
// This method is not exported to java.
virtual void flatten(SkFlattenableWriteBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkEmbossMaskFilter(SkFlattenableReadBuffer&);
const SkColor colors[], const SkScalar pos[],
int count, SkUnitMapper* mapper = NULL);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};
#endif
// public for Registrar
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
// overrides
virtual void onDraw(SkCanvas*);
return SkNEW_ARGS(SkLayerDrawLooper, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkLayerDrawLooper(SkFlattenableReadBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkLayerRasterizer(SkFlattenableReadBuffer&);
return SkNEW_ARGS(SkDilateImageFilter, (buffer));
}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
- SK_DECLARE_FLATTENABLE_REGISTRAR()
typedef SkMorphologyImageFilter INHERITED;
};
return SkNEW_ARGS(SkErodeImageFilter, (buffer));
}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
- SK_DECLARE_FLATTENABLE_REGISTRAR()
private:
typedef SkMorphologyImageFilter INHERITED;
return SkNEW_ARGS(SkPixelXorXfermode, (buffer));
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
// override from SkXfermode
virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst);
// public for Registrar
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
SkRectShape(SkFlattenableReadBuffer&);
const uint8_t tableR[256],
const uint8_t tableG[256],
const uint8_t tableB[256]);
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};
#endif
// override from flattenable
virtual bool toDumpString(SkString* str) const;
- SK_DECLARE_FLATTENABLE_REGISTRAR()
protected:
SkBitmapProcShader(SkFlattenableReadBuffer& );
virtual void flatten(SkFlattenableWriteBuffer& );
}
return NULL;
}
-
-bool SkFlattenable::toDumpString(SkString* str) const {
- return false;
-}
///////////////////////////////////////////////////////////////////////////////
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkPathEffect)
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStrokePathEffect)
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkComposePathEffect)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkStrokePathEffect)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkSumPathEffect)
return kColor_GradientType;
}
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkColorShader)
+
///////////////////////////////////////////////////////////////////////////////
#include "SkEmptyShader.h"
this->INHERITED::flatten(buffer);
}
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkEmptyShader)
dst->addPath(fPath, loc.fX, loc.fY);
}
-SK_DEFINE_FLATTENABLE_REGISTRAR(SkPath2DPathEffect)
+///////////////////////////////////////////////////////////////////////////////
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkPath2DPathEffect)
+++ /dev/null
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypes.h"
-
-#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-
-#include "Sk1DPathEffect.h"
-#include "Sk2DPathEffect.h"
-#include "SkAvoidXfermode.h"
-#include "SkBlurDrawLooper.h"
-#include "SkBlurImageFilter.h"
-#include "SkBlurMaskFilter.h"
-#include "SkColorFilter.h"
-#include "SkColorMatrixFilter.h"
-#include "SkCornerPathEffect.h"
-#include "SkDashPathEffect.h"
-#include "SkDiscretePathEffect.h"
-#include "SkEffects.h"
-#include "SkFlattenable.h"
-#include "SkGradientShader.h"
-#include "SkGroupShape.h"
-#include "SkLayerDrawLooper.h"
-#include "SkLayerRasterizer.h"
-#include "SkPathEffect.h"
-#include "SkPixelXorXfermode.h"
-#include "SkRectShape.h"
-
-void SkEffects::Init() {
- SkAvoidXfermode::Init();
- SkBlurDrawLooper::Init();
- SkBlurImageFilter::Init();
- SkBlurMaskFilter::Init();
- SkColorFilter::Init();
- SkColorMatrixFilter::Init();
- SkCornerPathEffect::Init();
- SkDashPathEffect::Init();
- SkDiscretePathEffect::Init();
- SkGradientShader::Init();
- SkGroupShape::Init();
- SkLayerDrawLooper::Init();
- SkLayerRasterizer::Init();
- SkPath1DPathEffect::Init();
- SkPath2DPathEffect::Init();
- SkPixelXorXfermode::Init();
- SkRectShape::Init();
-}
-
-#endif
buffer.writeScalar(fEnd.fY);
}
- SK_DECLARE_FLATTENABLE_REGISTRAR()
-
protected:
Linear_Gradient(SkFlattenableReadBuffer& buffer)
: Gradient_Shader(buffer),
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Linear_Gradient)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Radial_Gradient)
-
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Sweep_Gradient)
-
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Two_Point_Radial_Gradient)
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
const uint8_t tableB[256]) {
return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
}
+
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
return CreateProc;
}
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkOffsetImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkComposeImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkMergeImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkColorFilterImageFilter)
+SK_DEFINE_FLATTENABLE_REGISTRAR(SkDownSampleImageFilter)
#include "SkXfermode.h"
void SkFlattenable::InitializeFlattenables() {
- SkBitmapProcShader::Init();
- SkBlurImageFilter::Init();
- SkBlurMaskFilter::Init();
- SkColorFilter::Init();
- SkCornerPathEffect::Init();
- SkDashPathEffect::Init();
- SkGradientShader::Init();
- SkLayerDrawLooper::Init();
- SkXfermode::Init();
+
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
+
+ SkBlurMaskFilter::InitializeFlattenables();
+ SkColorFilter::InitializeFlattenables();
+ SkGradientShader::InitializeFlattenables();
+ SkXfermode::InitializeFlattenables();
}
void SkPixelRef::InitializeFlattenables() {
#if !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#include "SkBitmapProcShader.h"
-#include "SkEffects.h"
#include "SkFlipPixelRef.h"
#include "SkImageRef_ashmem.h"
#include "SkImageRef_GlobalPool.h"
#include "SkShape.h"
#include "SkXfermode.h"
+#include "Sk1DPathEffect.h"
+#include "Sk2DPathEffect.h"
+#include "SkAvoidXfermode.h"
+#include "SkBlurDrawLooper.h"
+#include "SkBlurImageFilter.h"
+#include "SkBlurMaskFilter.h"
+#include "SkColorFilter.h"
+#include "SkColorMatrixFilter.h"
+#include "SkColorShader.h"
+#include "SkCornerPathEffect.h"
+#include "SkDashPathEffect.h"
+#include "SkDiscretePathEffect.h"
+#include "SkEmptyShader.h"
+#include "SkFlattenable.h"
+#include "SkGradientShader.h"
+#include "SkGroupShape.h"
+#include "SkLayerDrawLooper.h"
+#include "SkLayerRasterizer.h"
+#include "SkMorphologyImageFilter.h"
+#include "SkPathEffect.h"
+#include "SkPixelXorXfermode.h"
+#include "SkRectShape.h"
+#include "SkTableColorFilter.h"
+#include "SkTestImageFilters.h"
+
void SkFlattenable::InitializeFlattenables() {
- SkBitmapProcShader::Init();
- SkEffects::Init();
- SkPathEffect::Init();
- SkShape::Init();
- SkXfermode::Init();
+
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkGroupShape)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShape)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStrokePathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkShape)
+
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDownSampleImageFilter)
+
+ SkBlurMaskFilter::InitializeFlattenables();
+ SkColorFilter::InitializeFlattenables();
+ SkGradientShader::InitializeFlattenables();
+ SkTableColorFilter::InitializeFlattenables();
+ SkXfermode::InitializeFlattenables();
+
+
}
void SkPixelRef::InitializeFlattenables() {
static void appendFlattenable(SkString* str, const SkFlattenable* ptr,
const char name[]) {
if (ptr) {
- SkString info;
- if (ptr->toDumpString(&info)) {
- str->appendf(" %s", info.c_str());
- } else {
- str->appendf(" %s:%p", name, ptr);
- }
+ str->appendf(" %s:%p", name, ptr);
}
}