summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 19:50:29 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 19:50:29 +0000
commit16f5c4de8b926dc889859cfff03c9328edb60a5c (patch)
treec6d7a6f51973164ae28ff3157f0cf6356736c1d7 /o3d/plugin
parentc890e98205d97b57534f2eac00618a2864d61bb5 (diff)
downloadchromium_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/plugin')
-rw-r--r--o3d/plugin/cross/plugin_main.h6
-rw-r--r--o3d/plugin/idl/client.idl24
2 files changed, 23 insertions, 7 deletions
diff --git a/o3d/plugin/cross/plugin_main.h b/o3d/plugin/cross/plugin_main.h
index e0af989..8528571 100644
--- a/o3d/plugin/cross/plugin_main.h
+++ b/o3d/plugin/cross/plugin_main.h
@@ -30,9 +30,9 @@
*/
-#ifndef TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H__
-#define TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H__
+#ifndef TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H_
+#define TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H_
#include "plugin/cross/o3d_glue.h"
-#endif // TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H__
+#endif // TOOLS_IDLGLUE_NG_O3D_GLUE_PLUGIN_MAIN_H_
diff --git a/o3d/plugin/idl/client.idl b/o3d/plugin/idl/client.idl
index a635508..fb36b53 100644
--- a/o3d/plugin/idl/client.idl
+++ b/o3d/plugin/idl/client.idl
@@ -486,11 +486,21 @@ class Client {
void InvalidateAllParameters();
%[
- This function is only available in the test version of the plugin.
- \param file_name Name to save screenshot to.
- \return True on success.
+ Gets a copy of the current backbuffer of O3D as a data: url.
+
+ NOTE: Calling it will cause a render to happen.
+
+ \return A Data URL for the backbuffer.
+ %]
+ String ToDataURL();
+
+ %[
+ Gets a copy of the current backbuffer of O3D as a data: url.
+ \param mime_type The type of data url you want. Currently O3D only supports
+ image/png. See HTML5 canvas tag for info about toDataURL.
+ \return A Data URL for the backbuffer.
%]
- bool SaveScreen(String file_name);
+ [userglue] String ToDataURL(String mime_type);
%[
Returns the status of initializing the renderer so we can display the
@@ -585,6 +595,12 @@ class Client {
&modes);
return modes;
}
+ o3d::String userglue_method_ToDataURL(o3d::Client* self,
+ const o3d::String& mime_type) {
+ // We ignore the mime_type since it's only a suggestion
+ // and we only return the required image/png type.
+ return self->ToDataURL();
+ }
void userglue_method_SetFullscreenClickRegion(
void *plugin_data, o3d::Client *self, int x, int y, int width,
int height, int mode_id) {