diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-08 19:50:29 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-08 19:50:29 +0000 |
commit | 16f5c4de8b926dc889859cfff03c9328edb60a5c (patch) | |
tree | c6d7a6f51973164ae28ff3157f0cf6356736c1d7 /o3d/converter | |
parent | c890e98205d97b57534f2eac00618a2864d61bb5 (diff) | |
download | chromium_src-16f5c4de8b926dc889859cfff03c9328edb60a5c.zip chromium_src-16f5c4de8b926dc889859cfff03c9328edb60a5c.tar.gz chromium_src-16f5c4de8b926dc889859cfff03c9328edb60a5c.tar.bz2 |
This CL adds client.toDataURL which gets the contents
of the client area as a data url (which is a base64
encoded string of a png file)
data urls are part of the HTML5 standard and supported
by firefox, safari and chrome.
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-canvas-todataurl
That means you can now do this
var dataURL = client.toDataURL();
// make an IMG tag display the screenshot
someImgTag.src = dataURL;
// use the IMG tag to draw into a canvas
someCanvasContext.drawImage(someImageTag, ...);
It also means there is no need for the test builds
anymore "test-dbg-d3d", "test-opt-d3d" etc as
toDataURL is part of the public API and can
therefore always be used to take screenshots
in any build.
I updated the selenium code to use it.
There are a few issues:
1) The GL version has the same limitations as taking
a screenshot before. Namely that the client area
must be on screen. We need to fix this.
2) We need to add support for origin-clean. See
https://tracker.corp.google.com/story/show/180334
Review URL: http://codereview.chromium.org/164130
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/converter')
-rw-r--r-- | o3d/converter/cross/renderer_stub.cc | 5 | ||||
-rw-r--r-- | o3d/converter/cross/renderer_stub.h | 8 | ||||
-rw-r--r-- | o3d/converter/cross/texture_stub.h | 6 |
3 files changed, 9 insertions, 10 deletions
diff --git a/o3d/converter/cross/renderer_stub.cc b/o3d/converter/cross/renderer_stub.cc index c53d2d5..9f71be6 100644 --- a/o3d/converter/cross/renderer_stub.cc +++ b/o3d/converter/cross/renderer_stub.cc @@ -196,9 +196,8 @@ StreamBank::Ref RendererStub::CreateStreamBank() { return StreamBank::Ref(new StreamBankStub(service_locator())); } -bool RendererStub::SaveScreen(const String &) { - DCHECK(false); - return true; +Bitmap::Ref RendererStub::TakeScreenshot() { + return Bitmap::Ref(); } ParamCache *RendererStub::CreatePlatformSpecificParamCache(void) { diff --git a/o3d/converter/cross/renderer_stub.h b/o3d/converter/cross/renderer_stub.h index afd5d41..9ebc860b 100644 --- a/o3d/converter/cross/renderer_stub.h +++ b/o3d/converter/cross/renderer_stub.h @@ -35,8 +35,8 @@ // can use it for serialization of the scene graph on all systems // without needing graphics. -#ifndef O3D_CONVERTER_CROSS_RENDERER_STUB_H__ -#define O3D_CONVERTER_CROSS_RENDERER_STUB_H__ +#ifndef O3D_CONVERTER_CROSS_RENDERER_STUB_H_ +#define O3D_CONVERTER_CROSS_RENDERER_STUB_H_ #include "core/cross/renderer.h" @@ -79,7 +79,7 @@ class RendererStub : public Renderer { virtual RenderDepthStencilSurface::Ref CreateDepthStencilSurface(int width, int height); virtual StreamBank::Ref CreateStreamBank(); - virtual bool SaveScreen(const String& file_name); + virtual Bitmap::Ref TakeScreenshot(); ParamCache *CreatePlatformSpecificParamCache(); virtual void SetViewportInPixels(int left, int top, @@ -123,4 +123,4 @@ class RendererStub : public Renderer { } // namespace o3d -#endif // O3D_CONVERTER_CROSS_RENDERER_STUB_H__ +#endif // O3D_CONVERTER_CROSS_RENDERER_STUB_H_ diff --git a/o3d/converter/cross/texture_stub.h b/o3d/converter/cross/texture_stub.h index 43888d4..9ded546 100644 --- a/o3d/converter/cross/texture_stub.h +++ b/o3d/converter/cross/texture_stub.h @@ -32,8 +32,8 @@ // This file contains the declarations for Texture2DStub and TextureCUBEStub. -#ifndef O3D_CONVERTER_CROSS_TEXTURE_STUB_H__ -#define O3D_CONVERTER_CROSS_TEXTURE_STUB_H__ +#ifndef O3D_CONVERTER_CROSS_TEXTURE_STUB_H_ +#define O3D_CONVERTER_CROSS_TEXTURE_STUB_H_ #include "core/cross/bitmap.h" #include "core/cross/texture.h" @@ -175,4 +175,4 @@ class TextureCUBEStub : public TextureCUBE { } // namespace o3d -#endif // O3D_CONVERTER_CROSS_TEXTURE_STUB_H__ +#endif // O3D_CONVERTER_CROSS_TEXTURE_STUB_H_ |