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

Unified Diff: cc/quads/draw_polygon.cc

Issue 416273002: BSP Tree perf tests to match LayerSorter perf tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test issue. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/quads/draw_polygon.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/quads/draw_polygon.cc
diff --git a/cc/quads/draw_polygon.cc b/cc/quads/draw_polygon.cc
index db2249c0ef5b86d75d28d51c6427fcdbeaaaa32e..bfc2b49296d0e09891a3df43e13531449b92ea75 100644
--- a/cc/quads/draw_polygon.cc
+++ b/cc/quads/draw_polygon.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "cc/output/bsp_compare_result.h"
+#include "cc/quads/draw_quad.h"
namespace {
// This allows for some imperfection in the normal comparison when checking if
@@ -45,6 +46,32 @@ DrawPolygon::DrawPolygon(DrawQuad* original,
normal_ = normal;
}
+// This takes the original DrawQuad that this polygon should be based on,
+// a visible content rect to make the 4 corner points from, and a transformation
+// to move it and its normal into screen space.
+DrawPolygon::DrawPolygon(DrawQuad* original_ref,
+ const gfx::RectF& visible_content_rect,
+ const gfx::Transform& transform,
+ int draw_order_index)
+ : order_index_(draw_order_index), original_ref_(original_ref) {
+ normal_ = default_normal;
+ gfx::Point3F points[8];
+ int num_vertices_in_clipped_quad;
+ gfx::QuadF send_quad(visible_content_rect);
+
+ // Doing this mapping here is very important, since we can't just transform
+ // the points without clipping and not run into strange geometry issues when
+ // crossing w = 0. At this point, in the constructor, we know that we're
+ // working with a quad, so we can reuse the MathUtil::MapClippedQuad3d
+ // function instead of writing a generic polygon version of it.
+ MathUtil::MapClippedQuad3d(
+ transform, send_quad, points, &num_vertices_in_clipped_quad);
+ for (int i = 0; i < num_vertices_in_clipped_quad; i++) {
+ points_.push_back(points[i]);
+ }
+ ApplyTransformToNormal(transform);
+}
+
DrawPolygon::~DrawPolygon() {
}
« no previous file with comments | « cc/quads/draw_polygon.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698