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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 // Note: order is important here. | 1691 // Note: order is important here. |
1692 renderer_.reset(); | 1692 renderer_.reset(); |
1693 tile_manager_.reset(); | 1693 tile_manager_.reset(); |
1694 resource_provider_.reset(); | 1694 resource_provider_.reset(); |
1695 output_surface_.reset(); | 1695 output_surface_.reset(); |
1696 | 1696 |
1697 if (!output_surface->BindToClient(this)) | 1697 if (!output_surface->BindToClient(this)) |
1698 return false; | 1698 return false; |
1699 | 1699 |
1700 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( | 1700 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( |
1701 output_surface.get(), settings_.highp_threshold_min); | 1701 output_surface.get(), |
| 1702 settings_.highp_threshold_min, |
| 1703 settings_.use_rgba_4444_textures); |
1702 if (!resource_provider) | 1704 if (!resource_provider) |
1703 return false; | 1705 return false; |
1704 | 1706 |
1705 if (output_surface->capabilities().deferred_gl_initialization) | 1707 if (output_surface->capabilities().deferred_gl_initialization) |
1706 EnforceZeroBudget(true); | 1708 EnforceZeroBudget(true); |
1707 | 1709 |
1708 bool skip_gl_renderer = false; | 1710 bool skip_gl_renderer = false; |
1709 CreateAndSetRenderer( | 1711 CreateAndSetRenderer( |
1710 output_surface.get(), resource_provider.get(), skip_gl_renderer); | 1712 output_surface.get(), resource_provider.get(), skip_gl_renderer); |
1711 | 1713 |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 break; | 2644 break; |
2643 } | 2645 } |
2644 | 2646 |
2645 // Allow for multiple creation requests with the same UIResourceId. The | 2647 // Allow for multiple creation requests with the same UIResourceId. The |
2646 // previous resource is simply deleted. | 2648 // previous resource is simply deleted. |
2647 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); | 2649 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); |
2648 if (id) | 2650 if (id) |
2649 DeleteUIResource(uid); | 2651 DeleteUIResource(uid); |
2650 id = resource_provider_->CreateResource( | 2652 id = resource_provider_->CreateResource( |
2651 bitmap->GetSize(), | 2653 bitmap->GetSize(), |
2652 resource_provider_->best_texture_format(), | |
2653 wrap_mode, | 2654 wrap_mode, |
2654 ResourceProvider::TextureUsageAny); | 2655 ResourceProvider::TextureUsageAny, |
| 2656 resource_provider_->best_texture_format()); |
2655 | 2657 |
2656 ui_resource_map_[uid] = id; | 2658 ui_resource_map_[uid] = id; |
2657 resource_provider_->SetPixels(id, | 2659 resource_provider_->SetPixels(id, |
2658 reinterpret_cast<uint8_t*>(bitmap->GetPixels()), | 2660 reinterpret_cast<uint8_t*>(bitmap->GetPixels()), |
2659 gfx::Rect(bitmap->GetSize()), | 2661 gfx::Rect(bitmap->GetSize()), |
2660 gfx::Rect(bitmap->GetSize()), | 2662 gfx::Rect(bitmap->GetSize()), |
2661 gfx::Vector2d(0, 0)); | 2663 gfx::Vector2d(0, 0)); |
2662 MarkUIResourceNotEvicted(uid); | 2664 MarkUIResourceNotEvicted(uid); |
2663 } | 2665 } |
2664 | 2666 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 std::set<UIResourceId>::iterator found_in_evicted = | 2706 std::set<UIResourceId>::iterator found_in_evicted = |
2705 evicted_ui_resources_.find(uid); | 2707 evicted_ui_resources_.find(uid); |
2706 if (found_in_evicted == evicted_ui_resources_.end()) | 2708 if (found_in_evicted == evicted_ui_resources_.end()) |
2707 return; | 2709 return; |
2708 evicted_ui_resources_.erase(found_in_evicted); | 2710 evicted_ui_resources_.erase(found_in_evicted); |
2709 if (evicted_ui_resources_.empty()) | 2711 if (evicted_ui_resources_.empty()) |
2710 client_->OnCanDrawStateChanged(CanDraw()); | 2712 client_->OnCanDrawStateChanged(CanDraw()); |
2711 } | 2713 } |
2712 | 2714 |
2713 } // namespace cc | 2715 } // namespace cc |
OLD | NEW |