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

Side by Side Diff: cc/float_quad_unittest.cc

Issue 11275113: Remove most remaining references to IntRect and FloatRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compositor bindings Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/direct_renderer.cc ('k') | cc/geometry_binding.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "FloatQuad.h" 7 #include "FloatQuad.h"
8 #include "cc/math_util.h" 8 #include "cc/math_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/rect_f.h"
10 #include <public/WebTransformationMatrix.h> 11 #include <public/WebTransformationMatrix.h>
11 12
12 using namespace cc; 13 using namespace cc;
13 using WebKit::WebTransformationMatrix; 14 using WebKit::WebTransformationMatrix;
14 15
15 namespace { 16 namespace {
16 17
17 TEST(FloatQuadTest, IsRectilinearTest) 18 TEST(FloatQuadTest, IsRectilinearTest)
18 { 19 {
19 const int numRectilinear = 8; 20 const int numRectilinear = 8;
20 WebTransformationMatrix rectilinearTrans[numRectilinear]; 21 WebTransformationMatrix rectilinearTrans[numRectilinear];
21 rectilinearTrans[1].rotate(90); 22 rectilinearTrans[1].rotate(90);
22 rectilinearTrans[2].rotate(180); 23 rectilinearTrans[2].rotate(180);
23 rectilinearTrans[3].rotate(270); 24 rectilinearTrans[3].rotate(270);
24 rectilinearTrans[4].skewX(0.00000000001); 25 rectilinearTrans[4].skewX(0.00000000001);
25 rectilinearTrans[5].skewY(0.00000000001); 26 rectilinearTrans[5].skewY(0.00000000001);
26 rectilinearTrans[6].scale(0.00001); 27 rectilinearTrans[6].scale(0.00001);
27 rectilinearTrans[6].rotate(180); 28 rectilinearTrans[6].rotate(180);
28 rectilinearTrans[7].scale(100000); 29 rectilinearTrans[7].scale(100000);
29 rectilinearTrans[7].rotate(180); 30 rectilinearTrans[7].rotate(180);
30 31
31 for (int i = 0; i < numRectilinear; ++i) { 32 for (int i = 0; i < numRectilinear; ++i) {
32 bool clipped = false; 33 bool clipped = false;
33 FloatQuad quad = MathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.0101 0101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); 34 FloatQuad quad = MathUtil::mapQuad(rectilinearTrans[i], gfx::RectF(0.010 10101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped);
34 ASSERT_TRUE(!clipped); 35 ASSERT_TRUE(!clipped);
35 EXPECT_TRUE(quad.isRectilinear()); 36 EXPECT_TRUE(quad.isRectilinear());
36 } 37 }
37 38
38 const int numNonRectilinear = 10; 39 const int numNonRectilinear = 10;
39 WebTransformationMatrix nonRectilinearTrans[numNonRectilinear]; 40 WebTransformationMatrix nonRectilinearTrans[numNonRectilinear];
40 nonRectilinearTrans[0].rotate(359.999); 41 nonRectilinearTrans[0].rotate(359.999);
41 nonRectilinearTrans[1].rotate(0.0000001); 42 nonRectilinearTrans[1].rotate(0.0000001);
42 nonRectilinearTrans[2].rotate(89.999999); 43 nonRectilinearTrans[2].rotate(89.999999);
43 nonRectilinearTrans[3].rotate(90.0000001); 44 nonRectilinearTrans[3].rotate(90.0000001);
44 nonRectilinearTrans[4].rotate(179.999999); 45 nonRectilinearTrans[4].rotate(179.999999);
45 nonRectilinearTrans[5].rotate(180.0000001); 46 nonRectilinearTrans[5].rotate(180.0000001);
46 nonRectilinearTrans[6].rotate(269.999999); 47 nonRectilinearTrans[6].rotate(269.999999);
47 nonRectilinearTrans[7].rotate(270.0000001); 48 nonRectilinearTrans[7].rotate(270.0000001);
48 nonRectilinearTrans[8].skewX(0.00001); 49 nonRectilinearTrans[8].skewX(0.00001);
49 nonRectilinearTrans[9].skewY(0.00001); 50 nonRectilinearTrans[9].skewY(0.00001);
50 51
51 for (int i = 0; i < numNonRectilinear; ++i) { 52 for (int i = 0; i < numNonRectilinear; ++i) {
52 bool clipped = false; 53 bool clipped = false;
53 FloatQuad quad = MathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.0 1010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); 54 FloatQuad quad = MathUtil::mapQuad(nonRectilinearTrans[i], gfx::RectF(0. 01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped);
54 ASSERT_TRUE(!clipped); 55 ASSERT_TRUE(!clipped);
55 EXPECT_FALSE(quad.isRectilinear()); 56 EXPECT_FALSE(quad.isRectilinear());
56 } 57 }
57 } 58 }
58 59
59 } // empty namespace 60 } // empty namespace
OLDNEW
« no previous file with comments | « cc/direct_renderer.cc ('k') | cc/geometry_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698