aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-25 18:43:28 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-25 18:43:28 +0000
commit16e3ddea6a80972aced04b21b1d66377fa95e7c7 (patch)
tree2dffbddbfa9f09ac89ca0ebbb5f79e77d5516c78 /src
parentb5a5a9dc755a1655007ca05b2cc279773f3623ba (diff)
Platform/Engine -> Backend
createPlatform -> wrapBackend R=robertphillips@google.com Review URL: https://codereview.appspot.com/6785044 git-svn-id: http://skia.googlecode.com/svn/trunk@6123 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp13
-rw-r--r--src/gpu/GrGpu.cpp8
-rw-r--r--src/gpu/GrGpu.h41
-rw-r--r--src/gpu/GrGpuFactory.cpp6
-rw-r--r--src/gpu/gl/GrGpuGL.cpp10
-rw-r--r--src/gpu/gl/GrGpuGL.h6
6 files changed, 40 insertions, 44 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 858242b0d8..23583dd45f 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -59,10 +59,9 @@ static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4;
#define ASSERT_OWNED_RESOURCE(R) GrAssert(!(R) || (R)->getContext() == this)
-GrContext* GrContext::Create(GrEngine engine,
- GrPlatform3DContext context3D) {
+GrContext* GrContext::Create(GrBackend backend, GrBackendContext context) {
GrContext* ctx = NULL;
- GrGpu* fGpu = GrGpu::Create(engine, context3D);
+ GrGpu* fGpu = GrGpu::Create(backend, context);
if (NULL != fGpu) {
ctx = SkNEW_ARGS(GrContext, (fGpu));
fGpu->unref();
@@ -531,12 +530,12 @@ int GrContext::getMaxRenderTargetSize() const {
///////////////////////////////////////////////////////////////////////////////
-GrTexture* GrContext::createPlatformTexture(const GrPlatformTextureDesc& desc) {
- return fGpu->createPlatformTexture(desc);
+GrTexture* GrContext::wrapBackendTexture(const GrBackendTextureDesc& desc) {
+ return fGpu->wrapBackendTexture(desc);
}
-GrRenderTarget* GrContext::createPlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) {
- return fGpu->createPlatformRenderTarget(desc);
+GrRenderTarget* GrContext::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
+ return fGpu->wrapBackendRenderTarget(desc);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 4bc1574f3f..542c458d3f 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -173,9 +173,9 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
}
}
-GrTexture* GrGpu::createPlatformTexture(const GrPlatformTextureDesc& desc) {
+GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) {
this->handleDirtyContext();
- GrTexture* tex = this->onCreatePlatformTexture(desc);
+ GrTexture* tex = this->onWrapBackendTexture(desc);
if (NULL == tex) {
return NULL;
}
@@ -190,9 +190,9 @@ GrTexture* GrGpu::createPlatformTexture(const GrPlatformTextureDesc& desc) {
}
}
-GrRenderTarget* GrGpu::createPlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) {
+GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
this->handleDirtyContext();
- return this->onCreatePlatformRenderTarget(desc);
+ return this->onWrapBackendRenderTarget(desc);
}
GrVertexBuffer* GrGpu::createVertexBuffer(uint32_t size, bool dynamic) {
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 60e49e7c9e..a4ed0ed5e7 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -29,7 +29,7 @@ class GrGpu : public GrDrawTarget {
public:
/**
- * Additional blend coeffecients for dual source blending, not exposed
+ * Additional blend coefficients for dual source blending, not exposed
* through GrPaint/GrContext.
*/
enum ExtendedBlendCoeffs {
@@ -44,11 +44,10 @@ public:
};
/**
- * Create an instance of GrGpu that matches the specified Engine backend.
- * If the requested engine is not supported (at compile-time or run-time)
- * this returns NULL.
+ * Create an instance of GrGpu that matches the specified backend. If the requested backend is
+ * not supported (at compile-time or run-time) this returns NULL.
*/
- static GrGpu* Create(GrEngine, GrPlatform3DContext context3D);
+ static GrGpu* Create(GrBackend, GrBackendContext);
////////////////////////////////////////////////////////////////////////////
@@ -96,14 +95,14 @@ public:
const void* srcData, size_t rowBytes);
/**
- * Implements GrContext::createPlatformTexture
+ * Implements GrContext::wrapBackendTexture
*/
- GrTexture* createPlatformTexture(const GrPlatformTextureDesc& desc);
+ GrTexture* wrapBackendTexture(const GrBackendTextureDesc&);
/**
- * Implements GrContext::createPlatformTexture
+ * Implements GrContext::wrapBackendTexture
*/
- GrRenderTarget* createPlatformRenderTarget(const GrPlatformRenderTargetDesc& desc);
+ GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&);
/**
* Creates a vertex buffer.
@@ -245,7 +244,7 @@ public:
* @param height height of rectangle to write in pixels.
* @param config the pixel config of the source buffer
* @param buffer memory to read pixels from
- * @param rowBytes number of bytes bewtween consecutive rows. Zero
+ * @param rowBytes number of bytes between consecutive rows. Zero
* means rows are tightly packed.
*/
void writeTexturePixels(GrTexture* texture,
@@ -443,23 +442,23 @@ protected:
virtual void onResetContext() = 0;
- // overridden by API-specific derived class to create objects.
+ // overridden by backend-specific derived class to create objects.
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
const void* srcData,
size_t rowBytes) = 0;
- virtual GrTexture* onCreatePlatformTexture(const GrPlatformTextureDesc& desc) = 0;
- virtual GrRenderTarget* onCreatePlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) = 0;
+ virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0;
+ virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) = 0;
virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size,
bool dynamic) = 0;
virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
bool dynamic) = 0;
virtual GrPath* onCreatePath(const SkPath& path) = 0;
- // overridden by API-specific derivated class to perform the clear and
+ // overridden by backend-specific derived class to perform the clear and
// clearRect. NULL rect means clear whole target.
virtual void onClear(const GrIRect* rect, GrColor color) = 0;
- // overridden by API-specific derived class to perform the draw call.
+ // overridden by backend-specific derived class to perform the draw call.
virtual void onGpuDrawIndexed(GrPrimitiveType type,
uint32_t startVertex,
uint32_t startIndex,
@@ -476,13 +475,13 @@ protected:
virtual void setStencilPathSettings(const GrPath&,
GrPathFill,
GrStencilSettings* settings) = 0;
- // overridden by API-specific derived class to perform the path stenciling.
+ // overridden by backend-specific derived class to perform the path stenciling.
virtual void onGpuStencilPath(const GrPath*, GrPathFill) = 0;
- // overridden by API-specific derived class to perform flush
+ // overridden by backend-specific derived class to perform flush
virtual void onForceRenderTargetFlush() = 0;
- // overridden by API-specific derived class to perform the read pixels.
+ // overridden by backend-specific derived class to perform the read pixels.
virtual bool onReadPixels(GrRenderTarget* target,
int left, int top, int width, int height,
GrPixelConfig,
@@ -490,13 +489,13 @@ protected:
size_t rowBytes,
bool invertY) = 0;
- // overridden by API-specific derived class to perform the texture update
+ // overridden by backend-specific derived class to perform the texture update
virtual void onWriteTexturePixels(GrTexture* texture,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes) = 0;
- // overridden by API-specific derived class to perform the resolve
+ // overridden by backend-specific derived class to perform the resolve
virtual void onResolveRenderTarget(GrRenderTarget* target) = 0;
// called to program the vertex data, indexCount will be 0 if drawing non-
@@ -520,7 +519,7 @@ protected:
// The GrGpu typically records the clients requested state and then flushes
// deltas from previous state at draw time. This function does the
- // API-specific flush of the state
+ // backend-specific flush of the state
// returns false if current state is unsupported.
virtual bool flushGraphicsState(DrawType) = 0;
diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp
index 0d4c3814dd..63a73b738a 100644
--- a/src/gpu/GrGpuFactory.cpp
+++ b/src/gpu/GrGpuFactory.cpp
@@ -14,13 +14,13 @@
#include "GrGpu.h"
#include "gl/GrGpuGL.h"
-GrGpu* GrGpu::Create(GrEngine engine, GrPlatform3DContext context3D) {
+GrGpu* GrGpu::Create(GrBackend backend, GrBackendContext context) {
const GrGLInterface* glInterface = NULL;
SkAutoTUnref<const GrGLInterface> glInterfaceUnref;
- if (kOpenGL_Shaders_GrEngine == engine) {
- glInterface = reinterpret_cast<const GrGLInterface*>(context3D);
+ if (kOpenGL_GrBackend == backend) {
+ glInterface = reinterpret_cast<const GrGLInterface*>(context);
if (NULL == glInterface) {
glInterface = GrGLDefaultInterface();
// By calling GrGLDefaultInterface we've taken a ref on the
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 7a58c53aef..62652f8b91 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -476,13 +476,13 @@ void GrGpuGL::onResetContext() {
fHWConstAttribCoverage = GrColor_ILLEGAL;
}
-GrTexture* GrGpuGL::onCreatePlatformTexture(const GrPlatformTextureDesc& desc) {
+GrTexture* GrGpuGL::onWrapBackendTexture(const GrBackendTextureDesc& desc) {
GrGLTexture::Desc glTexDesc;
- if (!configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) {
+ if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) {
return NULL;
}
- // next line relies on PlatformTextureDesc's flags matching GrTexture's
+ // next line relies on GrBackendTextureDesc's flags matching GrTexture's
glTexDesc.fFlags = (GrTextureFlags) desc.fFlags;
glTexDesc.fWidth = desc.fWidth;
glTexDesc.fHeight = desc.fHeight;
@@ -493,7 +493,7 @@ GrTexture* GrGpuGL::onCreatePlatformTexture(const GrPlatformTextureDesc& desc) {
glTexDesc.fOrientation = GrGLTexture::kBottomUp_Orientation;
GrGLTexture* texture = NULL;
- if (desc.fFlags & kRenderTarget_GrPlatformTextureFlag) {
+ if (desc.fFlags & kRenderTarget_GrBackendTextureFlag) {
GrGLRenderTarget::Desc glRTDesc;
glRTDesc.fRTFBOID = 0;
glRTDesc.fTexFBOID = 0;
@@ -519,7 +519,7 @@ GrTexture* GrGpuGL::onCreatePlatformTexture(const GrPlatformTextureDesc& desc) {
return texture;
}
-GrRenderTarget* GrGpuGL::onCreatePlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) {
+GrRenderTarget* GrGpuGL::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
GrGLRenderTarget::Desc glDesc;
glDesc.fConfig = desc.fConfig;
glDesc.fRTFBOID = static_cast<GrGLuint>(desc.fRenderTargetHandle);
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 0cd7eb58a0..0f7b8160e7 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -66,10 +66,8 @@ protected:
virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
bool dynamic) SK_OVERRIDE;
virtual GrPath* onCreatePath(const SkPath&) SK_OVERRIDE;
- virtual GrTexture* onCreatePlatformTexture(
- const GrPlatformTextureDesc& desc) SK_OVERRIDE;
- virtual GrRenderTarget* onCreatePlatformRenderTarget(
- const GrPlatformRenderTargetDesc& desc) SK_OVERRIDE;
+ virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVERRIDE;
+ virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) SK_OVERRIDE;
virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,
int width,
int height) SK_OVERRIDE;