/* Copyright 2011 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef GrGpu_DEFINED #define GrGpu_DEFINED #include "GrDrawTarget.h" #include "GrPathRenderer.h" #include "GrRect.h" #include "GrRefCnt.h" #include "GrTexture.h" class GrContext; class GrIndexBufferAllocPool; class GrResource; class GrVertexBufferAllocPool; /** * Gpu usage statistics. */ struct GrGpuStats { uint32_t fVertexCnt; // fGeoSrcStateStackStorage; GrTArray fGeomPoolStateStack; mutable GrIndexBuffer* fQuadIndexBuffer; // mutable so it can be // created on-demand mutable GrVertexBuffer* fUnitSquareVertexBuffer; // mutable so it can be // created on-demand GrDefaultPathRenderer* fDefaultPathRenderer; GrPathRenderer* fClientPathRenderer; bool fContextIsDirty; GrResource* fResourceHead; // 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 handleDirtyContext() { if (fContextIsDirty) { this->resetContext(); fContextIsDirty = false; } } typedef GrDrawTarget INHERITED; }; #endif