aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2015-09-17 11:43:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-17 11:43:02 -0700
commita7008403dcd03302e88e2df546d8427afe9e0e80 (patch)
tree5bce1f3fd012c399e17401605e3d9f5dcba53169 /src
parent4078d529e9e199eea13456db7bf3a63a104ab5b9 (diff)
Revert of add a ClassID function to GrBatch (patchset #5 id:80001 of https://codereview.chromium.org/1352813003/ )
Reason for revert: breaks mac bot Original issue's description: > add a ClassID function to GrBatch > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/4078d529e9e199eea13456db7bf3a63a104ab5b9 TBR=robertphillips@google.com,bsalomon@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1345393003
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAtlasTextContext.cpp9
-rw-r--r--src/gpu/GrDrawTarget.h1
-rw-r--r--src/gpu/GrOvalRenderer.cpp55
-rw-r--r--src/gpu/batches/GrAAConvexPathRenderer.cpp7
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp8
-rw-r--r--src/gpu/batches/GrAAHairLinePathRenderer.cpp7
-rw-r--r--src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp7
-rw-r--r--src/gpu/batches/GrAAStrokeRectBatch.h8
-rw-r--r--src/gpu/batches/GrBatch.cpp6
-rw-r--r--src/gpu/batches/GrBatch.h41
-rw-r--r--src/gpu/batches/GrClearBatch.h16
-rw-r--r--src/gpu/batches/GrCopySurfaceBatch.h8
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.cpp8
-rw-r--r--src/gpu/batches/GrDiscardBatch.h8
-rw-r--r--src/gpu/batches/GrDrawAtlasBatch.cpp4
-rw-r--r--src/gpu/batches/GrDrawAtlasBatch.h6
-rw-r--r--src/gpu/batches/GrDrawBatch.cpp2
-rw-r--r--src/gpu/batches/GrDrawBatch.h2
-rw-r--r--src/gpu/batches/GrDrawPathBatch.cpp3
-rw-r--r--src/gpu/batches/GrDrawPathBatch.h14
-rw-r--r--src/gpu/batches/GrDrawVerticesBatch.cpp4
-rw-r--r--src/gpu/batches/GrDrawVerticesBatch.h4
-rw-r--r--src/gpu/batches/GrStencilPathBatch.h8
-rw-r--r--src/gpu/batches/GrStrokeRectBatch.cpp5
-rw-r--r--src/gpu/batches/GrStrokeRectBatch.h4
-rw-r--r--src/gpu/batches/GrTInstanceBatch.h8
-rw-r--r--src/gpu/batches/GrTessellatingPathRenderer.cpp8
-rw-r--r--src/gpu/batches/GrTestBatch.h5
-rw-r--r--src/gpu/batches/GrVertexBatch.cpp2
-rw-r--r--src/gpu/batches/GrVertexBatch.h2
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp10
31 files changed, 93 insertions, 187 deletions
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 822c480ef3..fa96a8ddda 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1431,8 +1431,6 @@ inline void GrAtlasTextContext::appendGlyphCommon(GrAtlasTextBlob* blob, Run* ru
class TextBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable;
typedef GrAtlasTextBlob Blob;
typedef Blob::Run Run;
@@ -1450,6 +1448,7 @@ public:
GrBatchFontCache* fontCache) {
TextBatch* batch = new TextBatch;
+ batch->initClassID<TextBatch>();
batch->fFontCache = fontCache;
switch (maskFormat) {
case kA8_GrMaskFormat:
@@ -1475,7 +1474,7 @@ public:
SkColor filteredColor, bool isLCD,
bool useBGR) {
TextBatch* batch = new TextBatch;
-
+ batch->initClassID<TextBatch>();
batch->fFontCache = fontCache;
batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistanceField_MaskType;
batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable));
@@ -1784,7 +1783,7 @@ private:
this->flush(target, &flushInfo);
}
- TextBatch() : INHERITED(ClassID()) {} // initialized in factory functions.
+ TextBatch() {} // initialized in factory functions.
~TextBatch() {
for (int i = 0; i < fGeoCount; i++) {
@@ -2045,8 +2044,6 @@ private:
// Distance field properties
SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable;
SkColor fFilteredColor;
-
- typedef GrVertexBatch INHERITED;
};
void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, GrRenderTarget* rt,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index b12ac99de4..cae1552a3d 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -23,7 +23,6 @@
#include "SkClipStack.h"
#include "SkMatrix.h"
#include "SkPath.h"
-#include "SkStringUtils.h"
#include "SkStrokeRec.h"
#include "SkTArray.h"
#include "SkTLazy.h"
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 8a938c2265..8eed38233b 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -606,15 +606,13 @@ bool GrOvalRenderer::DrawOval(GrDrawTarget* target,
class CircleBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
- SkRect fDevBounds;
SkScalar fInnerRadius;
SkScalar fOuterRadius;
- GrColor fColor;
bool fStroke;
+ SkRect fDevBounds;
};
static GrDrawBatch* Create(const Geometry& geometry) { return new CircleBatch(geometry); }
@@ -707,7 +705,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- CircleBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ CircleBatch(const Geometry& geometry) {
+ this->initClassID<CircleBatch>();
fGeoData.push_back(geometry);
this->setBounds(geometry.fDevBounds);
@@ -754,8 +753,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
static GrDrawBatch* create_circle_batch(GrColor color,
@@ -824,17 +821,15 @@ void GrOvalRenderer::DrawCircle(GrDrawTarget* target,
class EllipseBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
- SkRect fDevBounds;
SkScalar fXRadius;
SkScalar fYRadius;
SkScalar fInnerXRadius;
SkScalar fInnerYRadius;
- GrColor fColor;
bool fStroke;
+ SkRect fDevBounds;
};
static GrDrawBatch* Create(const Geometry& geometry) { return new EllipseBatch(geometry); }
@@ -931,7 +926,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- EllipseBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ EllipseBatch(const Geometry& geometry) {
+ this->initClassID<EllipseBatch>();
fGeoData.push_back(geometry);
this->setBounds(geometry.fDevBounds);
@@ -979,8 +975,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
static GrDrawBatch* create_ellipse_batch(GrColor color,
@@ -1091,19 +1085,17 @@ bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target,
class DIEllipseBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
- SkRect fBounds;
SkScalar fXRadius;
SkScalar fYRadius;
SkScalar fInnerXRadius;
SkScalar fInnerYRadius;
SkScalar fGeoDx;
SkScalar fGeoDy;
- GrColor fColor;
DIEllipseEdgeEffect::Mode fMode;
+ SkRect fBounds;
};
static GrDrawBatch* Create(const Geometry& geometry, const SkRect& bounds) {
@@ -1194,7 +1186,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) : INHERITED(ClassID()) {
+ DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) {
+ this->initClassID<DIEllipseBatch>();
fGeoData.push_back(geometry);
this->setBounds(bounds);
@@ -1241,8 +1234,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
static GrDrawBatch* create_diellipse_batch(GrColor color,
@@ -1450,15 +1441,13 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
class RRectCircleRendererBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
- SkRect fDevBounds;
SkScalar fInnerRadius;
SkScalar fOuterRadius;
- GrColor fColor;
bool fStroke;
+ SkRect fDevBounds;
};
static GrDrawBatch* Create(const Geometry& geometry) {
@@ -1574,7 +1563,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- RRectCircleRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ RRectCircleRendererBatch(const Geometry& geometry) {
+ this->initClassID<RRectCircleRendererBatch>();
fGeoData.push_back(geometry);
this->setBounds(geometry.fDevBounds);
@@ -1621,23 +1611,19 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
class RRectEllipseRendererBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
- SkRect fDevBounds;
SkScalar fXRadius;
SkScalar fYRadius;
SkScalar fInnerXRadius;
SkScalar fInnerYRadius;
- GrColor fColor;
bool fStroke;
+ SkRect fDevBounds;
};
static GrDrawBatch* Create(const Geometry& geometry) {
@@ -1763,7 +1749,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- RRectEllipseRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ RRectEllipseRendererBatch(const Geometry& geometry) {
+ this->initClassID<RRectEllipseRendererBatch>();
fGeoData.push_back(geometry);
this->setBounds(geometry.fDevBounds);
@@ -1811,8 +1798,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
static GrDrawBatch* create_rrect_batch(GrColor color,
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index 543885e54f..75bf332790 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -733,7 +733,6 @@ static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
class AAConvexPathBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
struct Geometry {
GrColor fColor;
SkMatrix fViewMatrix;
@@ -753,6 +752,7 @@ public:
}
private:
+
void initBatchTracker(const GrPipelineOptimizations& opt) override {
// Handle any color overrides
if (!opt.readsColor()) {
@@ -921,7 +921,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- AAConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ AAConvexPathBatch(const Geometry& geometry) {
+ this->initClassID<AAConvexPathBatch>();
fGeoData.push_back(geometry);
// compute bounds
@@ -978,8 +979,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index ee5fdb8a80..f06553c2d8 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -111,8 +111,6 @@ static const SkScalar kAntiAliasPad = 1.0f;
class AADistanceFieldPathBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
typedef GrAADistanceFieldPathRenderer::PathData PathData;
typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList;
@@ -278,8 +276,8 @@ private:
AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
GrBatchAtlas* atlas,
- PathCache* pathCache, PathDataList* pathList)
- : INHERITED(ClassID()) {
+ PathCache* pathCache, PathDataList* pathList) {
+ this->initClassID<AADistanceFieldPathBatch>();
fBatch.fColor = color;
fBatch.fViewMatrix = viewMatrix;
fGeoData.push_back(geometry);
@@ -521,8 +519,6 @@ private:
GrBatchAtlas* fAtlas;
PathCache* fPathCache;
PathDataList* fPathList;
-
- typedef GrVertexBatch INHERITED;
};
bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index d17ed09da9..c6bdd055bb 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -672,8 +672,6 @@ bool check_bounds(const SkMatrix& viewMatrix, const SkRect& devBounds, void* ver
class AAHairlineBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
uint8_t fCoverage;
@@ -718,7 +716,8 @@ private:
typedef SkTArray<int, true> IntArray;
typedef SkTArray<float, true> FloatArray;
- AAHairlineBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ AAHairlineBatch(const Geometry& geometry) {
+ this->initClassID<AAHairlineBatch>();
fGeoData.push_back(geometry);
// compute bounds
@@ -786,8 +785,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
void AAHairlineBatch::onPrepareDraws(Target* target) {
diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
index a7e98249e2..d05fe4e908 100644
--- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
@@ -119,8 +119,6 @@ static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
class AAFlatteningConvexPathBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
SkMatrix fViewMatrix;
@@ -260,7 +258,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- AAFlatteningConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+ AAFlatteningConvexPathBatch(const Geometry& geometry) {
+ this->initClassID<AAFlatteningConvexPathBatch>();
fGeoData.push_back(geometry);
// compute bounds
@@ -309,8 +308,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h
index fad5bd9d8d..ae7534823b 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.h
+++ b/src/gpu/batches/GrAAStrokeRectBatch.h
@@ -18,8 +18,6 @@ class GrResourceProvider;
class GrAAStrokeRectBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
// TODO support AA rotated stroke rects by copying around view matrices
struct Geometry {
GrColor fColor;
@@ -50,8 +48,8 @@ private:
void onPrepareDraws(Target*) override;
void initBatchTracker(const GrPipelineOptimizations&) override;
- GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix)
- : INHERITED(ClassID()) {
+ GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix) {
+ this->initClassID<GrAAStrokeRectBatch>();
fBatch.fViewMatrix = viewMatrix;
fGeoData.push_back(geometry);
@@ -107,8 +105,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
diff --git a/src/gpu/batches/GrBatch.cpp b/src/gpu/batches/GrBatch.cpp
index 19c19ffcf1..a3a9884b0f 100644
--- a/src/gpu/batches/GrBatch.cpp
+++ b/src/gpu/batches/GrBatch.cpp
@@ -46,10 +46,10 @@ void GrBatch::operator delete(void* target) {
return MemoryPoolAccessor().pool()->release(target);
}
-GrBatch::GrBatch(uint32_t classID)
- : fClassID(classID)
+GrBatch::GrBatch()
+ : fClassID(kIllegalBatchID)
#if GR_BATCH_SPEW
- , fUniqueID(GenBatchID())
+ , fUniqueID(GenID(&gCurrBatchUniqueID))
#endif
{
SkDEBUGCODE(fUsed = false;)
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h
index c5fc80c5d5..b6eec1f969 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -41,16 +41,9 @@ class GrBatchFlushState;
#define GrBATCH_INFO(...)
#endif
-// A helper macro to generate a class static id
-#define DEFINE_BATCH_CLASS_ID \
- static uint32_t ClassID() { \
- static uint32_t kClassID = GenBatchClassID(); \
- return kClassID; \
- }
-
class GrBatch : public GrNonAtomicRef {
public:
- GrBatch(uint32_t classID);
+ GrBatch();
~GrBatch() override;
virtual const char* name() const = 0;
@@ -76,17 +69,10 @@ public:
}
/**
- * Helper for safely down-casting to a GrBatch subclass
+ * Helper for down-casting to a GrBatch subclass
*/
- template <typename T> const T& cast() const {
- SkASSERT(T::ClassID() == this->classID());
- return *static_cast<const T*>(this);
- }
-
- template <typename T> T* cast() {
- SkASSERT(T::ClassID() == this->classID());
- return static_cast<T*>(this);
- }
+ template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
+ template <typename T> T* cast() { return static_cast<T*>(this); }
uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fClassID; }
@@ -110,6 +96,11 @@ public:
virtual SkString dumpInfo() const = 0;
protected:
+ template <typename PROC_SUBCLASS> void initClassID() {
+ static uint32_t kClassID = GenID(&gCurrBatchClassID);
+ fClassID = kClassID;
+ }
+
// NOTE, compute some bounds, even if extremely conservative. Do *NOT* setLargest on the bounds
// rect because we outset it for dst copy textures
void setBounds(const SkRect& newBounds) { fBounds = newBounds; }
@@ -118,8 +109,6 @@ protected:
return fBounds.joinPossiblyEmptyRect(otherBounds);
}
- static uint32_t GenBatchClassID() { return GenID(&gCurrBatchClassID); }
-
SkRect fBounds;
private:
@@ -129,7 +118,8 @@ private:
virtual void onDraw(GrBatchFlushState*) = 0;
static uint32_t GenID(int32_t* idCounter) {
- // The atomic inc returns the old value not the incremented value. So we add
+ // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
+ // atomic inc returns the old value not the incremented value. So we add
// 1 to the returned value.
uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1;
if (!id) {
@@ -143,14 +133,13 @@ private:
kIllegalBatchID = 0,
};
+ uint32_t fClassID;
SkDEBUGCODE(bool fUsed;)
- const uint32_t fClassID;
#if GR_BATCH_SPEW
- static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); }
- const uint32_t fUniqueID;
- static int32_t gCurrBatchUniqueID;
+ uint32_t fUniqueID;
+ static int32_t gCurrBatchUniqueID;
#endif
- static int32_t gCurrBatchClassID;
+ static int32_t gCurrBatchClassID;
typedef GrNonAtomicRef INHERITED;
};
diff --git a/src/gpu/batches/GrClearBatch.h b/src/gpu/batches/GrClearBatch.h
index b973dab557..f13b073d75 100644
--- a/src/gpu/batches/GrClearBatch.h
+++ b/src/gpu/batches/GrClearBatch.h
@@ -15,13 +15,11 @@
class GrClearBatch final : public GrBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt)
- : INHERITED(ClassID())
- , fRect(rect)
+ : fRect(rect)
, fColor(color)
, fRenderTarget(rt) {
+ this->initClassID<GrClearBatch>();
fBounds = SkRect::Make(rect);
}
@@ -52,19 +50,15 @@ private:
SkIRect fRect;
GrColor fColor;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
-
- typedef GrBatch INHERITED;
};
class GrClearStencilClipBatch final : public GrBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget* rt)
- : INHERITED(ClassID())
- , fRect(rect)
+ : fRect(rect)
, fInsideClip(insideClip)
, fRenderTarget(rt) {
+ this->initClassID<GrClearStencilClipBatch>();
fBounds = SkRect::Make(rect);
}
@@ -92,8 +86,6 @@ private:
SkIRect fRect;
bool fInsideClip;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
-
- typedef GrBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrCopySurfaceBatch.h b/src/gpu/batches/GrCopySurfaceBatch.h
index ed5e77f5b0..584bbab5d7 100644
--- a/src/gpu/batches/GrCopySurfaceBatch.h
+++ b/src/gpu/batches/GrCopySurfaceBatch.h
@@ -15,8 +15,6 @@
class GrCopySurfaceBatch final : public GrBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
const SkIPoint& dstPoint);
@@ -39,11 +37,11 @@ public:
private:
GrCopySurfaceBatch(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
const SkIPoint& dstPoint)
- : INHERITED(ClassID())
- , fDst(dst)
+ : fDst(dst)
, fSrc(src)
, fSrcRect(srcRect)
, fDstPoint(dstPoint) {
+ this->initClassID<GrCopySurfaceBatch>();
fBounds = SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dstPoint.fY),
SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height()));
}
@@ -60,8 +58,6 @@ private:
GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
SkIRect fSrcRect;
SkIPoint fDstPoint;
-
- typedef GrBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 67bccb63b4..f4ce7c85a5 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -211,8 +211,6 @@ static inline void add_quad(SkPoint** vert, const SkPoint* base, const SkPoint p
class DefaultPathBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
SkPath fPath;
@@ -378,8 +376,8 @@ private:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
- bool isHairline, const SkRect& devBounds)
- : INHERITED(ClassID()) {
+ bool isHairline, const SkRect& devBounds) {
+ this->initClassID<DefaultPathBatch>();
fBatch.fCoverage = coverage;
fBatch.fIsHairline = isHairline;
fBatch.fViewMatrix = viewMatrix;
@@ -532,8 +530,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h
index c13e7327d7..8a050a7122 100644
--- a/src/gpu/batches/GrDiscardBatch.h
+++ b/src/gpu/batches/GrDiscardBatch.h
@@ -15,11 +15,9 @@
class GrDiscardBatch final : public GrBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
GrDiscardBatch(GrRenderTarget* rt)
- : INHERITED(ClassID())
- , fRenderTarget(rt) {
+ : fRenderTarget(rt) {
+ this->initClassID<GrDiscardBatch>();
fBounds = SkRect::MakeWH(SkIntToScalar(rt->width()), SkIntToScalar(rt->height()));
}
@@ -45,8 +43,6 @@ private:
}
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
-
- typedef GrBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp
index 2254e9cdfe..3596e16861 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.cpp
+++ b/src/gpu/batches/GrDrawAtlasBatch.cpp
@@ -77,8 +77,8 @@ void GrDrawAtlasBatch::onPrepareDraws(Target* target) {
GrDrawAtlasBatch::GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix,
int spriteCount, const SkRSXform* xforms, const SkRect* rects,
- const SkColor* colors)
- : INHERITED(ClassID()) {
+ const SkColor* colors) {
+ this->initClassID<GrDrawAtlasBatch>();
SkASSERT(xforms);
SkASSERT(rects);
diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h
index de128f211d..9a864c01c9 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.h
+++ b/src/gpu/batches/GrDrawAtlasBatch.h
@@ -14,13 +14,11 @@
class GrDrawAtlasBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
SkTArray<uint8_t, true> fVerts;
};
-
+
static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
int spriteCount, const SkRSXform* xforms, const SkRect* rects,
const SkColor* colors) {
@@ -68,8 +66,6 @@ private:
bool fColorIgnored;
bool fCoverageIgnored;
bool fHasColors;
-
- typedef GrVertexBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrDrawBatch.cpp b/src/gpu/batches/GrDrawBatch.cpp
index 43ef2ec64b..5e5d41247a 100644
--- a/src/gpu/batches/GrDrawBatch.cpp
+++ b/src/gpu/batches/GrDrawBatch.cpp
@@ -7,7 +7,7 @@
#include "GrDrawBatch.h"
-GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { }
+GrDrawBatch::GrDrawBatch() : fPipelineInstalled(false) { }
GrDrawBatch::~GrDrawBatch() {
if (fPipelineInstalled) {
diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h
index 93326efad2..f7c206d124 100644
--- a/src/gpu/batches/GrDrawBatch.h
+++ b/src/gpu/batches/GrDrawBatch.h
@@ -40,7 +40,7 @@ class GrDrawBatch : public GrBatch {
public:
class Target;
- GrDrawBatch(uint32_t classID);
+ GrDrawBatch();
~GrDrawBatch() override;
virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp
index c56c4ad2cd..a47e665607 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -57,10 +57,11 @@ bool GrDrawPathRangeBatch::isWinding() const {
GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
GrColor color, GrPathRangeDraw* pathRangeDraw)
- : INHERITED(ClassID(), viewMatrix, color)
+ : INHERITED(viewMatrix, color)
, fDraws(4)
, fLocalMatrix(localMatrix) {
SkDEBUGCODE(pathRangeDraw->fUsedInBatch = true;)
+ this->initClassID<GrDrawPathRangeBatch>();
fDraws.addToHead(SkRef(pathRangeDraw));
fTotalPathCount = pathRangeDraw->count();
// Don't compute a bounding box. For dst copy texture, we'll opt instead for it to just copy
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
index 228ad86617..71ef9d42b4 100644
--- a/src/gpu/batches/GrDrawPathBatch.h
+++ b/src/gpu/batches/GrDrawPathBatch.h
@@ -30,9 +30,8 @@ public:
void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings = stencil; }
protected:
- GrDrawPathBatchBase(uint32_t classID, const SkMatrix& viewMatrix, GrColor initialColor)
- : INHERITED(classID)
- , fViewMatrix(viewMatrix)
+ GrDrawPathBatchBase(const SkMatrix& viewMatrix, GrColor initialColor)
+ : fViewMatrix(viewMatrix)
, fColor(initialColor) {}
const GrStencilSettings& stencilSettings() const { return fStencilSettings; }
@@ -56,8 +55,6 @@ private:
class GrDrawPathBatch final : public GrDrawPathBatchBase {
public:
- DEFINE_BATCH_CLASS_ID
-
// This can't return a more abstract type because we install the stencil settings late :(
static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, GrColor color,
const GrPath* path) {
@@ -70,10 +67,11 @@ public:
private:
GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, const GrPath* path)
- : INHERITED(ClassID(), viewMatrix, color)
+ : INHERITED(viewMatrix, color)
, fPath(path) {
fBounds = path->getBounds();
viewMatrix.mapRect(&fBounds);
+ this->initClassID<GrDrawPathBatch>();
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return false; }
@@ -149,9 +147,7 @@ private:
// Template this if we decide to support index types other than 16bit
class GrDrawPathRangeBatch final : public GrDrawPathBatchBase {
public:
- DEFINE_BATCH_CLASS_ID
-
- // This can't return a more abstract type because we install the stencil settings late :(
+ // This can't return a more abstracet type because we install the stencil settings late :(
static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
GrColor color, GrPathRangeDraw* pathRangeDraw) {
return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color, pathRangeDraw));
diff --git a/src/gpu/batches/GrDrawVerticesBatch.cpp b/src/gpu/batches/GrDrawVerticesBatch.cpp
index 33bed0d0f8..f79b6859df 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.cpp
+++ b/src/gpu/batches/GrDrawVerticesBatch.cpp
@@ -45,8 +45,8 @@ GrDrawVerticesBatch::GrDrawVerticesBatch(const Geometry& geometry, GrPrimitiveTy
const SkPoint* positions, int vertexCount,
const uint16_t* indices, int indexCount,
const GrColor* colors, const SkPoint* localCoords,
- const SkRect& bounds)
- : INHERITED(ClassID()) {
+ const SkRect& bounds) {
+ this->initClassID<GrDrawVerticesBatch>();
SkASSERT(positions);
fBatch.fViewMatrix = viewMatrix;
diff --git a/src/gpu/batches/GrDrawVerticesBatch.h b/src/gpu/batches/GrDrawVerticesBatch.h
index 49e93c8370..aaa7b09812 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.h
+++ b/src/gpu/batches/GrDrawVerticesBatch.h
@@ -20,8 +20,6 @@ struct GrInitInvariantOutput;
class GrDrawVerticesBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
SkTDArray<SkPoint> fPositions;
@@ -93,8 +91,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h
index a0dcadb620..9f6740a046 100644
--- a/src/gpu/batches/GrStencilPathBatch.h
+++ b/src/gpu/batches/GrStencilPathBatch.h
@@ -17,8 +17,6 @@
class GrStencilPathBatch final : public GrBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
static GrBatch* Create(const SkMatrix& viewMatrix,
bool useHWAA,
const GrStencilSettings& stencil,
@@ -45,13 +43,13 @@ private:
const GrScissorState& scissor,
GrRenderTarget* renderTarget,
const GrPath* path)
- : INHERITED(ClassID())
- , fViewMatrix(viewMatrix)
+ : fViewMatrix(viewMatrix)
, fUseHWAA(useHWAA)
, fStencil(stencil)
, fScissor(scissor)
, fRenderTarget(renderTarget)
, fPath(path) {
+ this->initClassID<GrStencilPathBatch>();
fBounds = path->getBounds();
}
@@ -71,8 +69,6 @@ private:
GrScissorState fScissor;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
-
- typedef GrBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrStrokeRectBatch.cpp b/src/gpu/batches/GrStrokeRectBatch.cpp
index 20c754c899..766302bf5b 100644
--- a/src/gpu/batches/GrStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrStrokeRectBatch.cpp
@@ -10,8 +10,9 @@
#include "GrBatchFlushState.h"
#include "SkRandom.h"
-GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters)
- : INHERITED(ClassID()) {
+GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters) {
+ this->initClassID<GrStrokeRectBatch>();
+
fBatch.fHairline = geometry.fStrokeWidth == 0;
fGeoData.push_back(geometry);
diff --git a/src/gpu/batches/GrStrokeRectBatch.h b/src/gpu/batches/GrStrokeRectBatch.h
index b1cb8d4ccb..b374ea862d 100644
--- a/src/gpu/batches/GrStrokeRectBatch.h
+++ b/src/gpu/batches/GrStrokeRectBatch.h
@@ -14,8 +14,6 @@
class GrStrokeRectBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
GrColor fColor;
SkMatrix fViewMatrix;
@@ -76,8 +74,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index 014ec125fe..e314959bfc 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -40,8 +40,6 @@
template <typename Impl>
class GrTInstanceBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
typedef typename Impl::Geometry Geometry;
static GrTInstanceBatch* Create() { return new GrTInstanceBatch; }
@@ -74,7 +72,9 @@ public:
}
private:
- GrTInstanceBatch() : INHERITED(ClassID()) {
+ GrTInstanceBatch() {
+ this->initClassID<GrTInstanceBatch<Impl>>();
+
// Push back an initial geometry
fGeoData.push_back();
}
@@ -136,8 +136,6 @@ private:
GrPipelineOptimizations fOpts;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index 901d38369c..46fa280cfd 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -1385,7 +1385,6 @@ bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) cons
class TessellatingPathBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
static GrDrawBatch* Create(const GrColor& color,
const SkPath& path,
@@ -1588,12 +1587,13 @@ private:
const GrStrokeInfo& stroke,
const SkMatrix& viewMatrix,
const SkRect& clipBounds)
- : INHERITED(ClassID())
- , fColor(color)
+ : fColor(color)
, fPath(path)
, fStroke(stroke)
, fViewMatrix(viewMatrix)
, fClipBounds(clipBounds) {
+ this->initClassID<TessellatingPathBatch>();
+
fBounds = path.getBounds();
if (!stroke.isFillStyle()) {
SkScalar radius = SkScalarHalf(stroke.getWidth());
@@ -1614,8 +1614,6 @@ private:
SkMatrix fViewMatrix;
SkRect fClipBounds; // in source space
GrPipelineOptimizations fPipelineInfo;
-
- typedef GrVertexBatch INHERITED;
};
bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrTestBatch.h b/src/gpu/batches/GrTestBatch.h
index 02881c9668..085b184a28 100644
--- a/src/gpu/batches/GrTestBatch.h
+++ b/src/gpu/batches/GrTestBatch.h
@@ -50,8 +50,7 @@ public:
}
protected:
- GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& bounds)
- : INHERITED(classID) {
+ GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) {
fGeometryProcessor.reset(SkRef(gp));
this->setBounds(bounds);
@@ -83,8 +82,6 @@ private:
SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
BatchTracker fBatch;
-
- typedef GrVertexBatch INHERITED;
};
#endif
diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp
index 9ffe5180b7..6e2c1577db 100644
--- a/src/gpu/batches/GrVertexBatch.cpp
+++ b/src/gpu/batches/GrVertexBatch.cpp
@@ -9,7 +9,7 @@
#include "GrBatchFlushState.h"
#include "GrResourceProvider.h"
-GrVertexBatch::GrVertexBatch(uint32_t classID) : INHERITED(classID), fDrawArrays(1) {}
+GrVertexBatch::GrVertexBatch() : fDrawArrays(1) {}
void GrVertexBatch::onPrepare(GrBatchFlushState* state) {
Target target(state, this);
diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h
index 8922c30e2a..e2265bc8fc 100644
--- a/src/gpu/batches/GrVertexBatch.h
+++ b/src/gpu/batches/GrVertexBatch.h
@@ -24,7 +24,7 @@ class GrVertexBatch : public GrDrawBatch {
public:
class Target;
- GrVertexBatch(uint32_t classID);
+ GrVertexBatch();
protected:
/** Helper for rendering instances using an instanced index index buffer. This class creates the
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 106ee49672..3ca4c7ae4b 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -245,9 +245,8 @@ static GrGeometryProcessor* create_dash_gp(GrColor,
class DashBatch : public GrVertexBatch {
public:
- DEFINE_BATCH_CLASS_ID
-
struct Geometry {
+ GrColor fColor;
SkMatrix fViewMatrix;
SkMatrix fSrcRotInv;
SkPoint fPtsRot[2];
@@ -256,7 +255,6 @@ public:
SkScalar fIntervals[2];
SkScalar fParallelScale;
SkScalar fPerpendicularScale;
- GrColor fColor;
};
static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
@@ -277,8 +275,8 @@ public:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
private:
- DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash)
- : INHERITED(ClassID()) {
+ DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) {
+ this->initClassID<DashBatch>();
fGeoData.push_back(geometry);
fBatch.fAAMode = aaMode;
@@ -676,8 +674,6 @@ private:
BatchTracker fBatch;
SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],