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

Side by Side Diff: cc/output/software_renderer.cc

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to 205473 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/scheduler/frame_rate_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/software_renderer.h" 5 #include "cc/output/software_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return make_scoped_ptr( 49 return make_scoped_ptr(
50 new SoftwareRenderer(client, output_surface, resource_provider)); 50 new SoftwareRenderer(client, output_surface, resource_provider));
51 } 51 }
52 52
53 SoftwareRenderer::SoftwareRenderer(RendererClient* client, 53 SoftwareRenderer::SoftwareRenderer(RendererClient* client,
54 OutputSurface* output_surface, 54 OutputSurface* output_surface,
55 ResourceProvider* resource_provider) 55 ResourceProvider* resource_provider)
56 : DirectRenderer(client, output_surface, resource_provider), 56 : DirectRenderer(client, output_surface, resource_provider),
57 visible_(true), 57 visible_(true),
58 is_scissor_enabled_(false), 58 is_scissor_enabled_(false),
59 is_viewport_changed_(true),
60 output_device_(output_surface->software_device()), 59 output_device_(output_surface->software_device()),
61 current_canvas_(NULL) { 60 current_canvas_(NULL) {
62 if (resource_provider_) { 61 if (resource_provider_) {
63 capabilities_.max_texture_size = resource_provider_->max_texture_size(); 62 capabilities_.max_texture_size = resource_provider_->max_texture_size();
64 capabilities_.best_texture_format = 63 capabilities_.best_texture_format =
65 resource_provider_->best_texture_format(); 64 resource_provider_->best_texture_format();
66 } 65 }
67 capabilities_.using_set_visibility = true; 66 capabilities_.using_set_visibility = true;
68 // The updater can access bitmaps while the SoftwareRenderer is using them. 67 // The updater can access bitmaps while the SoftwareRenderer is using them.
69 capabilities_.allow_partial_texture_updates = true; 68 capabilities_.allow_partial_texture_updates = true;
70 capabilities_.using_partial_swap = true; 69 capabilities_.using_partial_swap = true;
71 if (Settings().compositor_frame_message && client_->HasImplThread())
72 capabilities_.using_swap_complete_callback = true;
73 compositor_frame_.software_frame_data.reset(new SoftwareFrameData());
74 } 70 }
75 71
76 SoftwareRenderer::~SoftwareRenderer() {} 72 SoftwareRenderer::~SoftwareRenderer() {}
77 73
78 const RendererCapabilities& SoftwareRenderer::Capabilities() const { 74 const RendererCapabilities& SoftwareRenderer::Capabilities() const {
79 return capabilities_; 75 return capabilities_;
80 } 76 }
81 77
82 void SoftwareRenderer::ViewportChanged() {
83 is_viewport_changed_ = true;
84 }
85
86 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { 78 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) {
87 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); 79 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame");
88 if (is_viewport_changed_) {
89 is_viewport_changed_ = false;
90 output_device_->Resize(client_->DeviceViewport().size());
91 }
92 root_canvas_ = output_device_->BeginPaint( 80 root_canvas_ = output_device_->BeginPaint(
93 gfx::ToEnclosingRect(frame->root_damage_rect)); 81 gfx::ToEnclosingRect(frame->root_damage_rect));
94 } 82 }
95 83
96 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { 84 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) {
97 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); 85 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame");
98 current_framebuffer_lock_.reset(); 86 current_framebuffer_lock_.reset();
99 current_canvas_ = NULL; 87 current_canvas_ = NULL;
100 root_canvas_ = NULL; 88 root_canvas_ = NULL;
101 if (Settings().compositor_frame_message) { 89
102 compositor_frame_.metadata = client_->MakeCompositorFrameMetadata(); 90 current_frame_data_.reset(new SoftwareFrameData);
103 output_device_->EndPaint(compositor_frame_.software_frame_data.get()); 91 output_device_->EndPaint(current_frame_data_.get());
104 } else {
105 output_device_->EndPaint(NULL);
106 }
107 } 92 }
108 93
109 void SoftwareRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { 94 void SoftwareRenderer::SwapBuffers() {
110 if (Settings().compositor_frame_message) 95 CompositorFrame compositor_frame;
111 output_surface_->SendFrameToParentCompositor(&compositor_frame_); 96 compositor_frame.metadata = client_->MakeCompositorFrameMetadata();
97 compositor_frame.software_frame_data = current_frame_data_.Pass();
98 output_surface_->SwapBuffers(&compositor_frame);
112 } 99 }
113 100
114 void SoftwareRenderer::ReceiveCompositorFrameAck( 101 void SoftwareRenderer::ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {
115 const CompositorFrameAck& ack) {
116 output_device_->ReclaimSoftwareFrame(ack.last_software_frame_id); 102 output_device_->ReclaimSoftwareFrame(ack.last_software_frame_id);
117 } 103 }
118 104
119 bool SoftwareRenderer::FlippedFramebuffer() const { 105 bool SoftwareRenderer::FlippedFramebuffer() const {
120 return false; 106 return false;
121 } 107 }
122 108
123 void SoftwareRenderer::EnsureScissorTestEnabled() { 109 void SoftwareRenderer::EnsureScissorTestEnabled() {
124 is_scissor_enabled_ = true; 110 is_scissor_enabled_ = true;
125 SetClipRect(scissor_rect_); 111 SetClipRect(scissor_rect_);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 4 * rect.width()); 451 4 * rect.width());
466 } 452 }
467 453
468 void SoftwareRenderer::SetVisible(bool visible) { 454 void SoftwareRenderer::SetVisible(bool visible) {
469 if (visible_ == visible) 455 if (visible_ == visible)
470 return; 456 return;
471 visible_ = visible; 457 visible_ = visible;
472 } 458 }
473 459
474 } // namespace cc 460 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/scheduler/frame_rate_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698