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 "base/metrics/histogram.h" |
10 #include "cc/math_util.h" | 11 #include "cc/math_util.h" |
11 #include "ui/gfx/rect_conversions.h" | 12 #include "ui/gfx/rect_conversions.h" |
12 #include "ui/gfx/transform.h" | 13 #include "ui/gfx/transform.h" |
13 | 14 |
14 static gfx::Transform orthoProjectionMatrix(float left, float right, float botto
m, float top) | 15 static gfx::Transform orthoProjectionMatrix(float left, float right, float botto
m, float top) |
15 { | 16 { |
16 // Use the standard formula to map the clipping frustum to the cube from | 17 // Use the standard formula to map the clipping frustum to the cube from |
17 // [-1, -1, -1] to [1, 1, 1]. | 18 // [-1, -1, -1] to [1, 1, 1]. |
18 float deltaX = right - left; | 19 float deltaX = right - left; |
19 float deltaY = top - bottom; | 20 float deltaY = top - bottom; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id)) { | 146 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id)) { |
146 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource
Provider); | 147 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource
Provider); |
147 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id, texture.Pas
s()); | 148 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id, texture.Pas
s()); |
148 } | 149 } |
149 } | 150 } |
150 } | 151 } |
151 | 152 |
152 void DirectRenderer::drawFrame(RenderPassList& renderPassesInDrawOrder, RenderPa
ssIdHashMap& renderPassesById) | 153 void DirectRenderer::drawFrame(RenderPassList& renderPassesInDrawOrder, RenderPa
ssIdHashMap& renderPassesById) |
153 { | 154 { |
154 TRACE_EVENT0("cc", "DirectRenderer::drawFrame"); | 155 TRACE_EVENT0("cc", "DirectRenderer::drawFrame"); |
| 156 HISTOGRAM_COUNTS("Renderer4.renderPassCount", renderPassesInDrawOrder.size()
); |
| 157 |
155 const RenderPass* rootRenderPass = renderPassesInDrawOrder.back(); | 158 const RenderPass* rootRenderPass = renderPassesInDrawOrder.back(); |
156 DCHECK(rootRenderPass); | 159 DCHECK(rootRenderPass); |
157 | 160 |
158 DrawingFrame frame; | 161 DrawingFrame frame; |
159 frame.renderPassesById = &renderPassesById; | 162 frame.renderPassesById = &renderPassesById; |
160 frame.rootRenderPass = rootRenderPass; | 163 frame.rootRenderPass = rootRenderPass; |
161 frame.rootDamageRect = capabilities().usingPartialSwap ? rootRenderPass->dam
age_rect : rootRenderPass->output_rect; | 164 frame.rootDamageRect = capabilities().usingPartialSwap ? rootRenderPass->dam
age_rect : rootRenderPass->output_rect; |
162 frame.rootDamageRect.Intersect(gfx::Rect(gfx::Point(), viewportSize())); | 165 frame.rootDamageRect.Intersect(gfx::Rect(gfx::Point(), viewportSize())); |
163 | 166 |
164 beginDrawingFrame(frame); | 167 beginDrawingFrame(frame); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return pass->output_rect.size(); | 285 return pass->output_rect.size(); |
283 } | 286 } |
284 | 287 |
285 // static | 288 // static |
286 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) | 289 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) |
287 { | 290 { |
288 return GL_RGBA; | 291 return GL_RGBA; |
289 } | 292 } |
290 | 293 |
291 } // namespace cc | 294 } // namespace cc |
OLD | NEW |