Chromium Code Reviews| 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_surface.h" | 5 #include "cc/output_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | |
| 9 #include "third_party/khronos/GLES2/gl2.h" | |
| 10 #include "third_party/khronos/GLES2/gl2ext.h" | |
| 11 #include "ui/gfx/rect.h" | |
| 12 #include "ui/gfx/size.h" | |
| 8 | 13 |
| 9 namespace cc { | 14 namespace cc { |
| 10 | 15 |
| 11 OutputSurface::OutputSurface( | 16 OutputSurface::OutputSurface( |
| 12 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) | 17 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) |
| 13 : client_(NULL), | 18 : client_(NULL), |
| 14 context3d_(context3d.Pass()) { | 19 context3d_(context3d.Pass()) { |
| 15 } | 20 } |
| 16 | 21 |
| 17 OutputSurface::OutputSurface( | 22 OutputSurface::OutputSurface( |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 37 client_ = client; | 42 client_ = client; |
| 38 if (!context3d_) | 43 if (!context3d_) |
| 39 return true; | 44 return true; |
| 40 return context3d_->makeContextCurrent(); | 45 return context3d_->makeContextCurrent(); |
| 41 } | 46 } |
| 42 | 47 |
| 43 void OutputSurface::SendFrameToParentCompositor(CompositorFrame*) { | 48 void OutputSurface::SendFrameToParentCompositor(CompositorFrame*) { |
| 44 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 45 } | 50 } |
| 46 | 51 |
| 52 void OutputSurface::EnsureBackbuffer() { | |
| 53 DCHECK(context3d_); | |
| 54 context3d_->ensureBackbufferCHROMIUM(); | |
| 55 } | |
| 56 | |
| 57 void OutputSurface::DiscardBackbuffer() { | |
| 58 DCHECK(context3d_); | |
|
no sievers
2013/02/27 00:12:30
Really it should query the extension here like it
piman
2013/02/27 01:07:13
You can check in BindToClient, which has to be cal
no sievers
2013/02/27 21:07:40
Done.
| |
| 59 context3d_->discardBackbufferCHROMIUM(); | |
| 60 } | |
| 61 | |
| 62 void OutputSurface::Reshape(const gfx::Size& size) { | |
| 63 DCHECK(context3d_); | |
| 64 context3d_->reshape(size.width(), size.height()); | |
| 65 } | |
| 66 | |
| 67 void OutputSurface::BindFramebuffer() { | |
| 68 DCHECK(context3d_); | |
| 69 context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); | |
| 70 } | |
| 71 | |
| 72 void OutputSurface::SwapBuffers() { | |
| 73 DCHECK(context3d_); | |
| 74 // Note that currently this has the same effect as swapBuffers; we should | |
| 75 // consider exposing a different entry point on WebGraphicsContext3D. | |
| 76 context3d_->prepareTexture(); | |
| 77 } | |
| 78 | |
| 79 void OutputSurface::PostSubBuffer(const gfx::Rect& rect) { | |
| 80 DCHECK(context3d_); | |
| 81 context3d_->postSubBufferCHROMIUM( | |
| 82 rect.x(), rect.y(), rect.width(), rect.height()); | |
| 83 } | |
| 84 | |
| 47 } // namespace cc | 85 } // namespace cc |
| OLD | NEW |