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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); | 322 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
323 }; | 323 }; |
324 | 324 |
325 class CC_EXPORT ScopedWriteLockGr { | 325 class CC_EXPORT ScopedWriteLockGr { |
326 public: | 326 public: |
327 ScopedWriteLockGr(ResourceProvider* resource_provider, | 327 ScopedWriteLockGr(ResourceProvider* resource_provider, |
328 ResourceProvider::ResourceId resource_id); | 328 ResourceProvider::ResourceId resource_id); |
329 ~ScopedWriteLockGr(); | 329 ~ScopedWriteLockGr(); |
330 | 330 |
331 SkSurface* sk_surface() { return sk_surface_; } | 331 SkSurface* GetSkSurface(bool use_distance_field_text); |
332 | 332 |
333 private: | 333 private: |
334 ResourceProvider* resource_provider_; | 334 ResourceProvider* resource_provider_; |
335 ResourceProvider::ResourceId resource_id_; | 335 ResourceProvider::ResourceId resource_id_; |
336 SkSurface* sk_surface_; | |
337 | 336 |
338 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); | 337 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); |
339 }; | 338 }; |
340 | 339 |
341 class Fence : public base::RefCounted<Fence> { | 340 class Fence : public base::RefCounted<Fence> { |
342 public: | 341 public: |
343 Fence() {} | 342 Fence() {} |
344 | 343 |
345 virtual void Set() = 0; | 344 virtual void Set() = 0; |
346 virtual bool HasPassed() = 0; | 345 virtual bool HasPassed() = 0; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 492 |
494 void CleanUpGLIfNeeded(); | 493 void CleanUpGLIfNeeded(); |
495 | 494 |
496 Resource* GetResource(ResourceId id); | 495 Resource* GetResource(ResourceId id); |
497 const Resource* LockForRead(ResourceId id); | 496 const Resource* LockForRead(ResourceId id); |
498 void UnlockForRead(ResourceId id); | 497 void UnlockForRead(ResourceId id); |
499 const Resource* LockForWrite(ResourceId id); | 498 const Resource* LockForWrite(ResourceId id); |
500 void UnlockForWrite(ResourceId id); | 499 void UnlockForWrite(ResourceId id); |
501 const Resource* LockForWriteToGpuMemoryBuffer(ResourceId id); | 500 const Resource* LockForWriteToGpuMemoryBuffer(ResourceId id); |
502 void UnlockForWriteToGpuMemoryBuffer(ResourceId id); | 501 void UnlockForWriteToGpuMemoryBuffer(ResourceId id); |
503 const Resource* LockForWriteToSkSurface(ResourceId id); | 502 void LockForWriteToSkSurface(ResourceId id); |
504 void UnlockForWriteToSkSurface(ResourceId id); | 503 void UnlockForWriteToSkSurface(ResourceId id); |
505 | 504 |
506 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 505 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
507 const Resource* resource); | 506 const Resource* resource); |
508 | 507 |
509 void TransferResource(gpu::gles2::GLES2Interface* gl, | 508 void TransferResource(gpu::gles2::GLES2Interface* gl, |
510 ResourceId id, | 509 ResourceId id, |
511 TransferableResource* resource); | 510 TransferableResource* resource); |
512 enum DeleteStyle { | 511 enum DeleteStyle { |
513 Normal, | 512 Normal, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return format_gl_data_format[format]; | 611 return format_gl_data_format[format]; |
613 } | 612 } |
614 | 613 |
615 inline GLenum GLInternalFormat(ResourceFormat format) { | 614 inline GLenum GLInternalFormat(ResourceFormat format) { |
616 return GLDataFormat(format); | 615 return GLDataFormat(format); |
617 } | 616 } |
618 | 617 |
619 } // namespace cc | 618 } // namespace cc |
620 | 619 |
621 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 620 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |