diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 00:18:47 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 00:18:47 +0000 |
commit | 2976fe30ed9e0454b0995456e64a5ef7ae216df8 (patch) | |
tree | 5194cf65778a90b5a277df3d635b8164da39bb50 /o3d/converter | |
parent | c874da66d375909e04eb2a0aba669b162c41faba (diff) | |
download | chromium_src-2976fe30ed9e0454b0995456e64a5ef7ae216df8.zip chromium_src-2976fe30ed9e0454b0995456e64a5ef7ae216df8.tar.gz chromium_src-2976fe30ed9e0454b0995456e64a5ef7ae216df8.tar.bz2 |
Cleanup Renderer.
I believe there were some mis-understandings
about the code. It's supposed to work
StartRendering();
BeginDraw();
EndDraw();
BeginDraw();
EndDraw();
BeginDraw();
EndDraw();
FinishRendering();
To try to enforce correct usage I separated
some platform dependant stuff from shared
stuff and added a few flags.
Also in this CL I made Texture::GetRenderSurface
not require a pack. This is so I because it feels
cleaner that way but also because I wanted to
use surfaces without a pack to take a screenshot.
Finally I put some screenshot code in for GL.
Also fixed some bugs with locking textures.
1) I thought it was x, y, width, height but it's
actually x1, y1, x2, y2
2) I was using width in places I should have been
using mip_width
Review URL: http://codereview.chromium.org/174199
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/converter')
-rw-r--r-- | o3d/converter/cross/renderer_stub.cc | 10 | ||||
-rw-r--r-- | o3d/converter/cross/renderer_stub.h | 20 | ||||
-rw-r--r-- | o3d/converter/cross/texture_stub.h | 35 |
3 files changed, 31 insertions, 34 deletions
diff --git a/o3d/converter/cross/renderer_stub.cc b/o3d/converter/cross/renderer_stub.cc index 333f72a..691c1ce 100644 --- a/o3d/converter/cross/renderer_stub.cc +++ b/o3d/converter/cross/renderer_stub.cc @@ -73,21 +73,21 @@ void RendererStub::Destroy(void) { DCHECK(false); } -bool RendererStub::BeginDraw(void) { +bool RendererStub::PlatformSpecificBeginDraw(void) { DCHECK(false); return true; } -void RendererStub::EndDraw(void) { +void RendererStub::PlatformSpecificEndDraw(void) { DCHECK(false); } -bool RendererStub::StartRendering(void) { +bool RendererStub::PlatformSpecificStartRendering(void) { DCHECK(false); return true; } -void RendererStub::FinishRendering(void) { +void RendererStub::PlatformSpecificFinishRendering(void) { DCHECK(false); } @@ -178,7 +178,7 @@ StreamBank::Ref RendererStub::CreateStreamBank() { return StreamBank::Ref(new StreamBankStub(service_locator())); } -Bitmap::Ref RendererStub::TakeScreenshot() { +Bitmap::Ref RendererStub::PlatformSpecificTakeScreenshot() { return Bitmap::Ref(); } diff --git a/o3d/converter/cross/renderer_stub.h b/o3d/converter/cross/renderer_stub.h index e6bd1eb..a4bd205 100644 --- a/o3d/converter/cross/renderer_stub.h +++ b/o3d/converter/cross/renderer_stub.h @@ -54,10 +54,6 @@ class RendererStub : public Renderer { virtual void InitCommon(); virtual void UninitCommon(); virtual void Destroy(); - virtual bool BeginDraw(); - virtual void EndDraw(); - virtual bool StartRendering(); - virtual void FinishRendering(); virtual void Resize(int width, int height); virtual void Clear(const Float4 &color, bool color_flag, @@ -79,7 +75,6 @@ class RendererStub : public Renderer { virtual RenderDepthStencilSurface::Ref CreateDepthStencilSurface(int width, int height); virtual StreamBank::Ref CreateStreamBank(); - virtual Bitmap::Ref TakeScreenshot(); ParamCache *CreatePlatformSpecificParamCache(); virtual void SetViewportInPixels(int left, int top, @@ -95,6 +90,21 @@ class RendererStub : public Renderer { explicit RendererStub(ServiceLocator* service_locator); // Overridden from Renderer. + virtual bool PlatformSpecificBeginDraw(); + + // Overridden from Renderer. + virtual void PlatformSpecificEndDraw(); + + // Overridden from Renderer. + virtual bool PlatformSpecificStartRendering(); + + // Overridden from Renderer. + virtual void PlatformSpecificFinishRendering(); + + // Overridden from Renderer. + virtual Bitmap::Ref PlatformSpecificTakeScreenshot(); + + // Overridden from Renderer. virtual void SetBackBufferPlatformSpecific(); // Overridden from Renderer. diff --git a/o3d/converter/cross/texture_stub.h b/o3d/converter/cross/texture_stub.h index b26107a..3a6c74a 100644 --- a/o3d/converter/cross/texture_stub.h +++ b/o3d/converter/cross/texture_stub.h @@ -70,16 +70,6 @@ class Texture2DStub : public Texture2D { int src_pitch) { } - // Returns a RenderSurface object associated with a mip_level of a texture. - // Parameters: - // mip_level: [in] The mip-level of the surface to be returned. - // pack: [in] The pack in which the surface will reside. - // Returns: - // Reference to the RenderSurface object. - virtual RenderSurface::Ref GetRenderSurface(int mip_level, Pack *pack) { - return RenderSurface::Ref(NULL); - } - // Returns the implementation-specific texture handle for this texture. void* GetTextureHandle() const { return NULL; @@ -99,6 +89,11 @@ class Texture2DStub : public Texture2D { // Unlocks this texture and returns it to Stub control. virtual bool Unlock(int level) { return true; } + // Overridden from Texture2D + virtual RenderSurface::Ref PlatformSpecificGetRenderSurface(int mip_level) { + return RenderSurface::Ref(NULL); + } + private: DISALLOW_COPY_AND_ASSIGN(Texture2DStub); }; @@ -131,20 +126,6 @@ class TextureCUBEStub : public TextureCUBE { int src_pitch) { }; - // Returns a RenderSurface object associated with a given cube face and - // mip_level of a texture. - // Parameters: - // face: [in] The cube face from which to extract the surface. - // mip_level: [in] The mip-level of the surface to be returned. - // pack: [in] The pack in which the surface will reside. - // Returns: - // Reference to the RenderSurface object. - virtual RenderSurface::Ref GetRenderSurface(CubeFace face, - int level, - Pack* pack) { - return RenderSurface::Ref(NULL); - } - // Returns the implementation-specific texture handle for this texture. void* GetTextureHandle() const { return NULL; @@ -165,6 +146,12 @@ class TextureCUBEStub : public TextureCUBE { // Unlocks the image buffer of a given face and mipmap level. virtual bool Unlock(CubeFace face, int level) { return true; } + // Overridden from TextureCUBE + virtual RenderSurface::Ref PlatformSpecificGetRenderSurface(CubeFace face, + int mip_level) { + return RenderSurface::Ref(NULL); + } + private: DISALLOW_COPY_AND_ASSIGN(TextureCUBEStub); }; |