| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 // Note: order is important here. | 1667 // Note: order is important here. |
| 1668 renderer_.reset(); | 1668 renderer_.reset(); |
| 1669 tile_manager_.reset(); | 1669 tile_manager_.reset(); |
| 1670 resource_provider_.reset(); | 1670 resource_provider_.reset(); |
| 1671 output_surface_.reset(); | 1671 output_surface_.reset(); |
| 1672 | 1672 |
| 1673 if (!output_surface->BindToClient(this)) | 1673 if (!output_surface->BindToClient(this)) |
| 1674 return false; | 1674 return false; |
| 1675 | 1675 |
| 1676 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( | 1676 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( |
| 1677 output_surface.get(), settings_.highp_threshold_min); | 1677 output_surface.get(), |
| 1678 settings_.highp_threshold_min, |
| 1679 settings_.use_rgba_4444_textures, |
| 1680 settings_.force_rgba_textures); |
| 1678 if (!resource_provider) | 1681 if (!resource_provider) |
| 1679 return false; | 1682 return false; |
| 1680 | 1683 |
| 1681 if (output_surface->capabilities().deferred_gl_initialization) | 1684 if (output_surface->capabilities().deferred_gl_initialization) |
| 1682 EnforceZeroBudget(true); | 1685 EnforceZeroBudget(true); |
| 1683 | 1686 |
| 1684 bool skip_gl_renderer = false; | 1687 bool skip_gl_renderer = false; |
| 1685 CreateAndSetRenderer( | 1688 CreateAndSetRenderer( |
| 1686 output_surface.get(), resource_provider.get(), skip_gl_renderer); | 1689 output_surface.get(), resource_provider.get(), skip_gl_renderer); |
| 1687 | 1690 |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 break; | 2627 break; |
| 2625 } | 2628 } |
| 2626 | 2629 |
| 2627 // Allow for multiple creation requests with the same UIResourceId. The | 2630 // Allow for multiple creation requests with the same UIResourceId. The |
| 2628 // previous resource is simply deleted. | 2631 // previous resource is simply deleted. |
| 2629 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); | 2632 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); |
| 2630 if (id) | 2633 if (id) |
| 2631 DeleteUIResource(uid); | 2634 DeleteUIResource(uid); |
| 2632 id = resource_provider_->CreateResource( | 2635 id = resource_provider_->CreateResource( |
| 2633 bitmap->GetSize(), | 2636 bitmap->GetSize(), |
| 2634 resource_provider_->best_texture_format(), | |
| 2635 wrap_mode, | 2637 wrap_mode, |
| 2636 ResourceProvider::TextureUsageAny); | 2638 ResourceProvider::TextureUsageAny, |
| 2639 resource_provider_->best_texture_format()); |
| 2637 | 2640 |
| 2638 ui_resource_map_[uid] = id; | 2641 ui_resource_map_[uid] = id; |
| 2639 resource_provider_->SetPixels(id, | 2642 resource_provider_->SetPixels(id, |
| 2640 reinterpret_cast<uint8_t*>(bitmap->GetPixels()), | 2643 reinterpret_cast<uint8_t*>(bitmap->GetPixels()), |
| 2641 gfx::Rect(bitmap->GetSize()), | 2644 gfx::Rect(bitmap->GetSize()), |
| 2642 gfx::Rect(bitmap->GetSize()), | 2645 gfx::Rect(bitmap->GetSize()), |
| 2643 gfx::Vector2d(0, 0)); | 2646 gfx::Vector2d(0, 0)); |
| 2644 } | 2647 } |
| 2645 | 2648 |
| 2646 void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { | 2649 void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2662 | 2665 |
| 2663 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( | 2666 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( |
| 2664 UIResourceId uid) const { | 2667 UIResourceId uid) const { |
| 2665 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); | 2668 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); |
| 2666 if (iter != ui_resource_map_.end()) | 2669 if (iter != ui_resource_map_.end()) |
| 2667 return iter->second; | 2670 return iter->second; |
| 2668 return 0; | 2671 return 0; |
| 2669 } | 2672 } |
| 2670 | 2673 |
| 2671 } // namespace cc | 2674 } // namespace cc |
| OLD | NEW |