Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/surface.h" | 5 #include "components/exo/surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 void Surface::SetUseSurfaceLayer(bool use_surface_layer) { | 258 void Surface::SetUseSurfaceLayer(bool use_surface_layer) { |
| 259 use_surface_layer_ = use_surface_layer; | 259 use_surface_layer_ = use_surface_layer; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void Surface::Attach(Buffer* buffer) { | 262 void Surface::Attach(Buffer* buffer) { |
| 263 TRACE_EVENT1("exo", "Surface::Attach", "buffer", | 263 TRACE_EVENT1("exo", "Surface::Attach", "buffer", |
| 264 buffer ? buffer->GetSize().ToString() : "null"); | 264 buffer ? buffer->GetSize().ToString() : "null"); |
| 265 | 265 |
| 266 has_pending_contents_ = true; | 266 has_pending_contents_ = true; |
| 267 pending_buffer_ = buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>(); | 267 pending_buffer_ = buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>(); |
| 268 | |
| 269 if ((pending_buffer_ && | |
| 270 (current_resource_.size != pending_buffer_->GetSize())) || | |
| 271 (!pending_buffer_ && !current_resource_.size.IsEmpty())) { | |
| 272 modified_layer_info_ = true; | |
|
reveman
2016/06/09 14:19:29
Can we evaluate this as part of CommitSurfaceHiera
| |
| 273 } | |
| 268 } | 274 } |
| 269 | 275 |
| 270 void Surface::Damage(const gfx::Rect& damage) { | 276 void Surface::Damage(const gfx::Rect& damage) { |
| 271 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString()); | 277 TRACE_EVENT1("exo", "Surface::Damage", "damage", damage.ToString()); |
| 272 | 278 |
| 273 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op); | 279 pending_damage_.op(gfx::RectToSkIRect(damage), SkRegion::kUnion_Op); |
| 274 } | 280 } |
| 275 | 281 |
| 276 void Surface::RequestFrameCallback(const FrameCallback& callback) { | 282 void Surface::RequestFrameCallback(const FrameCallback& callback) { |
| 277 TRACE_EVENT0("exo", "Surface::RequestFrameCallback"); | 283 TRACE_EVENT0("exo", "Surface::RequestFrameCallback"); |
| 278 | 284 |
| 279 pending_frame_callbacks_.push_back(callback); | 285 pending_frame_callbacks_.push_back(callback); |
| 280 } | 286 } |
| 281 | 287 |
| 282 void Surface::SetOpaqueRegion(const SkRegion& region) { | 288 void Surface::SetOpaqueRegion(const SkRegion& region) { |
| 283 TRACE_EVENT1("exo", "Surface::SetOpaqueRegion", "region", | 289 TRACE_EVENT1("exo", "Surface::SetOpaqueRegion", "region", |
| 284 gfx::SkIRectToRect(region.getBounds()).ToString()); | 290 gfx::SkIRectToRect(region.getBounds()).ToString()); |
| 285 | 291 |
| 292 if (pending_opaque_region_ == region) | |
| 293 return; | |
| 286 pending_opaque_region_ = region; | 294 pending_opaque_region_ = region; |
| 295 modified_layer_info_ = true; | |
| 287 } | 296 } |
| 288 | 297 |
| 289 void Surface::SetInputRegion(const SkRegion& region) { | 298 void Surface::SetInputRegion(const SkRegion& region) { |
| 290 TRACE_EVENT1("exo", "Surface::SetInputRegion", "region", | 299 TRACE_EVENT1("exo", "Surface::SetInputRegion", "region", |
| 291 gfx::SkIRectToRect(region.getBounds()).ToString()); | 300 gfx::SkIRectToRect(region.getBounds()).ToString()); |
| 292 | 301 |
| 293 pending_input_region_ = region; | 302 pending_input_region_ = region; |
| 303 modified_layer_info_ = true; | |
| 294 } | 304 } |
| 295 | 305 |
| 296 void Surface::SetBufferScale(float scale) { | 306 void Surface::SetBufferScale(float scale) { |
| 297 TRACE_EVENT1("exo", "Surface::SetBufferScale", "scale", scale); | 307 TRACE_EVENT1("exo", "Surface::SetBufferScale", "scale", scale); |
| 308 if (pending_buffer_scale_ == scale) | |
| 309 return; | |
| 298 | 310 |
| 299 pending_buffer_scale_ = scale; | 311 pending_buffer_scale_ = scale; |
| 312 | |
| 313 modified_layer_info_ = true; | |
| 300 } | 314 } |
| 301 | 315 |
| 302 void Surface::AddSubSurface(Surface* sub_surface) { | 316 void Surface::AddSubSurface(Surface* sub_surface) { |
| 303 TRACE_EVENT1("exo", "Surface::AddSubSurface", "sub_surface", | 317 TRACE_EVENT1("exo", "Surface::AddSubSurface", "sub_surface", |
| 304 sub_surface->AsTracedValue()); | 318 sub_surface->AsTracedValue()); |
| 305 | 319 |
| 306 DCHECK(!sub_surface->parent()); | 320 DCHECK(!sub_surface->parent()); |
| 307 DCHECK(!sub_surface->IsVisible()); | 321 DCHECK(!sub_surface->IsVisible()); |
| 308 AddChild(sub_surface); | 322 AddChild(sub_surface); |
| 309 | 323 |
| 310 DCHECK(!ListContainsEntry(pending_sub_surfaces_, sub_surface)); | 324 DCHECK(!ListContainsEntry(pending_sub_surfaces_, sub_surface)); |
| 311 pending_sub_surfaces_.push_back(std::make_pair(sub_surface, gfx::Point())); | 325 pending_sub_surfaces_.push_back(std::make_pair(sub_surface, gfx::Point())); |
| 326 modified_layer_info_ = true; | |
| 312 } | 327 } |
| 313 | 328 |
| 314 void Surface::RemoveSubSurface(Surface* sub_surface) { | 329 void Surface::RemoveSubSurface(Surface* sub_surface) { |
| 315 TRACE_EVENT1("exo", "Surface::AddSubSurface", "sub_surface", | 330 TRACE_EVENT1("exo", "Surface::AddSubSurface", "sub_surface", |
| 316 sub_surface->AsTracedValue()); | 331 sub_surface->AsTracedValue()); |
| 317 | 332 |
| 318 RemoveChild(sub_surface); | 333 RemoveChild(sub_surface); |
| 319 if (sub_surface->IsVisible()) | 334 if (sub_surface->IsVisible()) |
| 320 sub_surface->Hide(); | 335 sub_surface->Hide(); |
| 321 | 336 |
| 322 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); | 337 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); |
| 323 pending_sub_surfaces_.erase( | 338 pending_sub_surfaces_.erase( |
| 324 FindListEntry(pending_sub_surfaces_, sub_surface)); | 339 FindListEntry(pending_sub_surfaces_, sub_surface)); |
| 340 modified_layer_info_ = true; | |
| 325 } | 341 } |
| 326 | 342 |
| 327 void Surface::SetSubSurfacePosition(Surface* sub_surface, | 343 void Surface::SetSubSurfacePosition(Surface* sub_surface, |
| 328 const gfx::Point& position) { | 344 const gfx::Point& position) { |
| 329 TRACE_EVENT2("exo", "Surface::SetSubSurfacePosition", "sub_surface", | 345 TRACE_EVENT2("exo", "Surface::SetSubSurfacePosition", "sub_surface", |
| 330 sub_surface->AsTracedValue(), "position", position.ToString()); | 346 sub_surface->AsTracedValue(), "position", position.ToString()); |
| 331 | 347 |
| 332 auto it = FindListEntry(pending_sub_surfaces_, sub_surface); | 348 auto it = FindListEntry(pending_sub_surfaces_, sub_surface); |
| 333 DCHECK(it != pending_sub_surfaces_.end()); | 349 DCHECK(it != pending_sub_surfaces_.end()); |
| 350 if (it->second == position) | |
| 351 return; | |
| 334 it->second = position; | 352 it->second = position; |
| 353 modified_layer_info_ = true; | |
| 335 } | 354 } |
| 336 | 355 |
| 337 void Surface::PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference) { | 356 void Surface::PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference) { |
| 338 TRACE_EVENT2("exo", "Surface::PlaceSubSurfaceAbove", "sub_surface", | 357 TRACE_EVENT2("exo", "Surface::PlaceSubSurfaceAbove", "sub_surface", |
| 339 sub_surface->AsTracedValue(), "reference", | 358 sub_surface->AsTracedValue(), "reference", |
| 340 reference->AsTracedValue()); | 359 reference->AsTracedValue()); |
| 341 | 360 |
| 342 if (sub_surface == reference) { | 361 if (sub_surface == reference) { |
| 343 DLOG(WARNING) << "Client tried to place sub-surface above itself"; | 362 DLOG(WARNING) << "Client tried to place sub-surface above itself"; |
| 344 return; | 363 return; |
| 345 } | 364 } |
| 346 | 365 |
| 347 auto position_it = pending_sub_surfaces_.begin(); | 366 auto position_it = pending_sub_surfaces_.begin(); |
| 348 if (reference != this) { | 367 if (reference != this) { |
| 349 position_it = FindListEntry(pending_sub_surfaces_, reference); | 368 position_it = FindListEntry(pending_sub_surfaces_, reference); |
| 350 if (position_it == pending_sub_surfaces_.end()) { | 369 if (position_it == pending_sub_surfaces_.end()) { |
| 351 DLOG(WARNING) << "Client tried to place sub-surface above a reference " | 370 DLOG(WARNING) << "Client tried to place sub-surface above a reference " |
| 352 "surface that is neither a parent nor a sibling"; | 371 "surface that is neither a parent nor a sibling"; |
| 353 return; | 372 return; |
| 354 } | 373 } |
| 355 | 374 |
| 356 // Advance iterator to have |position_it| point to the sibling surface | 375 // Advance iterator to have |position_it| point to the sibling surface |
| 357 // above |reference|. | 376 // above |reference|. |
| 358 ++position_it; | 377 ++position_it; |
| 359 } | 378 } |
| 360 | 379 |
| 361 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); | 380 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); |
| 362 pending_sub_surfaces_.splice( | 381 auto it = FindListEntry(pending_sub_surfaces_, sub_surface); |
| 363 position_it, pending_sub_surfaces_, | 382 if (it == position_it) |
| 364 FindListEntry(pending_sub_surfaces_, sub_surface)); | 383 return; |
| 384 pending_sub_surfaces_.splice(position_it, pending_sub_surfaces_, it); | |
| 385 modified_layer_info_ = true; | |
| 365 } | 386 } |
| 366 | 387 |
| 367 void Surface::PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling) { | 388 void Surface::PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling) { |
| 368 TRACE_EVENT2("exo", "Surface::PlaceSubSurfaceBelow", "sub_surface", | 389 TRACE_EVENT2("exo", "Surface::PlaceSubSurfaceBelow", "sub_surface", |
| 369 sub_surface->AsTracedValue(), "sibling", | 390 sub_surface->AsTracedValue(), "sibling", |
| 370 sibling->AsTracedValue()); | 391 sibling->AsTracedValue()); |
| 371 | 392 |
| 372 if (sub_surface == sibling) { | 393 if (sub_surface == sibling) { |
| 373 DLOG(WARNING) << "Client tried to place sub-surface below itself"; | 394 DLOG(WARNING) << "Client tried to place sub-surface below itself"; |
| 374 return; | 395 return; |
| 375 } | 396 } |
| 376 | 397 |
| 377 auto sibling_it = FindListEntry(pending_sub_surfaces_, sibling); | 398 auto sibling_it = FindListEntry(pending_sub_surfaces_, sibling); |
| 378 if (sibling_it == pending_sub_surfaces_.end()) { | 399 if (sibling_it == pending_sub_surfaces_.end()) { |
| 379 DLOG(WARNING) << "Client tried to place sub-surface below a surface that " | 400 DLOG(WARNING) << "Client tried to place sub-surface below a surface that " |
| 380 "is not a sibling"; | 401 "is not a sibling"; |
| 381 return; | 402 return; |
| 382 } | 403 } |
| 383 | 404 |
| 384 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); | 405 DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); |
| 385 pending_sub_surfaces_.splice( | 406 auto it = FindListEntry(pending_sub_surfaces_, sub_surface); |
| 386 sibling_it, pending_sub_surfaces_, | 407 if (it == sibling_it) |
| 387 FindListEntry(pending_sub_surfaces_, sub_surface)); | 408 return; |
| 409 pending_sub_surfaces_.splice(sibling_it, pending_sub_surfaces_, it); | |
| 410 modified_layer_info_ = true; | |
| 388 } | 411 } |
| 389 | 412 |
| 390 void Surface::SetViewport(const gfx::Size& viewport) { | 413 void Surface::SetViewport(const gfx::Size& viewport) { |
| 391 TRACE_EVENT1("exo", "Surface::SetViewport", "viewport", viewport.ToString()); | 414 TRACE_EVENT1("exo", "Surface::SetViewport", "viewport", viewport.ToString()); |
| 392 | 415 |
| 416 if (pending_viewport_ == viewport) | |
| 417 return; | |
| 393 pending_viewport_ = viewport; | 418 pending_viewport_ = viewport; |
| 419 modified_layer_info_ = true; | |
| 394 } | 420 } |
| 395 | 421 |
| 396 void Surface::SetCrop(const gfx::RectF& crop) { | 422 void Surface::SetCrop(const gfx::RectF& crop) { |
| 397 TRACE_EVENT1("exo", "Surface::SetCrop", "crop", crop.ToString()); | 423 TRACE_EVENT1("exo", "Surface::SetCrop", "crop", crop.ToString()); |
| 398 | 424 |
| 425 if (pending_crop_ == crop) | |
| 426 return; | |
| 399 pending_crop_ = crop; | 427 pending_crop_ = crop; |
| 428 modified_layer_info_ = true; | |
| 400 } | 429 } |
| 401 | 430 |
| 402 void Surface::SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output) { | 431 void Surface::SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output) { |
| 403 TRACE_EVENT1("exo", "Surface::SetOnlyVisibleOnSecureOutput", | 432 TRACE_EVENT1("exo", "Surface::SetOnlyVisibleOnSecureOutput", |
| 404 "only_visible_on_secure_output", only_visible_on_secure_output); | 433 "only_visible_on_secure_output", only_visible_on_secure_output); |
| 405 | 434 |
| 406 pending_only_visible_on_secure_output_ = only_visible_on_secure_output; | 435 pending_only_visible_on_secure_output_ = only_visible_on_secure_output; |
| 407 } | 436 } |
| 408 | 437 |
| 409 void Surface::SetBlendMode(SkXfermode::Mode blend_mode) { | 438 void Surface::SetBlendMode(SkXfermode::Mode blend_mode) { |
| 410 TRACE_EVENT1("exo", "Surface::SetBlendMode", "blend_mode", blend_mode); | 439 TRACE_EVENT1("exo", "Surface::SetBlendMode", "blend_mode", blend_mode); |
| 411 | 440 |
| 441 if (pending_blend_mode_ == blend_mode) | |
| 442 return; | |
| 412 pending_blend_mode_ = blend_mode; | 443 pending_blend_mode_ = blend_mode; |
| 444 modified_layer_info_ = true; | |
| 413 } | 445 } |
| 414 | 446 |
| 415 void Surface::SetAlpha(float alpha) { | 447 void Surface::SetAlpha(float alpha) { |
| 416 TRACE_EVENT1("exo", "Surface::SetAlpha", "alpha", alpha); | 448 TRACE_EVENT1("exo", "Surface::SetAlpha", "alpha", alpha); |
| 417 | 449 |
| 450 if (pending_alpha_ == alpha) | |
| 451 return; | |
| 418 pending_alpha_ = alpha; | 452 pending_alpha_ = alpha; |
| 453 modified_layer_info_ = true; | |
| 419 } | 454 } |
| 420 | 455 |
| 421 void Surface::Commit() { | 456 void Surface::Commit() { |
| 422 TRACE_EVENT0("exo", "Surface::Commit"); | 457 TRACE_EVENT0("exo", "Surface::Commit"); |
| 423 | 458 |
| 424 needs_commit_surface_hierarchy_ = true; | 459 needs_commit_surface_hierarchy_ = true; |
| 425 | 460 |
| 426 if (delegate_) | 461 if (delegate_) { |
| 427 delegate_->OnSurfaceCommit(); | 462 delegate_->OnSurfaceCommit(); |
| 428 else | 463 } else { |
| 464 CheckForCommittingToNewSurface(); | |
|
reveman
2016/06/09 14:19:29
Instead of adding this function, can the requireme
| |
| 429 CommitSurfaceHierarchy(); | 465 CommitSurfaceHierarchy(); |
| 466 } | |
| 430 } | 467 } |
| 431 | 468 |
| 432 void Surface::CommitSurfaceHierarchy() { | 469 void Surface::CommitSurfaceHierarchy() { |
| 433 DCHECK(needs_commit_surface_hierarchy_); | 470 DCHECK(needs_commit_surface_hierarchy_); |
| 434 needs_commit_surface_hierarchy_ = false; | 471 needs_commit_surface_hierarchy_ = false; |
| 472 modified_layer_info_ = false; | |
| 435 | 473 |
| 436 // TODO(dcastagna): Make secure_output_only a layer property instead of a | 474 // TODO(dcastagna): Make secure_output_only a layer property instead of a |
| 437 // texture mailbox flag so this can be changed without have to provide | 475 // texture mailbox flag so this can be changed without have to provide |
| 438 // new contents. | 476 // new contents. |
| 439 only_visible_on_secure_output_ = pending_only_visible_on_secure_output_; | 477 only_visible_on_secure_output_ = pending_only_visible_on_secure_output_; |
| 440 pending_only_visible_on_secure_output_ = false; | 478 pending_only_visible_on_secure_output_ = false; |
| 441 | 479 |
| 442 // Update current alpha. | 480 // Update current alpha. |
| 443 alpha_ = pending_alpha_; | 481 alpha_ = pending_alpha_; |
| 444 | 482 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 compositor_ = nullptr; | 670 compositor_ = nullptr; |
| 633 } | 671 } |
| 634 | 672 |
| 635 void Surface::WillDraw(cc::SurfaceId id) { | 673 void Surface::WillDraw(cc::SurfaceId id) { |
| 636 while (!active_frame_callbacks_.empty()) { | 674 while (!active_frame_callbacks_.empty()) { |
| 637 active_frame_callbacks_.front().Run(base::TimeTicks::Now()); | 675 active_frame_callbacks_.front().Run(base::TimeTicks::Now()); |
| 638 active_frame_callbacks_.pop_front(); | 676 active_frame_callbacks_.pop_front(); |
| 639 } | 677 } |
| 640 } | 678 } |
| 641 | 679 |
| 680 void Surface::CheckForCommittingToNewSurface() { | |
| 681 if (HaveChildLayersChanged()) | |
| 682 SetChildrenCommitToNewSurface(); | |
| 683 } | |
| 684 | |
| 685 bool Surface::HaveChildLayersChanged() { | |
| 686 if (needs_commit_surface_hierarchy_ && modified_layer_info_) | |
| 687 return true; | |
| 688 | |
| 689 for (auto& surf : pending_sub_surfaces_) { | |
| 690 if (surf.first->HaveChildLayersChanged()) | |
| 691 return true; | |
| 692 } | |
| 693 return false; | |
| 694 } | |
| 695 | |
| 696 void Surface::SetChildrenCommitToNewSurface() { | |
| 697 commit_to_new_surface_ = true; | |
| 698 for (auto& surf : pending_sub_surfaces_) { | |
| 699 surf.first->SetChildrenCommitToNewSurface(); | |
| 700 } | |
| 701 } | |
| 702 | |
| 642 void Surface::CommitTextureContents() { | 703 void Surface::CommitTextureContents() { |
| 643 // We update contents if Attach() has been called since last commit. | 704 // We update contents if Attach() has been called since last commit. |
| 644 if (has_pending_contents_) { | 705 if (has_pending_contents_) { |
| 645 has_pending_contents_ = false; | 706 has_pending_contents_ = false; |
| 646 | 707 |
| 647 current_buffer_ = pending_buffer_; | 708 current_buffer_ = pending_buffer_; |
| 648 pending_buffer_.reset(); | 709 pending_buffer_.reset(); |
| 649 | 710 |
| 650 cc::TextureMailbox texture_mailbox; | 711 cc::TextureMailbox texture_mailbox; |
| 651 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; | 712 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 803 |
| 743 factory_owner_->release_callbacks_[resource.id] = std::make_pair( | 804 factory_owner_->release_callbacks_[resource.id] = std::make_pair( |
| 744 factory_owner_, std::move(texture_mailbox_release_callback)); | 805 factory_owner_, std::move(texture_mailbox_release_callback)); |
| 745 current_resource_ = resource; | 806 current_resource_ = resource; |
| 746 } else { | 807 } else { |
| 747 current_resource_.id = 0; | 808 current_resource_.id = 0; |
| 748 current_resource_.size = gfx::Size(); | 809 current_resource_.size = gfx::Size(); |
| 749 } | 810 } |
| 750 } | 811 } |
| 751 | 812 |
| 752 cc::SurfaceId old_surface_id = surface_id_; | 813 cc::SurfaceId old_surface_id; |
| 753 surface_id_ = factory_owner_->id_allocator_->GenerateId(); | 814 bool new_surface = false; |
|
reveman
2016/06/09 14:19:29
is this variable needed? would "surface_id_ != old
| |
| 754 factory_owner_->surface_factory_->Create(surface_id_); | 815 if (commit_to_new_surface_ || surface_id_.is_null()) { |
| 816 commit_to_new_surface_ = false; | |
| 817 new_surface = true; | |
| 818 old_surface_id = surface_id_; | |
| 819 surface_id_ = factory_owner_->id_allocator_->GenerateId(); | |
| 820 factory_owner_->surface_factory_->Create(surface_id_); | |
| 821 } | |
| 755 | 822 |
| 756 gfx::Size buffer_size = current_resource_.size; | 823 gfx::Size buffer_size = current_resource_.size; |
| 757 gfx::SizeF scaled_buffer_size( | 824 gfx::SizeF scaled_buffer_size( |
| 758 gfx::ScaleSize(gfx::SizeF(buffer_size), 1.0f / pending_buffer_scale_)); | 825 gfx::ScaleSize(gfx::SizeF(buffer_size), 1.0f / pending_buffer_scale_)); |
| 759 | 826 |
| 760 gfx::Size layer_size; // Size of the output layer, in DIP. | 827 gfx::Size layer_size; // Size of the output layer, in DIP. |
| 761 if (!pending_viewport_.IsEmpty()) { | 828 if (!pending_viewport_.IsEmpty()) { |
| 762 layer_size = pending_viewport_; | 829 layer_size = pending_viewport_; |
| 763 } else if (!crop_.IsEmpty()) { | 830 } else if (!crop_.IsEmpty()) { |
| 764 DLOG_IF(WARNING, !gfx::IsExpressibleAsInt(crop_.width()) || | 831 DLOG_IF(WARNING, !gfx::IsExpressibleAsInt(crop_.width()) || |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 | 904 |
| 838 factory_owner_->surface_factory_->SubmitCompositorFrame( | 905 factory_owner_->surface_factory_->SubmitCompositorFrame( |
| 839 surface_id_, std::move(frame), cc::SurfaceFactory::DrawCallback()); | 906 surface_id_, std::move(frame), cc::SurfaceFactory::DrawCallback()); |
| 840 | 907 |
| 841 if (!old_surface_id.is_null()) { | 908 if (!old_surface_id.is_null()) { |
| 842 factory_owner_->surface_factory_->SetPreviousFrameSurface(surface_id_, | 909 factory_owner_->surface_factory_->SetPreviousFrameSurface(surface_id_, |
| 843 old_surface_id); | 910 old_surface_id); |
| 844 factory_owner_->surface_factory_->Destroy(old_surface_id); | 911 factory_owner_->surface_factory_->Destroy(old_surface_id); |
| 845 } | 912 } |
| 846 | 913 |
| 847 layer()->SetShowSurface( | 914 if (new_surface) { |
| 848 surface_id_, | 915 layer()->SetShowSurface( |
| 849 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 916 surface_id_, |
| 850 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), | 917 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), |
| 851 contents_surface_size, contents_surface_to_layer_scale, layer_size); | 918 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), |
| 852 layer()->SetBounds(gfx::Rect(layer()->bounds().origin(), layer_size)); | 919 contents_surface_size, contents_surface_to_layer_scale, layer_size); |
| 853 layer()->SetFillsBoundsOpaquely(alpha_ == 1.0f && frame_is_opaque); | 920 layer()->SetBounds(gfx::Rect(layer()->bounds().origin(), layer_size)); |
| 921 layer()->SetFillsBoundsOpaquely(alpha_ == 1.0f && frame_is_opaque); | |
| 922 } | |
| 854 | 923 |
| 855 // Reset damage. | 924 // Reset damage. |
| 856 pending_damage_.setEmpty(); | 925 pending_damage_.setEmpty(); |
| 857 | 926 |
| 858 DCHECK(!current_resource_.id || | 927 DCHECK(!current_resource_.id || |
| 859 factory_owner_->release_callbacks_.count(current_resource_.id)); | 928 factory_owner_->release_callbacks_.count(current_resource_.id)); |
| 860 | 929 |
| 861 // Move pending frame callbacks to the end of active_frame_callbacks_ | 930 // Move pending frame callbacks to the end of active_frame_callbacks_ |
| 862 active_frame_callbacks_.splice(active_frame_callbacks_.end(), | 931 active_frame_callbacks_.splice(active_frame_callbacks_.end(), |
| 863 pending_frame_callbacks_); | 932 pending_frame_callbacks_); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 layer->SetShowSurface( | 965 layer->SetShowSurface( |
| 897 surface_id_, | 966 surface_id_, |
| 898 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 967 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), |
| 899 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), | 968 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), |
| 900 layer_size, contents_surface_to_layer_scale, layer_size); | 969 layer_size, contents_surface_to_layer_scale, layer_size); |
| 901 } | 970 } |
| 902 | 971 |
| 903 bool Surface::use_surface_layer_ = false; | 972 bool Surface::use_surface_layer_ = false; |
| 904 | 973 |
| 905 } // namespace exo | 974 } // namespace exo |
| OLD | NEW |