summaryrefslogtreecommitdiffstats
path: root/o3d/converter
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 19:57:05 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 19:57:05 +0000
commit0deb232d6da6dd26a81dde183effaa19db6bf7cd (patch)
tree4169d5c337e38e951ef3ebe9260794e809b43867 /o3d/converter
parent3c4a6a0b4fffab0126603e207e32632cba40879f (diff)
downloadchromium_src-0deb232d6da6dd26a81dde183effaa19db6bf7cd.zip
chromium_src-0deb232d6da6dd26a81dde183effaa19db6bf7cd.tar.gz
chromium_src-0deb232d6da6dd26a81dde183effaa19db6bf7cd.tar.bz2
Fixes toDataURL for GL by making it all work through
O3D. What happens is client.toDataURL creates a RenderSurface and DepthSurface, sets those as the current Surface then renders. It then calls Surface::GetBitmap to get the pixels in the bitmap. The complications are 1) I needed to make Renderer::StartRendering / Renderer::FinishRendering be nestable because the Renderer::SetRenderSurface required StartRendering to already have been called. I didn't see a cleaner way to do this but I'm happy to change it if you have a better idea. 2) Since we can only create POT RenderSurfaces I added a clip_width / clip_height to render surfaces. Renderer::SetViewport uses these values so we end up rendering correctly to the top/left area of the POT render surface. 3) Doing it this way means that screenshots are NOT anti-aliased. I feel like that issue can be handled later. It's more important that toDataURL work now than it have the ultimate best results. (I hope). It probably means I'll need to create all new reference images. 4) I was wondering we we should expose SetClipWidth to JavaScript. Given that we require POT render surfaces they should always get the same results on all hardware. Or, rather, we could just allow the user to create NPOT RenderSurfaces. Under the hood they'd get a POT surface but the clip_width/clip_height would be set to the size the requested. There would have to be a note that texture wrapping only works if the size if POT. 5) I had to split FinishRendering into FinishRendering and Present since when taking a screenshot nothing will be drawn to the backbuffer and so I don't want a present to happen. Review URL: http://codereview.chromium.org/174594 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/converter')
-rw-r--r--o3d/converter/cross/renderer_stub.cc24
-rw-r--r--o3d/converter/cross/renderer_stub.h28
2 files changed, 24 insertions, 28 deletions
diff --git a/o3d/converter/cross/renderer_stub.cc b/o3d/converter/cross/renderer_stub.cc
index 691c1ce..2801470 100644
--- a/o3d/converter/cross/renderer_stub.cc
+++ b/o3d/converter/cross/renderer_stub.cc
@@ -95,25 +95,22 @@ void RendererStub::Resize(int, int) {
DCHECK(false);
}
-void RendererStub::Clear(const Float4 &, bool, float, bool, int, bool) {
+void RendererStub::PlatformSpecificClear(
+ const Float4 &, bool, float, bool, int, bool) {
DCHECK(false);
}
-void RendererStub::RenderElement(Element *,
- DrawElement *,
- Material *,
- ParamObject *,
- ParamCache *) {
+void RendererStub::SetRenderSurfacesPlatformSpecific(
+ const RenderSurface* surface,
+ const RenderDepthStencilSurface* surface_depth) {
DCHECK(false);
}
-void RendererStub::SetRenderSurfacesPlatformSpecific(
- RenderSurface* surface,
- RenderDepthStencilSurface* surface_depth) {
+void RendererStub::SetBackBufferPlatformSpecific() {
DCHECK(false);
}
-void RendererStub::SetBackBufferPlatformSpecific() {
+void RendererStub::ApplyDirtyStates() {
DCHECK(false);
}
@@ -178,10 +175,6 @@ StreamBank::Ref RendererStub::CreateStreamBank() {
return StreamBank::Ref(new StreamBankStub(service_locator()));
}
-Bitmap::Ref RendererStub::PlatformSpecificTakeScreenshot() {
- return Bitmap::Ref();
-}
-
ParamCache *RendererStub::CreatePlatformSpecificParamCache(void) {
return new ParamCacheStub;
}
@@ -190,6 +183,9 @@ void RendererStub::SetViewportInPixels(int, int, int, int, float, float) {
DCHECK(false);
}
+void RendererStub::PlatformSpecificPresent(void) {
+}
+
const int* RendererStub::GetRGBAUByteNSwizzleTable() {
static int swizzle_table[] = { 0, 1, 2, 3, };
return swizzle_table;
diff --git a/o3d/converter/cross/renderer_stub.h b/o3d/converter/cross/renderer_stub.h
index a4bd205..3f0c413 100644
--- a/o3d/converter/cross/renderer_stub.h
+++ b/o3d/converter/cross/renderer_stub.h
@@ -55,17 +55,6 @@ class RendererStub : public Renderer {
virtual void UninitCommon();
virtual void Destroy();
virtual void Resize(int width, int height);
- virtual void Clear(const Float4 &color,
- bool color_flag,
- float depth,
- bool depth_flag,
- int stencil,
- bool stencil_flag);
- virtual void RenderElement(Element* element,
- DrawElement* draw_element,
- Material* material,
- ParamObject* override,
- ParamCache* param_cache);
virtual Primitive::Ref CreatePrimitive();
virtual DrawElement::Ref CreateDrawElement();
virtual VertexBuffer::Ref CreateVertexBuffer();
@@ -102,15 +91,26 @@ class RendererStub : public Renderer {
virtual void PlatformSpecificFinishRendering();
// Overridden from Renderer.
- virtual Bitmap::Ref PlatformSpecificTakeScreenshot();
+ virtual void PlatformSpecificPresent();
+
+ // Overridden from Renderer.
+ virtual void PlatformSpecificClear(const Float4 &color,
+ bool color_flag,
+ float depth,
+ bool depth_flag,
+ int stencil,
+ bool stencil_flag);
// Overridden from Renderer.
virtual void SetBackBufferPlatformSpecific();
// Overridden from Renderer.
+ virtual void ApplyDirtyStates();
+
+ // Overridden from Renderer.
virtual void SetRenderSurfacesPlatformSpecific(
- RenderSurface* surface,
- RenderDepthStencilSurface* depth_surface);
+ const RenderSurface* surface,
+ const RenderDepthStencilSurface* depth_surface);
// Overridden from Renderer.
virtual Texture2D::Ref CreatePlatformSpecificTexture2D(