Chromium Code Reviews| 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 "cc/direct_renderer.h" | 5 #include "cc/direct_renderer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 | 200 |
| 201 if (quadScissorRect.IsEmpty()) { | 201 if (quadScissorRect.IsEmpty()) { |
| 202 *shouldSkipQuad = true; | 202 *shouldSkipQuad = true; |
| 203 return; | 203 return; |
| 204 } | 204 } |
| 205 | 205 |
| 206 *shouldSkipQuad = false; | 206 *shouldSkipQuad = false; |
| 207 setScissorTestRect(moveScissorToWindowSpace(frame, quadScissorRect)); | 207 setScissorTestRect(moveScissorToWindowSpace(frame, quadScissorRect)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void DirectRenderer::finishDrawingQuadList() | |
|
shawnsingh
2012/11/28 19:44:16
I know I was the one who suggested doing it this w
whunt
2012/11/28 22:01:15
DirectRenderer isn't a virtual interface, it's alr
danakj
2012/11/28 22:03:16
Things that would be useful for GLRenderer and Sof
| |
| 211 { | |
| 212 } | |
| 213 | |
| 210 void DirectRenderer::drawRenderPass(DrawingFrame& frame, const RenderPass* rende rPass) | 214 void DirectRenderer::drawRenderPass(DrawingFrame& frame, const RenderPass* rende rPass) |
| 211 { | 215 { |
| 212 TRACE_EVENT0("cc", "DirectRenderer::drawRenderPass"); | 216 TRACE_EVENT0("cc", "DirectRenderer::drawRenderPass"); |
| 213 if (!useRenderPass(frame, renderPass)) | 217 if (!useRenderPass(frame, renderPass)) |
| 214 return; | 218 return; |
| 215 | 219 |
| 216 bool usingScissorAsOptimization = capabilities().usingPartialSwap; | 220 bool usingScissorAsOptimization = capabilities().usingPartialSwap; |
| 217 gfx::RectF renderPassScissor; | 221 gfx::RectF renderPassScissor; |
| 218 | 222 |
| 219 if (usingScissorAsOptimization) { | 223 if (usingScissorAsOptimization) { |
| 220 renderPassScissor = computeScissorRectForRenderPass(frame); | 224 renderPassScissor = computeScissorRectForRenderPass(frame); |
| 221 setScissorTestRect(moveScissorToWindowSpace(frame, renderPassScissor)); | 225 setScissorTestRect(moveScissorToWindowSpace(frame, renderPassScissor)); |
| 222 } | 226 } |
| 223 | 227 |
| 224 clearFramebuffer(frame); | 228 clearFramebuffer(frame); |
| 225 | 229 |
| 226 const QuadList& quadList = renderPass->quad_list; | 230 const QuadList& quadList = renderPass->quad_list; |
| 227 for (QuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) { | 231 for (QuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) { |
| 228 const DrawQuad& quad = *(*it); | 232 const DrawQuad& quad = *(*it); |
| 229 bool shouldSkipQuad = false; | 233 bool shouldSkipQuad = false; |
| 230 | 234 |
| 231 if (usingScissorAsOptimization) | 235 if (usingScissorAsOptimization) |
| 232 setScissorStateForQuadWithRenderPassScissor(frame, quad, renderPassS cissor, &shouldSkipQuad); | 236 setScissorStateForQuadWithRenderPassScissor(frame, quad, renderPassS cissor, &shouldSkipQuad); |
| 233 else | 237 else |
| 234 setScissorStateForQuad(frame, quad); | 238 setScissorStateForQuad(frame, quad); |
| 235 | 239 |
| 236 if (!shouldSkipQuad) | 240 if (!shouldSkipQuad) |
| 237 drawQuad(frame, *it); | 241 drawQuad(frame, *it); |
| 238 } | 242 } |
| 243 finishDrawingQuadList(); | |
| 239 | 244 |
| 240 CachedResource* texture = m_renderPassTextures.get(renderPass->id); | 245 CachedResource* texture = m_renderPassTextures.get(renderPass->id); |
| 241 if (texture) | 246 if (texture) |
| 242 texture->setIsComplete(!renderPass->has_occlusion_from_outside_target_su rface); | 247 texture->setIsComplete(!renderPass->has_occlusion_from_outside_target_su rface); |
| 243 } | 248 } |
| 244 | 249 |
| 245 bool DirectRenderer::useRenderPass(DrawingFrame& frame, const RenderPass* render Pass) | 250 bool DirectRenderer::useRenderPass(DrawingFrame& frame, const RenderPass* render Pass) |
| 246 { | 251 { |
| 247 frame.currentRenderPass = renderPass; | 252 frame.currentRenderPass = renderPass; |
| 248 frame.currentTexture = 0; | 253 frame.currentTexture = 0; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 274 return pass->output_rect.size(); | 279 return pass->output_rect.size(); |
| 275 } | 280 } |
| 276 | 281 |
| 277 // static | 282 // static |
| 278 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) | 283 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) |
| 279 { | 284 { |
| 280 return GL_RGBA; | 285 return GL_RGBA; |
| 281 } | 286 } |
| 282 | 287 |
| 283 } // namespace cc | 288 } // namespace cc |
| OLD | NEW |