Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: samples/o3d-webgl/texture.js

Issue 1092003: Fixed a lot of bugs with render surfaces and bitmaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/o3d-webgl/state.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/o3d-webgl/texture.js
===================================================================
--- samples/o3d-webgl/texture.js (revision 41482)
+++ samples/o3d-webgl/texture.js (working copy)
@@ -284,16 +284,6 @@
0, // Level.
bitmap.canvas_,
bitmap.defer_flip_verically_to_texture_);
-
- this.gl.texParameteri(this.gl.TEXTURE_2D,
- this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
- this.gl.texParameteri(this.gl.TEXTURE_2D,
- this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
- this.gl.texParameteri(this.gl.TEXTURE_2D,
- this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
- this.gl.texParameteri(this.gl.TEXTURE_2D,
- this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
-
if (bitmap.defer_mipmaps_to_texture_) {
this.generateMips();
}
@@ -325,7 +315,21 @@
function(source_img, source_mip, source_x, source_y, source_width,
source_height, dest_mip, dest_x, dest_y, dest_width,
dest_height) {
- o3d.notImplemented();
+ var canvas = o3d.Bitmap.getScratchCanvas_();
+ canvas.width = dest_width;
+ canvas.height = dest_height;
+
+ var context = canvas.getContext('2d');
+
+ context.translate(-source_x, -source_y);
+ context.scale(dest_width / source_width,
+ dest_height / source_height);
+
+ context.drawImage(source_img.canvas_,
+ 0, 0, source_img.canvas_.width, source_img.canvas_.height);
+
+ this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture_);
+ this.gl.texSubImage2D(this.gl.TEXTURE_2D, 0, 0, 0, canvas);
};
« no previous file with comments | « samples/o3d-webgl/state.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698