| 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_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 ResourceProvider::ResourceId resource_id_; | 294 ResourceProvider::ResourceId resource_id_; |
| 295 SkBitmap sk_bitmap_; | 295 SkBitmap sk_bitmap_; |
| 296 scoped_ptr<SkCanvas> sk_canvas_; | 296 scoped_ptr<SkCanvas> sk_canvas_; |
| 297 | 297 |
| 298 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 298 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
| 299 }; | 299 }; |
| 300 | 300 |
| 301 class Fence : public base::RefCounted<Fence> { | 301 class Fence : public base::RefCounted<Fence> { |
| 302 public: | 302 public: |
| 303 Fence() {} | 303 Fence() {} |
| 304 |
| 305 virtual void Set() = 0; |
| 304 virtual bool HasPassed() = 0; | 306 virtual bool HasPassed() = 0; |
| 305 | 307 |
| 306 protected: | 308 protected: |
| 307 friend class base::RefCounted<Fence>; | 309 friend class base::RefCounted<Fence>; |
| 308 virtual ~Fence() {} | 310 virtual ~Fence() {} |
| 309 | 311 |
| 310 private: | 312 private: |
| 311 DISALLOW_COPY_AND_ASSIGN(Fence); | 313 DISALLOW_COPY_AND_ASSIGN(Fence); |
| 312 }; | 314 }; |
| 313 | 315 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void CreateForTesting(ResourceId id); | 351 void CreateForTesting(ResourceId id); |
| 350 | 352 |
| 351 GLenum TargetForTesting(ResourceId id); | 353 GLenum TargetForTesting(ResourceId id); |
| 352 | 354 |
| 353 // Sets the current read fence. If a resource is locked for read | 355 // Sets the current read fence. If a resource is locked for read |
| 354 // and has read fences enabled, the resource will not allow writes | 356 // and has read fences enabled, the resource will not allow writes |
| 355 // until this fence has passed. | 357 // until this fence has passed. |
| 356 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } | 358 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } |
| 357 | 359 |
| 358 // Enable read lock fences for a specific resource. | 360 // Enable read lock fences for a specific resource. |
| 359 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); | 361 void EnableReadLockFences(ResourceProvider::ResourceId id); |
| 360 | 362 |
| 361 // Indicates if we can currently lock this resource for write. | 363 // Indicates if we can currently lock this resource for write. |
| 362 bool CanLockForWrite(ResourceId id); | 364 bool CanLockForWrite(ResourceId id); |
| 363 | 365 |
| 364 // Copy pixels from source to destination. | 366 // Copy pixels from source to destination. |
| 365 void CopyResource(ResourceId source_id, ResourceId dest_id); | 367 void CopyResource(ResourceId source_id, ResourceId dest_id); |
| 366 | 368 |
| 367 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 369 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
| 368 | 370 |
| 369 private: | 371 private: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 int lock_for_read_count; | 413 int lock_for_read_count; |
| 412 int imported_count; | 414 int imported_count; |
| 413 int exported_count; | 415 int exported_count; |
| 414 bool dirty_image : 1; | 416 bool dirty_image : 1; |
| 415 bool locked_for_write : 1; | 417 bool locked_for_write : 1; |
| 416 bool lost : 1; | 418 bool lost : 1; |
| 417 bool marked_for_deletion : 1; | 419 bool marked_for_deletion : 1; |
| 418 bool pending_set_pixels : 1; | 420 bool pending_set_pixels : 1; |
| 419 bool set_pixels_completion_forced : 1; | 421 bool set_pixels_completion_forced : 1; |
| 420 bool allocated : 1; | 422 bool allocated : 1; |
| 421 bool enable_read_lock_fences : 1; | 423 bool read_lock_fences_enabled : 1; |
| 422 bool has_shared_bitmap_id : 1; | 424 bool has_shared_bitmap_id : 1; |
| 423 bool allow_overlay : 1; | 425 bool allow_overlay : 1; |
| 424 scoped_refptr<Fence> read_lock_fence; | 426 scoped_refptr<Fence> read_lock_fence; |
| 425 gfx::Size size; | 427 gfx::Size size; |
| 426 Origin origin; | 428 Origin origin; |
| 427 GLenum target; | 429 GLenum target; |
| 428 // TODO(skyostil): Use a separate sampler object for filter state. | 430 // TODO(skyostil): Use a separate sampler object for filter state. |
| 429 GLenum original_filter; | 431 GLenum original_filter; |
| 430 GLenum filter; | 432 GLenum filter; |
| 431 unsigned image_id; | 433 unsigned image_id; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 return format_gl_data_format[format]; | 696 return format_gl_data_format[format]; |
| 695 } | 697 } |
| 696 | 698 |
| 697 inline GLenum GLInternalFormat(ResourceFormat format) { | 699 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 698 return GLDataFormat(format); | 700 return GLDataFormat(format); |
| 699 } | 701 } |
| 700 | 702 |
| 701 } // namespace cc | 703 } // namespace cc |
| 702 | 704 |
| 703 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 705 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |