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 #ifndef CC_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCE_PROVIDER_H_ |
6 #define CC_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCE_PROVIDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 private: | 191 private: |
192 ResourceProvider* m_resourceProvider; | 192 ResourceProvider* m_resourceProvider; |
193 ResourceProvider::ResourceId m_resourceId; | 193 ResourceProvider::ResourceId m_resourceId; |
194 SkBitmap m_skBitmap; | 194 SkBitmap m_skBitmap; |
195 scoped_ptr<SkCanvas> m_skCanvas; | 195 scoped_ptr<SkCanvas> m_skCanvas; |
196 | 196 |
197 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 197 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
198 }; | 198 }; |
199 | 199 |
| 200 // This set of functions can be used to asynchronously set pixel values |
| 201 // for a resource. |
| 202 void acquirePixelBuffer(ResourceId id); |
| 203 void releasePixelBuffer(ResourceId id); |
| 204 uint8_t* mapPixelBuffer(ResourceId id); |
| 205 void unmapPixelBuffer(ResourceId id); |
| 206 void beginSetPixels(ResourceId id); |
| 207 bool didSetPixelsComplete(ResourceId id); |
| 208 void abortSetPixels(ResourceId id); |
| 209 |
200 private: | 210 private: |
201 struct Resource { | 211 struct Resource { |
202 Resource(); | 212 Resource(); |
203 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for
mat); | 213 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for
mat); |
204 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format
); | 214 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format
); |
205 | 215 |
206 unsigned glId; | 216 unsigned glId; |
| 217 // Pixel buffer used for asynchronous set pixels. |
| 218 unsigned glPixelBufferId; |
| 219 // Query used to determine when asynchronous set pixels complete. |
| 220 unsigned glUploadQueryId; |
207 Mailbox mailbox; | 221 Mailbox mailbox; |
208 uint8_t* pixels; | 222 uint8_t* pixels; |
| 223 uint8_t* pixelBuffer; |
209 int pool; | 224 int pool; |
210 int lockForReadCount; | 225 int lockForReadCount; |
211 bool lockedForWrite; | 226 bool lockedForWrite; |
212 bool external; | 227 bool external; |
213 bool exported; | 228 bool exported; |
214 bool markedForDeletion; | 229 bool markedForDeletion; |
215 gfx::Size size; | 230 gfx::Size size; |
216 GLenum format; | 231 GLenum format; |
217 ResourceType type; | 232 ResourceType type; |
218 }; | 233 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 int m_maxTextureSize; | 269 int m_maxTextureSize; |
255 | 270 |
256 base::ThreadChecker m_threadChecker; | 271 base::ThreadChecker m_threadChecker; |
257 | 272 |
258 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 273 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
259 }; | 274 }; |
260 | 275 |
261 } | 276 } |
262 | 277 |
263 #endif // CC_RESOURCE_PROVIDER_H_ | 278 #endif // CC_RESOURCE_PROVIDER_H_ |
OLD | NEW |