{ return sds.fState; }
// implemented by subclass
- virtual bool acquireGeometryHelper(GrVertexLayout vertexLayout,
- void** vertices,
- void** indices) = 0;
+ virtual bool onAcquireGeometry(GrVertexLayout vertexLayout,
+ void** vertices,
+ void** indices) = 0;
- virtual void releaseGeometryHelper() = 0;
+ virtual void onReleaseGeometry() = 0;
// subclass overrides to be notified when clip is set.
virtual void clipWillBeSet(const GrClip& clip) = 0;
- virtual void setVertexSourceToArrayHelper(const void* vertexArray,
- int vertexCount) = 0;
+ virtual void onSetVertexSourceToArray(const void* vertexArray,
+ int vertexCount) = 0;
- virtual void setIndexSourceToArrayHelper(const void* indexArray,
- int indexCount) = 0;
+ virtual void onSetIndexSourceToArray(const void* indexArray,
+ int indexCount) = 0;
// Helpers for drawRect, protected so subclasses that override drawRect
// can use them.
int fCurrPoolStartIndex;
// GrDrawTarget overrides
- virtual bool acquireGeometryHelper(GrVertexLayout vertexLayout,
- void** vertices,
- void** indices);
- virtual void releaseGeometryHelper();
+ virtual bool onAcquireGeometry(GrVertexLayout vertexLayout,
+ void** vertices,
+ void** indices);
+ virtual void onReleaseGeometry();
- virtual void setVertexSourceToArrayHelper(const void* vertexArray,
- int vertexCount);
+ virtual void onSetVertexSourceToArray(const void* vertexArray,
+ int vertexCount);
- virtual void setIndexSourceToArrayHelper(const void* indexArray,
- int indexCount);
+ virtual void onSetIndexSourceToArray(const void* indexArray,
+ int indexCount);
// Helpers for setting up geometry state
void finalizeReservedVertices();
void finalizeReservedIndices();
virtual void resetContext() = 0;
// overridden by API-specific derived class to create objects.
- virtual GrTexture* createTextureHelper(const TextureDesc& desc,
- const void* srcData,
- size_t rowBytes) = 0;
+ virtual GrTexture* onCreateTexture(const TextureDesc& desc,
+ const void* srcData,
+ size_t rowBytes) = 0;
virtual GrResource* onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc) = 0;
- virtual GrRenderTarget* createPlatformRenderTargetHelper(
+ virtual GrRenderTarget* onCreatePlatformRenderTarget(
intptr_t platformRenderTarget,
int stencilBits,
bool isMultisampled,
int width, int height) = 0;
- virtual GrRenderTarget* createRenderTargetFrom3DApiStateHelper() = 0;
- virtual GrVertexBuffer* createVertexBufferHelper(uint32_t size,
- bool dynamic) = 0;
- virtual GrIndexBuffer* createIndexBufferHelper(uint32_t size,
- bool dynamic) = 0;
+ virtual GrRenderTarget* onCreateRenderTargetFrom3DApiState() = 0;
+ virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size,
+ bool dynamic) = 0;
+ virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
+ bool dynamic) = 0;
// overridden by API-specific derivated class to perform the erase.
- virtual void eraseColorHelper(GrColor color) = 0;
+ virtual void onEraseColor(GrColor color) = 0;
// overridden by API-specific derived class to perform the draw call.
- virtual void drawIndexedHelper(GrPrimitiveType type,
- uint32_t startVertex,
- uint32_t startIndex,
- uint32_t vertexCount,
- uint32_t indexCount) = 0;
+ virtual void onDrawIndexed(GrPrimitiveType type,
+ uint32_t startVertex,
+ uint32_t startIndex,
+ uint32_t vertexCount,
+ uint32_t indexCount) = 0;
- virtual void drawNonIndexedHelper(GrPrimitiveType type,
- uint32_t vertexCount,
- uint32_t numVertices) = 0;
+ virtual void onDrawNonIndexed(GrPrimitiveType type,
+ uint32_t vertexCount,
+ uint32_t numVertices) = 0;
// overridden by API-specific derived class to perform flush
- virtual void forceRenderTargetFlushHelper() = 0;
+ virtual void onForceRenderTargetFlush() = 0;
// overridden by API-specific derived class to perform the read pixels.
virtual bool onReadPixels(GrRenderTarget* target,
const GrIndexBuffer* fIndexBuffer;
};
- virtual bool acquireGeometryHelper(GrVertexLayout vertexLayout,
- void** vertices,
- void** indices);
- virtual void releaseGeometryHelper();
+ virtual bool onAcquireGeometry(GrVertexLayout vertexLayout,
+ void** vertices,
+ void** indices);
+ virtual void onReleaseGeometry();
virtual void clipWillBeSet(const GrClip& newClip);
- virtual void setVertexSourceToArrayHelper(const void* vertexArray,
- int vertexCount);
+ virtual void onSetVertexSourceToArray(const void* vertexArray,
+ int vertexCount);
- virtual void setIndexSourceToArrayHelper(const void* indexArray,
- int indexCount);
+ virtual void onSetIndexSourceToArray(const void* indexArray,
+ int indexCount);
bool needsNewState() const;
bool needsNewClip() const;
const GrPoint* translate);
private:
- void drawPathHelper(GrDrawTarget* target,
- GrDrawTarget::StageBitfield stages,
- GrPathIter* path,
- GrPathFill fill,
- const GrPoint* translate,
- bool stencilOnly);
+ void onDrawPath(GrDrawTarget* target,
+ GrDrawTarget::StageBitfield stages,
+ GrPathIter* path,
+ GrPathFill fill,
+ const GrPoint* translate,
+ bool stencilOnly);
bool fSeparateStencil;
bool fStencilWrapOps;
fReservedGeometry.fVertexCount = vertexCount;
fReservedGeometry.fIndexCount = indexCount;
- fReservedGeometry.fLocked = acquireGeometryHelper(vertexLayout,
- vertices,
- indices);
+ fReservedGeometry.fLocked = this->onAcquireGeometry(vertexLayout,
+ vertices,
+ indices);
if (fReservedGeometry.fLocked) {
if (vertexCount) {
fGeometrySrc.fVertexSrc = kReserved_GeometrySrcType;
void GrDrawTarget::releaseReservedGeometry() {
GrAssert(fReservedGeometry.fLocked);
- releaseGeometryHelper();
+ this->onReleaseGeometry();
fReservedGeometry.fLocked = false;
}
int vertexCount) {
fGeometrySrc.fVertexSrc = kArray_GeometrySrcType;
fGeometrySrc.fVertexLayout = vertexLayout;
- setVertexSourceToArrayHelper(vertexArray, vertexCount);
+ this->onSetVertexSourceToArray(vertexArray, vertexCount);
}
void GrDrawTarget::setIndexSourceToArray(const void* indexArray,
int indexCount) {
fGeometrySrc.fIndexSrc = kArray_GeometrySrcType;
- setIndexSourceToArrayHelper(indexArray, indexCount);
+ this->onSetIndexSourceToArray(indexArray, indexCount);
}
void GrDrawTarget::setVertexSourceToBuffer(GrVertexLayout vertexLayout,
GrTexture* GrGpu::createTexture(const TextureDesc& desc,
const void* srcData, size_t rowBytes) {
this->handleDirtyContext();
- return this->createTextureHelper(desc, srcData, rowBytes);
+ return this->onCreateTexture(desc, srcData, rowBytes);
}
GrRenderTarget* GrGpu::createPlatformRenderTarget(intptr_t platformRenderTarget,
bool isMultisampled,
int width, int height) {
this->handleDirtyContext();
- return this->createPlatformRenderTargetHelper(platformRenderTarget,
+ return this->onCreatePlatformRenderTarget(platformRenderTarget,
stencilBits,
isMultisampled,
width, height);
GrRenderTarget* GrGpu::createRenderTargetFrom3DApiState() {
this->handleDirtyContext();
- return this->createRenderTargetFrom3DApiStateHelper();
+ return this->onCreateRenderTargetFrom3DApiState();
}
GrResource* GrGpu::createPlatformSurface(const GrPlatformSurfaceDesc& desc) {
GrVertexBuffer* GrGpu::createVertexBuffer(uint32_t size, bool dynamic) {
this->handleDirtyContext();
- return this->createVertexBufferHelper(size, dynamic);
+ return this->onCreateVertexBuffer(size, dynamic);
}
GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) {
this->handleDirtyContext();
- return this->createIndexBufferHelper(size, dynamic);
+ return this->onCreateIndexBuffer(size, dynamic);
}
void GrGpu::eraseColor(GrColor color) {
this->handleDirtyContext();
- this->eraseColorHelper(color);
+ this->onEraseColor(color);
}
void GrGpu::forceRenderTargetFlush() {
this->handleDirtyContext();
- this->forceRenderTargetFlushHelper();
+ this->onForceRenderTargetFlush();
}
bool GrGpu::readPixels(GrRenderTarget* target,
int sIndex = startIndex;
setupGeometry(&sVertex, &sIndex, vertexCount, indexCount);
- drawIndexedHelper(type, sVertex, sIndex,
- vertexCount, indexCount);
+ this->onDrawIndexed(type, sVertex, sIndex,
+ vertexCount, indexCount);
}
void GrGpu::drawNonIndexed(GrPrimitiveType type,
int sVertex = startVertex;
setupGeometry(&sVertex, NULL, vertexCount, 0);
- drawNonIndexedHelper(type, sVertex, vertexCount);
+ this->onDrawNonIndexed(type, sVertex, vertexCount);
}
void GrGpu::finalizeReservedVertices() {
}
}
-bool GrGpu::acquireGeometryHelper(GrVertexLayout vertexLayout,
- void** vertices,
- void** indices) {
+bool GrGpu::onAcquireGeometry(GrVertexLayout vertexLayout,
+ void** vertices,
+ void** indices) {
GrAssert(!fReservedGeometry.fLocked);
size_t reservedVertexSpace = 0;
return true;
}
-void GrGpu::releaseGeometryHelper() {}
+void GrGpu::onReleaseGeometry() {}
-void GrGpu::setVertexSourceToArrayHelper(const void* vertexArray, int vertexCount) {
+void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) {
GrAssert(!fReservedGeometry.fLocked || !fReservedGeometry.fVertexCount);
- prepareVertexPool();
+ this->prepareVertexPool();
#if GR_DEBUG
bool success =
#endif
GR_DEBUGASSERT(success);
}
-void GrGpu::setIndexSourceToArrayHelper(const void* indexArray, int indexCount) {
+void GrGpu::onSetIndexSourceToArray(const void* indexArray, int indexCount) {
GrAssert(!fReservedGeometry.fLocked || !fReservedGeometry.fIndexCount);
- prepareIndexPool();
+ this->prepareIndexPool();
#if GR_DEBUG
bool success =
#endif
}
}
-GrRenderTarget* GrGpuGL::createPlatformRenderTargetHelper(
+GrRenderTarget* GrGpuGL::onCreatePlatformRenderTarget(
intptr_t platformRenderTarget,
int stencilBits,
bool isMultisampled,
isMultisampled, viewport, NULL);
}
-GrRenderTarget* GrGpuGL::createRenderTargetFrom3DApiStateHelper() {
+GrRenderTarget* GrGpuGL::onCreateRenderTargetFrom3DApiState() {
GrGLRenderTarget::GLRenderTargetIDs rtIDs;
}
#endif
-GrTexture* GrGpuGL::createTextureHelper(const TextureDesc& desc,
- const void* srcData,
- size_t rowBytes) {
+GrTexture* GrGpuGL::onCreateTexture(const TextureDesc& desc,
+ const void* srcData,
+ size_t rowBytes) {
#if GR_COLLECT_STATS
++fStats.fTextureCreateCnt;
#endif
- setSpareTextureUnit();
+ this->setSpareTextureUnit();
static const GrGLTexture::TexParams DEFAULT_PARAMS = {
GR_GL_NEAREST,
return tex;
}
-GrVertexBuffer* GrGpuGL::createVertexBufferHelper(uint32_t size, bool dynamic) {
+GrVertexBuffer* GrGpuGL::onCreateVertexBuffer(uint32_t size, bool dynamic) {
GrGLuint id;
GR_GL(GenBuffers(1, &id));
if (id) {
return NULL;
}
-GrIndexBuffer* GrGpuGL::createIndexBufferHelper(uint32_t size, bool dynamic) {
+GrIndexBuffer* GrGpuGL::onCreateIndexBuffer(uint32_t size, bool dynamic) {
GrGLuint id;
GR_GL(GenBuffers(1, &id));
if (id) {
}
}
-void GrGpuGL::eraseColorHelper(GrColor color) {
+void GrGpuGL::onEraseColor(GrColor color) {
if (NULL == fCurrDrawState.fRenderTarget) {
return;
}
fHWDrawState.fStencilSettings.invalidate();
}
-void GrGpuGL::forceRenderTargetFlushHelper() {
+void GrGpuGL::onForceRenderTargetFlush() {
flushRenderTarget();
}
#endif
#endif
-void GrGpuGL::drawIndexedHelper(GrPrimitiveType type,
- uint32_t startVertex,
- uint32_t startIndex,
- uint32_t vertexCount,
- uint32_t indexCount) {
+void GrGpuGL::onDrawIndexed(GrPrimitiveType type,
+ uint32_t startVertex,
+ uint32_t startIndex,
+ uint32_t vertexCount,
+ uint32_t indexCount) {
GrAssert((size_t)type < GR_ARRAY_COUNT(gPrimitiveType2GLMode));
GrGLvoid* indices = (GrGLvoid*)(sizeof(uint16_t) * startIndex);
#endif
}
-void GrGpuGL::drawNonIndexedHelper(GrPrimitiveType type,
- uint32_t startVertex,
- uint32_t vertexCount) {
+void GrGpuGL::onDrawNonIndexed(GrPrimitiveType type,
+ uint32_t startVertex,
+ uint32_t vertexCount) {
GrAssert((size_t)type < GR_ARRAY_COUNT(gPrimitiveType2GLMode));
GrAssert(NULL != fHWGeometryState.fVertexBuffer);
// overrides from GrGpu
virtual void resetContext();
- virtual GrTexture* createTextureHelper(const TextureDesc& desc,
- const void* srcData,
- size_t rowBytes);
- virtual GrVertexBuffer* createVertexBufferHelper(uint32_t size,
- bool dynamic);
- virtual GrIndexBuffer* createIndexBufferHelper(uint32_t size,
- bool dynamic);
+ virtual GrTexture* onCreateTexture(const TextureDesc& desc,
+ const void* srcData,
+ size_t rowBytes);
+ virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size,
+ bool dynamic);
+ virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
+ bool dynamic);
virtual GrResource* onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc);
- virtual GrRenderTarget* createPlatformRenderTargetHelper(
+ virtual GrRenderTarget* onCreatePlatformRenderTarget(
intptr_t platformRenderTarget,
int stencilBits,
bool isMultisampled,
int width, int height);
- virtual GrRenderTarget* createRenderTargetFrom3DApiStateHelper();
+ virtual GrRenderTarget* onCreateRenderTargetFrom3DApiState();
- virtual void eraseColorHelper(GrColor color);
+ virtual void onEraseColor(GrColor color);
- virtual void forceRenderTargetFlushHelper();
+ virtual void onForceRenderTargetFlush();
virtual bool onReadPixels(GrRenderTarget* target,
int left, int top, int width, int height,
GrPixelConfig, void* buffer);
- virtual void drawIndexedHelper(GrPrimitiveType type,
+ virtual void onDrawIndexed(GrPrimitiveType type,
uint32_t startVertex,
uint32_t startIndex,
uint32_t vertexCount,
uint32_t indexCount);
- virtual void drawNonIndexedHelper(GrPrimitiveType type,
+ virtual void onDrawNonIndexed(GrPrimitiveType type,
uint32_t vertexCount,
uint32_t numVertices);
virtual void flushScissor(const GrIRect* rect);
GrGpuGLShaders::GrGpuGLShaders() {
- resetContextHelper();
+ resetContext();
fProgramData = NULL;
fProgramCache = new ProgramCache();
void GrGpuGLShaders::resetContext() {
INHERITED::resetContext();
- resetContextHelper();
-}
-void GrGpuGLShaders::resetContextHelper() {
fHWGeometryState.fVertexLayout = 0;
fHWGeometryState.fVertexOffset = ~0;
GR_GL(DisableVertexAttribArray(COL_ATTR_LOCATION));
class ProgramCache;
- void resetContextHelper();
-
// Helpers to make code more readable
const GrMatrix& getHWSamplerMatrix(int stage);
void recordHWSamplerMatrix(int stage, const GrMatrix& matrix);
return flush;
}
-bool GrInOrderDrawBuffer::acquireGeometryHelper(GrVertexLayout vertexLayout,
- void** vertices,
- void** indices) {
+bool GrInOrderDrawBuffer::onAcquireGeometry(GrVertexLayout vertexLayout,
+ void** vertices,
+ void** indices) {
GrAssert(!fReservedGeometry.fLocked);
if (fReservedGeometry.fVertexCount) {
GrAssert(NULL != vertices);
return true;
}
-void GrInOrderDrawBuffer::releaseGeometryHelper() {
+void GrInOrderDrawBuffer::onReleaseGeometry() {
GrAssert(fUsedReservedVertexBytes <= fReservedVertexBytes);
GrAssert(fUsedReservedIndexBytes <= fReservedIndexBytes);
}
-void GrInOrderDrawBuffer::setVertexSourceToArrayHelper(const void* vertexArray,
- int vertexCount) {
+void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray,
+ int vertexCount) {
GrAssert(!fReservedGeometry.fLocked || !fReservedGeometry.fVertexCount);
#if GR_DEBUG
bool success =
GR_DEBUGASSERT(success);
}
-void GrInOrderDrawBuffer::setIndexSourceToArrayHelper(const void* indexArray,
- int indexCount) {
+void GrInOrderDrawBuffer::onSetIndexSourceToArray(const void* indexArray,
+ int indexCount) {
GrAssert(!fReservedGeometry.fLocked || !fReservedGeometry.fIndexCount);
#if GR_DEBUG
bool success =
return !single_pass_path(*target, *path, fill);
}
-void GrDefaultPathRenderer::drawPathHelper(GrDrawTarget* target,
- GrDrawTarget::StageBitfield stages,
- GrPathIter* path,
- GrPathFill fill,
- const GrPoint* translate,
- bool stencilOnly) {
+void GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target,
+ GrDrawTarget::StageBitfield stages,
+ GrPathIter* path,
+ GrPathFill fill,
+ const GrPoint* translate,
+ bool stencilOnly) {
GrDrawTarget::AutoStateRestore asr(target);
bool colorWritesWereDisabled = target->isColorWriteDisabled();
GrPathIter* path,
GrPathFill fill,
const GrPoint* translate) {
- this->drawPathHelper(target, stages, path, fill, translate, false);
+ this->onDrawPath(target, stages, path, fill, translate, false);
}
void GrDefaultPathRenderer::drawPathToStencil(GrDrawTarget* target,
const GrPoint* translate) {
GrAssert(kInverseEvenOdd_PathFill != fill);
GrAssert(kInverseWinding_PathFill != fill);
- this->drawPathHelper(target, 0, path, fill, translate, true);
+ this->onDrawPath(target, 0, path, fill, translate, true);
}
void deleteAtNode(Node* x);
static void RecursiveDelete(Node* x);
- int countOfHelper(const Node* n, const T& t) const;
+ int onCountOf(const Node* n, const T& t) const;
#if GR_DEBUG
void validate() const;
template <typename T, typename C>
int GrRedBlackTree<T,C>::countOf(const T& t) const {
- return countOfHelper(fRoot, t);
+ return onCountOf(fRoot, t);
}
template <typename T, typename C>
-int GrRedBlackTree<T,C>::countOfHelper(const Node* n, const T& t) const {
+int GrRedBlackTree<T,C>::onCountOf(const Node* n, const T& t) const {
// this is count*log(n) :(
while (NULL != n) {
if (fComp(t, n->fItem)) {
} else {
if (!fComp(n->fItem, t)) {
int count = 1;
- count += countOfHelper(n->fChildren[kLeft_Child], t);
- count += countOfHelper(n->fChildren[kRight_Child], t);
+ count += onCountOf(n->fChildren[kLeft_Child], t);
+ count += onCountOf(n->fChildren[kRight_Child], t);
return count;
}
n = n->fChildren[kRight_Child];