diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 00:07:49 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 00:07:49 +0000 |
commit | 8653167fd370f88b3bcc2be052a9aa26873dbe44 (patch) | |
tree | 602e188104e6d3992adac469f17d5c1605690f73 /o3d/core/cross/bitmap.h | |
parent | c1b7f06be387b3828d38eccbf0e88d1ec71bac3b (diff) | |
download | chromium_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/core/cross/bitmap.h')
-rw-r--r-- | o3d/core/cross/bitmap.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/o3d/core/cross/bitmap.h b/o3d/core/cross/bitmap.h index 2188fc9c..4710cb6 100644 --- a/o3d/core/cross/bitmap.h +++ b/o3d/core/cross/bitmap.h @@ -149,6 +149,11 @@ class Bitmap : public ParamObject { // level: mip level to get.
uint8 *GetMipData(unsigned int level) const;
+ // Gets the address of a particular pixel.
+ // Parameters:
+ // level: mip level to get.
+ uint8 *GetPixelData(unsigned int level, unsigned int x, unsigned int y) const;
+
// Gets the size of mip.
size_t GetMipSize(unsigned int level) const;
@@ -208,16 +213,20 @@ class Bitmap : public ParamObject { // and dest do not match.
// Parameters:
// source_img: source bitmap which would be drawn.
+ // source_level: level to draw.
// source_x: x-coordinate of the starting pixel in the source image.
// source_x: y-coordinate of the starting pixel in the source image.
// source_width: width of the source image to draw.
// source_height: Height of the source image to draw.
+ // dest_level: level to target.
// dest_x: x-coordinate of the starting pixel in the dest image.
// dest_y: y-coordinate of the starting pixel in the dest image.
// dest_width: width of the dest image to draw.
// dest_height: height of the dest image to draw.
- void DrawImage(const Bitmap& source_img, int source_x, int source_y,
+ void DrawImage(const Bitmap& source_img, int source_level,
+ int source_x, int source_y,
int source_width, int source_height,
+ int dest_level,
int dest_x, int dest_y,
int dest_width, int dest_height);
@@ -296,6 +305,9 @@ class Bitmap : public ParamObject { return GetMipChainSize(image::ComputeMipMapCount(width_, height_));
}
+ static size_t ComputeMaxSize(
+ unsigned width, unsigned height, Texture::Format format);
+
// pointer to the raw bitmap data
// NOTE: image_data_ is either NULL or it has space for the maximum number
// of mips for the current size bitmap, even if they are not used.
|