| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 bool OutputSurface::BindToClient( | 52 bool OutputSurface::BindToClient( |
| 53 cc::OutputSurfaceClient* client) { | 53 cc::OutputSurfaceClient* client) { |
| 54 DCHECK(client); | 54 DCHECK(client); |
| 55 client_ = client; | 55 client_ = client; |
| 56 if (!context3d_) | 56 if (!context3d_) |
| 57 return true; | 57 return true; |
| 58 if (!context3d_->makeContextCurrent()) | 58 if (!context3d_->makeContextCurrent()) |
| 59 return false; | 59 return false; |
| 60 | 60 |
| 61 string extensionsString = UTF16ToASCII(context3d_->getString(GL_EXTENSIONS)); | 61 string extensions_string = UTF16ToASCII(context3d_->getString(GL_EXTENSIONS)); |
| 62 vector<string> extensionsList; | 62 vector<string> extensions_list; |
| 63 base::SplitString(extensionsString, ' ', &extensionsList); | 63 base::SplitString(extensions_string, ' ', &extensions_list); |
| 64 set<string> extensions(extensionsList.begin(), extensionsList.end()); | 64 set<string> extensions(extensions_list.begin(), extensions_list.end()); |
| 65 | 65 |
| 66 has_gl_discard_backbuffer_ = | 66 has_gl_discard_backbuffer_ = |
| 67 extensions.count("GL_CHROMIUM_discard_backbuffer"); | 67 extensions.count("GL_CHROMIUM_discard_backbuffer"); |
| 68 | 68 |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void OutputSurface::SendFrameToParentCompositor(CompositorFrame*) { | 72 void OutputSurface::SendFrameToParentCompositor(CompositorFrame*) { |
| 73 NOTIMPLEMENTED(); | 73 NOTIMPLEMENTED(); |
| 74 } | 74 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 context3d_->reshape(size.width(), size.height()); | 90 context3d_->reshape(size.width(), size.height()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void OutputSurface::BindFramebuffer() { | 93 void OutputSurface::BindFramebuffer() { |
| 94 DCHECK(context3d_); | 94 DCHECK(context3d_); |
| 95 context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); | 95 context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void OutputSurface::SwapBuffers() { | 98 void OutputSurface::SwapBuffers() { |
| 99 DCHECK(context3d_); | 99 DCHECK(context3d_); |
| 100 // Note that currently this has the same effect as swapBuffers; we should | 100 // Note that currently this has the same effect as SwapBuffers; we should |
| 101 // consider exposing a different entry point on WebGraphicsContext3D. | 101 // consider exposing a different entry point on WebGraphicsContext3D. |
| 102 context3d_->prepareTexture(); | 102 context3d_->prepareTexture(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void OutputSurface::PostSubBuffer(gfx::Rect rect) { | 105 void OutputSurface::PostSubBuffer(gfx::Rect rect) { |
| 106 DCHECK(context3d_); | 106 DCHECK(context3d_); |
| 107 context3d_->postSubBufferCHROMIUM( | 107 context3d_->postSubBufferCHROMIUM( |
| 108 rect.x(), rect.y(), rect.width(), rect.height()); | 108 rect.x(), rect.y(), rect.width(), rect.height()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace cc | 111 } // namespace cc |
| OLD | NEW |