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

Unified Diff: components/test_runner/test_plugin.cc

Issue 1817323003: Revert of Remove create/delete methods from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@complex-casts
Patch Set: Created 4 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 | « components/test_runner/test_plugin.h ('k') | gpu/blink/webgraphicscontext3d_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_plugin.cc
diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc
index f840ecaf919783659b4924e902b619c7fb20c669..155fd6bb592587223039c766fde7e87968d6fc81 100644
--- a/components/test_runner/test_plugin.cc
+++ b/components/test_runner/test_plugin.cc
@@ -39,7 +39,7 @@
namespace {
-void PremultiplyAlpha(const uint8_t color_in[3],
+void PremultiplyAlpha(const unsigned color_in[3],
float alpha,
float color_out[4]) {
for (int i = 0; i < 3; ++i)
@@ -334,7 +334,7 @@
// FIXME: This method should already exist. Use it.
// For now just parse primary colors.
-void TestPlugin::ParseColor(const blink::WebString& string, uint8_t color[3]) {
+void TestPlugin::ParseColor(const blink::WebString& string, unsigned color[3]) {
color[0] = color[1] = color[2] = 0;
if (string == "black")
return;
@@ -359,14 +359,14 @@
}
bool TestPlugin::InitScene() {
- if (!gl_)
+ if (!context_)
return true;
float color[4];
PremultiplyAlpha(scene_.background_color, scene_.opacity, color);
- gl_->GenTextures(1, &color_texture_);
- gl_->GenFramebuffers(1, &framebuffer_);
+ color_texture_ = context_->createTexture();
+ framebuffer_ = context_->createFramebuffer();
gl_->Viewport(0, 0, rect_.width, rect_.height);
gl_->Disable(GL_DEPTH_TEST);
@@ -423,17 +423,17 @@
scene_.program = 0;
}
if (scene_.vbo) {
- gl_->DeleteBuffers(1, &scene_.vbo);
+ context_->deleteBuffer(scene_.vbo);
scene_.vbo = 0;
}
if (framebuffer_) {
- gl_->DeleteFramebuffers(1, &framebuffer_);
+ context_->deleteFramebuffer(framebuffer_);
framebuffer_ = 0;
}
if (color_texture_) {
- gl_->DeleteTextures(1, &color_texture_);
+ context_->deleteTexture(color_texture_);
color_texture_ = 0;
}
}
@@ -464,7 +464,7 @@
bool TestPlugin::InitPrimitive() {
DCHECK_EQ(scene_.primitive, PrimitiveTriangle);
- gl_->GenBuffers(1, &scene_.vbo);
+ scene_.vbo = context_->createBuffer();
if (!scene_.vbo)
return false;
@@ -496,8 +496,8 @@
gl_->DrawArrays(GL_TRIANGLES, 0, 3);
}
-GLuint TestPlugin::LoadShader(GLenum type, const std::string& source) {
- GLuint shader = gl_->CreateShader(type);
+unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) {
+ unsigned shader = gl_->CreateShader(type);
if (shader) {
context_->shaderSource(shader, source.data());
gl_->CompileShader(shader);
@@ -512,11 +512,11 @@
return shader;
}
-GLuint TestPlugin::LoadProgram(const std::string& vertex_source,
- const std::string& fragment_source) {
- GLuint vertex_shader = LoadShader(GL_VERTEX_SHADER, vertex_source);
- GLuint fragment_shader = LoadShader(GL_FRAGMENT_SHADER, fragment_source);
- GLuint program = gl_->CreateProgram();
+unsigned TestPlugin::LoadProgram(const std::string& vertex_source,
+ const std::string& fragment_source) {
+ unsigned vertex_shader = LoadShader(GL_VERTEX_SHADER, vertex_source);
+ unsigned fragment_shader = LoadShader(GL_FRAGMENT_SHADER, fragment_source);
+ unsigned program = gl_->CreateProgram();
if (vertex_shader && fragment_shader && program) {
gl_->AttachShader(program, vertex_shader);
gl_->AttachShader(program, fragment_shader);
« no previous file with comments | « components/test_runner/test_plugin.h ('k') | gpu/blink/webgraphicscontext3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698