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

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

Issue 22529002: [cc] Allow resources and ui resources to specify wrap mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix botched resolve Created 7 years, 3 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
« no previous file with comments | « cc/resources/resource_provider_unittest.cc ('k') | cc/resources/ui_resource_bitmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/scoped_resource.h" 5 #include "cc/resources/scoped_resource.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 ScopedResource::ScopedResource(ResourceProvider* resource_provider) 9 ScopedResource::ScopedResource(ResourceProvider* resource_provider)
10 : resource_provider_(resource_provider) { 10 : resource_provider_(resource_provider) {
11 DCHECK(resource_provider_); 11 DCHECK(resource_provider_);
12 } 12 }
13 13
14 ScopedResource::~ScopedResource() { 14 ScopedResource::~ScopedResource() {
15 Free(); 15 Free();
16 } 16 }
17 17
18 bool ScopedResource::Allocate(gfx::Size size, 18 bool ScopedResource::Allocate(gfx::Size size,
19 GLenum format, 19 GLenum format,
20 ResourceProvider::TextureUsageHint hint) { 20 ResourceProvider::TextureUsageHint hint) {
21 DCHECK(!id()); 21 DCHECK(!id());
22 DCHECK(!size.IsEmpty()); 22 DCHECK(!size.IsEmpty());
23 23
24 set_dimensions(size, format); 24 set_dimensions(size, format);
25 set_id(resource_provider_->CreateResource(size, format, hint)); 25 set_id(resource_provider_->CreateResource(
26 size, format, GL_CLAMP_TO_EDGE, hint));
26 27
27 #ifndef NDEBUG 28 #ifndef NDEBUG
28 allocate_thread_id_ = base::PlatformThread::CurrentId(); 29 allocate_thread_id_ = base::PlatformThread::CurrentId();
29 #endif 30 #endif
30 31
31 return id() != 0; 32 return id() != 0;
32 } 33 }
33 34
34 void ScopedResource::Free() { 35 void ScopedResource::Free() {
35 if (id()) { 36 if (id()) {
36 #ifndef NDEBUG 37 #ifndef NDEBUG
37 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId()); 38 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId());
38 #endif 39 #endif
39 resource_provider_->DeleteResource(id()); 40 resource_provider_->DeleteResource(id());
40 } 41 }
41 set_id(0); 42 set_id(0);
42 } 43 }
43 44
44 void ScopedResource::Leak() { 45 void ScopedResource::Leak() {
45 set_id(0); 46 set_id(0);
46 } 47 }
47 48
48 } // namespace cc 49 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider_unittest.cc ('k') | cc/resources/ui_resource_bitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698