| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/heads_up_display_layer_impl.h" | 5 #include "cc/layers/heads_up_display_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ResourceProvider* resource_provider) { | 89 ResourceProvider* resource_provider) { |
| 90 for (auto& resource : resources_) { | 90 for (auto& resource : resources_) { |
| 91 if (!resource_provider->InUseByConsumer(resource->id())) { | 91 if (!resource_provider->InUseByConsumer(resource->id())) { |
| 92 resource.swap(resources_.back()); | 92 resource.swap(resources_.back()); |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 std::unique_ptr<ScopedResource> resource = | 97 std::unique_ptr<ScopedResource> resource = |
| 98 ScopedResource::Create(resource_provider); | 98 ScopedResource::Create(resource_provider); |
| 99 resource->Allocate(internal_content_bounds_, | 99 resource->Allocate( |
| 100 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 100 internal_content_bounds_, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 101 resource_provider->best_texture_format()); | 101 resource_provider->best_texture_format(), gfx::ColorSpace()); |
| 102 resources_.push_back(std::move(resource)); | 102 resources_.push_back(std::move(resource)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void HeadsUpDisplayLayerImpl::ReleaseUnmatchedSizeResources( | 105 void HeadsUpDisplayLayerImpl::ReleaseUnmatchedSizeResources( |
| 106 ResourceProvider* resource_provider) { | 106 ResourceProvider* resource_provider) { |
| 107 auto it_erase = | 107 auto it_erase = |
| 108 std::remove_if(resources_.begin(), resources_.end(), | 108 std::remove_if(resources_.begin(), resources_.end(), |
| 109 [this](const std::unique_ptr<ScopedResource>& resource) { | 109 [this](const std::unique_ptr<ScopedResource>& resource) { |
| 110 return internal_content_bounds_ != resource->size(); | 110 return internal_content_bounds_ != resource->size(); |
| 111 }); | 111 }); |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 return "cc::HeadsUpDisplayLayerImpl"; | 798 return "cc::HeadsUpDisplayLayerImpl"; |
| 799 } | 799 } |
| 800 | 800 |
| 801 void HeadsUpDisplayLayerImpl::AsValueInto( | 801 void HeadsUpDisplayLayerImpl::AsValueInto( |
| 802 base::trace_event::TracedValue* dict) const { | 802 base::trace_event::TracedValue* dict) const { |
| 803 LayerImpl::AsValueInto(dict); | 803 LayerImpl::AsValueInto(dict); |
| 804 dict->SetString("layer_name", "Heads Up Display Layer"); | 804 dict->SetString("layer_name", "Heads Up Display Layer"); |
| 805 } | 805 } |
| 806 | 806 |
| 807 } // namespace cc | 807 } // namespace cc |
| OLD | NEW |