| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (external_texture_resource_) | 99 if (external_texture_resource_) |
| 100 own_mailbox_ = false; | 100 own_mailbox_ = false; |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (!valid_texture_copy_ && draw_mode == DRAW_MODE_HARDWARE && | 103 if (!valid_texture_copy_ && draw_mode == DRAW_MODE_HARDWARE && |
| 104 texture_mailbox_.IsSharedMemory()) { | 104 texture_mailbox_.IsSharedMemory()) { |
| 105 DCHECK(!external_texture_resource_); | 105 DCHECK(!external_texture_resource_); |
| 106 // Have to upload a copy to a texture for it to be used in a | 106 // Have to upload a copy to a texture for it to be used in a |
| 107 // hardware draw. | 107 // hardware draw. |
| 108 if (!texture_copy_) | 108 if (!texture_copy_) |
| 109 texture_copy_ = ScopedResource::Create(resource_provider); | 109 texture_copy_ = base::MakeUnique<ScopedResource>(resource_provider); |
| 110 if (texture_copy_->size() != texture_mailbox_.size_in_pixels() || | 110 if (texture_copy_->size() != texture_mailbox_.size_in_pixels() || |
| 111 resource_provider->InUseByConsumer(texture_copy_->id())) | 111 resource_provider->InUseByConsumer(texture_copy_->id())) |
| 112 texture_copy_->Free(); | 112 texture_copy_->Free(); |
| 113 | 113 |
| 114 if (!texture_copy_->id()) { | 114 if (!texture_copy_->id()) { |
| 115 texture_copy_->Allocate(texture_mailbox_.size_in_pixels(), | 115 texture_copy_->Allocate(texture_mailbox_.size_in_pixels(), |
| 116 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 116 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 117 resource_provider->best_texture_format(), | 117 resource_provider->best_texture_format(), |
| 118 gfx::ColorSpace()); | 118 gfx::ColorSpace()); |
| 119 } | 119 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } else if (external_texture_resource_) { | 263 } else if (external_texture_resource_) { |
| 264 DCHECK(!own_mailbox_); | 264 DCHECK(!own_mailbox_); |
| 265 ResourceProvider* resource_provider = | 265 ResourceProvider* resource_provider = |
| 266 layer_tree_impl()->resource_provider(); | 266 layer_tree_impl()->resource_provider(); |
| 267 resource_provider->DeleteResource(external_texture_resource_); | 267 resource_provider->DeleteResource(external_texture_resource_); |
| 268 external_texture_resource_ = 0; | 268 external_texture_resource_ = 0; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace cc | 272 } // namespace cc |
| OLD | NEW |