| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/test_runner/test_plugin.h" | 5 #include "components/test_runner/test_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 gl_->UseProgram(scene_.program); | 484 gl_->UseProgram(scene_.program); |
| 485 | 485 |
| 486 // Bind primitive color. | 486 // Bind primitive color. |
| 487 float color[4]; | 487 float color[4]; |
| 488 PremultiplyAlpha(scene_.primitive_color, scene_.opacity, color); | 488 PremultiplyAlpha(scene_.primitive_color, scene_.opacity, color); |
| 489 gl_->Uniform4f(scene_.color_location, color[0], color[1], color[2], color[3]); | 489 gl_->Uniform4f(scene_.color_location, color[0], color[1], color[2], color[3]); |
| 490 | 490 |
| 491 // Bind primitive vertices. | 491 // Bind primitive vertices. |
| 492 gl_->BindBuffer(GL_ARRAY_BUFFER, scene_.vbo); | 492 gl_->BindBuffer(GL_ARRAY_BUFFER, scene_.vbo); |
| 493 gl_->EnableVertexAttribArray(scene_.position_location); | 493 gl_->EnableVertexAttribArray(scene_.position_location); |
| 494 context_->vertexAttribPointer( | 494 gl_->VertexAttribPointer(scene_.position_location, 3, GL_FLOAT, GL_FALSE, 0, |
| 495 scene_.position_location, 3, GL_FLOAT, GL_FALSE, 0, 0); | 495 nullptr); |
| 496 gl_->DrawArrays(GL_TRIANGLES, 0, 3); | 496 gl_->DrawArrays(GL_TRIANGLES, 0, 3); |
| 497 } | 497 } |
| 498 | 498 |
| 499 unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) { | 499 unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) { |
| 500 unsigned shader = gl_->CreateShader(type); | 500 unsigned shader = gl_->CreateShader(type); |
| 501 if (shader) { | 501 if (shader) { |
| 502 context_->shaderSource(shader, source.data()); | 502 context_->shaderSource(shader, source.data()); |
| 503 gl_->CompileShader(shader); | 503 gl_->CompileShader(shader); |
| 504 | 504 |
| 505 int compiled = 0; | 505 int compiled = 0; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 return kPluginPersistsMimeType; | 723 return kPluginPersistsMimeType; |
| 724 } | 724 } |
| 725 | 725 |
| 726 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 726 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
| 727 return mime_type == TestPlugin::MimeType() || | 727 return mime_type == TestPlugin::MimeType() || |
| 728 mime_type == PluginPersistsMimeType() || | 728 mime_type == PluginPersistsMimeType() || |
| 729 mime_type == CanCreateWithoutRendererMimeType(); | 729 mime_type == CanCreateWithoutRendererMimeType(); |
| 730 } | 730 } |
| 731 | 731 |
| 732 } // namespace test_runner | 732 } // namespace test_runner |
| OLD | NEW |