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/resource_provider.h" | 5 #include "cc/resource_provider.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 ResourceId id = m_nextId++; | 191 ResourceId id = m_nextId++; |
192 Resource resource(pixels, pool, size, GL_RGBA); | 192 Resource resource(pixels, pool, size, GL_RGBA); |
193 m_resources[id] = resource; | 193 m_resources[id] = resource; |
194 return id; | 194 return id; |
195 } | 195 } |
196 | 196 |
197 ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture
(unsigned textureId) | 197 ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture
(unsigned textureId) |
198 { | 198 { |
199 DCHECK(m_threadChecker.CalledOnValidThread()); | 199 DCHECK(m_threadChecker.CalledOnValidThread()); |
200 DCHECK(m_context->context3D()); | 200 |
| 201 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 202 DCHECK(context3d); |
| 203 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); |
| 204 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_LINEAR)); |
| 205 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_LINEAR)); |
| 206 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL
_CLAMP_TO_EDGE)); |
| 207 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL
_CLAMP_TO_EDGE)); |
| 208 |
201 ResourceId id = m_nextId++; | 209 ResourceId id = m_nextId++; |
202 Resource resource(textureId, 0, gfx::Size(), 0); | 210 Resource resource(textureId, 0, gfx::Size(), 0); |
203 resource.external = true; | 211 resource.external = true; |
204 m_resources[id] = resource; | 212 m_resources[id] = resource; |
205 return id; | 213 return id; |
206 } | 214 } |
207 | 215 |
208 void ResourceProvider::deleteResource(ResourceId id) | 216 void ResourceProvider::deleteResource(ResourceId id) |
209 { | 217 { |
210 DCHECK(m_threadChecker.CalledOnValidThread()); | 218 DCHECK(m_threadChecker.CalledOnValidThread()); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 g_debugZone = zone; | 691 g_debugZone = zone; |
684 } | 692 } |
685 | 693 |
686 void ResourceProvider::debugNotifyLeaveZone() | 694 void ResourceProvider::debugNotifyLeaveZone() |
687 { | 695 { |
688 g_debugZone = 0; | 696 g_debugZone = 0; |
689 } | 697 } |
690 | 698 |
691 | 699 |
692 } // namespace cc | 700 } // namespace cc |
OLD | NEW |