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

Side by Side Diff: cc/resource_provider.h

Issue 11111005: Remove GraphicsContext3D:: stubs from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again 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 "IntSize.h"
8 #include "base/basictypes.h" 9 #include "base/basictypes.h"
9 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "CCGraphicsContext.h" 12 #include "cc/graphics_context.h"
12 #include "cc/texture_copier.h" 13 #include "cc/texture_copier.h"
13 #include "GraphicsContext3D.h" 14 #include "third_party/khronos/GLES2/gl2.h"
14 #include "IntSize.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
17 #include <deque> 17 #include <deque>
18 #include <vector> 18 #include <vector>
19 19
20 namespace WebKit { 20 namespace WebKit {
21 class WebGraphicsContext3D; 21 class WebGraphicsContext3D;
22 } 22 }
23 23
24 namespace cc { 24 namespace cc {
25 25
26 class IntRect; 26 class IntRect;
27 class LayerTextureSubImage; 27 class LayerTextureSubImage;
28 class TextureCopier; 28 class TextureCopier;
29 class TextureUploader; 29 class TextureUploader;
30 30
31 // Thread-safety notes: this class is not thread-safe and can only be called 31 // Thread-safety notes: this class is not thread-safe and can only be called
32 // from the thread it was created on (in practice, the compositor thread). 32 // from the thread it was created on (in practice, the compositor thread).
33 class CCResourceProvider { 33 class CCResourceProvider {
34 public: 34 public:
35 typedef unsigned ResourceId; 35 typedef unsigned ResourceId;
36 typedef std::vector<ResourceId> ResourceIdArray; 36 typedef std::vector<ResourceId> ResourceIdArray;
37 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 37 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
38 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 38 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
39 enum ResourceType { 39 enum ResourceType {
40 GLTexture = 1, 40 GLTexture = 1,
41 Bitmap, 41 Bitmap,
42 }; 42 };
43 struct Mailbox { 43 struct Mailbox {
44 GC3Dbyte name[64]; 44 GLbyte name[64];
45 }; 45 };
46 struct TransferableResource { 46 struct TransferableResource {
47 unsigned id; 47 unsigned id;
48 GC3Denum format; 48 GLenum format;
49 IntSize size; 49 IntSize size;
50 Mailbox mailbox; 50 Mailbox mailbox;
51 }; 51 };
52 typedef std::vector<TransferableResource> TransferableResourceArray; 52 typedef std::vector<TransferableResource> TransferableResourceArray;
53 struct TransferableResourceList { 53 struct TransferableResourceList {
54 TransferableResourceList(); 54 TransferableResourceList();
55 ~TransferableResourceList(); 55 ~TransferableResourceList();
56 56
57 TransferableResourceArray resources; 57 TransferableResourceArray resources;
58 unsigned syncPoint; 58 unsigned syncPoint;
(...skipping 13 matching lines...) Expand all
72 bool inUseByConsumer(ResourceId); 72 bool inUseByConsumer(ResourceId);
73 73
74 74
75 // Producer interface. 75 // Producer interface.
76 76
77 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; } 77 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; }
78 ResourceType defaultResourceType() const { return m_defaultResourceType; } 78 ResourceType defaultResourceType() const { return m_defaultResourceType; }
79 ResourceType resourceType(ResourceId); 79 ResourceType resourceType(ResourceId);
80 80
81 // Creates a resource of the default resource type. 81 // Creates a resource of the default resource type.
82 ResourceId createResource(int pool, const IntSize&, GC3Denum format, Texture UsageHint); 82 ResourceId createResource(int pool, const IntSize&, GLenum format, TextureUs ageHint);
83 83
84 // You can also explicitly create a specific resource type. 84 // You can also explicitly create a specific resource type.
85 ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, Textur eUsageHint); 85 ResourceId createGLTexture(int pool, const IntSize&, GLenum format, TextureU sageHint);
86 ResourceId createBitmap(int pool, const IntSize&); 86 ResourceId createBitmap(int pool, const IntSize&);
87 // Wraps an external texture into a GL resource. 87 // Wraps an external texture into a GL resource.
88 ResourceId createResourceFromExternalTexture(unsigned textureId); 88 ResourceId createResourceFromExternalTexture(unsigned textureId);
89 89
90 void deleteResource(ResourceId); 90 void deleteResource(ResourceId);
91 91
92 // Deletes all resources owned by a given pool. 92 // Deletes all resources owned by a given pool.
93 void deleteOwnedResources(int pool); 93 void deleteOwnedResources(int pool);
94 94
95 // Upload data from image, copying sourceRect (in image) into destRect (in t he resource). 95 // 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
203 CCResourceProvider::ResourceId m_resourceId; 203 CCResourceProvider::ResourceId m_resourceId;
204 SkBitmap m_skBitmap; 204 SkBitmap m_skBitmap;
205 scoped_ptr<SkCanvas> m_skCanvas; 205 scoped_ptr<SkCanvas> m_skCanvas;
206 206
207 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 207 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
208 }; 208 };
209 209
210 private: 210 private:
211 struct Resource { 211 struct Resource {
212 Resource(); 212 Resource();
213 Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum for mat); 213 Resource(unsigned textureId, int pool, const IntSize& size, GLenum forma t);
214 Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format ); 214 Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format);
215 215
216 unsigned glId; 216 unsigned glId;
217 uint8_t* pixels; 217 uint8_t* pixels;
218 int pool; 218 int pool;
219 int lockForReadCount; 219 int lockForReadCount;
220 bool lockedForWrite; 220 bool lockedForWrite;
221 bool external; 221 bool external;
222 bool exported; 222 bool exported;
223 bool markedForDeletion; 223 bool markedForDeletion;
224 IntSize size; 224 IntSize size;
225 GC3Denum format; 225 GLenum format;
226 ResourceType type; 226 ResourceType type;
227 }; 227 };
228 typedef base::hash_map<ResourceId, Resource> ResourceMap; 228 typedef base::hash_map<ResourceId, Resource> ResourceMap;
229 struct Child { 229 struct Child {
230 Child(); 230 Child();
231 ~Child(); 231 ~Child();
232 232
233 int pool; 233 int pool;
234 ResourceIdMap childToParentMap; 234 ResourceIdMap childToParentMap;
235 ResourceIdMap parentToChildMap; 235 ResourceIdMap parentToChildMap;
(...skipping 29 matching lines...) Expand all
265 scoped_ptr<TextureUploader> m_textureUploader; 265 scoped_ptr<TextureUploader> m_textureUploader;
266 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 266 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
267 int m_maxTextureSize; 267 int m_maxTextureSize;
268 268
269 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider); 269 DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
270 }; 270 };
271 271
272 } 272 }
273 273
274 #endif 274 #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