| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCResourceProvider.h" | 7 #include "CCResourceProvider.h" |
| 8 #ifdef LOG | 8 #ifdef LOG |
| 9 #undef LOG | 9 #undef LOG |
| 10 #endif | 10 #endif |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 return storageFormat; | 44 return storageFormat; |
| 45 } | 45 } |
| 46 | 46 |
| 47 static bool isTextureFormatSupportedForStorage(GC3Denum format) | 47 static bool isTextureFormatSupportedForStorage(GC3Denum format) |
| 48 { | 48 { |
| 49 return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EX
T); | 49 return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EX
T); |
| 50 } | 50 } |
| 51 | 51 |
| 52 CCResourceProvider::TransferableResourceList::TransferableResourceList() |
| 53 { |
| 54 } |
| 55 |
| 56 CCResourceProvider::TransferableResourceList::~TransferableResourceList() |
| 57 { |
| 58 } |
| 59 |
| 60 CCResourceProvider::Resource::Resource() |
| 61 : glId(0) |
| 62 , pixels(0) |
| 63 , pool(0) |
| 64 , lockForReadCount(0) |
| 65 , lockedForWrite(false) |
| 66 , external(false) |
| 67 , exported(false) |
| 68 , size() |
| 69 , format(0) |
| 70 , type(static_cast<ResourceType>(0)) |
| 71 { |
| 72 } |
| 73 |
| 74 CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSi
ze& size, GC3Denum format) |
| 75 : glId(textureId) |
| 76 , pixels(0) |
| 77 , pool(pool) |
| 78 , lockForReadCount(0) |
| 79 , lockedForWrite(false) |
| 80 , external(false) |
| 81 , exported(false) |
| 82 , size(size) |
| 83 , format(format) |
| 84 , type(GLTexture) |
| 85 { |
| 86 } |
| 87 |
| 88 CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize&
size, GC3Denum format) |
| 89 : glId(0) |
| 90 , pixels(pixels) |
| 91 , pool(pool) |
| 92 , lockForReadCount(0) |
| 93 , lockedForWrite(false) |
| 94 , external(false) |
| 95 , exported(false) |
| 96 , size(size) |
| 97 , format(format) |
| 98 , type(Bitmap) |
| 99 { |
| 100 } |
| 101 |
| 102 CCResourceProvider::Child::Child() |
| 103 { |
| 104 } |
| 105 |
| 106 CCResourceProvider::Child::~Child() |
| 107 { |
| 108 } |
| 109 |
| 52 PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* con
text, TextureUploaderOption option) | 110 PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* con
text, TextureUploaderOption option) |
| 53 { | 111 { |
| 54 OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(
context))); | 112 OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(
context))); |
| 55 if (!resourceProvider->initialize(option)) | 113 if (!resourceProvider->initialize(option)) |
| 56 return nullptr; | 114 return nullptr; |
| 57 return resourceProvider.release(); | 115 return resourceProvider.release(); |
| 58 } | 116 } |
| 59 | 117 |
| 60 CCResourceProvider::~CCResourceProvider() | 118 CCResourceProvider::~CCResourceProvider() |
| 61 { | 119 { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 if (childPoolSet.contains(it->second.pool)) | 701 if (childPoolSet.contains(it->second.pool)) |
| 644 #endif | 702 #endif |
| 645 ++maxMailboxCount; | 703 ++maxMailboxCount; |
| 646 } | 704 } |
| 647 } | 705 } |
| 648 while (m_mailboxes.size() > maxMailboxCount) | 706 while (m_mailboxes.size() > maxMailboxCount) |
| 649 m_mailboxes.removeFirst(); | 707 m_mailboxes.removeFirst(); |
| 650 } | 708 } |
| 651 | 709 |
| 652 } | 710 } |
| OLD | NEW |