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

Side by Side Diff: cc/surfaces/display.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/surfaces/display.h ('k') | cc/surfaces/surface.cc » ('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 2014 The Chromium Authors. All rights reserved. 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 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/surfaces/display.h" 5 #include "cc/surfaces/display.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 11 matching lines...) Expand all
22 namespace cc { 22 namespace cc {
23 23
24 Display::Display(DisplayClient* client, 24 Display::Display(DisplayClient* client,
25 SurfaceManager* manager, 25 SurfaceManager* manager,
26 SharedBitmapManager* bitmap_manager, 26 SharedBitmapManager* bitmap_manager,
27 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) 27 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager)
28 : client_(client), 28 : client_(client),
29 manager_(manager), 29 manager_(manager),
30 bitmap_manager_(bitmap_manager), 30 bitmap_manager_(bitmap_manager),
31 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 31 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
32 device_scale_factor_(1.f),
32 blocking_main_thread_task_runner_( 33 blocking_main_thread_task_runner_(
33 BlockingTaskRunner::Create(base::MessageLoopProxy::current())), 34 BlockingTaskRunner::Create(base::MessageLoopProxy::current())),
34 texture_mailbox_deleter_( 35 texture_mailbox_deleter_(
35 new TextureMailboxDeleter(base::MessageLoopProxy::current())) { 36 new TextureMailboxDeleter(base::MessageLoopProxy::current())) {
36 manager_->AddObserver(this); 37 manager_->AddObserver(this);
37 } 38 }
38 39
39 Display::~Display() { 40 Display::~Display() {
40 manager_->RemoveObserver(this); 41 manager_->RemoveObserver(this);
41 } 42 }
42 43
43 bool Display::Initialize(scoped_ptr<OutputSurface> output_surface) { 44 bool Display::Initialize(scoped_ptr<OutputSurface> output_surface) {
44 output_surface_ = output_surface.Pass(); 45 output_surface_ = output_surface.Pass();
45 return output_surface_->BindToClient(this); 46 return output_surface_->BindToClient(this);
46 } 47 }
47 48
48 void Display::Resize(SurfaceId id, const gfx::Size& size) { 49 void Display::Resize(SurfaceId id,
50 const gfx::Size& size,
51 float device_scale_factor) {
49 current_surface_id_ = id; 52 current_surface_id_ = id;
50 current_surface_size_ = size; 53 current_surface_size_ = size;
54 device_scale_factor_ = device_scale_factor;
51 client_->DisplayDamaged(); 55 client_->DisplayDamaged();
52 } 56 }
53 57
54 void Display::InitializeRenderer() { 58 void Display::InitializeRenderer() {
55 if (resource_provider_) 59 if (resource_provider_)
56 return; 60 return;
57 61
58 int highp_threshold_min = 0; 62 int highp_threshold_min = 0;
59 bool use_rgba_4444_texture_format = false; 63 bool use_rgba_4444_texture_format = false;
60 size_t id_allocation_chunk_size = 1; 64 size_t id_allocation_chunk_size = 1;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // while Aggregate is called to immediately run release callbacks afterward. 112 // while Aggregate is called to immediately run release callbacks afterward.
109 scoped_ptr<CompositorFrame> frame = 113 scoped_ptr<CompositorFrame> frame =
110 aggregator_->Aggregate(current_surface_id_); 114 aggregator_->Aggregate(current_surface_id_);
111 if (!frame) 115 if (!frame)
112 return false; 116 return false;
113 117
114 TRACE_EVENT0("cc", "Display::Draw"); 118 TRACE_EVENT0("cc", "Display::Draw");
115 benchmark_instrumentation::IssueDisplayRenderingStatsEvent(); 119 benchmark_instrumentation::IssueDisplayRenderingStatsEvent();
116 DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); 120 DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
117 121
118 // Only reshape when we know we are going to draw. Otherwise, the reshape
119 // can leave the window at the wrong size if we never draw and the proper
120 // viewport size is never set.
121 output_surface_->Reshape(current_surface_size_, 1.f);
122 float device_scale_factor = 1.0f;
123 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); 122 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_);
124 gfx::Rect device_clip_rect = device_viewport_rect; 123 gfx::Rect device_clip_rect = device_viewport_rect;
125 bool disable_picture_quad_image_filtering = false; 124 bool disable_picture_quad_image_filtering = false;
126 125
127 renderer_->DecideRenderPassAllocationsForFrame(frame_data->render_pass_list); 126 renderer_->DecideRenderPassAllocationsForFrame(frame_data->render_pass_list);
128 renderer_->DrawFrame(&frame_data->render_pass_list, 127 renderer_->DrawFrame(&frame_data->render_pass_list,
129 device_scale_factor, 128 device_scale_factor_,
130 device_viewport_rect, 129 device_viewport_rect,
131 device_clip_rect, 130 device_clip_rect,
132 disable_picture_quad_image_filtering); 131 disable_picture_quad_image_filtering);
133 renderer_->SwapBuffers(frame->metadata); 132 renderer_->SwapBuffers(frame->metadata);
134 for (SurfaceAggregator::SurfaceIndexMap::iterator it = 133 for (SurfaceAggregator::SurfaceIndexMap::iterator it =
135 aggregator_->previous_contained_surfaces().begin(); 134 aggregator_->previous_contained_surfaces().begin();
136 it != aggregator_->previous_contained_surfaces().end(); 135 it != aggregator_->previous_contained_surfaces().end();
137 ++it) { 136 ++it) {
138 Surface* surface = manager_->GetSurfaceForId(it->first); 137 Surface* surface = manager_->GetSurfaceForId(it->first);
139 if (surface) 138 if (surface)
(...skipping 28 matching lines...) Expand all
168 return current_surface_id_; 167 return current_surface_id_;
169 } 168 }
170 169
171 int Display::GetMaxFramesPending() { 170 int Display::GetMaxFramesPending() {
172 if (!output_surface_) 171 if (!output_surface_)
173 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING; 172 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
174 return output_surface_->capabilities().max_frames_pending; 173 return output_surface_->capabilities().max_frames_pending;
175 } 174 }
176 175
177 } // namespace cc 176 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/display.h ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698