aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--bench/benchmain.cpp9
-rw-r--r--debugger/QT/SkGLWidget.cpp12
-rw-r--r--debugger/QT/SkGLWidget.h2
-rw-r--r--include/gpu/GrContext.h26
-rw-r--r--include/gpu/GrContextFactory.h5
-rw-r--r--include/gpu/GrRenderTarget.h10
-rw-r--r--include/gpu/GrTypes.h52
-rw-r--r--samplecode/SampleApp.cpp7
-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
-rw-r--r--tests/Test.cpp4
15 files changed, 115 insertions, 96 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index eb8c4eda5e..6f339529f2 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -203,17 +203,16 @@ public:
if (!glCtx->init(width, height)) {
return false;
}
- GrPlatform3DContext ctx =
- reinterpret_cast<GrPlatform3DContext>(glCtx->gl());
- grCtx = GrContext::Create(kOpenGL_Shaders_GrEngine, ctx);
+ GrBackendContext ctx = reinterpret_cast<GrBackendContext>(glCtx->gl());
+ grCtx = GrContext::Create(kOpenGL_GrBackend, ctx);
if (NULL != grCtx) {
- GrPlatformRenderTargetDesc desc;
+ GrBackendRenderTargetDesc desc;
desc.fConfig = kSkia8888_PM_GrPixelConfig;
desc.fWidth = width;
desc.fHeight = height;
desc.fStencilBits = 8;
desc.fRenderTargetHandle = glCtx->getFBOID();
- GrRenderTarget* rt = grCtx->createPlatformRenderTarget(desc);
+ GrRenderTarget* rt = grCtx->wrapBackendRenderTarget(desc);
if (NULL == rt) {
grCtx->unref();
return false;
diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp
index a9a625ac70..8b6e8572a2 100644
--- a/debugger/QT/SkGLWidget.cpp
+++ b/debugger/QT/SkGLWidget.cpp
@@ -27,8 +27,9 @@ SkGLWidget::~SkGLWidget() {
void SkGLWidget::initializeGL() {
fCurIntf = GrGLCreateNativeInterface();
- fCurContext = GrContext::Create(kOpenGL_Shaders_GrEngine, (GrPlatform3DContext) fCurIntf);
- GrRenderTarget* curRenderTarget = fCurContext->createPlatformRenderTarget(getDesc(this->width(), this->height()));
+ fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf);
+ GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height());
+ GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget);
fCanvas = new SkCanvas(fGpuDevice);
curRenderTarget->unref();
@@ -39,7 +40,8 @@ void SkGLWidget::initializeGL() {
}
void SkGLWidget::resizeGL(int w, int h) {
- GrRenderTarget* curRenderTarget = fCurContext->createPlatformRenderTarget(getDesc(w,h));
+ GrBackendRenderTargetDesc desc = this->getDesc(w, h);
+ GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
SkSafeUnref(fGpuDevice);
SkSafeUnref(fCanvas);
fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget);
@@ -57,8 +59,8 @@ void SkGLWidget::paintGL() {
}
}
-GrPlatformRenderTargetDesc SkGLWidget::getDesc(int w, int h) {
- GrPlatformRenderTargetDesc desc;
+GrBackendRenderTargetDesc SkGLWidget::getDesc(int w, int h) {
+ GrBackendRenderTargetDesc desc;
desc.fWidth = SkScalarRound(this->width());
desc.fHeight = SkScalarRound(this->height());
desc.fConfig = kSkia8888_PM_GrPixelConfig;
diff --git a/debugger/QT/SkGLWidget.h b/debugger/QT/SkGLWidget.h
index e31d09c8a9..2a60c9ab91 100644
--- a/debugger/QT/SkGLWidget.h
+++ b/debugger/QT/SkGLWidget.h
@@ -48,7 +48,7 @@ private:
SkGpuDevice* fGpuDevice;
SkCanvas* fCanvas;
SkDebugger* fDebugger;
- GrPlatformRenderTargetDesc getDesc(int w, int h);
+ GrBackendRenderTargetDesc getDesc(int w, int h);
};
#endif /* SKGLWIDGET_H_ */
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index dcb5d8bf89..195f7316d1 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -46,10 +46,9 @@ public:
SK_DECLARE_INST_COUNT(GrContext)
/**
- * Creates a GrContext from within a 3D context.
+ * Creates a GrContext for a backend context.
*/
- static GrContext* Create(GrEngine engine,
- GrPlatform3DContext context3D);
+ static GrContext* Create(GrBackend, GrBackendContext);
/**
* Returns the number of GrContext instances for the current thread.
@@ -290,7 +289,7 @@ public:
bool isConfigRenderable(GrPixelConfig config) const;
///////////////////////////////////////////////////////////////////////////
- // Platform Surfaces
+ // Backend Surfaces
/**
* Wraps an existing texture with a GrTexture object.
@@ -302,11 +301,11 @@ public:
*
* @return GrTexture object or NULL on failure.
*/
- GrTexture* createPlatformTexture(const GrPlatformTextureDesc& desc);
+ GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc);
/**
* Wraps an existing render target with a GrRenderTarget object. It is
- * similar to createPlatformTexture but can be used to draw into surfaces
+ * similar to wrapBackendTexture but can be used to draw into surfaces
* that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that
* the client will resolve to a texture).
*
@@ -314,8 +313,7 @@ public:
*
* @return GrTexture object or NULL on failure.
*/
- GrRenderTarget* createPlatformRenderTarget(
- const GrPlatformRenderTargetDesc& desc);
+ GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
///////////////////////////////////////////////////////////////////////////
// Matrix state
@@ -607,7 +605,7 @@ public:
* be executed before the resolve.
*
* This is only necessary when a client wants to access the object directly
- * using the underlying graphics API. GrContext will detect when it must
+ * using the backend API directly. GrContext will detect when it must
* perform a resolve to a GrTexture used as the source of a draw or before
* reading pixels back from a GrTexture or GrRenderTarget.
*/
@@ -860,6 +858,16 @@ public:
void printCacheStats() const;
#endif
+ ///////////////////////////////////////////////////////////////////////////
+ // Legacy names that will be kept until WebKit can be updated.
+ GrTexture* createPlatformTexture(const GrPlatformTextureDesc& desc) {
+ return this->wrapBackendTexture(desc);
+ }
+
+ GrRenderTarget* createPlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) {
+ return wrapBackendRenderTarget(desc);
+ }
+
private:
// Used to indicate whether a draw should be performed immediately or queued in fDrawBuffer.
enum BufferedDraw {
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index 600bedae66..95d02a2f11 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -95,9 +95,8 @@ public:
if (!glCtx.get()->init(kBogusSize, kBogusSize)) {
return NULL;
}
- GrPlatform3DContext p3dctx =
- reinterpret_cast<GrPlatform3DContext>(glCtx.get()->gl());
- grCtx.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, p3dctx));
+ GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glCtx.get()->gl());
+ grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx));
if (!grCtx.get()) {
return NULL;
}
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index f3add50ee3..58a3aa5220 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -70,7 +70,7 @@ public:
* If this RT is multisampled, this is the multisample buffer
* @return the 3D API's handle to this object (e.g. FBO ID in OpenGL)
*/
- virtual intptr_t getRenderTargetHandle() const = 0;
+ virtual GrBackendObject getRenderTargetHandle() const = 0;
/**
* If this RT is multisampled, this is the buffer it is resolved to.
@@ -78,7 +78,7 @@ public:
* (In GL a separate FBO ID is used for the msaa and resolved buffers)
* @return the 3D API's handle to this object (e.g. FBO ID in OpenGL)
*/
- virtual intptr_t getRenderTargetResolvedHandle() const = 0;
+ virtual GrBackendObject getRenderTargetResolvedHandle() const = 0;
/**
* @return true if the surface is multisampled, false otherwise
@@ -94,9 +94,9 @@ public:
* Call to indicate the multisample contents were modified such that the
* render target needs to be resolved before it can be used as texture. Gr
* tracks this for its own drawing and thus this only needs to be called
- * when the render target has been modified outside of Gr. Only meaningful
- * for Gr-created RT/Textures and Platform RT/Textures created with the
- * kGrCanResolve flag.
+ * when the render target has been modified outside of Gr. This has no
+ * effect on wrapped backend render targets.
+ *
* @param rect a rect bounding the area needing resolve. NULL indicates
* the whole RT needs resolving.
*/
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index f084427e6f..8bd1f2f8a8 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -186,16 +186,15 @@ static inline int16_t GrToS16(intptr_t x) {
/**
* Possible 3D APIs that may be used by Ganesh.
*/
-enum GrEngine {
- kOpenGL_Shaders_GrEngine,
- kOpenGL_Fixed_GrEngine,
+enum GrBackend {
+ kOpenGL_GrBackend,
};
/**
- * Engine-specific 3D context handle
+ * Backend-specific 3D context handle
* GrGLInterface* for OpenGL. If NULL will use the default GL interface.
*/
-typedef intptr_t GrPlatform3DContext;
+typedef intptr_t GrBackendContext;
///////////////////////////////////////////////////////////////////////////////
@@ -595,7 +594,7 @@ static inline bool GrIsFillInverted(GrPathFill fill) {
///////////////////////////////////////////////////////////////////////////////
// opaque type for 3D API object handles
-typedef intptr_t GrPlatform3DObject;
+typedef intptr_t GrBackendObject;
/**
* Gr can wrap an existing texture created by the client with a GrTexture
@@ -618,11 +617,11 @@ typedef intptr_t GrPlatform3DObject;
* Note: These flags currently form a subset of GrTexture's flags.
*/
-enum GrPlatformTextureFlags {
+enum GrBackendTextureFlags {
/**
* No flags enabled
*/
- kNone_GrPlatformTextureFlag = kNone_GrTextureFlags,
+ kNone_GrBackendTextureFlag = kNone_GrTextureFlags,
/**
* Indicates that the texture is also a render target, and thus should have
* a GrRenderTarget object.
@@ -630,13 +629,13 @@ enum GrPlatformTextureFlags {
* D3D (future): client must have created the texture with flags that allow
* it to be used as a render target.
*/
- kRenderTarget_GrPlatformTextureFlag = kRenderTarget_GrTextureFlagBit,
+ kRenderTarget_GrBackendTextureFlag = kRenderTarget_GrTextureFlagBit,
};
-GR_MAKE_BITFIELD_OPS(GrPlatformTextureFlags)
+GR_MAKE_BITFIELD_OPS(GrBackendTextureFlags)
-struct GrPlatformTextureDesc {
- GrPlatformTextureDesc() { memset(this, 0, sizeof(*this)); }
- GrPlatformTextureFlags fFlags;
+struct GrBackendTextureDesc {
+ GrBackendTextureDesc() { memset(this, 0, sizeof(*this)); }
+ GrBackendTextureFlags fFlags;
int fWidth; //<! width in pixels
int fHeight; //<! height in pixels
GrPixelConfig fConfig; //<! color format
@@ -649,7 +648,7 @@ struct GrPlatformTextureDesc {
* Handle to the 3D API object.
* OpenGL: Texture ID.
*/
- GrPlatform3DObject fTextureHandle;
+ GrBackendObject fTextureHandle;
};
///////////////////////////////////////////////////////////////////////////////
@@ -664,14 +663,14 @@ struct GrPlatformTextureDesc {
* the 3D API doesn't require this (OpenGL).
*/
-struct GrPlatformRenderTargetDesc {
- GrPlatformRenderTargetDesc() { memset(this, 0, sizeof(*this)); }
+struct GrBackendRenderTargetDesc {
+ GrBackendRenderTargetDesc() { memset(this, 0, sizeof(*this)); }
int fWidth; //<! width in pixels
int fHeight; //<! height in pixels
GrPixelConfig fConfig; //<! color format
/**
* The number of samples per pixel. Gr uses this to influence decisions
- * about applying other forms of antialiasing.
+ * about applying other forms of anti-aliasing.
*/
int fSampleCnt;
/**
@@ -682,9 +681,26 @@ struct GrPlatformRenderTargetDesc {
* Handle to the 3D API object.
* OpenGL: FBO ID
*/
- GrPlatform3DObject fRenderTargetHandle;
+ GrBackendObject fRenderTargetHandle;
};
+///////////////////////////////////////////////////////////////////////////////
+// Legacy names that will be kept until WebKit can be updated.
+
+typedef GrBackend GrEngine;
+static const GrBackend kOpenGL_Shaders_GrEngine = kOpenGL_GrBackend;
+
+typedef GrBackendContext GrPlatform3DContext;
+
+typedef GrBackendObject GrPlatform3DObject;
+
+typedef GrBackendTextureFlags GrPlatformTextureFlags;
+static const GrBackendTextureFlags kNone_GrPlatformTextureFlag = kNone_GrBackendTextureFlag;
+static const GrBackendTextureFlags kRenderTarget_GrPlatformTextureFlag = kRenderTarget_GrBackendTextureFlag;
+
+typedef GrBackendTextureDesc GrPlatformTextureDesc;
+
+typedef GrBackendRenderTargetDesc GrPlatformRenderTargetDesc;
///////////////////////////////////////////////////////////////////////////////
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index df77063633..5ff1b4e3c4 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -226,8 +226,7 @@ public:
}
SkASSERT(NULL == fCurContext);
- fCurContext = GrContext::Create(kOpenGL_Shaders_GrEngine,
- (GrPlatform3DContext) fCurIntf);
+ fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf);
if (NULL == fCurContext || NULL == fCurIntf) {
// We need some context and interface to see results
@@ -315,7 +314,7 @@ public:
if (fCurContext) {
win->attach(fBackend, fMSAASampleCount);
- GrPlatformRenderTargetDesc desc;
+ GrBackendRenderTargetDesc desc;
desc.fWidth = SkScalarRound(win->width());
desc.fHeight = SkScalarRound(win->height());
desc.fConfig = kSkia8888_PM_GrPixelConfig;
@@ -326,7 +325,7 @@ public:
desc.fRenderTargetHandle = buffer;
SkSafeUnref(fCurRenderTarget);
- fCurRenderTarget = fCurContext->createPlatformRenderTarget(desc);
+ fCurRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
}
#endif
}
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;
diff --git a/tests/Test.cpp b/tests/Test.cpp
index deb83483c2..07107bc934 100644
--- a/tests/Test.cpp
+++ b/tests/Test.cpp
@@ -93,8 +93,8 @@ GrContext* GpuTest::GetContext() {
if (NULL == gGrContext.get()) {
gGLContext.init();
if (gGLContext.get()->init(800, 600)) {
- GrPlatform3DContext ctx = reinterpret_cast<GrPlatform3DContext>(gGLContext.get()->gl());
- gGrContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, ctx));
+ GrBackendContext ctx = reinterpret_cast<GrBackendContext>(gGLContext.get()->gl());
+ gGrContext.reset(GrContext::Create(kOpenGL_GrBackend, ctx));
}
}
if (gGLContext.get()) {