| 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/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 DCHECK(thread_checker_.CalledOnValidThread()); | 589 DCHECK(thread_checker_.CalledOnValidThread()); |
| 590 // Just store the information. Mailbox will be consumed in LockForRead(). | 590 // Just store the information. Mailbox will be consumed in LockForRead(). |
| 591 ResourceId id = next_id_++; | 591 ResourceId id = next_id_++; |
| 592 DCHECK(mailbox.IsValid()); | 592 DCHECK(mailbox.IsValid()); |
| 593 Resource& resource = resources_[id]; | 593 Resource& resource = resources_[id]; |
| 594 if (mailbox.IsTexture()) { | 594 if (mailbox.IsTexture()) { |
| 595 resource = Resource(0, | 595 resource = Resource(0, |
| 596 gfx::Size(), | 596 gfx::Size(), |
| 597 Resource::External, | 597 Resource::External, |
| 598 mailbox.target(), | 598 mailbox.target(), |
| 599 GL_LINEAR, | 599 mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, |
| 600 0, | 600 0, |
| 601 GL_CLAMP_TO_EDGE, | 601 GL_CLAMP_TO_EDGE, |
| 602 TextureHintImmutable, | 602 TextureHintImmutable, |
| 603 RGBA_8888); | 603 RGBA_8888); |
| 604 } else { | 604 } else { |
| 605 DCHECK(mailbox.IsSharedMemory()); | 605 DCHECK(mailbox.IsSharedMemory()); |
| 606 base::SharedMemory* shared_memory = mailbox.shared_memory(); | 606 base::SharedMemory* shared_memory = mailbox.shared_memory(); |
| 607 DCHECK(shared_memory->memory()); | 607 DCHECK(shared_memory->memory()); |
| 608 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); | 608 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); |
| 609 DCHECK(pixels); | 609 DCHECK(pixels); |
| (...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 ContextProvider* context_provider = output_surface_->context_provider(); | 2064 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2065 return context_provider ? context_provider->ContextGL() : NULL; | 2065 return context_provider ? context_provider->ContextGL() : NULL; |
| 2066 } | 2066 } |
| 2067 | 2067 |
| 2068 class GrContext* ResourceProvider::GrContext() const { | 2068 class GrContext* ResourceProvider::GrContext() const { |
| 2069 ContextProvider* context_provider = output_surface_->context_provider(); | 2069 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2070 return context_provider ? context_provider->GrContext() : NULL; | 2070 return context_provider ? context_provider->GrContext() : NULL; |
| 2071 } | 2071 } |
| 2072 | 2072 |
| 2073 } // namespace cc | 2073 } // namespace cc |
| OLD | NEW |