Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: cc/resources/resource_provider.h

Issue 2752523006: cc: Use SkCreateColorSpaceXformCanvas for color transforms (Closed)
Patch Set: Allow to link Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 public: 281 public:
282 ScopedWriteLockGL(ResourceProvider* resource_provider, 282 ScopedWriteLockGL(ResourceProvider* resource_provider,
283 ResourceId resource_id, 283 ResourceId resource_id,
284 bool create_mailbox); 284 bool create_mailbox);
285 ~ScopedWriteLockGL(); 285 ~ScopedWriteLockGL();
286 286
287 unsigned texture_id() const { return texture_id_; } 287 unsigned texture_id() const { return texture_id_; }
288 GLenum target() const { return target_; } 288 GLenum target() const { return target_; }
289 ResourceFormat format() const { return format_; } 289 ResourceFormat format() const { return format_; }
290 const gfx::Size& size() const { return size_; } 290 const gfx::Size& size() const { return size_; }
291 sk_sp<SkColorSpace> sk_color_space() const { return sk_color_space_; }
292 291
293 const TextureMailbox& mailbox() const { return mailbox_; } 292 const TextureMailbox& mailbox() const { return mailbox_; }
294 293
295 void set_sync_token(const gpu::SyncToken& sync_token) { 294 void set_sync_token(const gpu::SyncToken& sync_token) {
296 sync_token_ = sync_token; 295 sync_token_ = sync_token;
297 has_sync_token_ = true; 296 has_sync_token_ = true;
298 } 297 }
299 298
300 void set_synchronized(bool synchronized) { synchronized_ = synchronized; } 299 void set_synchronized(bool synchronized) { synchronized_ = synchronized; }
301 300
302 private: 301 private:
303 ResourceProvider* resource_provider_; 302 ResourceProvider* resource_provider_;
304 ResourceId resource_id_; 303 ResourceId resource_id_;
305 unsigned texture_id_; 304 unsigned texture_id_;
306 GLenum target_; 305 GLenum target_;
307 ResourceFormat format_; 306 ResourceFormat format_;
308 gfx::Size size_; 307 gfx::Size size_;
309 TextureMailbox mailbox_; 308 TextureMailbox mailbox_;
310 gpu::SyncToken sync_token_; 309 gpu::SyncToken sync_token_;
311 bool has_sync_token_; 310 bool has_sync_token_;
312 bool synchronized_; 311 bool synchronized_;
313 base::ThreadChecker thread_checker_; 312 base::ThreadChecker thread_checker_;
314 sk_sp<SkColorSpace> sk_color_space_;
315 313
316 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL); 314 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL);
317 }; 315 };
318 316
319 class CC_EXPORT ScopedTextureProvider { 317 class CC_EXPORT ScopedTextureProvider {
320 public: 318 public:
321 ScopedTextureProvider(gpu::gles2::GLES2Interface* gl, 319 ScopedTextureProvider(gpu::gles2::GLES2Interface* gl,
322 ScopedWriteLockGL* resource_lock, 320 ScopedWriteLockGL* resource_lock,
323 bool use_mailbox); 321 bool use_mailbox);
324 ~ScopedTextureProvider(); 322 ~ScopedTextureProvider();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 }; 390 };
393 391
394 class CC_EXPORT ScopedWriteLockSoftware { 392 class CC_EXPORT ScopedWriteLockSoftware {
395 public: 393 public:
396 ScopedWriteLockSoftware(ResourceProvider* resource_provider, 394 ScopedWriteLockSoftware(ResourceProvider* resource_provider,
397 ResourceId resource_id); 395 ResourceId resource_id);
398 ~ScopedWriteLockSoftware(); 396 ~ScopedWriteLockSoftware();
399 397
400 SkBitmap& sk_bitmap() { return sk_bitmap_; } 398 SkBitmap& sk_bitmap() { return sk_bitmap_; }
401 bool valid() const { return !!sk_bitmap_.getPixels(); } 399 bool valid() const { return !!sk_bitmap_.getPixels(); }
402 sk_sp<SkColorSpace> sk_color_space() const { return sk_color_space_; }
403 400
404 private: 401 private:
405 ResourceProvider* resource_provider_; 402 ResourceProvider* resource_provider_;
406 ResourceId resource_id_; 403 ResourceId resource_id_;
407 SkBitmap sk_bitmap_; 404 SkBitmap sk_bitmap_;
408 sk_sp<SkColorSpace> sk_color_space_;
409 base::ThreadChecker thread_checker_; 405 base::ThreadChecker thread_checker_;
410 406
411 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 407 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
412 }; 408 };
413 409
414 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { 410 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer {
415 public: 411 public:
416 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, 412 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider,
417 ResourceId resource_id); 413 ResourceId resource_id);
418 ~ScopedWriteLockGpuMemoryBuffer(); 414 ~ScopedWriteLockGpuMemoryBuffer();
419 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); 415 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer();
420 sk_sp<SkColorSpace> sk_color_space() const { return sk_color_space_; }
421 416
422 private: 417 private:
423 ResourceProvider* resource_provider_; 418 ResourceProvider* resource_provider_;
424 ResourceId resource_id_; 419 ResourceId resource_id_;
425 ResourceFormat format_; 420 ResourceFormat format_;
426 gfx::BufferUsage usage_; 421 gfx::BufferUsage usage_;
427 gfx::Size size_; 422 gfx::Size size_;
428 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; 423 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
429 sk_sp<SkColorSpace> sk_color_space_;
430 base::ThreadChecker thread_checker_; 424 base::ThreadChecker thread_checker_;
431 425
432 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); 426 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
433 }; 427 };
434 428
435 class Fence : public base::RefCounted<Fence> { 429 class Fence : public base::RefCounted<Fence> {
436 public: 430 public:
437 Fence() {} 431 Fence() {}
438 432
439 virtual void Set() = 0; 433 virtual void Set() = 0;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 void BindImageForSampling(Resource* resource); 710 void BindImageForSampling(Resource* resource);
717 // Binds the given GL resource to a texture target for sampling using the 711 // Binds the given GL resource to a texture target for sampling using the
718 // specified filter for both minification and magnification. Returns the 712 // specified filter for both minification and magnification. Returns the
719 // texture target used. The resource must be locked for reading. 713 // texture target used. The resource must be locked for reading.
720 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); 714 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter);
721 715
722 // Returns null if we do not have a ContextProvider. 716 // Returns null if we do not have a ContextProvider.
723 gpu::gles2::GLES2Interface* ContextGL() const; 717 gpu::gles2::GLES2Interface* ContextGL() const;
724 bool IsGLContextLost() const; 718 bool IsGLContextLost() const;
725 719
726 // Returns null if |settings_.enable_color_correct_rasterization| is false.
727 sk_sp<SkColorSpace> GetResourceSkColorSpace(const Resource* resource) const;
728
729 // Holds const settings for the ResourceProvider. Never changed after init. 720 // Holds const settings for the ResourceProvider. Never changed after init.
730 struct Settings { 721 struct Settings {
731 Settings(ContextProvider* compositor_context_provider, 722 Settings(ContextProvider* compositor_context_provider,
732 bool delegated_sync_points_required, 723 bool delegated_sync_points_required,
733 bool use_gpu_memory_buffer_resources, 724 bool use_gpu_memory_buffer_resources,
734 bool enable_color_correct_rasterization); 725 bool enable_color_correct_rasterization);
735 726
736 int max_texture_size = 0; 727 int max_texture_size = 0;
737 bool use_texture_storage_ext = false; 728 bool use_texture_storage_ext = false;
738 bool use_texture_format_bgra = false; 729 bool use_texture_format_bgra = false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // Set of resource Ids that would like to be notified about promotion hints. 762 // Set of resource Ids that would like to be notified about promotion hints.
772 ResourceIdSet wants_promotion_hints_set_; 763 ResourceIdSet wants_promotion_hints_set_;
773 #endif 764 #endif
774 765
775 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 766 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
776 }; 767 };
777 768
778 } // namespace cc 769 } // namespace cc
779 770
780 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 771 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698