| 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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 TextureUsageAny, | 1426 TextureUsageAny, |
| 1427 it->format); | 1427 it->format); |
| 1428 resource.mailbox = TextureMailbox(it->mailbox_holder.mailbox, | 1428 resource.mailbox = TextureMailbox(it->mailbox_holder.mailbox, |
| 1429 it->mailbox_holder.texture_target, | 1429 it->mailbox_holder.texture_target, |
| 1430 it->mailbox_holder.sync_point); | 1430 it->mailbox_holder.sync_point); |
| 1431 } | 1431 } |
| 1432 resource.child_id = child; | 1432 resource.child_id = child; |
| 1433 // Don't allocate a texture for a child. | 1433 // Don't allocate a texture for a child. |
| 1434 resource.allocated = true; | 1434 resource.allocated = true; |
| 1435 resource.imported_count = 1; | 1435 resource.imported_count = 1; |
| 1436 resource.allow_overlay = it->allow_overlay; |
| 1436 child_info.parent_to_child_map[local_id] = it->id; | 1437 child_info.parent_to_child_map[local_id] = it->id; |
| 1437 child_info.child_to_parent_map[it->id] = local_id; | 1438 child_info.child_to_parent_map[it->id] = local_id; |
| 1438 } | 1439 } |
| 1439 } | 1440 } |
| 1440 | 1441 |
| 1441 void ResourceProvider::DeclareUsedResourcesFromChild( | 1442 void ResourceProvider::DeclareUsedResourcesFromChild( |
| 1442 int child, | 1443 int child, |
| 1443 const ResourceIdArray& resources_from_child) { | 1444 const ResourceIdArray& resources_from_child) { |
| 1444 DCHECK(thread_checker_.CalledOnValidThread()); | 1445 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1445 | 1446 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 DCHECK(!source->locked_for_write); | 1587 DCHECK(!source->locked_for_write); |
| 1587 DCHECK(!source->lock_for_read_count); | 1588 DCHECK(!source->lock_for_read_count); |
| 1588 DCHECK(source->origin != Resource::External || source->mailbox.IsValid()); | 1589 DCHECK(source->origin != Resource::External || source->mailbox.IsValid()); |
| 1589 DCHECK(source->allocated); | 1590 DCHECK(source->allocated); |
| 1590 resource->id = id; | 1591 resource->id = id; |
| 1591 resource->format = source->format; | 1592 resource->format = source->format; |
| 1592 resource->mailbox_holder.texture_target = source->target; | 1593 resource->mailbox_holder.texture_target = source->target; |
| 1593 resource->filter = source->filter; | 1594 resource->filter = source->filter; |
| 1594 resource->size = source->size; | 1595 resource->size = source->size; |
| 1595 resource->is_repeated = (source->wrap_mode == GL_REPEAT); | 1596 resource->is_repeated = (source->wrap_mode == GL_REPEAT); |
| 1597 resource->allow_overlay = source->allow_overlay; |
| 1596 | 1598 |
| 1597 if (source->type == Bitmap) { | 1599 if (source->type == Bitmap) { |
| 1598 resource->mailbox_holder.mailbox = source->shared_bitmap_id; | 1600 resource->mailbox_holder.mailbox = source->shared_bitmap_id; |
| 1599 resource->is_software = true; | 1601 resource->is_software = true; |
| 1600 } else if (!source->mailbox.IsValid()) { | 1602 } else if (!source->mailbox.IsValid()) { |
| 1601 LazyCreate(source); | 1603 LazyCreate(source); |
| 1602 DCHECK(source->gl_id); | 1604 DCHECK(source->gl_id); |
| 1603 DCHECK(source->origin == Resource::Internal); | 1605 DCHECK(source->origin == Resource::Internal); |
| 1604 GLC(gl, | 1606 GLC(gl, |
| 1605 gl->BindTexture(resource->mailbox_holder.texture_target, | 1607 gl->BindTexture(resource->mailbox_holder.texture_target, |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 ContextProvider* context_provider = output_surface_->context_provider(); | 2252 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2251 return context_provider ? context_provider->ContextGL() : NULL; | 2253 return context_provider ? context_provider->ContextGL() : NULL; |
| 2252 } | 2254 } |
| 2253 | 2255 |
| 2254 class GrContext* ResourceProvider::GrContext() const { | 2256 class GrContext* ResourceProvider::GrContext() const { |
| 2255 ContextProvider* context_provider = output_surface_->context_provider(); | 2257 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2256 return context_provider ? context_provider->GrContext() : NULL; | 2258 return context_provider ? context_provider->GrContext() : NULL; |
| 2257 } | 2259 } |
| 2258 | 2260 |
| 2259 } // namespace cc | 2261 } // namespace cc |
| OLD | NEW |