| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 ResourceId ResourceProvider::CreateResourceFromTextureMailbox( | 587 ResourceId ResourceProvider::CreateResourceFromTextureMailbox( |
| 588 const TextureMailbox& mailbox, | 588 const TextureMailbox& mailbox, |
| 589 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 589 scoped_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 590 bool read_lock_fences_enabled) { | 590 bool read_lock_fences_enabled) { |
| 591 DCHECK(thread_checker_.CalledOnValidThread()); | 591 DCHECK(thread_checker_.CalledOnValidThread()); |
| 592 // Just store the information. Mailbox will be consumed in LockForRead(). | 592 // Just store the information. Mailbox will be consumed in LockForRead(). |
| 593 ResourceId id = next_id_++; | 593 ResourceId id = next_id_++; |
| 594 DCHECK(mailbox.IsValid()); | 594 DCHECK(mailbox.IsValid()); |
| 595 Resource* resource = nullptr; | 595 Resource* resource = nullptr; |
| 596 if (mailbox.IsTexture()) { | 596 if (mailbox.IsTexture()) { |
| 597 gfx::Size size = |
| 598 mailbox.is_overlay_candidate() ? mailbox.size_in_pixels() : gfx::Size(); |
| 597 resource = InsertResource( | 599 resource = InsertResource( |
| 598 id, | 600 id, |
| 599 Resource(0, gfx::Size(), Resource::EXTERNAL, mailbox.target(), | 601 Resource(0, size, Resource::EXTERNAL, mailbox.target(), |
| 600 mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, | 602 mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, |
| 601 TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, RGBA_8888)); | 603 TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, RGBA_8888)); |
| 602 } else { | 604 } else { |
| 603 DCHECK(mailbox.IsSharedMemory()); | 605 DCHECK(mailbox.IsSharedMemory()); |
| 604 SharedBitmap* shared_bitmap = mailbox.shared_bitmap(); | 606 SharedBitmap* shared_bitmap = mailbox.shared_bitmap(); |
| 605 uint8_t* pixels = shared_bitmap->pixels(); | 607 uint8_t* pixels = shared_bitmap->pixels(); |
| 606 DCHECK(pixels); | 608 DCHECK(pixels); |
| 607 resource = InsertResource( | 609 resource = InsertResource( |
| 608 id, Resource(pixels, shared_bitmap, mailbox.size_in_pixels(), | 610 id, Resource(pixels, shared_bitmap, mailbox.size_in_pixels(), |
| 609 Resource::EXTERNAL, GL_LINEAR)); | 611 Resource::EXTERNAL, GL_LINEAR)); |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 | 1961 |
| 1960 const int kImportance = 2; | 1962 const int kImportance = 2; |
| 1961 pmd->CreateSharedGlobalAllocatorDump(guid); | 1963 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1962 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1964 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1963 } | 1965 } |
| 1964 | 1966 |
| 1965 return true; | 1967 return true; |
| 1966 } | 1968 } |
| 1967 | 1969 |
| 1968 } // namespace cc | 1970 } // namespace cc |
| OLD | NEW |