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

Side by Side Diff: cc/output/direct_renderer.cc

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 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
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/output/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, 74 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform,
75 const gfx::Transform& quad_transform, 75 const gfx::Transform& quad_transform,
76 const gfx::RectF& quad_rect) { 76 const gfx::RectF& quad_rect) {
77 *quad_rect_transform = quad_transform; 77 *quad_rect_transform = quad_transform;
78 quad_rect_transform->Translate(0.5 * quad_rect.width() + quad_rect.x(), 78 quad_rect_transform->Translate(0.5 * quad_rect.width() + quad_rect.x(),
79 0.5 * quad_rect.height() + quad_rect.y()); 79 0.5 * quad_rect.height() + quad_rect.y());
80 quad_rect_transform->Scale(quad_rect.width(), quad_rect.height()); 80 quad_rect_transform->Scale(quad_rect.width(), quad_rect.height());
81 } 81 }
82 82
83 void DirectRenderer::InitializeViewport(DrawingFrame* frame, 83 void DirectRenderer::InitializeViewport(DrawingFrame* frame,
84 gfx::Rect draw_rect, 84 const gfx::Rect& draw_rect,
85 gfx::Rect viewport_rect, 85 const gfx::Rect& viewport_rect,
86 gfx::Size surface_size) { 86 gfx::Size surface_size) {
87 bool flip_y = FlippedFramebuffer(); 87 bool flip_y = FlippedFramebuffer();
88 88
89 DCHECK_GE(viewport_rect.x(), 0); 89 DCHECK_GE(viewport_rect.x(), 0);
90 DCHECK_GE(viewport_rect.y(), 0); 90 DCHECK_GE(viewport_rect.y(), 0);
91 DCHECK_LE(viewport_rect.right(), surface_size.width()); 91 DCHECK_LE(viewport_rect.right(), surface_size.width());
92 DCHECK_LE(viewport_rect.bottom(), surface_size.height()); 92 DCHECK_LE(viewport_rect.bottom(), surface_size.height());
93 if (flip_y) { 93 if (flip_y) {
94 frame->projection_matrix = OrthoProjectionMatrix(draw_rect.x(), 94 frame->projection_matrix = OrthoProjectionMatrix(draw_rect.x(),
95 draw_rect.right(), 95 draw_rect.right(),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 ScopedResource::Create(resource_provider_); 188 ScopedResource::Create(resource_provider_);
189 render_pass_textures_.set(render_passes_in_draw_order[i]->id, 189 render_pass_textures_.set(render_passes_in_draw_order[i]->id,
190 texture.Pass()); 190 texture.Pass());
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, 195 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
196 ContextProvider* offscreen_context_provider, 196 ContextProvider* offscreen_context_provider,
197 float device_scale_factor, 197 float device_scale_factor,
198 gfx::Rect device_viewport_rect, 198 const gfx::Rect& device_viewport_rect,
199 gfx::Rect device_clip_rect, 199 const gfx::Rect& device_clip_rect,
200 bool allow_partial_swap, 200 bool allow_partial_swap,
201 bool disable_picture_quad_image_filtering) { 201 bool disable_picture_quad_image_filtering) {
202 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); 202 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame");
203 UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount", 203 UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount",
204 render_passes_in_draw_order->size()); 204 render_passes_in_draw_order->size());
205 205
206 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); 206 const RenderPass* root_render_pass = render_passes_in_draw_order->back();
207 DCHECK(root_render_pass); 207 DCHECK(root_render_pass);
208 208
209 DrawingFrame frame; 209 DrawingFrame frame;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 if (quad_scissor_rect.IsEmpty()) { 311 if (quad_scissor_rect.IsEmpty()) {
312 *should_skip_quad = true; 312 *should_skip_quad = true;
313 return; 313 return;
314 } 314 }
315 315
316 *should_skip_quad = false; 316 *should_skip_quad = false;
317 SetScissorTestRectInDrawSpace(frame, quad_scissor_rect); 317 SetScissorTestRectInDrawSpace(frame, quad_scissor_rect);
318 } 318 }
319 319
320 void DirectRenderer::SetScissorTestRectInDrawSpace(const DrawingFrame* frame, 320 void DirectRenderer::SetScissorTestRectInDrawSpace(
321 gfx::RectF draw_space_rect) { 321 const DrawingFrame* frame,
322 const gfx::RectF& draw_space_rect) {
322 gfx::Rect window_space_rect = MoveFromDrawToWindowSpace(draw_space_rect); 323 gfx::Rect window_space_rect = MoveFromDrawToWindowSpace(draw_space_rect);
323 if (NeedDeviceClip(frame)) 324 if (NeedDeviceClip(frame))
324 window_space_rect.Intersect(DeviceClipRectInWindowSpace(frame)); 325 window_space_rect.Intersect(DeviceClipRectInWindowSpace(frame));
325 SetScissorTestRect(window_space_rect); 326 SetScissorTestRect(window_space_rect);
326 } 327 }
327 328
328 void DirectRenderer::FinishDrawingQuadList() {} 329 void DirectRenderer::FinishDrawingQuadList() {}
329 330
330 void DirectRenderer::DrawRenderPass(DrawingFrame* frame, 331 void DirectRenderer::DrawRenderPass(DrawingFrame* frame,
331 const RenderPass* render_pass, 332 const RenderPass* render_pass,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ScopedResource* texture = render_pass_textures_.get(id); 421 ScopedResource* texture = render_pass_textures_.get(id);
421 return texture && texture->id(); 422 return texture && texture->id();
422 } 423 }
423 424
424 // static 425 // static
425 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 426 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
426 return render_pass->output_rect.size(); 427 return render_pass->output_rect.size();
427 } 428 }
428 429
429 } // namespace cc 430 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698