OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
6 #include "ui/gfx/gl/gl_bindings_skia_in_process.h" | 6 #include "ui/gfx/gl/gl_bindings_skia_in_process.h" |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/gl/gl_bindings.h" | 9 #include "ui/gfx/gl/gl_bindings.h" |
10 #include "ui/gfx/gl/gl_implementation.h" | 10 #include "ui/gfx/gl/gl_implementation.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 462 } |
463 | 463 |
464 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) { | 464 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) { |
465 glViewport(x, y, width, height); | 465 glViewport(x, y, width, height); |
466 } | 466 } |
467 } // extern "C" | 467 } // extern "C" |
468 } // namespace | 468 } // namespace |
469 | 469 |
470 namespace gfx { | 470 namespace gfx { |
471 | 471 |
472 void BindSkiaToInProcessGL() { | 472 GrGLInterface* GetInProcessSkiaGLBinding() { |
473 static SkAutoTUnref<GrGLInterface> host_gl_interface; | 473 static SkAutoTUnref<GrGLInterface> host_gl_interface; |
474 if (NULL == host_gl_interface.get()) { | 474 if (NULL == host_gl_interface.get()) { |
475 GrGLBinding binding; | 475 GrGLBinding binding; |
476 switch (gfx::GetGLImplementation()) { | 476 switch (gfx::GetGLImplementation()) { |
477 case gfx::kGLImplementationNone: | 477 case gfx::kGLImplementationNone: |
478 NOTREACHED(); | 478 NOTREACHED(); |
479 return; | 479 return NULL; |
480 case gfx::kGLImplementationDesktopGL: | 480 case gfx::kGLImplementationDesktopGL: |
481 binding = kDesktop_GrGLBinding; | 481 binding = kDesktop_GrGLBinding; |
482 break; | 482 break; |
483 case gfx::kGLImplementationOSMesaGL: | 483 case gfx::kGLImplementationOSMesaGL: |
484 binding = kDesktop_GrGLBinding; | 484 binding = kDesktop_GrGLBinding; |
485 break; | 485 break; |
486 case gfx::kGLImplementationEGLGLES2: | 486 case gfx::kGLImplementationEGLGLES2: |
487 binding = kES2_GrGLBinding; | 487 binding = kES2_GrGLBinding; |
488 break; | 488 break; |
489 case gfx::kGLImplementationMockGL: | 489 case gfx::kGLImplementationMockGL: |
490 NOTREACHED(); | 490 NOTREACHED(); |
491 return; | 491 return NULL; |
492 default: | 492 default: |
493 NOTREACHED(); | 493 NOTREACHED(); |
494 return; | 494 return NULL; |
495 } | 495 } |
496 | 496 |
497 GrGLInterface* interface = new GrGLInterface; | 497 GrGLInterface* interface = new GrGLInterface; |
498 host_gl_interface.reset(interface); | 498 host_gl_interface.reset(interface); |
499 | 499 |
500 interface->fBindingsExported = binding; | 500 interface->fBindingsExported = binding; |
501 interface->fActiveTexture = StubGLActiveTexture; | 501 interface->fActiveTexture = StubGLActiveTexture; |
502 interface->fAttachShader = StubGLAttachShader; | 502 interface->fAttachShader = StubGLAttachShader; |
503 interface->fBindAttribLocation = StubGLBindAttribLocation; | 503 interface->fBindAttribLocation = StubGLBindAttribLocation; |
504 interface->fBindBuffer = StubGLBindBuffer; | 504 interface->fBindBuffer = StubGLBindBuffer; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 interface->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv; | 595 interface->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv; |
596 interface->fRenderbufferStorage = StubGLRenderbufferStorage; | 596 interface->fRenderbufferStorage = StubGLRenderbufferStorage; |
597 interface->fRenderbufferStorageMultisample = | 597 interface->fRenderbufferStorageMultisample = |
598 StubGLRenderbufferStorageMultisample; | 598 StubGLRenderbufferStorageMultisample; |
599 interface->fBlitFramebuffer = StubGLBlitFramebuffer; | 599 interface->fBlitFramebuffer = StubGLBlitFramebuffer; |
600 interface->fMapBuffer = StubGLMapBuffer; | 600 interface->fMapBuffer = StubGLMapBuffer; |
601 interface->fUnmapBuffer = StubGLUnmapBuffer; | 601 interface->fUnmapBuffer = StubGLUnmapBuffer; |
602 interface->fBindFragDataLocationIndexed = | 602 interface->fBindFragDataLocationIndexed = |
603 StubBindFragDataLocationIndexedARB; | 603 StubBindFragDataLocationIndexedARB; |
604 } | 604 } |
605 GrGLSetDefaultGLInterface(host_gl_interface.get()); | 605 return host_gl_interface.get(); |
606 } | 606 } |
607 | 607 |
608 } // namespace gfx | 608 } // namespace gfx |
609 | 609 |
OLD | NEW |