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/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 format); | 392 format); |
393 case RESOURCE_TYPE_BITMAP: | 393 case RESOURCE_TYPE_BITMAP: |
394 DCHECK_EQ(RGBA_8888, format); | 394 DCHECK_EQ(RGBA_8888, format); |
395 return CreateBitmap(size); | 395 return CreateBitmap(size); |
396 } | 396 } |
397 | 397 |
398 LOG(FATAL) << "Invalid default resource type."; | 398 LOG(FATAL) << "Invalid default resource type."; |
399 return 0; | 399 return 0; |
400 } | 400 } |
401 | 401 |
402 ResourceId ResourceProvider::CreateResourceWithTextureTarget( | 402 ResourceId ResourceProvider::CreateResourceWithImageTextureTarget( |
403 const gfx::Size& size, | 403 const gfx::Size& size, |
404 GLenum target, | |
405 TextureHint hint, | 404 TextureHint hint, |
406 ResourceFormat format) { | 405 ResourceFormat format) { |
407 DCHECK(!size.IsEmpty()); | 406 DCHECK(!size.IsEmpty()); |
408 switch (default_resource_type_) { | 407 switch (default_resource_type_) { |
409 case RESOURCE_TYPE_GL_TEXTURE: | 408 case RESOURCE_TYPE_GL_TEXTURE: { |
410 return CreateGLTexture(size, | 409 return CreateGLTexture(size, GetImageTextureTarget(format), hint, format); |
411 target, | 410 } |
412 hint, | |
413 format); | |
414 case RESOURCE_TYPE_BITMAP: | 411 case RESOURCE_TYPE_BITMAP: |
415 DCHECK_EQ(RGBA_8888, format); | 412 DCHECK_EQ(RGBA_8888, format); |
416 return CreateBitmap(size); | 413 return CreateBitmap(size); |
417 } | 414 } |
418 | 415 |
419 LOG(FATAL) << "Invalid default resource type."; | 416 LOG(FATAL) << "Invalid default resource type."; |
420 return 0; | 417 return 0; |
421 } | 418 } |
422 | 419 |
423 ResourceId ResourceProvider::CreateGLTexture(const gfx::Size& size, | 420 ResourceId ResourceProvider::CreateGLTexture(const gfx::Size& size, |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 const int kImportance = 2; | 1637 const int kImportance = 2; |
1641 pmd->CreateSharedGlobalAllocatorDump(guid); | 1638 pmd->CreateSharedGlobalAllocatorDump(guid); |
1642 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1639 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1643 } | 1640 } |
1644 } | 1641 } |
1645 | 1642 |
1646 return true; | 1643 return true; |
1647 } | 1644 } |
1648 | 1645 |
1649 } // namespace cc | 1646 } // namespace cc |
OLD | NEW |