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

Side by Side Diff: cc/CCRendererGL.h

Issue 10984053: cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
OLDNEW
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 5
6 #ifndef CCRendererGL_h 6 #ifndef CCRendererGL_h
7 #define CCRendererGL_h 7 #define CCRendererGL_h
8 8
9 #if USE(ACCELERATED_COMPOSITING) 9 #if USE(ACCELERATED_COMPOSITING)
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider *); 42 static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider *);
43 43
44 virtual ~CCRendererGL(); 44 virtual ~CCRendererGL();
45 45
46 virtual const RendererCapabilities& capabilities() const OVERRIDE; 46 virtual const RendererCapabilities& capabilities() const OVERRIDE;
47 47
48 WebKit::WebGraphicsContext3D* context(); 48 WebKit::WebGraphicsContext3D* context();
49 49
50 virtual void viewportChanged() OVERRIDE; 50 virtual void viewportChanged() OVERRIDE;
51 51
52 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
53
54 // waits for rendering to finish 52 // waits for rendering to finish
55 virtual void finish() OVERRIDE; 53 virtual void finish() OVERRIDE;
56 54
57 virtual void doNoOp() OVERRIDE; 55 virtual void doNoOp() OVERRIDE;
58 // puts backbuffer onscreen 56 // puts backbuffer onscreen
59 virtual bool swapBuffers() OVERRIDE; 57 virtual bool swapBuffers() OVERRIDE;
60 58
61 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command, const char* file, int line); 59 virtual void getFramebufferPixels(void *pixels, const cc::IntRect&) OVERRIDE ;
62
63 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get( ); }
64
65 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
66 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect);
67 60
68 virtual bool isContextLost() OVERRIDE; 61 virtual bool isContextLost() OVERRIDE;
69 62
70 virtual void setVisible(bool) OVERRIDE; 63 virtual void setVisible(bool) OVERRIDE;
71 64
72 protected: 65 protected:
73 CCRendererGL(CCRendererClient*, CCResourceProvider*); 66 CCRendererGL(CCRendererClient*, CCResourceProvider*);
74 67
68 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command, const char* file, int line);
69
75 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } 70 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
76 bool initialize(); 71 bool initialize();
77 72
73 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
74 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get( ); }
75
76 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect);
78 void releaseRenderPassTextures(); 77 void releaseRenderPassTextures();
79 78
80 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; 79 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
81 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE; 80 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const ccmath::IntRect& framebufferRect) OVERRIDE;
82 virtual void setDrawViewportSize(const IntSize&) OVERRIDE; 81 virtual void setDrawViewportSize(const ccmath::IntSize&) OVERRIDE;
83 virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; 82 virtual void enableScissorTestRect(const ccmath::IntRect& scissorRect) OVERR IDE;
84 virtual void disableScissorTest() OVERRIDE; 83 virtual void disableScissorTest() OVERRIDE;
85 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; 84 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE;
86 virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; 85 virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE;
87 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; 86 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE;
88 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; 87 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE;
89 virtual bool flippedFramebuffer() const OVERRIDE; 88 virtual bool flippedFramebuffer() const OVERRIDE;
90 89
91 private: 90 private:
92 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); 91 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
93 92
94 void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad* ); 93 void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad* );
95 void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); 94 void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*);
96 PassOwnPtr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRen derPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransform ationMatrix& deviceTransform); 95 PassOwnPtr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRen derPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransform ationMatrix& deviceTransform);
97 void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*); 96 void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*);
98 void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); 97 void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*);
99 void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*); 98 void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*);
100 void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); 99 void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*);
101 void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*); 100 void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*);
102 void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); 101 void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*);
103 void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*); 102 void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*);
104 103
105 void setShaderOpacity(float opacity, int alphaLocation); 104 void setShaderOpacity(float opacity, int alphaLocation);
106 void setShaderFloatQuad(const FloatQuad&, int quadLocation); 105 void setShaderFloatQuad(const FloatQuad&, int quadLocation);
107 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa trix& drawTransform, const FloatRect& quadRect, int matrixLocation); 106 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa trix& drawTransform, const ccmath::FloatRect& quadRect, int matrixLocation);
108 107
109 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const IntR ect&, const WebKit::WebTransformationMatrix& drawMatrix); 108 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const ccma th::IntRect&, const WebKit::WebTransformationMatrix& drawMatrix);
110 109
111 bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect); 110 bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const ccmath::I ntRect& viewportRect);
112 111
113 bool makeContextCurrent(); 112 bool makeContextCurrent();
114 113
115 bool initializeSharedObjects(); 114 bool initializeSharedObjects();
116 void cleanupSharedObjects(); 115 void cleanupSharedObjects();
117 116
118 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM IUM implementation. 117 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM IUM implementation.
119 virtual void onSwapBuffersComplete() OVERRIDE; 118 virtual void onSwapBuffersComplete() OVERRIDE;
120 119
121 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC HROMIUM implementation. 120 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC HROMIUM implementation.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 OwnPtr<TextureProgramFlip> m_textureProgramFlip; 201 OwnPtr<TextureProgramFlip> m_textureProgramFlip;
203 OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; 202 OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram;
204 203
205 OwnPtr<VideoYUVProgram> m_videoYUVProgram; 204 OwnPtr<VideoYUVProgram> m_videoYUVProgram;
206 OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram; 205 OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram;
207 206
208 OwnPtr<SolidColorProgram> m_solidColorProgram; 207 OwnPtr<SolidColorProgram> m_solidColorProgram;
209 208
210 WebKit::WebGraphicsContext3D* m_context; 209 WebKit::WebGraphicsContext3D* m_context;
211 210
212 IntRect m_swapBufferRect; 211 ccmath::IntRect m_swapBufferRect;
213 bool m_isViewportChanged; 212 bool m_isViewportChanged;
214 bool m_isFramebufferDiscarded; 213 bool m_isFramebufferDiscarded;
215 bool m_isUsingBindUniform; 214 bool m_isUsingBindUniform;
216 bool m_visible; 215 bool m_visible;
217 216
218 OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; 217 OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock;
219 }; 218 };
220 219
221 220
222 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL 221 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL
223 // call made by the compositor. Useful for debugging rendering issues but 222 // call made by the compositor. Useful for debugging rendering issues but
224 // will significantly degrade performance. 223 // will significantly degrade performance.
225 #define DEBUG_GL_CALLS 0 224 #define DEBUG_GL_CALLS 0
226 225
227 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) 226 #if DEBUG_GL_CALLS && !defined ( NDEBUG )
228 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _ _LINE__)) 227 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _ _LINE__))
229 #else 228 #else
230 #define GLC(context, x) (x) 229 #define GLC(context, x) (x)
231 #endif 230 #endif
232 231
233 232
234 } 233 }
235 234
236 #endif // USE(ACCELERATED_COMPOSITING) 235 #endif // USE(ACCELERATED_COMPOSITING)
237 236
238 #endif 237 #endif
OLDNEW
« no previous file with comments | « cc/CCRenderer.h ('k') | cc/CCRendererGL.cpp » ('j') | cc/math/clamp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698