/* * 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 GrGpu_DEFINED #define GrGpu_DEFINED #include "GrDrawTarget.h" #include "GrRect.h" #include "GrRefCnt.h" #include "GrTexture.h" class GrContext; class GrIndexBufferAllocPool; class GrPathRenderer; class GrPathRendererChain; class GrResource; class GrStencilBuffer; class GrVertexBufferAllocPool; /** * Gpu usage statistics. */ struct GrGpuStats { uint32_t fVertexCnt; // fGeomPoolStateStack; mutable GrIndexBuffer* fQuadIndexBuffer; // mutable so it can be // created on-demand mutable GrVertexBuffer* fUnitSquareVertexBuffer; // mutable so it can be // created on-demand // must be instantiated after GrGpu object has been given its owning // GrContext ptr. (GrGpu is constructed first then handed off to GrContext). GrPathRendererChain* fPathRendererChain; bool fContextIsDirty; GrResource* fResourceHead; // Given a rt, find or create a stencil buffer and attach it bool attachStencilBufferToRenderTarget(GrRenderTarget* target); // GrDrawTarget overrides virtual void onDrawIndexed(GrPrimitiveType type, int startVertex, int startIndex, int vertexCount, int indexCount); virtual void onDrawNonIndexed(GrPrimitiveType type, int startVertex, int vertexCount); // readies the pools to provide vertex/index data. void prepareVertexPool(); void prepareIndexPool(); // determines the path renderer used to draw a clip path element. GrPathRenderer* getClipPathRenderer(const SkPath& path, GrPathFill fill); void resetContext() { this->onResetContext(); ++fResetTimestamp; } void handleDirtyContext() { if (fContextIsDirty) { this->resetContext(); fContextIsDirty = false; } } typedef GrDrawTarget INHERITED; }; #endif