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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 DCHECK(thread_checker_.CalledOnValidThread()); | 608 DCHECK(thread_checker_.CalledOnValidThread()); |
609 // Just store the information. Mailbox will be consumed in LockForRead(). | 609 // Just store the information. Mailbox will be consumed in LockForRead(). |
610 ResourceId id = next_id_++; | 610 ResourceId id = next_id_++; |
611 DCHECK(mailbox.IsValid()); | 611 DCHECK(mailbox.IsValid()); |
612 Resource& resource = resources_[id]; | 612 Resource& resource = resources_[id]; |
613 if (mailbox.IsTexture()) { | 613 if (mailbox.IsTexture()) { |
614 resource = Resource(0, | 614 resource = Resource(0, |
615 gfx::Size(), | 615 gfx::Size(), |
616 Resource::External, | 616 Resource::External, |
617 mailbox.target(), | 617 mailbox.target(), |
618 GL_LINEAR, | 618 mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, |
619 0, | 619 0, |
620 GL_CLAMP_TO_EDGE, | 620 GL_CLAMP_TO_EDGE, |
621 TextureHintImmutable, | 621 TextureHintImmutable, |
622 RGBA_8888); | 622 RGBA_8888); |
623 } else { | 623 } else { |
624 DCHECK(mailbox.IsSharedMemory()); | 624 DCHECK(mailbox.IsSharedMemory()); |
625 base::SharedMemory* shared_memory = mailbox.shared_memory(); | 625 base::SharedMemory* shared_memory = mailbox.shared_memory(); |
626 DCHECK(shared_memory->memory()); | 626 DCHECK(shared_memory->memory()); |
627 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); | 627 uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory()); |
628 DCHECK(pixels); | 628 DCHECK(pixels); |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 ContextProvider* context_provider = output_surface_->context_provider(); | 2159 ContextProvider* context_provider = output_surface_->context_provider(); |
2160 return context_provider ? context_provider->ContextGL() : NULL; | 2160 return context_provider ? context_provider->ContextGL() : NULL; |
2161 } | 2161 } |
2162 | 2162 |
2163 class GrContext* ResourceProvider::GrContext() const { | 2163 class GrContext* ResourceProvider::GrContext() const { |
2164 ContextProvider* context_provider = output_surface_->context_provider(); | 2164 ContextProvider* context_provider = output_surface_->context_provider(); |
2165 return context_provider ? context_provider->GrContext() : NULL; | 2165 return context_provider ? context_provider->GrContext() : NULL; |
2166 } | 2166 } |
2167 | 2167 |
2168 } // namespace cc | 2168 } // namespace cc |
OLD | NEW |