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

Unified Diff: services/js/modules/gl/context.cc

Issue 788863003: Restore the JS Spinning Cube demo (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changes per review feedback Created 6 years 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 | « services/js/modules/gl/context.h ('k') | services/js/modules/gl/module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/js/modules/gl/context.cc
diff --git a/services/js/modules/gl/context.cc b/services/js/modules/gl/context.cc
index 61450ef9c01e1a59f8dc464494f09b218dc0e786..5a476a6771c87591880d931fd86ccf131b07811b 100644
--- a/services/js/modules/gl/context.cc
+++ b/services/js/modules/gl/context.cc
@@ -5,11 +5,14 @@
#include "services/js/modules/gl/context.h"
#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include "base/bind.h"
#include "gin/arguments.h"
#include "gin/array_buffer.h"
#include "gin/object_template_builder.h"
#include "gin/per_context_data.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "mojo/public/c/gles2/gles2.h"
#include "mojo/public/cpp/environment/environment.h"
@@ -140,6 +143,7 @@ gin::ObjectTemplateBuilder Context::GetObjectTemplateBuilder(
.SetMethod("getShaderInfoLog", GetShaderInfoLog)
.SetMethod("getUniformLocation", GetUniformLocation)
.SetMethod("linkProgram", glLinkProgram)
+ .SetMethod("resize", base::Bind(&Context::Resize, base::Unretained(this)))
.SetMethod("shaderSource", ShaderSource)
.SetMethod("swapBuffers", MojoGLES2SwapBuffers)
.SetMethod("uniformMatrix4fv", UniformMatrix4fv)
@@ -165,6 +169,13 @@ Context::~Context() {
MojoGLES2DestroyContext(context_);
}
+void Context::Resize(GLuint width, GLuint height, GLfloat scale_factor) {
+ static_cast<gpu::gles2::GLES2Interface*>(
+ MojoGLES2GetGLES2Interface(context_))->ResizeCHROMIUM(width,
+ height,
+ scale_factor);
+}
+
void Context::ContextLost() {
if (!runner_)
return;
« no previous file with comments | « services/js/modules/gl/context.h ('k') | services/js/modules/gl/module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698