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

Side by Side Diff: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
6
7 #include "cc/output/compositor_frame.h"
8 #include "content/browser/compositor/buffered_output_surface.h"
9 #include "content/browser/compositor/reflector_impl.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h"
11 #include "content/common/gpu/client/context_provider_command_buffer.h"
12 #include "gpu/GLES2/gl2extchromium.h"
13 #include "gpu/command_buffer/client/gles2_interface.h"
14
15 namespace content {
16
17 GpuSurfacelessBrowserCompositorOutputSurface::
18 GpuSurfacelessBrowserCompositorOutputSurface(
19 const scoped_refptr<ContextProviderCommandBuffer>& context,
20 int surface_id,
21 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
22 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
23 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator,
24 unsigned internalformat,
25 int z_order)
26 : GpuBrowserCompositorOutputSurface(context,
27 surface_id,
28 output_surface_map,
29 vsync_manager,
30 overlay_candidate_validator.Pass()),
31 z_order_(z_order),
alexst (slow to review) 2014/09/11 15:41:32 Let's save the z_order for when we need it.
achaulk 2014/09/11 17:25:48 Done.
32 internalformat_(internalformat) {
33 }
34
35 GpuSurfacelessBrowserCompositorOutputSurface::
36 ~GpuSurfacelessBrowserCompositorOutputSurface() {
37 }
38
39 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
40 cc::CompositorFrame* frame) {
41 DCHECK(output_surface_);
42
43 const gfx::Size& size = frame->gl_frame_data->size;
44 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
45 gl->Finish(); // This will eventually be replaced by sync fences.
46 gl->ScheduleOverlayPlaneCHROMIUM(z_order_,
47 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM,
48 output_surface_->current_tex_id(),
49 0,
50 0,
51 size.width(),
52 size.height(),
53 0,
54 0,
55 1.0f,
56 1.0f);
57 output_surface_->SwapBuffers();
58 GpuBrowserCompositorOutputSurface::SwapBuffers(frame);
59 }
60
61 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() {
62 DCHECK(output_surface_);
63 output_surface_->PageFlipComplete();
64 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete();
65 }
66
67 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() {
68 DCHECK(output_surface_);
69 output_surface_->BindFramebuffer();
70 }
71
72 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape(
73 const gfx::Size& size,
74 float scale_factor) {
75 gfx::Size current = SurfaceSize();
76 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor);
77 DCHECK(output_surface_);
78 output_surface_->Reshape(SurfaceSize(), scale_factor);
79 }
80
81 bool GpuSurfacelessBrowserCompositorOutputSurface::BindToClient(
82 cc::OutputSurfaceClient* client) {
83 DCHECK(output_surface_);
84 if (!GpuBrowserCompositorOutputSurface::BindToClient(client))
85 return false;
86 if (!output_surface_) {
87 output_surface_.reset(
88 new BufferedOutputSurface(context_provider_, internalformat_));
89 }
90 return true;
91 }
92
93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698