}
/**
- * Count elements in an array
- */
-#define GR_ARRAY_COUNT(array) SK_ARRAY_COUNT(array)
-
-/**
* 16.16 fixed point type
*/
typedef int32_t GrFixed;
kConstA_GrBlendCoeff, //<! constant color alpha
kIConstA_GrBlendCoeff, //<! one minus constant color alpha
- kPublicGrBlendCoeffCount
+ kFirstPublicGrBlendCoeff = kZero_GrBlendCoeff,
+ kLastPublicGrBlendCoeff = kIConstA_GrBlendCoeff,
};
+static const int kPublicGrBlendCoeffCount = kLastPublicGrBlendCoeff + 1;
/**
* Formats for masks, used by the font cache.
}
/**
- * Optional bitfield flags that can be passed to createTexture.
+ * Optional bitfield flags that can be set on GrSurfaceDesc (below).
*/
-enum GrTextureFlags {
- kNone_GrTextureFlags = 0x0,
+enum GrSurfaceFlags {
+ kNone_GrSurfaceFlags = 0x0,
/**
* Creates a texture that can be rendered to as a GrRenderTarget. Use
* GrTexture::asRenderTarget() to access.
*/
- kRenderTarget_GrTextureFlagBit = 0x1,
+ kRenderTarget_GrSurfaceFlag = 0x1,
/**
* By default all render targets have an associated stencil buffer that
* may be required for path filling. This flag overrides stencil buffer
* creation.
* MAKE THIS PRIVATE?
*/
- kNoStencil_GrTextureFlagBit = 0x2,
- /**
- * Hint that the CPU may modify this texture after creation.
- */
- kDynamicUpdate_GrTextureFlagBit = 0x4,
+ kNoStencil_GrSurfaceFlag = 0x2,
/**
* Indicates that all allocations (color buffer, FBO completeness, etc)
* should be verified.
*/
- kCheckAllocation_GrTextureFlagBit = 0x8,
-
- kDummy_GrTextureFlagBit,
- kLastPublic_GrTextureFlagBit = kDummy_GrTextureFlagBit-1,
+ kCheckAllocation_GrSurfaceFlag = 0x4,
};
-GR_MAKE_BITFIELD_OPS(GrTextureFlags)
+GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
+
+// Legacy aliases
+typedef GrSurfaceFlags GrTextureFlags;
+static const GrSurfaceFlags kNone_GrTextureFlags = kNone_GrSurfaceFlags;
+static const GrSurfaceFlags kRenderTarget_GrTextureFlagBit = kRenderTarget_GrSurfaceFlag;
+static const GrSurfaceFlags kNoStencil_GrTextureFlagBit = kNoStencil_GrSurfaceFlag;
+static const GrSurfaceFlags kCheckAllocation_GrTextureFlagBit = kCheckAllocation_GrSurfaceFlag;
/**
* Some textures will be stored such that the upper and left edges of the content meet at the
};
/**
- * Describes a texture to be created.
+ * Describes a surface to be created.
*/
-struct GrTextureDesc {
- GrTextureDesc()
- : fFlags(kNone_GrTextureFlags)
+struct GrSurfaceDesc {
+ GrSurfaceDesc()
+ : fFlags(kNone_GrSurfaceFlags)
, fOrigin(kDefault_GrSurfaceOrigin)
, fWidth(0)
, fHeight(0)
, fSampleCnt(0) {
}
- GrTextureFlags fFlags; //!< bitfield of TextureFlags
+ GrSurfaceFlags fFlags; //!< bitfield of TextureFlags
GrSurfaceOrigin fOrigin; //!< origin of the texture
int fWidth; //!< Width of the texture
int fHeight; //!< Height of the texture
/**
* The number of samples per pixel or 0 to disable full scene AA. This only
- * applies if the kRenderTarget_GrTextureFlagBit is set. The actual number
+ * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number
* of samples may not exactly match the request. The request will be rounded
* up to the next supported sample count, or down if it is larger than the
* max supported count.
int fSampleCnt;
};
+// Legacy alias
+typedef GrSurfaceDesc GrTextureDesc;
+
/**
* GrCacheID is used create and find cached GrResources (e.g. GrTextures). The ID has two parts:
* the domain and the key. Domains simply allow multiple clients to use 0-based indices as their
/**
* No flags enabled
*/
- kNone_GrBackendTextureFlag = kNone_GrTextureFlags,
+ kNone_GrBackendTextureFlag = 0,
/**
* Indicates that the texture is also a render target, and thus should have
* a GrRenderTarget object.
- *
- * D3D (future): client must have created the texture with flags that allow
- * it to be used as a render target.
*/
- kRenderTarget_GrBackendTextureFlag = kRenderTarget_GrTextureFlagBit,
+ kRenderTarget_GrBackendTextureFlag = kRenderTarget_GrSurfaceFlag,
};
GR_MAKE_BITFIELD_OPS(GrBackendTextureFlags)