summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 00:07:49 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 00:07:49 +0000
commit8653167fd370f88b3bcc2be052a9aa26873dbe44 (patch)
tree602e188104e6d3992adac469f17d5c1605690f73 /o3d/plugin
parentc1b7f06be387b3828d38eccbf0e88d1ec71bac3b (diff)
downloadchromium_src-8653167fd370f88b3bcc2be052a9aa26873dbe44.zip
chromium_src-8653167fd370f88b3bcc2be052a9aa26873dbe44.tar.gz
chromium_src-8653167fd370f88b3bcc2be052a9aa26873dbe44.tar.bz2
expose Bitmap to JavaScript.
Also added Texture.drawImage(canvas...) There's still the big question of whether we should flip textures by default in the o3d code. Currently I'm flipping them by default in o3djs.texture.createTextureFromRawData and I'm flipping them by default in o3djs.canvas.CanvasQuad.updateTexture. I'm torn whether or not I should be flipping them. I feel like 2d examples and examples of displaying images, like a picasa viewer, would be simpler if we didn't flip by default but the problem then is if you load some textures through a collada scene they'll be flipped the opposite of any textures you load by hand. Review URL: http://codereview.chromium.org/171060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/idl/param.idl2
-rw-r--r--o3d/plugin/idl/texture.idl128
2 files changed, 104 insertions, 26 deletions
diff --git a/o3d/plugin/idl/param.idl b/o3d/plugin/idl/param.idl
index e57f8fe..49aa369 100644
--- a/o3d/plugin/idl/param.idl
+++ b/o3d/plugin/idl/param.idl
@@ -316,7 +316,7 @@ typedef Param[] ParamVector;
%[
A Param which stores a DrawList.
%]
-[nocpp, include="core/cross/param.h"] class ParamDrawList : Param {
+[nocpp, include="core/cross/draw_context.h"] class ParamDrawList : Param {
%[
The DrawList stored by the Param.
%]
diff --git a/o3d/plugin/idl/texture.idl b/o3d/plugin/idl/texture.idl
index dcaf4e7..0cd27c0 100644
--- a/o3d/plugin/idl/texture.idl
+++ b/o3d/plugin/idl/texture.idl
@@ -242,34 +242,74 @@ namespace o3d {
Copy pixels from source bitmap to certain mip level.
Scales if the width and height of source and dest do not match.
- \param source_img source bitmap which would be drawn.
+ \param source_img The source bitmap.
+ \param source_mip which mip from the source to copy from.
\param source_x x-coordinate of the starting pixel in the source image.
\param source_y y-coordinate of the starting pixel in the source image.
\param source_width width of the source image to draw.
\param source_height Height of the source image to draw.
- \param dest_x x-coordinate of the starting pixel in the dest image.
- \param dest_y y-coordinate of the starting pixel in the dest image.
+ \param dest_mip on which mip level to draw to.
+ \param dest_x x-coordinate of the starting pixel in the destination texture.
+ \param dest_y y-coordinate of the starting pixel in the destination texture.
\param dest_width width of the dest image.
\param dest_height height of the dest image.
- \param dest_mip on which mip level the sourceImg would be drawn.
%]
[userglue]
- void DrawImage(Bitmap source_img, int source_x, int source_y,
+ void DrawImage(Bitmap source_img, int source_mip,
+ int source_x, int source_y,
int source_width, int source_height,
+ int dest_mip,
int dest_x, int dest_y,
- int dest_width, int dest_height, int dest_mip);
+ int dest_width, int dest_height);
+
+ %[
+ Copy pixels from source canvas to certain mip level.
+ Scales if the width and height of source and dest do not match.
+
+ \param source_img The source canvas.
+ \param source_x x-coordinate of the starting pixel in the source image.
+ \param source_y y-coordinate of the starting pixel in the source image.
+ \param source_width width of the source image to draw.
+ \param source_height Height of the source image to draw.
+ \param dest_mip on which mip level to draw to.
+ \param dest_x x-coordinate of the starting pixel in the destination texture.
+ \param dest_y y-coordinate of the starting pixel in the destination texture.
+ \param dest_width width of the dest image.
+ \param dest_height height of the dest image.
+ %]
+ [userglue, include="core/cross/canvas.h"]
+ void DrawImage(Canvas source_img,
+ int source_x, int source_y,
+ int source_width, int source_height,
+ int dest_mip,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height);
+
[verbatim=cpp_glue] %{
void userglue_method_DrawImage(
o3d::Texture2D* self,
- o3d::Bitmap* source_img, int source_x, int source_y,
+ o3d::Bitmap* source_img, int source_mip, int source_x, int source_y,
+ int source_width, int source_height,
+ int dest_mip,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height) {
+ self->DrawImage(*source_img, source_mip, source_x, source_y,
+ source_width, source_height,
+ dest_mip, dest_x, dest_y,
+ dest_width, dest_height);
+ }
+ void userglue_method_DrawImage(
+ o3d::Texture2D* self,
+ o3d::Canvas* source_img, int source_x, int source_y,
int source_width, int source_height,
+ int dest_mip,
int dest_x, int dest_y,
- int dest_width, int dest_height, int dest_mip) {
+ int dest_width, int dest_height) {
self->DrawImage(*source_img, source_x, source_y,
source_width, source_height,
- dest_x, dest_y,
- dest_width, dest_height, dest_mip);
+ dest_mip, dest_x, dest_y,
+ dest_width, dest_height);
}
%}
}; // Texture2D
@@ -402,40 +442,78 @@ namespace o3d {
%}
%[
- Copy pixels from source bitmap to certain mip level.
+ Copy pixels from source bitmap to certain face and mip level.
Scales if the width and height of source and dest do not match.
- \param source_img source bitmap which would be drawn.
+ \param source_img The source bitmap.
+ \param source_mip which mip of the source to copy from.
\param source_x x-coordinate of the starting pixel in the source image.
\param source_y y-coordinate of the starting pixel in the source image.
\param source_width width of the source image to draw.
\param source_height Height of the source image to draw.
- \param dest_x x-coordinate of the starting pixel in the dest image.
- \param dest_y y-coordinate of the starting pixel in the dest image.
- \param dest_width width of the dest image.
- \param dest_height height of the dest image.
- \param face on which face the sourceImg would be drawn.
- \param dest_mip on which mip level the sourceImg would be drawn.
+ \param face on which face to draw on.
+ \param dest_mip on which mip level to draw on.
+ \param dest_x x-coordinate of the starting pixel in the destination texture.
+ \param dest_y y-coordinate of the starting pixel in the destination texture.
+ \param dest_width width of the destination image.
+ \param dest_height height of the destination image.
%]
[userglue]
- void DrawImage(Bitmap source_img, int source_x, int source_y,
+ void DrawImage(Bitmap source_img, int source_mip, int source_x, int source_y,
+ int source_width, int source_height,
+ CubeFace face, int dest_mip,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height);
+
+ %[
+ Copy pixels from source canvas to certain face and mip level.
+ Scales if the width and height of source and dest do not match.
+
+ \param source_img The source canvas.
+ \param source_x x-coordinate of the starting pixel in the source image.
+ \param source_y y-coordinate of the starting pixel in the source image.
+ \param source_width width of the source image to draw.
+ \param source_height Height of the source image to draw.
+ \param face on which face to draw on.
+ \param dest_mip on which mip level to draw on.
+ \param dest_x x-coordinate of the starting pixel in the destination texture.
+ \param dest_y y-coordinate of the starting pixel in the destination texture.
+ \param dest_width width of the destination image.
+ \param dest_height height of the destination image.
+ %]
+ [userglue, include="core/cross/canvas.h"]
+ void DrawImage(Canvas source_img, int source_x, int source_y,
int source_width, int source_height,
+ CubeFace face, int dest_mip,
int dest_x, int dest_y,
- int dest_width, int dest_height,
- CubeFace face, int dest_mip);
+ int dest_width, int dest_height);
[verbatim=cpp_glue] %{
void userglue_method_DrawImage(
o3d::TextureCUBE* self,
- o3d::Bitmap* source_img, int source_x, int source_y,
+ o3d::Bitmap* source_img, int source_mip, int source_x, int source_y,
+ int source_width, int source_height,
+ o3d::TextureCUBE::CubeFace dest_face, int dest_mip,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height) {
+ self->DrawImage(*source_img, source_mip, source_x, source_y,
+ source_width, source_height,
+ dest_face, dest_mip,
+ dest_x, dest_y,
+ dest_width, dest_height);
+ }
+ void userglue_method_DrawImage(
+ o3d::TextureCUBE* self,
+ o3d::Canvas* source_img, int source_x, int source_y,
int source_width, int source_height,
+ o3d::TextureCUBE::CubeFace dest_face, int dest_mip,
int dest_x, int dest_y,
- int dest_width, int dest_height,
- o3d::TextureCUBE::CubeFace dest_face, int dest_mip) {
+ int dest_width, int dest_height) {
self->DrawImage(*source_img, source_x, source_y,
source_width, source_height,
+ dest_face, dest_mip,
dest_x, dest_y,
- dest_width, dest_height, dest_face, dest_mip);
+ dest_width, dest_height);
}
%}
}; // TextureCUBE