OLD | NEW |
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 "services/view_manager/display_manager.h" | 5 #include "services/view_manager/display_manager.h" |
6 | 6 |
7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 surface_.set_client(this); | 132 surface_.set_client(this); |
133 surface_id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); | 133 surface_id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); |
134 Draw(); | 134 Draw(); |
135 } | 135 } |
136 | 136 |
137 void DefaultDisplayManager::Draw() { | 137 void DefaultDisplayManager::Draw() { |
138 if (!surface_) | 138 if (!surface_) |
139 return; | 139 return; |
140 if (surface_id_.is_null()) { | 140 if (surface_id_.is_null()) { |
141 surface_id_ = surface_id_allocator_->GenerateId(); | 141 surface_id_ = surface_id_allocator_->GenerateId(); |
142 surface_->CreateSurface(mojo::SurfaceId::From(surface_id_), | 142 surface_->CreateSurface(mojo::SurfaceId::From(surface_id_)); |
143 Size::From(size_)); | |
144 } | 143 } |
145 | 144 |
146 Rect rect; | 145 Rect rect; |
147 rect.width = size_.width(); | 146 rect.width = size_.width(); |
148 rect.height = size_.height(); | 147 rect.height = size_.height(); |
149 auto pass = CreateDefaultPass(1, rect); | 148 auto pass = CreateDefaultPass(1, rect); |
150 pass->damage_rect = Rect::From(dirty_rect_); | 149 pass->damage_rect = Rect::From(dirty_rect_); |
151 | 150 |
152 DrawViewTree(pass.get(), connection_manager_->root(), gfx::Vector2d(), 1.0f); | 151 DrawViewTree(pass.get(), connection_manager_->root(), gfx::Vector2d(), 1.0f); |
153 | 152 |
(...skipping 17 matching lines...) Expand all Loading... |
171 void DefaultDisplayManager::OnSizeChanged(mojo::SizePtr size) { | 170 void DefaultDisplayManager::OnSizeChanged(mojo::SizePtr size) { |
172 size_ = size.To<gfx::Size>(); | 171 size_ = size.To<gfx::Size>(); |
173 connection_manager_->root()->SetBounds(gfx::Rect(size_)); | 172 connection_manager_->root()->SetBounds(gfx::Rect(size_)); |
174 if (surface_id_.is_null()) | 173 if (surface_id_.is_null()) |
175 return; | 174 return; |
176 surface_->DestroySurface(mojo::SurfaceId::From(surface_id_)); | 175 surface_->DestroySurface(mojo::SurfaceId::From(surface_id_)); |
177 surface_id_ = cc::SurfaceId(); | 176 surface_id_ = cc::SurfaceId(); |
178 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); | 177 SchedulePaint(connection_manager_->root(), gfx::Rect(size_)); |
179 } | 178 } |
180 | 179 |
| 180 void DefaultDisplayManager::SetIdNamespace(uint32_t id_namespace) { |
| 181 } |
| 182 |
181 void DefaultDisplayManager::ReturnResources( | 183 void DefaultDisplayManager::ReturnResources( |
182 mojo::Array<mojo::ReturnedResourcePtr> resources) { | 184 mojo::Array<mojo::ReturnedResourcePtr> resources) { |
183 DCHECK_EQ(0u, resources.size()); | 185 DCHECK_EQ(0u, resources.size()); |
184 } | 186 } |
185 | 187 |
186 } // namespace view_manager | 188 } // namespace view_manager |
OLD | NEW |