| 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/debug/overdraw_metrics.h" | 5 #include "cc/debug/overdraw_metrics.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/trees/layer_tree_host.h" | 10 #include "cc/trees/layer_tree_host.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const gfx::QuadF& quad) { | 48 const gfx::QuadF& quad) { |
| 49 gfx::PointF clipped_quad[8]; | 49 gfx::PointF clipped_quad[8]; |
| 50 int num_vertices_in_clipped_quad = 0; | 50 int num_vertices_in_clipped_quad = 0; |
| 51 MathUtil::MapClippedQuad(transform, | 51 MathUtil::MapClippedQuad(transform, |
| 52 quad, | 52 quad, |
| 53 clipped_quad, | 53 clipped_quad, |
| 54 &num_vertices_in_clipped_quad); | 54 &num_vertices_in_clipped_quad); |
| 55 return PolygonArea(clipped_quad, num_vertices_in_clipped_quad); | 55 return PolygonArea(clipped_quad, num_vertices_in_clipped_quad); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void OverdrawMetrics::DidPaint(gfx::Rect painted_rect) { | 58 void OverdrawMetrics::DidPaint(const gfx::Rect& painted_rect) { |
| 59 if (!record_metrics_for_frame_) | 59 if (!record_metrics_for_frame_) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 pixels_painted_ += | 62 pixels_painted_ += |
| 63 static_cast<float>(painted_rect.width()) * painted_rect.height(); | 63 static_cast<float>(painted_rect.width()) * painted_rect.height(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void OverdrawMetrics::DidCullTilesForUpload(int count) { | 66 void OverdrawMetrics::DidCullTilesForUpload(int count) { |
| 67 if (record_metrics_for_frame_) | 67 if (record_metrics_for_frame_) |
| 68 tiles_culled_for_upload_ += count; | 68 tiles_culled_for_upload_ += count; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void OverdrawMetrics::DidUpload(const gfx::Transform& transform_to_target, | 71 void OverdrawMetrics::DidUpload(const gfx::Transform& transform_to_target, |
| 72 gfx::Rect upload_rect, | 72 const gfx::Rect& upload_rect, |
| 73 gfx::Rect opaque_rect) { | 73 const gfx::Rect& opaque_rect) { |
| 74 if (!record_metrics_for_frame_) | 74 if (!record_metrics_for_frame_) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 float upload_area = | 77 float upload_area = |
| 78 AreaOfMappedQuad(transform_to_target, gfx::QuadF(upload_rect)); | 78 AreaOfMappedQuad(transform_to_target, gfx::QuadF(upload_rect)); |
| 79 float upload_opaque_area = | 79 float upload_opaque_area = |
| 80 AreaOfMappedQuad(transform_to_target, | 80 AreaOfMappedQuad(transform_to_target, |
| 81 gfx::QuadF(gfx::IntersectRects(opaque_rect, | 81 gfx::QuadF(gfx::IntersectRects(opaque_rect, |
| 82 upload_rect))); | 82 upload_rect))); |
| 83 | 83 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 void OverdrawMetrics::DidUseRenderSurfaceTextureMemoryBytes( | 96 void OverdrawMetrics::DidUseRenderSurfaceTextureMemoryBytes( |
| 97 size_t render_surface_use_bytes) { | 97 size_t render_surface_use_bytes) { |
| 98 if (!record_metrics_for_frame_) | 98 if (!record_metrics_for_frame_) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 render_surface_texture_use_bytes_ += render_surface_use_bytes; | 101 render_surface_texture_use_bytes_ += render_surface_use_bytes; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void OverdrawMetrics::DidCullForDrawing( | 104 void OverdrawMetrics::DidCullForDrawing( |
| 105 const gfx::Transform& transform_to_target, | 105 const gfx::Transform& transform_to_target, |
| 106 gfx::Rect before_cull_rect, | 106 const gfx::Rect& before_cull_rect, |
| 107 gfx::Rect after_cull_rect) { | 107 const gfx::Rect& after_cull_rect) { |
| 108 if (!record_metrics_for_frame_) | 108 if (!record_metrics_for_frame_) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 float before_cull_area = | 111 float before_cull_area = |
| 112 AreaOfMappedQuad(transform_to_target, gfx::QuadF(before_cull_rect)); | 112 AreaOfMappedQuad(transform_to_target, gfx::QuadF(before_cull_rect)); |
| 113 float after_cull_area = | 113 float after_cull_area = |
| 114 AreaOfMappedQuad(transform_to_target, gfx::QuadF(after_cull_rect)); | 114 AreaOfMappedQuad(transform_to_target, gfx::QuadF(after_cull_rect)); |
| 115 | 115 |
| 116 pixels_culled_for_drawing_ += before_cull_area - after_cull_area; | 116 pixels_culled_for_drawing_ += before_cull_area - after_cull_area; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void OverdrawMetrics::DidDraw(const gfx::Transform& transform_to_target, | 119 void OverdrawMetrics::DidDraw(const gfx::Transform& transform_to_target, |
| 120 gfx::Rect after_cull_rect, | 120 const gfx::Rect& after_cull_rect, |
| 121 gfx::Rect opaque_rect) { | 121 const gfx::Rect& opaque_rect) { |
| 122 if (!record_metrics_for_frame_) | 122 if (!record_metrics_for_frame_) |
| 123 return; | 123 return; |
| 124 | 124 |
| 125 float after_cull_area = | 125 float after_cull_area = |
| 126 AreaOfMappedQuad(transform_to_target, gfx::QuadF(after_cull_rect)); | 126 AreaOfMappedQuad(transform_to_target, gfx::QuadF(after_cull_rect)); |
| 127 float after_cull_opaque_area = | 127 float after_cull_opaque_area = |
| 128 AreaOfMappedQuad(transform_to_target, | 128 AreaOfMappedQuad(transform_to_target, |
| 129 gfx::QuadF(gfx::IntersectRects(opaque_rect, | 129 gfx::QuadF(gfx::IntersectRects(opaque_rect, |
| 130 after_cull_rect))); | 130 after_cull_rect))); |
| 131 | 131 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 contents_texture_use_bytes_, | 259 contents_texture_use_bytes_, |
| 260 "RenderSurfaceTextureBytes", | 260 "RenderSurfaceTextureBytes", |
| 261 render_surface_texture_use_bytes_); | 261 render_surface_texture_use_bytes_); |
| 262 } | 262 } |
| 263 break; | 263 break; |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace cc | 268 } // namespace cc |
| OLD | NEW |