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

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

Issue 363563006: cc: Hide Gpu Rasterization details in Resource Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added scopedgpuraster class Created 6 years, 5 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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 virtual bool HasPassed() = 0; 312 virtual bool HasPassed() = 0;
313 313
314 protected: 314 protected:
315 friend class base::RefCounted<Fence>; 315 friend class base::RefCounted<Fence>;
316 virtual ~Fence() {} 316 virtual ~Fence() {}
317 317
318 private: 318 private:
319 DISALLOW_COPY_AND_ASSIGN(Fence); 319 DISALLOW_COPY_AND_ASSIGN(Fence);
320 }; 320 };
321 321
322 // This class is used to begin and end gpu rasterization.
reveman 2014/07/01 17:19:01 How about something like this instead: // The fol
sohanjg 2014/07/02 07:40:37 Done.
323 class CC_EXPORT ScopedGpuRaster {
324 public:
325 ScopedGpuRaster(ResourceProvider* resource_provider, const char* name);
326 ~ScopedGpuRaster();
327
328 private:
329 void BeginGpuRaster(const char* name);
330 void EndGpuRaster();
reveman 2014/07/01 17:19:01 How about keeping these as private ResourceProvide
sohanjg 2014/07/02 07:40:37 Done.
331 gpu::gles2::GLES2Interface* gl_;
332 class GrContext* gr_context_;
333
334 DISALLOW_COPY_AND_ASSIGN(ScopedGpuRaster);
335 };
reveman 2014/07/01 17:19:01 Please move this class above the Fence class so al
sohanjg 2014/07/02 07:40:37 Done.
336
322 // Returns a canvas for gpu rasterization. 337 // Returns a canvas for gpu rasterization.
323 // Call Unmap before the resource can be read or used for compositing. 338 // Call Unmap before the resource can be read or used for compositing.
324 // It is used for direct gpu rasterization. 339 // It is used for direct gpu rasterization.
325 SkCanvas* MapGpuRasterBuffer(ResourceId id); 340 SkCanvas* MapGpuRasterBuffer(ResourceId id);
326 void UnmapGpuRasterBuffer(ResourceId id); 341 void UnmapGpuRasterBuffer(ResourceId id);
327 342
328 // Returns a canvas backed by an image buffer. UnmapImageRasterBuffer 343 // Returns a canvas backed by an image buffer. UnmapImageRasterBuffer
329 // returns true if canvas was written to while mapped. 344 // returns true if canvas was written to while mapped.
330 // Rasterizing to the canvas writes the content into the image buffer, 345 // Rasterizing to the canvas writes the content into the image buffer,
331 // which is internally bound to the underlying resource when read. 346 // which is internally bound to the underlying resource when read.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return format_gl_data_format[format]; 717 return format_gl_data_format[format];
703 } 718 }
704 719
705 inline GLenum GLInternalFormat(ResourceFormat format) { 720 inline GLenum GLInternalFormat(ResourceFormat format) {
706 return GLDataFormat(format); 721 return GLDataFormat(format);
707 } 722 }
708 723
709 } // namespace cc 724 } // namespace cc
710 725
711 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 726 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698