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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCDirectRenderer.h" | 7 #include "CCDirectRenderer.h" |
8 | 8 |
9 #include "CCMathUtil.h" | 9 #include "CCMathUtil.h" |
10 #include <public/WebTransformationMatrix.h> | 10 #include <public/WebTransformationMatrix.h> |
(...skipping 30 matching lines...) Expand all Loading... |
41 canvas.scale3d(width, height, 0); | 41 canvas.scale3d(width, height, 0); |
42 | 42 |
43 // Map from ([-1, -1] to [1, 1]) -> ([0, 0] to [1, 1]) | 43 // Map from ([-1, -1] to [1, 1]) -> ([0, 0] to [1, 1]) |
44 canvas.translate3d(0.5, 0.5, 0.5); | 44 canvas.translate3d(0.5, 0.5, 0.5); |
45 canvas.scale3d(0.5, 0.5, 0.5); | 45 canvas.scale3d(0.5, 0.5, 0.5); |
46 | 46 |
47 return canvas; | 47 return canvas; |
48 } | 48 } |
49 | 49 |
50 namespace cc { | 50 namespace cc { |
| 51 |
| 52 CCDirectRenderer::DrawingFrame::DrawingFrame() |
| 53 : rootRenderPass(0) |
| 54 , currentRenderPass(0) |
| 55 , currentTexture(0) |
| 56 , flippedY(false) |
| 57 { |
| 58 } |
| 59 |
| 60 CCDirectRenderer::DrawingFrame::~DrawingFrame() |
| 61 { |
| 62 } |
| 63 |
51 // | 64 // |
52 // static | 65 // static |
53 FloatRect CCDirectRenderer::quadVertexRect() | 66 FloatRect CCDirectRenderer::quadVertexRect() |
54 { | 67 { |
55 return FloatRect(-0.5, -0.5, 1, 1); | 68 return FloatRect(-0.5, -0.5, 1, 1); |
56 } | 69 } |
57 | 70 |
58 // static | 71 // static |
59 void CCDirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRe
ctTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRe
ct& quadRect) | 72 void CCDirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRe
ctTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRe
ct& quadRect) |
60 { | 73 { |
(...skipping 21 matching lines...) Expand all Loading... |
82 // by the relative position of the top left corner of the current render pas
s. | 95 // by the relative position of the top left corner of the current render pas
s. |
83 IntRect framebufferOutputRect = frame.currentRenderPass->outputRect(); | 96 IntRect framebufferOutputRect = frame.currentRenderPass->outputRect(); |
84 scissorRectInCanvasSpace.setX(scissorRectInCanvasSpace.x() - framebufferOutp
utRect.x()); | 97 scissorRectInCanvasSpace.setX(scissorRectInCanvasSpace.x() - framebufferOutp
utRect.x()); |
85 if (frame.flippedY && !frame.currentTexture) | 98 if (frame.flippedY && !frame.currentTexture) |
86 scissorRectInCanvasSpace.setY(framebufferOutputRect.height() - (scissorR
ectInCanvasSpace.maxY() - framebufferOutputRect.y())); | 99 scissorRectInCanvasSpace.setY(framebufferOutputRect.height() - (scissorR
ectInCanvasSpace.maxY() - framebufferOutputRect.y())); |
87 else | 100 else |
88 scissorRectInCanvasSpace.setY(scissorRectInCanvasSpace.y() - framebuffer
OutputRect.y()); | 101 scissorRectInCanvasSpace.setY(scissorRectInCanvasSpace.y() - framebuffer
OutputRect.y()); |
89 return scissorRectInCanvasSpace; | 102 return scissorRectInCanvasSpace; |
90 } | 103 } |
91 | 104 |
| 105 CCDirectRenderer::CCDirectRenderer(CCRendererClient* client, CCResourceProvider*
resourceProvider) |
| 106 : CCRenderer(client) |
| 107 , m_resourceProvider(resourceProvider) |
| 108 { |
| 109 } |
| 110 |
| 111 CCDirectRenderer::~CCDirectRenderer() |
| 112 { |
| 113 } |
| 114 |
92 void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis
t& renderPassesInDrawOrder) | 115 void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis
t& renderPassesInDrawOrder) |
93 { | 116 { |
94 HashMap<CCRenderPass::Id, const CCRenderPass*> renderPassesInFrame; | 117 HashMap<CCRenderPass::Id, const CCRenderPass*> renderPassesInFrame; |
95 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) | 118 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) |
96 renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesIn
DrawOrder[i]); | 119 renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesIn
DrawOrder[i]); |
97 | 120 |
98 Vector<CCRenderPass::Id> passesToDelete; | 121 Vector<CCRenderPass::Id> passesToDelete; |
99 HashMap<CCRenderPass::Id, OwnPtr<CachedTexture> >::const_iterator passIterat
or; | 122 HashMap<CCRenderPass::Id, OwnPtr<CachedTexture> >::const_iterator passIterat
or; |
100 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { | 123 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { |
101 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 124 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return pass->outputRect().size(); | 238 return pass->outputRect().size(); |
216 } | 239 } |
217 | 240 |
218 // static | 241 // static |
219 GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) | 242 GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) |
220 { | 243 { |
221 return GraphicsContext3D::RGBA; | 244 return GraphicsContext3D::RGBA; |
222 } | 245 } |
223 | 246 |
224 } | 247 } |
OLD | NEW |