Remove GrRefCnt.h in favor of SkRefCnt.h
This removes GrRefCnt.h with all its tyepdefs and #defines and just switch them
to the Sk* equivalents.
GrSafeSetNull was promoted to SkSafeSetNull in SkRefCnt.h.
BUG=None
TEST=none, no functional changes.
R=bsalomon@google.com, robertphillips@google.com
Author: tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23904003
git-svn-id: http://skia.googlecode.com/svn/trunk@11151 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index b104df5..8d5851f 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -6,7 +6,6 @@
*/
#include "GrAARectRenderer.h"
-#include "GrRefCnt.h"
#include "GrGpu.h"
#include "gl/GrGLEffect.h"
#include "GrTBackendEffectFactory.h"
@@ -295,8 +294,8 @@
};
void GrAARectRenderer::reset() {
- GrSafeSetNull(fAAFillRectIndexBuffer);
- GrSafeSetNull(fAAStrokeRectIndexBuffer);
+ SkSafeSetNull(fAAFillRectIndexBuffer);
+ SkSafeSetNull(fAAStrokeRectIndexBuffer);
}
static const uint16_t gFillAARectIdx[] = {
diff --git a/src/gpu/GrAARectRenderer.h b/src/gpu/GrAARectRenderer.h
index 607329a..2e705ca 100644
--- a/src/gpu/GrAARectRenderer.h
+++ b/src/gpu/GrAARectRenderer.h
@@ -5,13 +5,12 @@
* found in the LICENSE file.
*/
-
#ifndef GrAARectRenderer_DEFINED
#define GrAARectRenderer_DEFINED
-#include "GrRefCnt.h"
#include "SkMatrix.h"
#include "SkRect.h"
+#include "SkRefCnt.h"
class GrGpu;
class GrDrawTarget;
@@ -20,7 +19,7 @@
/*
* This class wraps helper functions that draw AA rects (filled & stroked)
*/
-class GrAARectRenderer : public GrRefCnt {
+class GrAARectRenderer : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrAARectRenderer)
@@ -108,7 +107,7 @@
const SkRect& devInside,
bool useVertexCoverage);
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif // GrAARectRenderer_DEFINED
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 865478b..ca46e8a 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -170,7 +170,7 @@
GrAtlasMgr::~GrAtlasMgr() {
for (size_t i = 0; i < GR_ARRAY_COUNT(fTexture); i++) {
- GrSafeUnref(fTexture[i]);
+ SkSafeUnref(fTexture[i]);
}
delete fPlotMgr;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5145b29..d931de5 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -167,8 +167,8 @@
fOvalRenderer->unref();
fGpu->unref();
- GrSafeUnref(fPathRendererChain);
- GrSafeUnref(fSoftwarePathRenderer);
+ SkSafeUnref(fPathRendererChain);
+ SkSafeUnref(fSoftwarePathRenderer);
fDrawState->unref();
--THREAD_INSTANCE_COUNT;
@@ -186,8 +186,8 @@
// a path renderer may be holding onto resources that
// are now unusable
- GrSafeSetNull(fPathRendererChain);
- GrSafeSetNull(fSoftwarePathRenderer);
+ SkSafeSetNull(fPathRendererChain);
+ SkSafeSetNull(fSoftwarePathRenderer);
delete fDrawBuffer;
fDrawBuffer = NULL;
@@ -221,8 +221,8 @@
fTextureCache->purgeAllUnlocked();
fFontCache->freeAll();
// a path renderer may be holding onto resources
- GrSafeSetNull(fPathRendererChain);
- GrSafeSetNull(fSoftwarePathRenderer);
+ SkSafeSetNull(fPathRendererChain);
+ SkSafeSetNull(fSoftwarePathRenderer);
}
size_t GrContext::getGpuTextureCacheBytes() const {
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index ef6cc46..bfc15b0 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -14,7 +14,6 @@
#include "GrEffectStage.h"
#include "GrPaint.h"
#include "GrPoint.h"
-#include "GrRefCnt.h"
#include "GrRenderTarget.h"
#include "GrStencil.h"
#include "GrTemplates.h"
@@ -25,7 +24,7 @@
#include "SkMatrix.h"
#include "SkXfermode.h"
-class GrDrawState : public GrRefCnt {
+class GrDrawState : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawState)
@@ -675,7 +674,7 @@
fDrawState->setRenderTarget(fSavedTarget);
fDrawState = NULL;
}
- GrSafeSetNull(fSavedTarget);
+ SkSafeSetNull(fSavedTarget);
}
void set(GrDrawState* ds, GrRenderTarget* newTarget) {
@@ -1077,7 +1076,7 @@
*/
void setVertexAttribs(const GrVertexAttrib attribs[], int count);
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index d242797..5b19546 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,20 +5,18 @@
* found in the LICENSE file.
*/
-
#ifndef GrDrawTarget_DEFINED
#define GrDrawTarget_DEFINED
#include "GrClipData.h"
#include "GrDrawState.h"
#include "GrIndexBuffer.h"
-#include "SkMatrix.h"
-#include "GrRefCnt.h"
#include "SkClipStack.h"
+#include "SkMatrix.h"
#include "SkPath.h"
-#include "SkTLazy.h"
#include "SkTArray.h"
+#include "SkTLazy.h"
#include "SkXfermode.h"
class GrClipData;
@@ -28,7 +25,7 @@
class GrVertexBuffer;
class SkStrokeRec;
-class GrDrawTarget : public GrRefCnt {
+class GrDrawTarget : public SkRefCnt {
protected:
class DrawInfo;
@@ -869,7 +866,7 @@
// The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTarget.
GrContext* fContext;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index adcc3a3..a4aa00e 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -66,7 +66,7 @@
}
SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid());
- GrSafeSetNull(fQuadIndexBuffer);
+ SkSafeSetNull(fQuadIndexBuffer);
delete fVertexPool;
fVertexPool = NULL;
delete fIndexPool;
@@ -82,7 +82,7 @@
}
SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid());
- GrSafeSetNull(fQuadIndexBuffer);
+ SkSafeSetNull(fQuadIndexBuffer);
delete fVertexPool;
fVertexPool = NULL;
delete fIndexPool;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 2b3608d..239ae6b 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -9,7 +9,6 @@
#define GrGpu_DEFINED
#include "GrDrawTarget.h"
-#include "GrRefCnt.h"
#include "GrClipMaskManager.h"
#include "SkPath.h"
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index d04538d..1cd04d9 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -431,7 +431,7 @@
// we always have a VB, but not always an IB
SkASSERT(NULL != fDraws[d].fVertexBuffer);
fDraws[d].fVertexBuffer->unref();
- GrSafeUnref(fDraws[d].fIndexBuffer);
+ SkSafeUnref(fDraws[d].fIndexBuffer);
}
fCmds.reset();
fDraws.reset();
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index 507be82..dcc5ab7 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -108,7 +108,7 @@
struct Clear : GrNoncopyable {
Clear() : fRenderTarget(NULL) {}
- ~Clear() { GrSafeUnref(fRenderTarget); }
+ ~Clear() { SkSafeUnref(fRenderTarget); }
SkIRect fRect;
GrColor fColor;
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 79c8e83..4f41ae9 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -464,7 +464,7 @@
///////////////////////////////////////////////////////////////////////////////
void GrOvalRenderer::reset() {
- GrSafeSetNull(fRRectIndexBuffer);
+ SkSafeSetNull(fRRectIndexBuffer);
}
bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
diff --git a/src/gpu/GrOvalRenderer.h b/src/gpu/GrOvalRenderer.h
index 8c47e9a..b58abb7 100644
--- a/src/gpu/GrOvalRenderer.h
+++ b/src/gpu/GrOvalRenderer.h
@@ -10,7 +10,6 @@
#include "GrContext.h"
#include "GrPaint.h"
-#include "GrRefCnt.h"
class GrContext;
class GrDrawTarget;
@@ -21,7 +20,7 @@
/*
* This class wraps helper functions that draw ovals and roundrects (filled & stroked)
*/
-class GrOvalRenderer : public GrRefCnt {
+class GrOvalRenderer : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrOvalRenderer)
@@ -52,7 +51,7 @@
GrIndexBuffer* fRRectIndexBuffer;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif // GrOvalRenderer_DEFINED
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index c49dd48..f86eb9f 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -27,7 +27,7 @@
* stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and
* filter masks).
*/
-class SK_API GrPathRenderer : public GrRefCnt {
+class SK_API GrPathRenderer : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrPathRenderer)
@@ -192,7 +192,7 @@
private:
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 646ad02..e4303c1 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -67,7 +67,7 @@
fVertices = NULL;
fMaxVertices = 0;
fCurrVertex = 0;
- GrSafeSetNull(fCurrTexture);
+ SkSafeSetNull(fCurrTexture);
}
}
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 9ef9a54..d3214a7 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -231,7 +231,7 @@
return true;
}
- GrAutoRef ar(scaler);
+ SkAutoRef ar(scaler);
int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat);
size_t size = glyph->fBounds.area() * bytesPerPixel;
diff --git a/src/gpu/SkGrFontScaler.cpp b/src/gpu/SkGrFontScaler.cpp
index c48e633..3c42af8 100644
--- a/src/gpu/SkGrFontScaler.cpp
+++ b/src/gpu/SkGrFontScaler.cpp
@@ -73,7 +73,7 @@
}
SkGrFontScaler::~SkGrFontScaler() {
- GrSafeUnref(fKey);
+ SkSafeUnref(fKey);
}
GrMaskFormat SkGrFontScaler::getMaskFormat() {
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 98819bf..dc5d755 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -94,7 +94,7 @@
#endif
SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (dst));
- GrSafeUnref(dst);
+ SkSafeUnref(dst);
return pixelRef;
}
@@ -114,7 +114,7 @@
fSurface = surface;
}
fUnlock = transferCacheLock;
- GrSafeRef(surface);
+ SkSafeRef(surface);
}
SkGrPixelRef::~SkGrPixelRef() {
@@ -125,7 +125,7 @@
context->unlockScratchTexture(texture);
}
}
- GrSafeUnref(fSurface);
+ SkSafeUnref(fSurface);
}
GrTexture* SkGrPixelRef::getTexture() {
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 1d0a01f..93f3691 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -73,13 +73,13 @@
}
GrGLContext& GrGLContext::operator = (const GrGLContext& ctx) {
- GrSafeAssign(fInterface, ctx.fInterface);
+ SkRefCnt_SafeAssign(fInterface, ctx.fInterface);
fInfo = ctx.fInfo;
return *this;
}
void GrGLContext::reset() {
- GrSafeSetNull(fInterface);
+ SkSafeSetNull(fInterface);
fInfo.reset();
}
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 34f2190..ac9e9ed 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -101,7 +101,7 @@
*/
GrGLContext(const GrGLContext& ctx);
- ~GrGLContext() { GrSafeUnref(fInterface); }
+ ~GrGLContext() { SkSafeUnref(fInterface); }
/**
* Copies a GrGLContext
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index bef2ecf..b18b8ae 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -33,7 +33,7 @@
* Uniforms are program-local so we can't rely on fHWState to hold the
* previous uniform state after a program change.
*/
-class GrGLProgram : public GrRefCnt {
+class GrGLProgram : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrGLProgram)
@@ -235,7 +235,7 @@
GrGLUniformManager fUniformManager;
UniformHandles fUniformHandles;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index e41ebc8..62052fd 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -15,7 +15,7 @@
/**
* A ref counted tex id that deletes the texture in its destructor.
*/
-class GrGLTexID : public GrRefCnt {
+class GrGLTexID : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrGLTexID)
@@ -39,7 +39,7 @@
GrGLuint fTexID;
bool fIsWrapped;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
////////////////////////////////////////////////////////////////////////////////