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/layers/texture_layer_impl.h" | 5 #include "cc/layers/texture_layer_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/output/renderer.h" | 10 #include "cc/output/renderer.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Have to upload a copy to a texture for it to be used in a | 98 // Have to upload a copy to a texture for it to be used in a |
99 // hardware draw. | 99 // hardware draw. |
100 if (!texture_copy_) | 100 if (!texture_copy_) |
101 texture_copy_ = ScopedResource::Create(resource_provider); | 101 texture_copy_ = ScopedResource::Create(resource_provider); |
102 if (texture_copy_->size() != texture_mailbox_.shared_memory_size() || | 102 if (texture_copy_->size() != texture_mailbox_.shared_memory_size() || |
103 resource_provider->InUseByConsumer(texture_copy_->id())) | 103 resource_provider->InUseByConsumer(texture_copy_->id())) |
104 texture_copy_->Free(); | 104 texture_copy_->Free(); |
105 | 105 |
106 if (!texture_copy_->id()) { | 106 if (!texture_copy_->id()) { |
107 texture_copy_->Allocate(texture_mailbox_.shared_memory_size(), | 107 texture_copy_->Allocate(texture_mailbox_.shared_memory_size(), |
108 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 108 ResourceProvider::TextureHintImmutable, |
109 resource_provider->best_texture_format()); | 109 resource_provider->best_texture_format()); |
110 } | 110 } |
111 | 111 |
112 if (texture_copy_->id()) { | 112 if (texture_copy_->id()) { |
113 std::vector<uint8> swizzled; | 113 std::vector<uint8> swizzled; |
114 uint8* pixels = texture_mailbox_.shared_bitmap()->pixels(); | 114 uint8* pixels = texture_mailbox_.shared_bitmap()->pixels(); |
115 | 115 |
116 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) { | 116 if (!PlatformColor::SameComponentOrder(texture_copy_->format())) { |
117 // Swizzle colors. This is slow, but should be really uncommon. | 117 // Swizzle colors. This is slow, but should be really uncommon. |
118 size_t bytes = texture_mailbox_.SharedMemorySizeInBytes(); | 118 size_t bytes = texture_mailbox_.SharedMemorySizeInBytes(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } else if (external_texture_resource_) { | 256 } else if (external_texture_resource_) { |
257 DCHECK(!own_mailbox_); | 257 DCHECK(!own_mailbox_); |
258 ResourceProvider* resource_provider = | 258 ResourceProvider* resource_provider = |
259 layer_tree_impl()->resource_provider(); | 259 layer_tree_impl()->resource_provider(); |
260 resource_provider->DeleteResource(external_texture_resource_); | 260 resource_provider->DeleteResource(external_texture_resource_); |
261 external_texture_resource_ = 0; | 261 external_texture_resource_ = 0; |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 } // namespace cc | 265 } // namespace cc |
OLD | NEW |