OLD | NEW |
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_DIRECT_RENDERER_H_ | 5 #ifndef CC_DIRECT_RENDERER_H_ |
6 #define CC_DIRECT_RENDERER_H_ | 6 #define CC_DIRECT_RENDERER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "cc/renderer.h" | 10 #include "cc/renderer.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class CachedResource : public ScopedResource { | 51 class CachedResource : public ScopedResource { |
52 public: | 52 public: |
53 static scoped_ptr<CachedResource> create(ResourceProvider* resourceProvi
der) { | 53 static scoped_ptr<CachedResource> create(ResourceProvider* resourceProvi
der) { |
54 return make_scoped_ptr(new CachedResource(resourceProvider)); | 54 return make_scoped_ptr(new CachedResource(resourceProvider)); |
55 } | 55 } |
56 virtual ~CachedResource() {} | 56 virtual ~CachedResource() {} |
57 | 57 |
58 bool isComplete() const { return m_isComplete; } | 58 bool isComplete() const { return m_isComplete; } |
59 void setIsComplete(bool isComplete) { m_isComplete = isComplete; } | 59 void setIsComplete(bool isComplete) { m_isComplete = isComplete; } |
60 | 60 |
| 61 bool needsFullClear() const { return m_needsFullClear; } |
| 62 void setNeedsFullClear(bool fullClear) { m_needsFullClear = fullClear; } |
| 63 |
61 protected: | 64 protected: |
62 explicit CachedResource(ResourceProvider* resourceProvider) | 65 explicit CachedResource(ResourceProvider* resourceProvider) |
63 : ScopedResource(resourceProvider) | 66 : ScopedResource(resourceProvider) |
64 , m_isComplete(false) | 67 , m_isComplete(false) |
| 68 , m_needsFullClear(false) |
65 { | 69 { |
66 } | 70 } |
67 | 71 |
68 private: | 72 private: |
69 bool m_isComplete; | 73 bool m_isComplete; |
| 74 bool m_needsFullClear; |
70 | 75 |
71 DISALLOW_COPY_AND_ASSIGN(CachedResource); | 76 DISALLOW_COPY_AND_ASSIGN(CachedResource); |
72 }; | 77 }; |
73 | 78 |
74 static gfx::RectF quadVertexRect(); | 79 static gfx::RectF quadVertexRect(); |
75 static void quadRectTransform(gfx::Transform* quadRectTransform, const gfx::
Transform& quadTransform, const gfx::RectF& quadRect); | 80 static void quadRectTransform(gfx::Transform* quadRectTransform, const gfx::
Transform& quadTransform, const gfx::RectF& quadRect); |
76 static void initializeMatrices(DrawingFrame&, const gfx::Rect& drawRect, boo
l flipY); | 81 static void initializeMatrices(DrawingFrame&, const gfx::Rect& drawRect, boo
l flipY); |
77 static gfx::Rect moveScissorToWindowSpace(const DrawingFrame&, gfx::RectF sc
issorRect); | 82 static gfx::Rect moveScissorToWindowSpace(const DrawingFrame&, gfx::RectF sc
issorRect); |
78 static gfx::RectF computeScissorRectForRenderPass(const DrawingFrame& frame)
; | 83 static gfx::RectF computeScissorRectForRenderPass(const DrawingFrame& frame)
; |
79 void setScissorStateForQuad(const DrawingFrame& frame, const DrawQuad& quad)
; | 84 void setScissorStateForQuad(const DrawingFrame& frame, const DrawQuad& quad)
; |
80 void setScissorStateForQuadWithRenderPassScissor(const DrawingFrame& frame,
const DrawQuad& quad, const gfx::RectF& renderPassScissor, bool* shouldSkipQuad)
; | 85 void setScissorStateForQuadWithRenderPassScissor(const DrawingFrame& frame,
const DrawQuad& quad, const gfx::RectF& renderPassScissor, bool* shouldSkipQuad)
; |
81 | 86 |
82 bool haveCachedResources(RenderPass::Id) const; | 87 bool haveCachedResources(RenderPass::Id) const; |
83 static gfx::Size renderPassTextureSize(const RenderPass*); | 88 static gfx::Size renderPassTextureSize(const RenderPass*); |
84 static GLenum renderPassTextureFormat(const RenderPass*); | 89 static GLenum renderPassTextureFormat(const RenderPass*); |
85 | 90 |
86 void drawRenderPass(DrawingFrame&, const RenderPass*); | 91 void drawRenderPass(DrawingFrame&, const RenderPass*); |
87 bool useRenderPass(DrawingFrame&, const RenderPass*); | 92 bool useRenderPass(DrawingFrame&, const RenderPass*); |
88 | 93 |
89 virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0; | 94 virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0; |
90 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) = 0; | 95 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) = 0; |
91 virtual void setDrawViewportSize(const gfx::Size&) = 0; | 96 virtual void setDrawViewportSize(const gfx::Size&) = 0; |
92 virtual void setScissorTestRect(const gfx::Rect& scissorRect) = 0; | 97 virtual void setScissorTestRect(const gfx::Rect& scissorRect) = 0; |
93 virtual void clearFramebuffer(DrawingFrame&) = 0; | 98 virtual void clearFramebuffer(DrawingFrame&, bool) = 0; |
94 virtual void drawQuad(DrawingFrame&, const DrawQuad*) = 0; | 99 virtual void drawQuad(DrawingFrame&, const DrawQuad*) = 0; |
95 virtual void beginDrawingFrame(DrawingFrame&) = 0; | 100 virtual void beginDrawingFrame(DrawingFrame&) = 0; |
96 virtual void finishDrawingFrame(DrawingFrame&) = 0; | 101 virtual void finishDrawingFrame(DrawingFrame&) = 0; |
97 virtual void finishDrawingQuadList(); | 102 virtual void finishDrawingQuadList(); |
98 virtual bool flippedFramebuffer() const = 0; | 103 virtual bool flippedFramebuffer() const = 0; |
99 virtual void ensureScissorTestEnabled() = 0; | 104 virtual void ensureScissorTestEnabled() = 0; |
100 virtual void ensureScissorTestDisabled() = 0; | 105 virtual void ensureScissorTestDisabled() = 0; |
101 | 106 |
102 ScopedPtrHashMap<RenderPass::Id, CachedResource> m_renderPassTextures; | 107 ScopedPtrHashMap<RenderPass::Id, CachedResource> m_renderPassTextures; |
103 ResourceProvider* m_resourceProvider; | 108 ResourceProvider* m_resourceProvider; |
104 | 109 |
105 private: | 110 private: |
106 | 111 |
107 gfx::Vector2d m_enlargePassTextureAmount; | 112 gfx::Vector2d m_enlargePassTextureAmount; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 114 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace cc | 117 } // namespace cc |
113 | 118 |
114 #endif // CC_DIRECT_RENDERER_H_ | 119 #endif // CC_DIRECT_RENDERER_H_ |
OLD | NEW |