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" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 GLenum gl_internal_format = GetInternalFormat(version_.get(), internalformat); | 416 GLenum gl_internal_format = GetInternalFormat(version_.get(), internalformat); |
417 GLApiBase::glRenderbufferStorageMultisampleFn( | 417 GLApiBase::glRenderbufferStorageMultisampleFn( |
418 target, samples, gl_internal_format, width, height); | 418 target, samples, gl_internal_format, width, height); |
419 } | 419 } |
420 | 420 |
421 void RealGLApi::glClearFn(GLbitfield mask) { | 421 void RealGLApi::glClearFn(GLbitfield mask) { |
422 if (!g_null_draw_bindings_enabled) | 422 if (!g_null_draw_bindings_enabled) |
423 GLApiBase::glClearFn(mask); | 423 GLApiBase::glClearFn(mask); |
424 } | 424 } |
425 | 425 |
| 426 void RealGLApi::glClearColorFn(GLclampf red, |
| 427 GLclampf green, |
| 428 GLclampf blue, |
| 429 GLclampf alpha) { |
| 430 if (gl_workarounds_.clear_to_zero_or_one_broken && (1 == red || 0 == red) && |
| 431 (1 == green || 0 == green) && (1 == blue || 0 == blue) && |
| 432 (1 == alpha || 0 == alpha)) { |
| 433 if (1 == alpha) |
| 434 alpha = 2; |
| 435 else |
| 436 alpha = -1; |
| 437 } |
| 438 GLApiBase::glClearColorFn(red, green, blue, alpha); |
| 439 } |
| 440 |
426 void RealGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { | 441 void RealGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { |
427 if (!g_null_draw_bindings_enabled) | 442 if (!g_null_draw_bindings_enabled) |
428 GLApiBase::glDrawArraysFn(mode, first, count); | 443 GLApiBase::glDrawArraysFn(mode, first, count); |
429 } | 444 } |
430 | 445 |
431 void RealGLApi::glDrawElementsFn(GLenum mode, | 446 void RealGLApi::glDrawElementsFn(GLenum mode, |
432 GLsizei count, | 447 GLsizei count, |
433 GLenum type, | 448 GLenum type, |
434 const void* indices) { | 449 const void* indices) { |
435 if (!g_null_draw_bindings_enabled) | 450 if (!g_null_draw_bindings_enabled) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 filtered_exts_.push_back(gl_extension); | 499 filtered_exts_.push_back(gl_extension); |
485 } | 500 } |
486 filtered_exts_str_ = base::JoinString(filtered_exts_, " "); | 501 filtered_exts_str_ = base::JoinString(filtered_exts_, " "); |
487 } | 502 } |
488 #if DCHECK_IS_ON() | 503 #if DCHECK_IS_ON() |
489 filtered_exts_initialized_ = true; | 504 filtered_exts_initialized_ = true; |
490 #endif | 505 #endif |
491 } | 506 } |
492 } | 507 } |
493 | 508 |
| 509 void RealGLApi::set_gl_workarounds(const GLWorkarounds& workarounds) { |
| 510 gl_workarounds_ = workarounds; |
| 511 } |
| 512 |
494 void RealGLApi::set_version(std::unique_ptr<GLVersionInfo> version) { | 513 void RealGLApi::set_version(std::unique_ptr<GLVersionInfo> version) { |
495 version_ = std::move(version); | 514 version_ = std::move(version); |
496 } | 515 } |
497 | 516 |
498 TraceGLApi::~TraceGLApi() { | 517 TraceGLApi::~TraceGLApi() { |
499 } | 518 } |
500 | 519 |
501 DebugGLApi::DebugGLApi(GLApi* gl_api) : gl_api_(gl_api) {} | 520 DebugGLApi::DebugGLApi(GLApi* gl_api) : gl_api_(gl_api) {} |
502 | 521 |
503 DebugGLApi::~DebugGLApi() {} | 522 DebugGLApi::~DebugGLApi() {} |
504 | 523 |
505 NoContextGLApi::NoContextGLApi() { | 524 NoContextGLApi::NoContextGLApi() { |
506 } | 525 } |
507 | 526 |
508 NoContextGLApi::~NoContextGLApi() { | 527 NoContextGLApi::~NoContextGLApi() { |
509 } | 528 } |
510 | 529 |
511 } // namespace gl | 530 } // namespace gl |
OLD | NEW |