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 28 matching lines...) Expand all Loading... |
39 float area = 0; | 39 float area = 0; |
40 for (int i = 0; i < num_points; ++i) | 40 for (int i = 0; i < num_points; ++i) |
41 area += WedgeProduct(points[i], points[(i+1)%num_points]); | 41 area += WedgeProduct(points[i], points[(i+1)%num_points]); |
42 return fabs(0.5f * area); | 42 return fabs(0.5f * area); |
43 } | 43 } |
44 | 44 |
45 // Takes a given quad, maps it by the given transformation, and gives the area | 45 // Takes a given quad, maps it by the given transformation, and gives the area |
46 // of the resulting polygon. | 46 // of the resulting polygon. |
47 static inline float AreaOfMappedQuad(const gfx::Transform& transform, | 47 static inline float AreaOfMappedQuad(const gfx::Transform& transform, |
48 const gfx::QuadF& quad) { | 48 const gfx::QuadF& quad) { |
49 gfx::PointF clippedQuad[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 clippedQuad, | 53 clipped_quad, |
54 num_vertices_in_clipped_quad); | 54 num_vertices_in_clipped_quad); |
55 return PolygonArea(clippedQuad, 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(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 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 contents_texture_use_bytes_, | 258 contents_texture_use_bytes_, |
259 "RenderSurfaceTextureBytes", | 259 "RenderSurfaceTextureBytes", |
260 render_surface_texture_use_bytes_); | 260 render_surface_texture_use_bytes_); |
261 } | 261 } |
262 break; | 262 break; |
263 } | 263 } |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 } // namespace cc | 267 } // namespace cc |
OLD | NEW |