Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2399)

Unified Diff: cc/output/output_surface.cc

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SynchronousCompositorOutputSurface::DemandDrawSw Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/output_surface.cc
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 84d94b843edfec34473e9fc95623c51445157280..55923ec2e0fd91b6f9de9cbf6583a4fdfea779c7 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/strings/string_split.h"
+#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface_client.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -35,7 +36,7 @@ class OutputSurfaceCallbacks
}
// WK:WGC3D::WGSwapBuffersCompleteCallbackCHROMIUM implementation.
- virtual void onSwapBuffersComplete() { client_->OnSwapBuffersComplete(); }
+ virtual void onSwapBuffersComplete() { client_->OnSwapBuffersComplete(NULL); }
// WK:WGC3D::WGContextLostCallback implementation.
virtual void onContextLost() { client_->DidLoseOutputSurface(); }
@@ -49,6 +50,7 @@ OutputSurface::OutputSurface(
: client_(NULL),
context3d_(context3d.Pass()),
has_gl_discard_backbuffer_(false),
+ has_swap_buffers_complete_callback_(false),
device_scale_factor_(-1) {
}
@@ -57,6 +59,7 @@ OutputSurface::OutputSurface(
: client_(NULL),
software_device_(software_device.Pass()),
has_gl_discard_backbuffer_(false),
+ has_swap_buffers_complete_callback_(false),
device_scale_factor_(-1) {
}
@@ -67,6 +70,7 @@ OutputSurface::OutputSurface(
context3d_(context3d.Pass()),
software_device_(software_device.Pass()),
has_gl_discard_backbuffer_(false),
+ has_swap_buffers_complete_callback_(false),
device_scale_factor_(-1) {
}
@@ -129,6 +133,9 @@ void OutputSurface::SetContext3D(
set<string> extensions(extensions_list.begin(), extensions_list.end());
has_gl_discard_backbuffer_ =
extensions.count("GL_CHROMIUM_discard_backbuffer") > 0;
+ has_swap_buffers_complete_callback_ =
+ extensions.count("GL_CHROMIUM_swapbuffers_complete_callback") > 0;
+
context3d_ = context3d.Pass();
callbacks_.reset(new OutputSurfaceCallbacks(client_));
@@ -136,10 +143,6 @@ void OutputSurface::SetContext3D(
context3d_->setContextLostCallback(callbacks_.get());
}
-void OutputSurface::SendFrameToParentCompositor(CompositorFrame* frame) {
- NOTIMPLEMENTED();
-}
-
void OutputSurface::EnsureBackbuffer() {
DCHECK(context3d_);
if (has_gl_discard_backbuffer_)
@@ -162,6 +165,8 @@ void OutputSurface::Reshape(gfx::Size size, float scale_factor) {
context3d_->reshapeWithScaleFactor(
size.width(), size.height(), scale_factor);
}
+ if (software_device_)
+ software_device_->Resize(size);
}
gfx::Size OutputSurface::SurfaceSize() const {
@@ -173,18 +178,24 @@ void OutputSurface::BindFramebuffer() {
context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0);
}
-void OutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) {
+void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
DCHECK(context3d_);
- // Note that currently this has the same effect as SwapBuffers; we should
- // consider exposing a different entry point on WebGraphicsContext3D.
- context3d_->prepareTexture();
-}
+ DCHECK(frame->gl_frame_data);
+
+ gfx::Rect sub_buffer_rect = frame->gl_frame_data->sub_buffer_rect;
+ if (!sub_buffer_rect.IsEmpty()) {
+ context3d()->postSubBufferCHROMIUM(sub_buffer_rect.x(),
+ sub_buffer_rect.y(),
+ sub_buffer_rect.width(),
+ sub_buffer_rect.height());
+ } else {
+ // Note that currently this has the same effect as SwapBuffers; we should
+ // consider exposing a different entry point on WebGraphicsContext3D.
+ context3d()->prepareTexture();
+ }
-void OutputSurface::PostSubBuffer(gfx::Rect rect,
- const ui::LatencyInfo& latency_info) {
- DCHECK(context3d_);
- context3d_->postSubBufferCHROMIUM(
- rect.x(), rect.y(), rect.width(), rect.height());
+ if (client_ && !has_swap_buffers_complete_callback_)
+ client_->OnSwapBuffersComplete(NULL);
piman 2013/06/10 19:52:25 I don't know if there could be some issues with re
aelias_OOO_until_Jul13 2013/06/10 23:18:07 I switched to always post task for onSwapBuffersCo
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698