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

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

Issue 234403005: cc: Add CopyResource function to ResourceProvider API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/resource_pool.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 private: 317 private:
318 DISALLOW_COPY_AND_ASSIGN(Fence); 318 DISALLOW_COPY_AND_ASSIGN(Fence);
319 }; 319 };
320 320
321 // Returns a canvas for direct rasterization. 321 // Returns a canvas for direct rasterization.
322 // Call Unmap before the resource can be read or used for compositing. 322 // Call Unmap before the resource can be read or used for compositing.
323 // It is used for direct gpu rasterization. 323 // It is used for direct gpu rasterization.
324 SkCanvas* MapDirectRasterBuffer(ResourceId id); 324 SkCanvas* MapDirectRasterBuffer(ResourceId id);
325 void UnmapDirectRasterBuffer(ResourceId id); 325 void UnmapDirectRasterBuffer(ResourceId id);
326 326
327 // Returns a canvas backed by an image buffer. 327 // Returns a canvas backed by an image buffer. UnmapImageRasterBuffer
328 // returns true if canvas was written to while mapped.
328 // Rasterizing to the canvas writes the content into the image buffer, 329 // Rasterizing to the canvas writes the content into the image buffer,
329 // which is internally bound to the underlying resource when read. 330 // which is internally bound to the underlying resource when read.
330 // Call Unmap before the resource can be read or used for compositing. 331 // Call Unmap before the resource can be read or used for compositing.
331 // It is used by ImageRasterWorkerPool. 332 // It is used by ImageRasterWorkerPool.
332 SkCanvas* MapImageRasterBuffer(ResourceId id); 333 SkCanvas* MapImageRasterBuffer(ResourceId id);
333 void UnmapImageRasterBuffer(ResourceId id); 334 bool UnmapImageRasterBuffer(ResourceId id);
334 335
335 // Returns a canvas backed by pixel buffer. UnmapPixelRasterBuffer 336 // Returns a canvas backed by pixel buffer. UnmapPixelRasterBuffer
336 // returns true if canvas was written to while mapped. 337 // returns true if canvas was written to while mapped.
337 // The pixel buffer needs to be uploaded to the underlying resource 338 // The pixel buffer needs to be uploaded to the underlying resource
338 // using BeginSetPixels before the resouce can be used for compositing. 339 // using BeginSetPixels before the resouce can be used for compositing.
339 // It is used by PixelRasterWorkerPool. 340 // It is used by PixelRasterWorkerPool.
340 void AcquirePixelRasterBuffer(ResourceId id); 341 void AcquirePixelRasterBuffer(ResourceId id);
341 void ReleasePixelRasterBuffer(ResourceId id); 342 void ReleasePixelRasterBuffer(ResourceId id);
342 SkCanvas* MapPixelRasterBuffer(ResourceId id); 343 SkCanvas* MapPixelRasterBuffer(ResourceId id);
343 bool UnmapPixelRasterBuffer(ResourceId id); 344 bool UnmapPixelRasterBuffer(ResourceId id);
(...skipping 19 matching lines...) Expand all
363 current_read_lock_fence_ = fence; 364 current_read_lock_fence_ = fence;
364 } 365 }
365 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } 366 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); }
366 367
367 // Enable read lock fences for a specific resource. 368 // Enable read lock fences for a specific resource.
368 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); 369 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable);
369 370
370 // Indicates if we can currently lock this resource for write. 371 // Indicates if we can currently lock this resource for write.
371 bool CanLockForWrite(ResourceId id); 372 bool CanLockForWrite(ResourceId id);
372 373
374 // Copy pixels from source to destination.
375 void CopyResource(ResourceId source_id, ResourceId dest_id);
376
373 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 377 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
374 378
375 private: 379 private:
376 class DirectRasterBuffer; 380 class DirectRasterBuffer;
377 class ImageRasterBuffer; 381 class ImageRasterBuffer;
378 class PixelRasterBuffer; 382 class PixelRasterBuffer;
379 383
380 struct Resource { 384 struct Resource {
381 enum Origin { Internal, External, Delegated }; 385 enum Origin { Internal, External, Delegated };
382 386
(...skipping 19 matching lines...) Expand all
402 Origin origin, 406 Origin origin,
403 GLenum filter, 407 GLenum filter,
404 GLint wrap_mode); 408 GLint wrap_mode);
405 409
406 int child_id; 410 int child_id;
407 unsigned gl_id; 411 unsigned gl_id;
408 // Pixel buffer used for set pixels without unnecessary copying. 412 // Pixel buffer used for set pixels without unnecessary copying.
409 unsigned gl_pixel_buffer_id; 413 unsigned gl_pixel_buffer_id;
410 // Query used to determine when asynchronous set pixels complete. 414 // Query used to determine when asynchronous set pixels complete.
411 unsigned gl_upload_query_id; 415 unsigned gl_upload_query_id;
416 // Query used to determine when read lock fence has passed.
417 unsigned gl_read_lock_query_id;
412 TextureMailbox mailbox; 418 TextureMailbox mailbox;
413 ReleaseCallback release_callback; 419 ReleaseCallback release_callback;
414 uint8_t* pixels; 420 uint8_t* pixels;
415 int lock_for_read_count; 421 int lock_for_read_count;
416 int imported_count; 422 int imported_count;
417 int exported_count; 423 int exported_count;
418 bool dirty_image : 1; 424 bool dirty_image : 1;
419 bool locked_for_write : 1; 425 bool locked_for_write : 1;
420 bool lost : 1; 426 bool lost : 1;
421 bool marked_for_deletion : 1; 427 bool marked_for_deletion : 1;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return format_gl_data_format[format]; 697 return format_gl_data_format[format];
692 } 698 }
693 699
694 inline GLenum GLInternalFormat(ResourceFormat format) { 700 inline GLenum GLInternalFormat(ResourceFormat format) {
695 return GLDataFormat(format); 701 return GLDataFormat(format);
696 } 702 }
697 703
698 } // namespace cc 704 } // namespace cc
699 705
700 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 706 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/resources/resource_pool.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698