Remove GrContext.h dependence on GrGpu.h
Review URL: http://codereview.appspot.com/4433096/
git-svn-id: http://skia.googlecode.com/svn/trunk@1227 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index 2263172..399eaf8 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -15,7 +15,7 @@
*/
#include "GrContext.h"
-#include "GrTypes.h"
+#include "GrGpu.h"
#include "GrTextureCache.h"
#include "GrTextStrike.h"
#include "GrMemory.h"
@@ -43,8 +43,8 @@
static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 0;
static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 0;
-GrContext* GrContext::Create(GrGpu::Engine engine,
- GrGpu::Platform3DContext context3D) {
+GrContext* GrContext::Create(GrEngine engine,
+ GrPlatform3DContext context3D) {
GrContext* ctx = NULL;
GrGpu* fGpu = GrGpu::Create(engine, context3D);
if (NULL != fGpu) {
@@ -55,7 +55,7 @@
}
GrContext* GrContext::CreateGLShaderContext() {
- return GrContext::Create(GrGpu::kOpenGL_Shaders_Engine, NULL);
+ return GrContext::Create(kOpenGL_Shaders_GrEngine, NULL);
}
GrContext::~GrContext() {
@@ -351,6 +351,25 @@
return fGpu->createPlatformSurface(desc);
}
+GrRenderTarget* GrContext::createPlatformRenderTarget(intptr_t platformRenderTarget,
+ int stencilBits,
+ bool isMultisampled,
+ int width, int height) {
+#if GR_DEBUG
+ GrPrintf("Using deprecated createPlatformRenderTarget API.");
+#endif
+ return fGpu->createPlatformRenderTarget(platformRenderTarget,
+ stencilBits, isMultisampled,
+ width, height);
+}
+
+GrRenderTarget* GrContext::createRenderTargetFrom3DApiState() {
+#if GR_DEBUG
+ GrPrintf("Using deprecated createRenderTargetFrom3DApiState API.");
+#endif
+ return fGpu->createRenderTargetFrom3DApiState();
+}
+
///////////////////////////////////////////////////////////////////////////////
bool GrContext::supportsIndex8PixelConfig(const GrSamplerState& sampler,
@@ -378,6 +397,8 @@
////////////////////////////////////////////////////////////////////////////////
+const GrClip& GrContext::getClip() const { return fGpu->getClip(); }
+
void GrContext::setClip(const GrClip& clip) {
fGpu->setClip(clip);
fGpu->enableState(GrDrawTarget::kClip_StateBit);
@@ -1355,7 +1376,7 @@
fGpu->resetStats();
}
-const GrGpu::Stats& GrContext::getStats() const {
+const GrGpuStats& GrContext::getStats() const {
return fGpu->getStats();
}
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp
index cb78204..5fff20f 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -725,7 +725,7 @@
////////////////////////////////////////////////////////////////////////////////
-const GrGpu::Stats& GrGpu::getStats() const {
+const GrGpuStats& GrGpu::getStats() const {
return fStats;
}
diff --git a/gpu/src/GrGpuFactory.cpp b/gpu/src/GrGpuFactory.cpp
index 1715333..c6f541c 100644
--- a/gpu/src/GrGpuFactory.cpp
+++ b/gpu/src/GrGpuFactory.cpp
@@ -28,10 +28,10 @@
#include "GrGpuGLShaders.h"
#include "GrGpuGLShaders2.h"
-GrGpu* GrGpu::Create(Engine engine, Platform3DContext context3D) {
+GrGpu* GrGpu::Create(GrEngine engine, GrPlatform3DContext context3D) {
- if (kOpenGL_Shaders_Engine == engine ||
- kOpenGL_Fixed_Engine == engine) {
+ if (kOpenGL_Shaders_GrEngine == engine ||
+ kOpenGL_Fixed_GrEngine == engine) {
// If no GL bindings have been installed, fall-back to calling the
// GL functions that have been linked with the executable.
if (!GrGLGetGLInterface()) {
@@ -46,7 +46,7 @@
GrGpu* gpu = NULL;
switch (engine) {
- case kOpenGL_Shaders_Engine:
+ case kOpenGL_Shaders_GrEngine:
GrAssert(NULL == context3D);
{
#if GR_USE_NEW_GLSHADERS
@@ -56,11 +56,11 @@
#endif
}
break;
- case kOpenGL_Fixed_Engine:
+ case kOpenGL_Fixed_GrEngine:
GrAssert(NULL == context3D);
gpu = new GrGpuGLFixed;
break;
- case kDirect3D9_Engine:
+ case kDirect3D9_GrEngine:
GrAssert(NULL != context3D);
#if GR_WIN32_BUILD
// gpu = new GrGpuD3D9((IDirect3DDevice9*)context3D);
diff --git a/gpu/src/GrTexture.cpp b/gpu/src/GrTexture.cpp
index e9ec4e6..8ee531c 100644
--- a/gpu/src/GrTexture.cpp
+++ b/gpu/src/GrTexture.cpp
@@ -16,6 +16,7 @@
#include "GrTexture.h"
#include "GrContext.h"
+#include "GrGpu.h"
bool GrRenderTarget::readPixels(int left, int top, int width, int height,
GrPixelConfig config, void* buffer) {