OLD | NEW |
---|---|
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_OUTPUT_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
7 | 7 |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/base/scoped_ptr_vector.h" | 10 #include "cc/base/scoped_ptr_vector.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 // Class that handles drawing of composited render layers using GL. | 38 // Class that handles drawing of composited render layers using GL. |
39 class CC_EXPORT GLRenderer | 39 class CC_EXPORT GLRenderer |
40 : public DirectRenderer, | 40 : public DirectRenderer, |
41 public NON_EXPORTED_BASE( | 41 public NON_EXPORTED_BASE( |
42 WebKit::WebGraphicsContext3D:: | 42 WebKit::WebGraphicsContext3D:: |
43 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM) { | 43 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM) { |
44 public: | 44 public: |
45 static scoped_ptr<GLRenderer> Create(RendererClient* client, | 45 static scoped_ptr<GLRenderer> Create(RendererClient* client, |
46 OutputSurface* output_surface, | 46 OutputSurface* output_surface, |
47 ResourceProvider* resource_provider, | 47 ResourceProvider* resource_provider, |
48 int highp_threshold_min); | 48 int highp_threshold_min, |
49 bool use_ganesh); | |
49 | 50 |
50 virtual ~GLRenderer(); | 51 virtual ~GLRenderer(); |
51 | 52 |
52 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 53 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
53 | 54 |
54 WebKit::WebGraphicsContext3D* Context(); | 55 WebKit::WebGraphicsContext3D* Context(); |
55 | 56 |
56 virtual void ViewportChanged() OVERRIDE; | 57 virtual void ViewportChanged() OVERRIDE; |
57 | 58 |
58 // Waits for rendering to finish. | 59 // Waits for rendering to finish. |
(...skipping 19 matching lines...) Expand all Loading... | |
78 int line); | 79 int line); |
79 | 80 |
80 protected: | 81 protected: |
81 GLRenderer(RendererClient* client, | 82 GLRenderer(RendererClient* client, |
82 OutputSurface* output_surface, | 83 OutputSurface* output_surface, |
83 ResourceProvider* resource_provider, | 84 ResourceProvider* resource_provider, |
84 int highp_threshold_min); | 85 int highp_threshold_min); |
85 | 86 |
86 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } | 87 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } |
87 bool Initialize(); | 88 bool Initialize(); |
89 void InitializeGrContext(); | |
88 | 90 |
89 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 91 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
90 const GeometryBinding* SharedGeometry() const { | 92 const GeometryBinding* SharedGeometry() const { |
91 return shared_geometry_.get(); | 93 return shared_geometry_.get(); |
92 } | 94 } |
93 | 95 |
94 void GetFramebufferPixelsAsync(gfx::Rect rect, | 96 void GetFramebufferPixelsAsync(gfx::Rect rect, |
95 bool flipped_y, | 97 bool flipped_y, |
96 CopyRenderPassCallback callback); | 98 CopyRenderPassCallback callback); |
97 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); | 99 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 void DrawIOSurfaceQuad(const DrawingFrame* frame, | 146 void DrawIOSurfaceQuad(const DrawingFrame* frame, |
145 const IOSurfaceDrawQuad* quad); | 147 const IOSurfaceDrawQuad* quad); |
146 void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad); | 148 void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad); |
147 void DrawContentQuad(const DrawingFrame* frame, | 149 void DrawContentQuad(const DrawingFrame* frame, |
148 const ContentDrawQuadBase* quad, | 150 const ContentDrawQuadBase* quad, |
149 ResourceProvider::ResourceId resource_id); | 151 ResourceProvider::ResourceId resource_id); |
150 void DrawYUVVideoQuad(const DrawingFrame* frame, | 152 void DrawYUVVideoQuad(const DrawingFrame* frame, |
151 const YUVVideoDrawQuad* quad); | 153 const YUVVideoDrawQuad* quad); |
152 void DrawPictureQuad(const DrawingFrame* frame, | 154 void DrawPictureQuad(const DrawingFrame* frame, |
153 const PictureDrawQuad* quad); | 155 const PictureDrawQuad* quad); |
156 void DrawPictureQuadDirectToBackbuffer(const DrawingFrame* frame, | |
157 const PictureDrawQuad* quad); | |
154 | 158 |
155 void SetShaderOpacity(float opacity, int alpha_location); | 159 void SetShaderOpacity(float opacity, int alpha_location); |
156 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); | 160 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); |
157 void DrawQuadGeometry(const DrawingFrame* frame, | 161 void DrawQuadGeometry(const DrawingFrame* frame, |
158 const gfx::Transform& draw_transform, | 162 const gfx::Transform& draw_transform, |
159 const gfx::RectF& quad_rect, | 163 const gfx::RectF& quad_rect, |
160 int matrix_location); | 164 int matrix_location); |
161 void SetBlendEnabled(bool enabled); | 165 void SetBlendEnabled(bool enabled); |
162 bool blend_enabled() const { return blend_shadow_; } | 166 bool blend_enabled() const { return blend_shadow_; } |
163 void SetUseProgram(unsigned program); | 167 void SetUseProgram(unsigned program); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 unsigned source_buffer, | 203 unsigned source_buffer, |
200 uint8_t* dest_pixels, | 204 uint8_t* dest_pixels, |
201 gfx::Size size, | 205 gfx::Size size, |
202 bool flipped_y); | 206 bool flipped_y); |
203 void PassOnSkBitmap( | 207 void PassOnSkBitmap( |
204 scoped_ptr<SkBitmap> bitmap, | 208 scoped_ptr<SkBitmap> bitmap, |
205 scoped_ptr<SkAutoLockPixels> lock, | 209 scoped_ptr<SkAutoLockPixels> lock, |
206 const CopyRenderPassCallback& callback, | 210 const CopyRenderPassCallback& callback, |
207 bool success); | 211 bool success); |
208 | 212 |
213 void ReinitializeGrCanvas(); | |
214 void ReinitializeGLState(); | |
215 | |
216 bool CanUseGanesh() const; | |
217 | |
209 // WebKit:: | 218 // WebKit:: |
210 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM | 219 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM |
211 // implementation. | 220 // implementation. |
212 virtual void onMemoryAllocationChanged( | 221 virtual void onMemoryAllocationChanged( |
213 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; | 222 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
214 void DiscardBackbuffer(); | 223 void DiscardBackbuffer(); |
215 void EnsureBackbuffer(); | 224 void EnsureBackbuffer(); |
216 void EnforceMemoryPolicy(); | 225 void EnforceMemoryPolicy(); |
217 | 226 |
218 RendererCapabilities capabilities_; | 227 RendererCapabilities capabilities_; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 scoped_ptr<VideoYUVProgram> video_yuv_program_highp_; | 394 scoped_ptr<VideoYUVProgram> video_yuv_program_highp_; |
386 scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_highp_; | 395 scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_highp_; |
387 | 396 |
388 scoped_ptr<DebugBorderProgram> debug_border_program_; | 397 scoped_ptr<DebugBorderProgram> debug_border_program_; |
389 scoped_ptr<SolidColorProgram> solid_color_program_; | 398 scoped_ptr<SolidColorProgram> solid_color_program_; |
390 scoped_ptr<SolidColorProgramAA> solid_color_program_aa_; | 399 scoped_ptr<SolidColorProgramAA> solid_color_program_aa_; |
391 | 400 |
392 OutputSurface* output_surface_; | 401 OutputSurface* output_surface_; |
393 WebKit::WebGraphicsContext3D* context_; | 402 WebKit::WebGraphicsContext3D* context_; |
394 | 403 |
404 skia::RefPtr<class GrContext> gr_context_; | |
danakj
2013/05/15 20:33:16
need the "class"? I don't see a method with the na
enne (OOO)
2013/05/15 22:34:38
Done.
| |
405 SkAutoTUnref<SkCanvas> sk_canvas_; | |
danakj
2013/05/15 20:33:16
skia::RefPtr > SkAutoTUnref
enne (OOO)
2013/05/15 22:34:38
Done.
| |
406 | |
395 gfx::Rect swap_buffer_rect_; | 407 gfx::Rect swap_buffer_rect_; |
396 gfx::Rect scissor_rect_; | 408 gfx::Rect scissor_rect_; |
397 bool is_viewport_changed_; | 409 bool is_viewport_changed_; |
398 bool is_backbuffer_discarded_; | 410 bool is_backbuffer_discarded_; |
399 bool discard_backbuffer_when_not_visible_; | 411 bool discard_backbuffer_when_not_visible_; |
400 bool is_using_bind_uniform_; | 412 bool is_using_bind_uniform_; |
401 bool visible_; | 413 bool visible_; |
402 bool is_scissor_enabled_; | 414 bool is_scissor_enabled_; |
403 bool blend_shadow_; | 415 bool blend_shadow_; |
404 unsigned program_shadow_; | 416 unsigned program_shadow_; |
(...skipping 23 matching lines...) Expand all Loading... | |
428 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 440 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
429 #define GLC(context, x) \ | 441 #define GLC(context, x) \ |
430 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) | 442 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) |
431 #else | 443 #else |
432 #define GLC(context, x) (x) | 444 #define GLC(context, x) (x) |
433 #endif | 445 #endif |
434 | 446 |
435 } // namespace cc | 447 } // namespace cc |
436 | 448 |
437 #endif // CC_OUTPUT_GL_RENDERER_H_ | 449 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |