diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-01-18 20:57:22 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-01-18 20:57:22 +0000 |
commit | 2e7b43d33cc495663cb814a7a9d1ecdc09c31828 (patch) | |
tree | 10d01113bbac30d6e3b121d4a9ab5552a6567fd6 /gpu/include | |
parent | 44b2c73ca6358ba9c4a413d7b39db7991612a6a2 (diff) |
Remove notion of default rendertarget. This doesn't map well to usage patterns outside sample app. Make binding between SkGpuDevice and a GrRenderTarget more explicit. Create method on GrContext to wrap the current target in the 3D API with a GrRenderTarget.
git-svn-id: http://skia.googlecode.com/svn/trunk@706 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/include')
-rw-r--r-- | gpu/include/GrContext.h | 17 | ||||
-rw-r--r-- | gpu/include/GrGpu.h | 26 |
2 files changed, 25 insertions, 18 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index a9316957cb..905fe50411 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -41,7 +41,7 @@ public: * Helper to create a opengl-shader based context
*/
static GrContext* CreateGLShaderContext();
-
+
virtual ~GrContext();
/**
@@ -115,6 +115,19 @@ public: int width, int height);
/**
+ * Reads the current target object (e.g. FBO or IDirect3DSurface9*) and
+ * viewport state from the underlying 3D API and wraps it in a
+ * GrRenderTarget. The GrRenderTarget will not attempt to delete/destroy the
+ * underlying object in its destructor and it is up to caller to guarantee
+ * that it remains valid while the GrRenderTarget is used.
+ *
+ * @return the newly created GrRenderTarget
+ */
+ GrRenderTarget* createRenderTargetFrom3DApiState() {
+ return fGpu->createRenderTargetFrom3DApiState();
+ }
+
+ /**
* Returns true if the specified use of an indexed texture is supported.
*/
bool supportsIndex8PixelConfig(const GrSamplerState&, int width, int height);
@@ -126,8 +139,6 @@ public: const GrClip& getClip() const { return fGpu->getClip(); }
void setRenderTarget(GrRenderTarget* target);
- void setDefaultRenderTargetSize(uint32_t width, uint32_t height);
- GrRenderTarget* defaultRenderTarget() { return fGpu->defaultRenderTarget(); }
void setTexture(int stage, GrTexture* texture);
void setSamplerState(int stage, const GrSamplerState&);
diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h index f1fdf01d50..6cbe53e698 100644 --- a/gpu/include/GrGpu.h +++ b/gpu/include/GrGpu.h @@ -197,6 +197,17 @@ public: int width, int height) = 0; /** + * Reads the current target object (e.g. FBO or IDirect3DSurface9*) and + * viewport state from the underlying 3D API and wraps it in a + * GrRenderTarget. The GrRenderTarget will not attempt to delete/destroy the + * underlying object in its destructor and it is up to caller to guarantee + * that it remains valid while the GrRenderTarget is used. + * + * @return the newly created GrRenderTarget + */ + virtual GrRenderTarget* createRenderTargetFrom3DApiState() = 0; + + /** * Creates a vertex buffer. * * @param size size in bytes of the vertex buffer @@ -221,21 +232,6 @@ public: virtual GrIndexBuffer* createIndexBuffer(uint32_t size, bool dynamic) = 0; /** - * Gets the default render target. This is the render target set in the - * 3D API at the time the GrGpu was created. - */ - virtual GrRenderTarget* defaultRenderTarget() = 0; - - /** - * At construction time the GrGpu infers the render target and viewport from - * the state of the underlying 3D API. However, a platform-specific resize - * event may occur. - * @param width new width of the default rendertarget - * @param height new height of the default rendertarget - */ - virtual void setDefaultRenderTargetSize(uint32_t width, uint32_t height) = 0; - - /** * Erase the entire render target, ignoring any clips/scissors. * * This is issued to the GPU driver immediately. |