| 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 | 5 |
| 6 #ifndef CCResourceProvider_h | 6 #ifndef CCResourceProvider_h |
| 7 #define CCResourceProvider_h | 7 #define CCResourceProvider_h |
| 8 | 8 |
| 9 #include "CCGraphicsContext.h" | 9 #include "CCGraphicsContext.h" |
| 10 #include "GraphicsContext3D.h" | 10 #include "GraphicsContext3D.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 GC3Dbyte name[64]; | 50 GC3Dbyte name[64]; |
| 51 }; | 51 }; |
| 52 struct TransferableResource { | 52 struct TransferableResource { |
| 53 unsigned id; | 53 unsigned id; |
| 54 GC3Denum format; | 54 GC3Denum format; |
| 55 IntSize size; | 55 IntSize size; |
| 56 Mailbox mailbox; | 56 Mailbox mailbox; |
| 57 }; | 57 }; |
| 58 typedef Vector<TransferableResource> TransferableResourceArray; | 58 typedef Vector<TransferableResource> TransferableResourceArray; |
| 59 struct TransferableResourceList { | 59 struct TransferableResourceList { |
| 60 TransferableResourceList(); |
| 61 ~TransferableResourceList(); |
| 62 |
| 60 TransferableResourceArray resources; | 63 TransferableResourceArray resources; |
| 61 unsigned syncPoint; | 64 unsigned syncPoint; |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*, TextureUplo
aderOption); | 67 static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*, TextureUplo
aderOption); |
| 65 | 68 |
| 66 virtual ~CCResourceProvider(); | 69 virtual ~CCResourceProvider(); |
| 67 | 70 |
| 68 WebKit::WebGraphicsContext3D* graphicsContext3D(); | 71 WebKit::WebGraphicsContext3D* graphicsContext3D(); |
| 69 TextureUploader* textureUploader() const { return m_textureUploader.get(); } | 72 TextureUploader* textureUploader() const { return m_textureUploader.get(); } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 204 |
| 202 private: | 205 private: |
| 203 CCResourceProvider* m_resourceProvider; | 206 CCResourceProvider* m_resourceProvider; |
| 204 CCResourceProvider::ResourceId m_resourceId; | 207 CCResourceProvider::ResourceId m_resourceId; |
| 205 SkBitmap m_skBitmap; | 208 SkBitmap m_skBitmap; |
| 206 SkCanvas m_skCanvas; | 209 SkCanvas m_skCanvas; |
| 207 }; | 210 }; |
| 208 | 211 |
| 209 private: | 212 private: |
| 210 struct Resource { | 213 struct Resource { |
| 211 Resource() | 214 Resource(); |
| 212 : glId(0) | 215 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for
mat); |
| 213 , pixels(0) | 216 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format
); |
| 214 , pool(0) | 217 |
| 215 , lockForReadCount(0) | |
| 216 , lockedForWrite(false) | |
| 217 , external(false) | |
| 218 , exported(false) | |
| 219 , size() | |
| 220 , format(0) | |
| 221 , type(static_cast<ResourceType>(0)) | |
| 222 { } | |
| 223 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for
mat) | |
| 224 : glId(textureId) | |
| 225 , pixels(0) | |
| 226 , pool(pool) | |
| 227 , lockForReadCount(0) | |
| 228 , lockedForWrite(false) | |
| 229 , external(false) | |
| 230 , exported(false) | |
| 231 , size(size) | |
| 232 , format(format) | |
| 233 , type(GLTexture) | |
| 234 { } | |
| 235 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format
) | |
| 236 : glId(0) | |
| 237 , pixels(pixels) | |
| 238 , pool(pool) | |
| 239 , lockForReadCount(0) | |
| 240 , lockedForWrite(false) | |
| 241 , external(false) | |
| 242 , exported(false) | |
| 243 , size(size) | |
| 244 , format(format) | |
| 245 , type(Bitmap) | |
| 246 { } | |
| 247 unsigned glId; | 218 unsigned glId; |
| 248 uint8_t* pixels; | 219 uint8_t* pixels; |
| 249 int pool; | 220 int pool; |
| 250 int lockForReadCount; | 221 int lockForReadCount; |
| 251 bool lockedForWrite; | 222 bool lockedForWrite; |
| 252 bool external; | 223 bool external; |
| 253 bool exported; | 224 bool exported; |
| 254 IntSize size; | 225 IntSize size; |
| 255 GC3Denum format; | 226 GC3Denum format; |
| 256 ResourceType type; | 227 ResourceType type; |
| 257 }; | 228 }; |
| 258 typedef HashMap<ResourceId, Resource> ResourceMap; | 229 typedef HashMap<ResourceId, Resource> ResourceMap; |
| 259 struct Child { | 230 struct Child { |
| 231 Child(); |
| 232 ~Child(); |
| 233 |
| 260 int pool; | 234 int pool; |
| 261 ResourceIdMap childToParentMap; | 235 ResourceIdMap childToParentMap; |
| 262 ResourceIdMap parentToChildMap; | 236 ResourceIdMap parentToChildMap; |
| 263 }; | 237 }; |
| 264 typedef HashMap<int, Child> ChildMap; | 238 typedef HashMap<int, Child> ChildMap; |
| 265 | 239 |
| 266 explicit CCResourceProvider(CCGraphicsContext*); | 240 explicit CCResourceProvider(CCGraphicsContext*); |
| 267 bool initialize(TextureUploaderOption); | 241 bool initialize(TextureUploaderOption); |
| 268 | 242 |
| 269 const Resource* lockForRead(ResourceId); | 243 const Resource* lockForRead(ResourceId); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 289 bool m_useShallowFlush; | 263 bool m_useShallowFlush; |
| 290 OwnPtr<LayerTextureSubImage> m_texSubImage; | 264 OwnPtr<LayerTextureSubImage> m_texSubImage; |
| 291 OwnPtr<TextureUploader> m_textureUploader; | 265 OwnPtr<TextureUploader> m_textureUploader; |
| 292 OwnPtr<AcceleratedTextureCopier> m_textureCopier; | 266 OwnPtr<AcceleratedTextureCopier> m_textureCopier; |
| 293 int m_maxTextureSize; | 267 int m_maxTextureSize; |
| 294 }; | 268 }; |
| 295 | 269 |
| 296 } | 270 } |
| 297 | 271 |
| 298 #endif | 272 #endif |
| OLD | NEW |