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

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

Issue 307693005: Add use-surfaces command-line flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
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/surface_display_output_surface.h"
6
7 #include "cc/output/compositor_frame.h"
8 #include "cc/surfaces/display.h"
9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_manager.h"
11
12 namespace content {
13
14 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface(
15 cc::Display* display,
16 cc::SurfaceManager* surface_manager,
17 const scoped_refptr<cc::ContextProvider>& context_provider,
18 scoped_ptr<cc::SoftwareOutputDevice> software_device)
19 : cc::OutputSurface(context_provider, software_device.Pass()),
20 display_(display),
21 surface_manager_(surface_manager) {
22 capabilities_.delegated_rendering = true;
23 capabilities_.max_frames_pending = 1;
24 }
25
26 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() {
27 }
28
29 void SurfaceDisplayOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
30 gfx::Size frame_size =
31 frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
32 display_->Resize(frame_size);
33 int surface_id = display_->CurrentSurfaceID();
34 cc::Surface* surface = surface_manager_->GetSurfaceForID(surface_id);
35 if (!surface)
36 return;
37
38 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame());
39 frame->AssignTo(frame_copy.get());
40 surface->QueueFrame(frame_copy.Pass());
41
42 if (!display_->Draw())
43 return;
44
45 client_->DidSwapBuffers();
46 client_->DidSwapBuffersComplete();
47 }
48
49 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/surface_display_output_surface.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698