| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gl/gl_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "ui/gl/gl_context.h" | 14 #include "ui/gl/gl_context.h" |
| 15 #include "ui/gl/gl_driver_workarounds.h" |
| 15 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
| 16 #include "ui/gl/gl_state_restorer.h" | 17 #include "ui/gl/gl_state_restorer.h" |
| 17 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 18 #include "ui/gl/gl_switches.h" | 19 #include "ui/gl/gl_switches.h" |
| 19 #include "ui/gl/gl_version_info.h" | 20 #include "ui/gl/gl_version_info.h" |
| 20 | 21 |
| 21 namespace gl { | 22 namespace gl { |
| 22 | 23 |
| 23 // The GL state for when no context is bound | 24 // The GL state for when no context is bound |
| 24 static CurrentGL* g_no_context_current_gl = nullptr; | 25 static CurrentGL* g_no_context_current_gl = nullptr; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 GLenum gl_internal_format = GetInternalFormat(version_.get(), internalformat); | 417 GLenum gl_internal_format = GetInternalFormat(version_.get(), internalformat); |
| 417 GLApiBase::glRenderbufferStorageMultisampleFn( | 418 GLApiBase::glRenderbufferStorageMultisampleFn( |
| 418 target, samples, gl_internal_format, width, height); | 419 target, samples, gl_internal_format, width, height); |
| 419 } | 420 } |
| 420 | 421 |
| 421 void RealGLApi::glClearFn(GLbitfield mask) { | 422 void RealGLApi::glClearFn(GLbitfield mask) { |
| 422 if (!g_null_draw_bindings_enabled) | 423 if (!g_null_draw_bindings_enabled) |
| 423 GLApiBase::glClearFn(mask); | 424 GLApiBase::glClearFn(mask); |
| 424 } | 425 } |
| 425 | 426 |
| 427 void RealGLApi::glClearColorFn(GLclampf red, |
| 428 GLclampf green, |
| 429 GLclampf blue, |
| 430 GLclampf alpha) { |
| 431 if (workarounds::clearToBoundaryValuesIsBroken && (1 == red || 0 == red) && |
| 432 (1 == green || 0 == green) && (1 == blue || 0 == blue) && |
| 433 (1 == alpha || 0 == alpha)) { |
| 434 if (1 == alpha) |
| 435 alpha = 2; |
| 436 else |
| 437 alpha = -1; |
| 438 } |
| 439 GLApiBase::glClearColorFn(red, green, blue, alpha); |
| 440 } |
| 441 |
| 426 void RealGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { | 442 void RealGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { |
| 427 if (!g_null_draw_bindings_enabled) | 443 if (!g_null_draw_bindings_enabled) |
| 428 GLApiBase::glDrawArraysFn(mode, first, count); | 444 GLApiBase::glDrawArraysFn(mode, first, count); |
| 429 } | 445 } |
| 430 | 446 |
| 431 void RealGLApi::glDrawElementsFn(GLenum mode, | 447 void RealGLApi::glDrawElementsFn(GLenum mode, |
| 432 GLsizei count, | 448 GLsizei count, |
| 433 GLenum type, | 449 GLenum type, |
| 434 const void* indices) { | 450 const void* indices) { |
| 435 if (!g_null_draw_bindings_enabled) | 451 if (!g_null_draw_bindings_enabled) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 518 |
| 503 DebugGLApi::~DebugGLApi() {} | 519 DebugGLApi::~DebugGLApi() {} |
| 504 | 520 |
| 505 NoContextGLApi::NoContextGLApi() { | 521 NoContextGLApi::NoContextGLApi() { |
| 506 } | 522 } |
| 507 | 523 |
| 508 NoContextGLApi::~NoContextGLApi() { | 524 NoContextGLApi::~NoContextGLApi() { |
| 509 } | 525 } |
| 510 | 526 |
| 511 } // namespace gl | 527 } // namespace gl |
| OLD | NEW |