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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 gfx::Size size_; | 325 gfx::Size size_; |
326 ResourceFormat format_; | 326 ResourceFormat format_; |
327 base::ThreadChecker thread_checker_; | 327 base::ThreadChecker thread_checker_; |
328 | 328 |
329 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); | 329 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
330 }; | 330 }; |
331 | 331 |
332 class CC_EXPORT ScopedWriteLockGr { | 332 class CC_EXPORT ScopedWriteLockGr { |
333 public: | 333 public: |
334 ScopedWriteLockGr(ResourceProvider* resource_provider, | 334 ScopedWriteLockGr(ResourceProvider* resource_provider, |
335 ResourceProvider::ResourceId resource_id, | 335 ResourceProvider::ResourceId resource_id); |
336 bool use_distance_field_text, | |
337 bool can_use_lcd_text, | |
338 int msaa_sample_count); | |
339 ~ScopedWriteLockGr(); | 336 ~ScopedWriteLockGr(); |
340 | 337 |
341 SkSurface* get_sk_surface() { return sk_surface_.get(); } | 338 void InitSkSurface(bool use_worker_context, |
| 339 bool use_distance_field_text, |
| 340 bool can_use_lcd_text, |
| 341 int msaa_sample_count); |
| 342 void ReleaseSkSurface(); |
| 343 |
| 344 SkSurface* sk_surface() { return sk_surface_.get(); } |
| 345 ResourceProvider::Resource* resource() { return resource_; } |
342 | 346 |
343 private: | 347 private: |
344 ResourceProvider* resource_provider_; | 348 ResourceProvider* resource_provider_; |
345 ResourceProvider::Resource* resource_; | 349 ResourceProvider::Resource* resource_; |
346 base::ThreadChecker thread_checker_; | 350 base::ThreadChecker thread_checker_; |
347 skia::RefPtr<SkSurface> sk_surface_; | 351 skia::RefPtr<SkSurface> sk_surface_; |
348 | 352 |
349 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); | 353 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); |
350 }; | 354 }; |
351 | 355 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 423 |
420 // Copy pixels from source to destination. | 424 // Copy pixels from source to destination. |
421 void CopyResource(ResourceId source_id, ResourceId dest_id); | 425 void CopyResource(ResourceId source_id, ResourceId dest_id); |
422 | 426 |
423 void WaitSyncPointIfNeeded(ResourceId id); | 427 void WaitSyncPointIfNeeded(ResourceId id); |
424 | 428 |
425 void WaitReadLockIfNeeded(ResourceId id); | 429 void WaitReadLockIfNeeded(ResourceId id); |
426 | 430 |
427 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 431 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
428 | 432 |
| 433 OutputSurface* output_surface() { return output_surface_; } |
| 434 |
429 private: | 435 private: |
430 struct Resource { | 436 struct Resource { |
431 enum Origin { Internal, External, Delegated }; | 437 enum Origin { Internal, External, Delegated }; |
432 | 438 |
433 Resource(); | 439 Resource(); |
434 ~Resource(); | 440 ~Resource(); |
435 Resource(unsigned texture_id, | 441 Resource(unsigned texture_id, |
436 const gfx::Size& size, | 442 const gfx::Size& size, |
437 Origin origin, | 443 Origin origin, |
438 GLenum target, | 444 GLenum target, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 void LazyAllocate(Resource* resource); | 559 void LazyAllocate(Resource* resource); |
554 | 560 |
555 void BindImageForSampling(Resource* resource); | 561 void BindImageForSampling(Resource* resource); |
556 // Binds the given GL resource to a texture target for sampling using the | 562 // Binds the given GL resource to a texture target for sampling using the |
557 // specified filter for both minification and magnification. Returns the | 563 // specified filter for both minification and magnification. Returns the |
558 // texture target used. The resource must be locked for reading. | 564 // texture target used. The resource must be locked for reading. |
559 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); | 565 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); |
560 | 566 |
561 // Returns NULL if the output_surface_ does not have a ContextProvider. | 567 // Returns NULL if the output_surface_ does not have a ContextProvider. |
562 gpu::gles2::GLES2Interface* ContextGL() const; | 568 gpu::gles2::GLES2Interface* ContextGL() const; |
563 class GrContext* GrContext() const; | 569 class GrContext* GrContext(bool worker_context) const; |
564 | 570 |
565 OutputSurface* output_surface_; | 571 OutputSurface* output_surface_; |
566 SharedBitmapManager* shared_bitmap_manager_; | 572 SharedBitmapManager* shared_bitmap_manager_; |
567 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 573 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
568 BlockingTaskRunner* blocking_main_thread_task_runner_; | 574 BlockingTaskRunner* blocking_main_thread_task_runner_; |
569 bool lost_output_surface_; | 575 bool lost_output_surface_; |
570 int highp_threshold_min_; | 576 int highp_threshold_min_; |
571 ResourceId next_id_; | 577 ResourceId next_id_; |
572 ResourceMap resources_; | 578 ResourceMap resources_; |
573 int next_child_; | 579 int next_child_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 return format_gl_data_format[format]; | 656 return format_gl_data_format[format]; |
651 } | 657 } |
652 | 658 |
653 inline GLenum GLInternalFormat(ResourceFormat format) { | 659 inline GLenum GLInternalFormat(ResourceFormat format) { |
654 return GLDataFormat(format); | 660 return GLDataFormat(format); |
655 } | 661 } |
656 | 662 |
657 } // namespace cc | 663 } // namespace cc |
658 | 664 |
659 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 665 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |