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

Unified Diff: mojo/apps/js/main.js

Issue 131153007: Send size to NativeViewportClient::OnCreated instead of GLES2Client::DidCreateContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix various issues Created 6 years, 11 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 | « mojo/apps/js/bindings/gl/context.cc ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/apps/js/main.js
diff --git a/mojo/apps/js/main.js b/mojo/apps/js/main.js
index 9ca9e9d4c7f3bd076aae146d56126920bb781364..1a1596700fbc68af323907963839dc4c2bfeabef 100644
--- a/mojo/apps/js/main.js
+++ b/mojo/apps/js/main.js
@@ -295,9 +295,15 @@ define([
this.remote_ = remote;
var pipe = core.createMessagePipe();
- new GLES2ClientImpl(pipe.handle0);
-
- this.remote_.open();
+ this.gles2_ = new GLES2ClientImpl(pipe.handle0);
+
+ var rect = new nativeViewport.Rect;
+ rect.position = new nativeViewport.Point;
+ rect.size = new nativeViewport.Size;
+ rect.size.width = 800;
+ rect.size.height = 600;
+ this.remote_.create(rect);
+ this.remote_.show();
this.remote_.createGLES2Context(pipe.handle1);
}
NativeViewportClientImpl.prototype =
@@ -306,10 +312,11 @@ define([
NativeViewportClientImpl.prototype.onCreated = function() {
console.log('NativeViewportClientImpl.prototype.OnCreated');
};
- NativeViewportClientImpl.prototype.didOpen = function() {
- console.log('NativeViewportClientImpl.prototype.DidOpen');
- };
+ NativeViewportClientImpl.prototype.onBoundsChanged = function(bounds) {
+ console.log('NativeViewportClientImpl.prototype.OnBoundsChanged');
+ this.gles2_.setDimensions(bounds.size);
+ }
function GLES2ClientImpl(remotePipe) {
this.gl_ = new gljs.Context(remotePipe, this.didCreateContext.bind(this));
@@ -317,9 +324,7 @@ define([
this.angle_ = 45;
}
- GLES2ClientImpl.prototype.didCreateContext = function(width, height) {
- this.width_ = width;
- this.height_ = height;
+ GLES2ClientImpl.prototype.didCreateContext = function() {
this.program_ = loadProgram(this.gl_);
this.positionLocation_ =
this.gl_.getAttribLocation(this.program_, 'a_position');
@@ -333,7 +338,14 @@ define([
this.timer_ = timer.createRepeating(16, this.handleTimer.bind(this));
};
+ GLES2ClientImpl.prototype.setDimensions = function(size) {
+ this.width_ = size.width;
+ this.height_ = size.height;
+ }
+
GLES2ClientImpl.prototype.drawCube = function() {
+ if (!this.width_ || !this.height_)
+ return;
this.gl_.viewport(0, 0, this.width_, this.height_);
this.gl_.clear(this.gl_.COLOR_BUFFER_BIT);
this.gl_.useProgram(this.program_);
« no previous file with comments | « mojo/apps/js/bindings/gl/context.cc ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698