Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: cc/resources/resource_provider.cc

Issue 303063002: Transfer texture wrap mode in in cc::Resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 continue; 1438 continue;
1439 } 1439 }
1440 1440
1441 ResourceId local_id = next_id_++; 1441 ResourceId local_id = next_id_++;
1442 Resource& resource = resources_[local_id]; 1442 Resource& resource = resources_[local_id];
1443 if (it->is_software) { 1443 if (it->is_software) {
1444 resource = Resource(it->mailbox_holder.mailbox, 1444 resource = Resource(it->mailbox_holder.mailbox,
1445 it->size, 1445 it->size,
1446 Resource::Delegated, 1446 Resource::Delegated,
1447 GL_LINEAR, 1447 GL_LINEAR,
1448 GL_CLAMP_TO_EDGE); 1448 it->is_repeated ? GL_REPEAT : GL_CLAMP_TO_EDGE);
1449 } else { 1449 } else {
1450 resource = Resource(0, 1450 resource = Resource(0,
1451 it->size, 1451 it->size,
1452 Resource::Delegated, 1452 Resource::Delegated,
1453 it->mailbox_holder.texture_target, 1453 it->mailbox_holder.texture_target,
1454 it->filter, 1454 it->filter,
1455 0, 1455 0,
1456 GL_CLAMP_TO_EDGE, 1456 it->is_repeated ? GL_REPEAT : GL_CLAMP_TO_EDGE,
1457 TextureUsageAny, 1457 TextureUsageAny,
1458 it->format); 1458 it->format);
1459 resource.mailbox = TextureMailbox(it->mailbox_holder.mailbox, 1459 resource.mailbox = TextureMailbox(it->mailbox_holder.mailbox,
1460 it->mailbox_holder.texture_target, 1460 it->mailbox_holder.texture_target,
1461 it->mailbox_holder.sync_point); 1461 it->mailbox_holder.sync_point);
1462 } 1462 }
1463 resource.child_id = child; 1463 resource.child_id = child;
1464 // Don't allocate a texture for a child. 1464 // Don't allocate a texture for a child.
1465 resource.allocated = true; 1465 resource.allocated = true;
1466 resource.imported_count = 1; 1466 resource.imported_count = 1;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 Resource* source = GetResource(id); 1613 Resource* source = GetResource(id);
1614 DCHECK(!source->locked_for_write); 1614 DCHECK(!source->locked_for_write);
1615 DCHECK(!source->lock_for_read_count); 1615 DCHECK(!source->lock_for_read_count);
1616 DCHECK(source->origin != Resource::External || source->mailbox.IsValid()); 1616 DCHECK(source->origin != Resource::External || source->mailbox.IsValid());
1617 DCHECK(source->allocated); 1617 DCHECK(source->allocated);
1618 resource->id = id; 1618 resource->id = id;
1619 resource->format = source->format; 1619 resource->format = source->format;
1620 resource->mailbox_holder.texture_target = source->target; 1620 resource->mailbox_holder.texture_target = source->target;
1621 resource->filter = source->filter; 1621 resource->filter = source->filter;
1622 resource->size = source->size; 1622 resource->size = source->size;
1623 resource->is_repeated = (source->wrap_mode == GL_REPEAT);
1623 1624
1624 if (source->type == Bitmap) { 1625 if (source->type == Bitmap) {
1625 resource->mailbox_holder.mailbox = source->shared_bitmap_id; 1626 resource->mailbox_holder.mailbox = source->shared_bitmap_id;
1626 resource->is_software = true; 1627 resource->is_software = true;
1627 } else if (!source->mailbox.IsValid()) { 1628 } else if (!source->mailbox.IsValid()) {
1628 LazyCreate(source); 1629 LazyCreate(source);
1629 DCHECK(source->gl_id); 1630 DCHECK(source->gl_id);
1630 DCHECK(source->origin == Resource::Internal); 1631 DCHECK(source->origin == Resource::Internal);
1631 GLC(gl, 1632 GLC(gl,
1632 gl->BindTexture(resource->mailbox_holder.texture_target, 1633 gl->BindTexture(resource->mailbox_holder.texture_target,
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 ContextProvider* context_provider = output_surface_->context_provider(); 2279 ContextProvider* context_provider = output_surface_->context_provider();
2279 return context_provider ? context_provider->ContextGL() : NULL; 2280 return context_provider ? context_provider->ContextGL() : NULL;
2280 } 2281 }
2281 2282
2282 class GrContext* ResourceProvider::GrContext() const { 2283 class GrContext* ResourceProvider::GrContext() const {
2283 ContextProvider* context_provider = output_surface_->context_provider(); 2284 ContextProvider* context_provider = output_surface_->context_provider();
2284 return context_provider ? context_provider->GrContext() : NULL; 2285 return context_provider ? context_provider->GrContext() : NULL;
2285 } 2286 }
2286 2287
2287 } // namespace cc 2288 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/transferable_resource.h » ('j') | cc/resources/transferable_resource.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698