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/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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 context3d_->ensureBackbufferCHROMIUM(); | 105 context3d_->ensureBackbufferCHROMIUM(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void OutputSurface::DiscardBackbuffer() { | 108 void OutputSurface::DiscardBackbuffer() { |
| 109 DCHECK(context3d_); | 109 DCHECK(context3d_); |
| 110 if (has_gl_discard_backbuffer_) | 110 if (has_gl_discard_backbuffer_) |
| 111 context3d_->discardBackbufferCHROMIUM(); | 111 context3d_->discardBackbufferCHROMIUM(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void OutputSurface::Reshape(gfx::Size size, float scale_factor) { | 114 void OutputSurface::Reshape(gfx::Size size, float scale_factor) { |
| 115 DCHECK(context3d_); | 115 if (size == surface_size_ && scale_factor == device_scale_factor_) |
| 116 context3d_->reshapeWithScaleFactor(size.width(), size.height(), scale_factor); | 116 return; |
| 117 | |
| 118 surface_size_ = size; | |
| 119 device_scale_factor_ = scale_factor; | |
| 120 if (context3d_) | |
|
piman
2013/06/05 00:52:08
nit: brackets needed.
| |
| 121 context3d_->reshapeWithScaleFactor( | |
| 122 size.width(), size.height(), scale_factor); | |
| 123 } | |
| 124 | |
| 125 gfx::Size OutputSurface::SurfaceSize() const { | |
| 126 return surface_size_; | |
| 117 } | 127 } |
| 118 | 128 |
| 119 void OutputSurface::BindFramebuffer() { | 129 void OutputSurface::BindFramebuffer() { |
| 120 DCHECK(context3d_); | 130 DCHECK(context3d_); |
| 121 context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); | 131 context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); |
| 122 } | 132 } |
| 123 | 133 |
| 124 void OutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) { | 134 void OutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) { |
| 125 DCHECK(context3d_); | 135 DCHECK(context3d_); |
| 126 // Note that currently this has the same effect as SwapBuffers; we should | 136 // Note that currently this has the same effect as SwapBuffers; we should |
| 127 // consider exposing a different entry point on WebGraphicsContext3D. | 137 // consider exposing a different entry point on WebGraphicsContext3D. |
| 128 context3d_->prepareTexture(); | 138 context3d_->prepareTexture(); |
| 129 } | 139 } |
| 130 | 140 |
| 131 void OutputSurface::PostSubBuffer(gfx::Rect rect, | 141 void OutputSurface::PostSubBuffer(gfx::Rect rect, |
| 132 const ui::LatencyInfo& latency_info) { | 142 const ui::LatencyInfo& latency_info) { |
| 133 DCHECK(context3d_); | 143 DCHECK(context3d_); |
| 134 context3d_->postSubBufferCHROMIUM( | 144 context3d_->postSubBufferCHROMIUM( |
| 135 rect.x(), rect.y(), rect.width(), rect.height()); | 145 rect.x(), rect.y(), rect.width(), rect.height()); |
| 136 } | 146 } |
| 137 | 147 |
| 138 } // namespace cc | 148 } // namespace cc |
| OLD | NEW |