| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 private: | 300 private: |
| 301 ResourceProvider* resource_provider_; | 301 ResourceProvider* resource_provider_; |
| 302 ResourceProvider::ResourceId resource_id_; | 302 ResourceProvider::ResourceId resource_id_; |
| 303 SkBitmap sk_bitmap_; | 303 SkBitmap sk_bitmap_; |
| 304 scoped_ptr<SkCanvas> sk_canvas_; | 304 scoped_ptr<SkCanvas> sk_canvas_; |
| 305 | 305 |
| 306 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 306 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 // The following class is needed to modify GL resources using GPU |
| 310 // raster. The user must ensure that they only use GPU raster on |
| 311 // GL resources while an instance of this class is alive. |
| 312 class CC_EXPORT ScopedGpuRaster { |
| 313 public: |
| 314 ScopedGpuRaster(ResourceProvider* resource_provider); |
| 315 ~ScopedGpuRaster(); |
| 316 |
| 317 private: |
| 318 ResourceProvider* resource_provider_; |
| 319 |
| 320 DISALLOW_COPY_AND_ASSIGN(ScopedGpuRaster); |
| 321 }; |
| 322 |
| 309 class Fence : public base::RefCounted<Fence> { | 323 class Fence : public base::RefCounted<Fence> { |
| 310 public: | 324 public: |
| 311 Fence() {} | 325 Fence() {} |
| 312 virtual bool HasPassed() = 0; | 326 virtual bool HasPassed() = 0; |
| 313 | 327 |
| 314 protected: | 328 protected: |
| 315 friend class base::RefCounted<Fence>; | 329 friend class base::RefCounted<Fence>; |
| 316 virtual ~Fence() {} | 330 virtual ~Fence() {} |
| 317 | 331 |
| 318 private: | 332 private: |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // specified filter for both minification and magnification. Returns the | 634 // specified filter for both minification and magnification. Returns the |
| 621 // texture target used. The resource must be locked for reading. | 635 // texture target used. The resource must be locked for reading. |
| 622 GLenum BindForSampling(ResourceProvider::ResourceId resource_id, | 636 GLenum BindForSampling(ResourceProvider::ResourceId resource_id, |
| 623 GLenum unit, | 637 GLenum unit, |
| 624 GLenum filter); | 638 GLenum filter); |
| 625 | 639 |
| 626 // Returns NULL if the output_surface_ does not have a ContextProvider. | 640 // Returns NULL if the output_surface_ does not have a ContextProvider. |
| 627 gpu::gles2::GLES2Interface* ContextGL() const; | 641 gpu::gles2::GLES2Interface* ContextGL() const; |
| 628 class GrContext* GrContext() const; | 642 class GrContext* GrContext() const; |
| 629 | 643 |
| 644 void BeginGpuRaster(); |
| 645 void EndGpuRaster(); |
| 646 |
| 630 OutputSurface* output_surface_; | 647 OutputSurface* output_surface_; |
| 631 SharedBitmapManager* shared_bitmap_manager_; | 648 SharedBitmapManager* shared_bitmap_manager_; |
| 632 bool lost_output_surface_; | 649 bool lost_output_surface_; |
| 633 int highp_threshold_min_; | 650 int highp_threshold_min_; |
| 634 ResourceId next_id_; | 651 ResourceId next_id_; |
| 635 ResourceMap resources_; | 652 ResourceMap resources_; |
| 636 int next_child_; | 653 int next_child_; |
| 637 ChildMap children_; | 654 ChildMap children_; |
| 638 | 655 |
| 639 ResourceType default_resource_type_; | 656 ResourceType default_resource_type_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 return format_gl_data_format[format]; | 719 return format_gl_data_format[format]; |
| 703 } | 720 } |
| 704 | 721 |
| 705 inline GLenum GLInternalFormat(ResourceFormat format) { | 722 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 706 return GLDataFormat(format); | 723 return GLDataFormat(format); |
| 707 } | 724 } |
| 708 | 725 |
| 709 } // namespace cc | 726 } // namespace cc |
| 710 | 727 |
| 711 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 728 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |