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

Side by Side Diff: cc/resource_provider.h

Issue 11150025: Patch from https://codereview.chromium.org/11111005/ without actual file deletes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cc/program_binding.cc ('k') | cc/resource_provider.cc » ('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 #ifndef CCResourceProvider_h 5 #ifndef CCResourceProvider_h
6 #define CCResourceProvider_h 6 #define CCResourceProvider_h
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "third_party/khronos/GLES2/gl2.h"
9 #include "CCGraphicsContext.h" 10 #include "CCGraphicsContext.h"
10 #include "GraphicsContext3D.h"
11 #include "IntSize.h" 11 #include "IntSize.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "TextureCopier.h" 14 #include "TextureCopier.h"
15 #include <wtf/Deque.h> 15 #include <wtf/Deque.h>
16 #include <wtf/HashMap.h> 16 #include <wtf/HashMap.h>
17 #include <wtf/OwnPtr.h> 17 #include <wtf/OwnPtr.h>
18 #include <wtf/PassOwnPtr.h> 18 #include <wtf/PassOwnPtr.h>
19 #include <wtf/PassRefPtr.h> 19 #include <wtf/PassRefPtr.h>
20 #include <wtf/RefPtr.h> 20 #include <wtf/RefPtr.h>
(...skipping 16 matching lines...) Expand all
37 public: 37 public:
38 typedef unsigned ResourceId; 38 typedef unsigned ResourceId;
39 typedef Vector<ResourceId> ResourceIdArray; 39 typedef Vector<ResourceId> ResourceIdArray;
40 typedef HashMap<ResourceId, ResourceId> ResourceIdMap; 40 typedef HashMap<ResourceId, ResourceId> ResourceIdMap;
41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 41 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
42 enum ResourceType { 42 enum ResourceType {
43 GLTexture = 1, 43 GLTexture = 1,
44 Bitmap, 44 Bitmap,
45 }; 45 };
46 struct Mailbox { 46 struct Mailbox {
47 GC3Dbyte name[64]; 47 GLbyte name[64];
48 }; 48 };
49 struct TransferableResource { 49 struct TransferableResource {
50 unsigned id; 50 unsigned id;
51 GC3Denum format; 51 GLenum format;
52 IntSize size; 52 IntSize size;
53 Mailbox mailbox; 53 Mailbox mailbox;
54 }; 54 };
55 typedef Vector<TransferableResource> TransferableResourceArray; 55 typedef Vector<TransferableResource> TransferableResourceArray;
56 struct TransferableResourceList { 56 struct TransferableResourceList {
57 TransferableResourceList(); 57 TransferableResourceList();
58 ~TransferableResourceList(); 58 ~TransferableResourceList();
59 59
60 TransferableResourceArray resources; 60 TransferableResourceArray resources;
61 unsigned syncPoint; 61 unsigned syncPoint;
(...skipping 13 matching lines...) Expand all
75 bool inUseByConsumer(ResourceId); 75 bool inUseByConsumer(ResourceId);
76 76
77 77
78 // Producer interface. 78 // Producer interface.
79 79
80 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; } 80 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; }
81 ResourceType defaultResourceType() const { return m_defaultResourceType; } 81 ResourceType defaultResourceType() const { return m_defaultResourceType; }
82 ResourceType resourceType(ResourceId); 82 ResourceType resourceType(ResourceId);
83 83
84 // Creates a resource of the default resource type. 84 // Creates a resource of the default resource type.
85 ResourceId createResource(int pool, const IntSize&, GC3Denum format, Texture UsageHint); 85 ResourceId createResource(int pool, const IntSize&, GLenum format, TextureUs ageHint);
86 86
87 // You can also explicitly create a specific resource type. 87 // You can also explicitly create a specific resource type.
88 ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, Textur eUsageHint); 88 ResourceId createGLTexture(int pool, const IntSize&, GLenum format, TextureU sageHint);
89 ResourceId createBitmap(int pool, const IntSize&); 89 ResourceId createBitmap(int pool, const IntSize&);
90 // Wraps an external texture into a GL resource. 90 // Wraps an external texture into a GL resource.
91 ResourceId createResourceFromExternalTexture(unsigned textureId); 91 ResourceId createResourceFromExternalTexture(unsigned textureId);
92 92
93 void deleteResource(ResourceId); 93 void deleteResource(ResourceId);
94 94
95 // Deletes all resources owned by a given pool. 95 // Deletes all resources owned by a given pool.
96 void deleteOwnedResources(int pool); 96 void deleteOwnedResources(int pool);
97 97
98 // Upload data from image, copying sourceRect (in image) into destRect (in t he resource). 98 // Upload data from image, copying sourceRect (in image) into destRect (in t he resource).
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 CCResourceProvider::ResourceId m_resourceId; 206 CCResourceProvider::ResourceId m_resourceId;
207 SkBitmap m_skBitmap; 207 SkBitmap m_skBitmap;
208 OwnPtr<SkCanvas> m_skCanvas; 208 OwnPtr<SkCanvas> m_skCanvas;
209 209
210 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 210 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
211 }; 211 };
212 212
213 private: 213 private:
214 struct Resource { 214 struct Resource {
215 Resource(); 215 Resource();
216 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat); 216 Resource(unsigned textureId, int pool, const IntSize& size, GLenum forma t);
217 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format ); 217 Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format);
218 218
219 unsigned glId; 219 unsigned glId;
220 uint8_t* pixels; 220 uint8_t* pixels;
221 int pool; 221 int pool;
222 int lockForReadCount; 222 int lockForReadCount;
223 bool lockedForWrite; 223 bool lockedForWrite;
224 bool external; 224 bool external;
225 bool exported; 225 bool exported;
226 bool markedForDeletion; 226 bool markedForDeletion;
227 IntSize size; 227 IntSize size;
228 GC3Denum format; 228 GLenum format;
229 ResourceType type; 229 ResourceType type;
230 }; 230 };
231 typedef HashMap<ResourceId, Resource> ResourceMap; 231 typedef HashMap<ResourceId, Resource> ResourceMap;
232 struct Child { 232 struct Child {
233 Child(); 233 Child();
234 ~Child(); 234 ~Child();
235 235
236 int pool; 236 int pool;
237 ResourceIdMap childToParentMap; 237 ResourceIdMap childToParentMap;
238 ResourceIdMap parentToChildMap; 238 ResourceIdMap parentToChildMap;
(...skipping 29 matching lines...) Expand all
268 OwnPtr<TextureUploader> m_textureUploader; 268 OwnPtr<TextureUploader> m_textureUploader;
269 OwnPtr<AcceleratedTextureCopier> m_textureCopier; 269 OwnPtr<AcceleratedTextureCopier> m_textureCopier;
270 int m_maxTextureSize; 270 int m_maxTextureSize;
271 271
272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); 272 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
273 }; 273 };
274 274
275 } 275 }
276 276
277 #endif 277 #endif
OLDNEW
« no previous file with comments | « cc/program_binding.cc ('k') | cc/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698