| 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 <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "cc/cc_export.h" | 17 #include "cc/cc_export.h" |
| 18 #include "cc/output_surface.h" | 18 #include "cc/output_surface.h" |
| 19 #include "cc/texture_copier.h" | 19 #include "cc/texture_copier.h" |
| 20 #include "cc/texture_mailbox.h" |
| 20 #include "cc/transferable_resource.h" | 21 #include "cc/transferable_resource.h" |
| 21 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
| 22 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
| 23 #include "third_party/skia/include/core/SkCanvas.h" | 24 #include "third_party/skia/include/core/SkCanvas.h" |
| 24 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
| 25 | 26 |
| 26 namespace WebKit { | 27 namespace WebKit { |
| 27 class WebGraphicsContext3D; | 28 class WebGraphicsContext3D; |
| 28 } | 29 } |
| 29 | 30 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 ResourceId createManagedResource(const gfx::Size&, GLenum format, TextureUsa
geHint); | 80 ResourceId createManagedResource(const gfx::Size&, GLenum format, TextureUsa
geHint); |
| 80 | 81 |
| 81 // You can also explicitly create a specific resource type. | 82 // You can also explicitly create a specific resource type. |
| 82 ResourceId createGLTexture(const gfx::Size&, GLenum format, GLenum texturePo
ol, TextureUsageHint); | 83 ResourceId createGLTexture(const gfx::Size&, GLenum format, GLenum texturePo
ol, TextureUsageHint); |
| 83 | 84 |
| 84 ResourceId createBitmap(const gfx::Size&); | 85 ResourceId createBitmap(const gfx::Size&); |
| 85 // Wraps an external texture into a GL resource. | 86 // Wraps an external texture into a GL resource. |
| 86 ResourceId createResourceFromExternalTexture(unsigned textureId); | 87 ResourceId createResourceFromExternalTexture(unsigned textureId); |
| 87 | 88 |
| 88 // Wraps an external texture mailbox into a GL resource. | 89 // Wraps an external texture mailbox into a GL resource. |
| 89 ResourceId createResourceFromTextureMailbox(const std::string& mailboxName,
const base::Callback<void(unsigned)>& releaseCallback); | 90 ResourceId createResourceFromTextureMailbox(const TextureMailbox&); |
| 90 | 91 |
| 91 void deleteResource(ResourceId); | 92 void deleteResource(ResourceId); |
| 92 | 93 |
| 93 // Update pixels from image, copying sourceRect (in image) into destRect (in
the resource). | 94 // Update pixels from image, copying sourceRect (in image) into destRect (in
the resource). |
| 94 void setPixels(ResourceId, const uint8_t* image, const gfx::Rect& imageRect,
const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset); | 95 void setPixels(ResourceId, const uint8_t* image, const gfx::Rect& imageRect,
const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset); |
| 95 | 96 |
| 96 // Check upload status. | 97 // Check upload status. |
| 97 size_t numBlockingUploads(); | 98 size_t numBlockingUploads(); |
| 98 void markPendingUploadsAsNonBlocking(); | 99 void markPendingUploadsAsNonBlocking(); |
| 99 double estimatedUploadsPerSecond(); | 100 double estimatedUploadsPerSecond(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 Resource(); | 246 Resource(); |
| 246 ~Resource(); | 247 ~Resource(); |
| 247 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); | 248 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu
m filter); |
| 248 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); | 249 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f
ilter); |
| 249 | 250 |
| 250 unsigned glId; | 251 unsigned glId; |
| 251 // Pixel buffer used for set pixels without unnecessary copying. | 252 // Pixel buffer used for set pixels without unnecessary copying. |
| 252 unsigned glPixelBufferId; | 253 unsigned glPixelBufferId; |
| 253 // Query used to determine when asynchronous set pixels complete. | 254 // Query used to determine when asynchronous set pixels complete. |
| 254 unsigned glUploadQueryId; | 255 unsigned glUploadQueryId; |
| 255 Mailbox mailbox; | 256 TextureMailbox mailbox; |
| 256 base::Callback<void(unsigned)> mailboxReleaseCallback; | |
| 257 uint8_t* pixels; | 257 uint8_t* pixels; |
| 258 uint8_t* pixelBuffer; | 258 uint8_t* pixelBuffer; |
| 259 int lockForReadCount; | 259 int lockForReadCount; |
| 260 bool lockedForWrite; | 260 bool lockedForWrite; |
| 261 bool external; | 261 bool external; |
| 262 bool exported; | 262 bool exported; |
| 263 bool markedForDeletion; | 263 bool markedForDeletion; |
| 264 bool pendingSetPixels; | 264 bool pendingSetPixels; |
| 265 bool allocated; | 265 bool allocated; |
| 266 gfx::Size size; | 266 gfx::Size size; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 GLenum m_bestTextureFormat; | 308 GLenum m_bestTextureFormat; |
| 309 | 309 |
| 310 base::ThreadChecker m_threadChecker; | 310 base::ThreadChecker m_threadChecker; |
| 311 | 311 |
| 312 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 312 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 } | 315 } |
| 316 | 316 |
| 317 #endif // CC_RESOURCE_PROVIDER_H_ | 317 #endif // CC_RESOURCE_PROVIDER_H_ |
| OLD | NEW |