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 "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "cc/output/direct_renderer.h" | 9 #include "cc/output/direct_renderer.h" |
10 #include "cc/output/gl_renderer_draw_cache.h" | 10 #include "cc/output/gl_renderer_draw_cache.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool Initialize(); | 88 bool Initialize(); |
89 | 89 |
90 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 90 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
91 const GeometryBinding* SharedGeometry() const { | 91 const GeometryBinding* SharedGeometry() const { |
92 return shared_geometry_.get(); | 92 return shared_geometry_.get(); |
93 } | 93 } |
94 | 94 |
95 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); | 95 bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); |
96 void ReleaseRenderPassTextures(); | 96 void ReleaseRenderPassTextures(); |
97 | 97 |
98 virtual void BindFramebufferToOutputSurface(DrawingFrame& frame) OVERRIDE; | 98 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; |
99 virtual bool BindFramebufferToTexture(DrawingFrame& frame, | 99 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
100 const ScopedResource* resource, | 100 const ScopedResource* resource, |
101 gfx::Rect framebuffer_rect) OVERRIDE; | 101 gfx::Rect framebuffer_rect) OVERRIDE; |
102 virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; | 102 virtual void SetDrawViewportSize(gfx::Size viewport_size) OVERRIDE; |
103 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; | 103 virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; |
104 virtual void ClearFramebuffer(DrawingFrame& frame) OVERRIDE; | 104 virtual void ClearFramebuffer(DrawingFrame* frame) OVERRIDE; |
105 virtual void DoDrawQuad(DrawingFrame& frame, const class DrawQuad*) OVERRIDE; | 105 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; |
106 virtual void BeginDrawingFrame(DrawingFrame& frame) OVERRIDE; | 106 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; |
107 virtual void FinishDrawingFrame(DrawingFrame& frame) OVERRIDE; | 107 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; |
108 virtual bool FlippedFramebuffer() const OVERRIDE; | 108 virtual bool FlippedFramebuffer() const OVERRIDE; |
109 virtual void EnsureScissorTestEnabled() OVERRIDE; | 109 virtual void EnsureScissorTestEnabled() OVERRIDE; |
110 virtual void EnsureScissorTestDisabled() OVERRIDE; | 110 virtual void EnsureScissorTestDisabled() OVERRIDE; |
111 virtual void FinishDrawingQuadList() OVERRIDE; | 111 virtual void FinishDrawingQuadList() OVERRIDE; |
112 | 112 |
113 private: | 113 private: |
114 friend class GLRendererShaderTest; | 114 friend class GLRendererShaderTest; |
115 | 115 |
116 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); | 116 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); |
117 static ManagedMemoryPolicy::PriorityCutoff PriorityCutoff( | 117 static ManagedMemoryPolicy::PriorityCutoff PriorityCutoff( |
118 WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff); | 118 WebKit::WebGraphicsMemoryAllocation::PriorityCutoff priority_cutoff); |
119 | 119 |
120 void DrawCheckerboardQuad(const DrawingFrame& frame, | 120 void DrawCheckerboardQuad(const DrawingFrame* frame, |
121 const CheckerboardDrawQuad* quad); | 121 const CheckerboardDrawQuad* quad); |
122 void DrawDebugBorderQuad(const DrawingFrame& frame, | 122 void DrawDebugBorderQuad(const DrawingFrame* frame, |
123 const DebugBorderDrawQuad* quad); | 123 const DebugBorderDrawQuad* quad); |
124 scoped_ptr<ScopedResource> DrawBackgroundFilters( | 124 scoped_ptr<ScopedResource> DrawBackgroundFilters( |
125 DrawingFrame& frame, | 125 DrawingFrame* frame, |
126 const RenderPassDrawQuad* quad, | 126 const RenderPassDrawQuad* quad, |
127 const gfx::Transform& contents_device_transform, | 127 const gfx::Transform& contents_device_transform, |
128 const gfx::Transform& contents_device_transformInverse); | 128 const gfx::Transform& contents_device_transformInverse); |
129 void DrawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQuad* quad); | 129 void DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad); |
130 void DrawSolidColorQuad(const DrawingFrame& frame, | 130 void DrawSolidColorQuad(const DrawingFrame* frame, |
131 const SolidColorDrawQuad* quad); | 131 const SolidColorDrawQuad* quad); |
132 void DrawStreamVideoQuad(const DrawingFrame& frame, | 132 void DrawStreamVideoQuad(const DrawingFrame* frame, |
133 const StreamVideoDrawQuad* quad); | 133 const StreamVideoDrawQuad* quad); |
134 void DrawTextureQuad(const DrawingFrame& frame, const TextureDrawQuad* quad); | 134 void DrawTextureQuad(const DrawingFrame* frame, const TextureDrawQuad* quad); |
135 void EnqueueTextureQuad(const DrawingFrame& frame, | 135 void EnqueueTextureQuad(const DrawingFrame* frame, |
136 const TextureDrawQuad* quad); | 136 const TextureDrawQuad* quad); |
137 void FlushTextureQuadCache(); | 137 void FlushTextureQuadCache(); |
138 void DrawIOSurfaceQuad(const DrawingFrame& frame, | 138 void DrawIOSurfaceQuad(const DrawingFrame* frame, |
139 const IOSurfaceDrawQuad* quad); | 139 const IOSurfaceDrawQuad* quad); |
140 void DrawTileQuad(const DrawingFrame& frame, const TileDrawQuad* quad); | 140 void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad); |
141 void DrawYUVVideoQuad(const DrawingFrame& frame, | 141 void DrawYUVVideoQuad(const DrawingFrame* frame, |
142 const YUVVideoDrawQuad* quad); | 142 const YUVVideoDrawQuad* quad); |
143 | 143 |
144 void SetShaderOpacity(float opacity, int alpha_location); | 144 void SetShaderOpacity(float opacity, int alpha_location); |
145 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); | 145 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); |
146 void DrawQuadGeometry(const DrawingFrame& frame, | 146 void DrawQuadGeometry(const DrawingFrame* frame, |
147 const gfx::Transform& draw_transform, | 147 const gfx::Transform& draw_transform, |
148 const gfx::RectF& quad_rect, | 148 const gfx::RectF& quad_rect, |
149 int matrix_location); | 149 int matrix_location); |
150 void SetBlendEnabled(bool enabled); | 150 void SetBlendEnabled(bool enabled); |
151 void SetUseProgram(unsigned program); | 151 void SetUseProgram(unsigned program); |
152 | 152 |
153 void CopyTextureToFramebuffer(const DrawingFrame& frame, | 153 void CopyTextureToFramebuffer(const DrawingFrame* frame, |
154 int texture_id, | 154 int texture_id, |
155 gfx::Rect rect, | 155 gfx::Rect rect, |
156 const gfx::Transform& draw_matrix); | 156 const gfx::Transform& draw_matrix); |
157 | 157 |
158 // Check if quad needs antialiasing and if so, inflate the quad and | 158 // Check if quad needs antialiasing and if so, inflate the quad and |
159 // fill edge array for fragment shader. local_quad is set to | 159 // fill edge array for fragment shader. local_quad is set to |
160 // inflated quad if antialiasing is required, otherwise it is left | 160 // inflated quad if antialiasing is required, otherwise it is left |
161 // unchanged. edge array is filled with inflated quad's edge data | 161 // unchanged. edge array is filled with inflated quad's edge data |
162 // if antialiasing is required, otherwise it is left unchanged. | 162 // if antialiasing is required, otherwise it is left unchanged. |
163 // Returns true if quad requires antialiasing and false otherwise. | 163 // Returns true if quad requires antialiasing and false otherwise. |
164 bool SetupQuadForAntialiasing(const gfx::Transform& device_transform, | 164 bool SetupQuadForAntialiasing(const gfx::Transform& device_transform, |
165 const DrawQuad* quad, | 165 const DrawQuad* quad, |
166 gfx::QuadF* local_quad, | 166 gfx::QuadF* local_quad, |
167 float edge[24]) const; | 167 float edge[24]) const; |
168 | 168 |
169 bool UseScopedTexture(DrawingFrame& frame, | 169 bool UseScopedTexture(DrawingFrame* frame, |
170 const ScopedResource* resource, | 170 const ScopedResource* resource, |
171 gfx::Rect viewport_rect); | 171 gfx::Rect viewport_rect); |
172 | 172 |
173 bool MakeContextCurrent(); | 173 bool MakeContextCurrent(); |
174 | 174 |
175 bool InitializeSharedObjects(); | 175 bool InitializeSharedObjects(); |
176 void CleanupSharedObjects(); | 176 void CleanupSharedObjects(); |
177 | 177 |
178 // WebKit:: | 178 // WebKit:: |
179 // WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM | 179 // WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 331 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
332 #define GLC(context, x) \ | 332 #define GLC(context, x) \ |
333 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) | 333 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) |
334 #else | 334 #else |
335 #define GLC(context, x) (x) | 335 #define GLC(context, x) (x) |
336 #endif | 336 #endif |
337 | 337 |
338 } | 338 } |
339 | 339 |
340 #endif // CC_OUTPUT_GL_RENDERER_H_ | 340 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |