| 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 "content/browser/renderer_host/compositing_iosurface_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| 6 | 6 |
| 7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
| 8 #include <OpenGL/OpenGL.h> | 8 #include <OpenGL/OpenGL.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 return true; | 623 return true; |
| 624 } | 624 } |
| 625 | 625 |
| 626 void CompositingIOSurfaceMac::UnrefIOSurface() { | 626 void CompositingIOSurfaceMac::UnrefIOSurface() { |
| 627 CGLSetCurrentContext(offscreen_context_->cgl_context()); | 627 CGLSetCurrentContext(offscreen_context_->cgl_context()); |
| 628 UnrefIOSurfaceWithContextCurrent(); | 628 UnrefIOSurfaceWithContextCurrent(); |
| 629 CGLSetCurrentContext(0); | 629 CGLSetCurrentContext(0); |
| 630 } | 630 } |
| 631 | 631 |
| 632 void CompositingIOSurfaceMac::DrawQuad(const SurfaceQuad& quad) { | 632 void CompositingIOSurfaceMac::DrawQuad(const SurfaceQuad& quad) { |
| 633 TRACE_EVENT0("gpu", "CompositingIOSurfaceMac::DrawQuad"); |
| 634 |
| 633 glEnableClientState(GL_VERTEX_ARRAY); CHECK_AND_SAVE_GL_ERROR(); | 635 glEnableClientState(GL_VERTEX_ARRAY); CHECK_AND_SAVE_GL_ERROR(); |
| 634 glEnableClientState(GL_TEXTURE_COORD_ARRAY); CHECK_AND_SAVE_GL_ERROR(); | 636 glEnableClientState(GL_TEXTURE_COORD_ARRAY); CHECK_AND_SAVE_GL_ERROR(); |
| 635 | 637 |
| 636 glVertexPointer(2, GL_FLOAT, sizeof(SurfaceVertex), &quad.verts_[0].x_); | 638 glVertexPointer(2, GL_FLOAT, sizeof(SurfaceVertex), &quad.verts_[0].x_); |
| 637 glTexCoordPointer(2, GL_FLOAT, sizeof(SurfaceVertex), &quad.verts_[0].tx_); | 639 glTexCoordPointer(2, GL_FLOAT, sizeof(SurfaceVertex), &quad.verts_[0].tx_); |
| 638 glDrawArrays(GL_QUADS, 0, 4); CHECK_AND_SAVE_GL_ERROR(); | 640 glDrawArrays(GL_QUADS, 0, 4); CHECK_AND_SAVE_GL_ERROR(); |
| 639 | 641 |
| 640 glDisableClientState(GL_VERTEX_ARRAY); | 642 glDisableClientState(GL_VERTEX_ARRAY); |
| 641 glDisableClientState(GL_TEXTURE_COORD_ARRAY); | 643 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
| 642 } | 644 } |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 } | 1037 } |
| 1036 | 1038 |
| 1037 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { | 1039 GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { |
| 1038 GLenum gl_error = glGetError(); | 1040 GLenum gl_error = glGetError(); |
| 1039 if (gl_error_ == GL_NO_ERROR) | 1041 if (gl_error_ == GL_NO_ERROR) |
| 1040 gl_error_ = gl_error; | 1042 gl_error_ = gl_error; |
| 1041 return gl_error; | 1043 return gl_error; |
| 1042 } | 1044 } |
| 1043 | 1045 |
| 1044 } // namespace content | 1046 } // namespace content |
| OLD | NEW |