089a780c33
Before this change, an object needed to inherit from GrResource (and thus be a GPU object) in order to live in the GrResourceCache. That was a problem for caching items that weren't GPU objects themselves, but owned GPU objects. This change splits GrResource into two classes: 1. GrCacheable: The base class for objects that can live in the GrResourceCache. 2. GrGpuObject, which inherits from GrCacheable: The base class for objects that get tracked by GrGpu. This change is purely a refactor; there is no change in functionality. Change-Id: I3e8daeb1f123041f414aa306c1366e959ae9e39e BUG=skia: R=bsalomon@google.com Author: cdalton@nvidia.com Review URL: https://codereview.chromium.org/251013002 git-svn-id: http://skia.googlecode.com/svn/trunk@14553 2bbb7eff-a529-9590-31e7-b0007b416f81
34 lines
878 B
C++
34 lines
878 B
C++
|
|
/*
|
|
* Copyright 2010 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrIndexBuffer_DEFINED
|
|
#define GrIndexBuffer_DEFINED
|
|
|
|
#include "GrGeometryBuffer.h"
|
|
|
|
class GrIndexBuffer : public GrGeometryBuffer {
|
|
public:
|
|
/**
|
|
* Retrieves the maximum number of quads that could be rendered
|
|
* from the index buffer (using kTriangles_GrPrimitiveType).
|
|
* @return the maximum number of quads using full size of index buffer.
|
|
*/
|
|
int maxQuads() const {
|
|
return static_cast<int>(this->gpuMemorySize() / (sizeof(uint16_t) * 6));
|
|
}
|
|
protected:
|
|
GrIndexBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dynamic, bool cpuBacked)
|
|
: INHERITED(gpu, isWrapped, gpuMemorySize, dynamic, cpuBacked) {}
|
|
private:
|
|
typedef GrGeometryBuffer INHERITED;
|
|
};
|
|
|
|
#endif
|