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

Side by Side Diff: cc/float_quad_unittest.cc

Issue 11364044: cc: Replace WebCore::FloatQuad with gfx::QuadF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reeebase. 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/damage_tracker_unittest.cc ('k') | cc/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 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"
8 #include "cc/math_util.h" 7 #include "cc/math_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/rect_f.h" 9 #include "ui/gfx/rect_f.h"
10 #include "ui/gfx/quad_f.h"
11 #include <public/WebTransformationMatrix.h> 11 #include <public/WebTransformationMatrix.h>
12 12
13 using namespace cc; 13 using namespace cc;
14 using WebKit::WebTransformationMatrix; 14 using WebKit::WebTransformationMatrix;
15 15
16 namespace { 16 namespace {
17 17
18 // TODO(danakj) Move this test to ui/gfx/ when we don't use WebTransformationMat rix.
18 TEST(FloatQuadTest, IsRectilinearTest) 19 TEST(FloatQuadTest, IsRectilinearTest)
19 { 20 {
20 const int numRectilinear = 8; 21 const int numRectilinear = 8;
21 WebTransformationMatrix rectilinearTrans[numRectilinear]; 22 WebTransformationMatrix rectilinearTrans[numRectilinear];
22 rectilinearTrans[1].rotate(90); 23 rectilinearTrans[1].rotate(90);
23 rectilinearTrans[2].rotate(180); 24 rectilinearTrans[2].rotate(180);
24 rectilinearTrans[3].rotate(270); 25 rectilinearTrans[3].rotate(270);
25 rectilinearTrans[4].skewX(0.00000000001); 26 rectilinearTrans[4].skewX(0.00000000001);
26 rectilinearTrans[5].skewY(0.00000000001); 27 rectilinearTrans[5].skewY(0.00000000001);
27 rectilinearTrans[6].scale(0.00001); 28 rectilinearTrans[6].scale(0.00001);
28 rectilinearTrans[6].rotate(180); 29 rectilinearTrans[6].rotate(180);
29 rectilinearTrans[7].scale(100000); 30 rectilinearTrans[7].scale(100000);
30 rectilinearTrans[7].rotate(180); 31 rectilinearTrans[7].rotate(180);
31 32
32 for (int i = 0; i < numRectilinear; ++i) { 33 for (int i = 0; i < numRectilinear; ++i) {
33 bool clipped = false; 34 bool clipped = false;
34 FloatQuad quad = MathUtil::mapQuad(rectilinearTrans[i], gfx::RectF(0.010 10101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); 35 gfx::QuadF quad = MathUtil::mapQuad(rectilinearTrans[i], gfx::QuadF(gfx: :RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)), clipped);
35 ASSERT_TRUE(!clipped); 36 ASSERT_TRUE(!clipped);
36 EXPECT_TRUE(quad.isRectilinear()); 37 EXPECT_TRUE(quad.IsRectilinear());
37 } 38 }
38 39
39 const int numNonRectilinear = 10; 40 const int numNonRectilinear = 10;
40 WebTransformationMatrix nonRectilinearTrans[numNonRectilinear]; 41 WebTransformationMatrix nonRectilinearTrans[numNonRectilinear];
41 nonRectilinearTrans[0].rotate(359.999); 42 nonRectilinearTrans[0].rotate(359.999);
42 nonRectilinearTrans[1].rotate(0.0000001); 43 nonRectilinearTrans[1].rotate(0.0000001);
43 nonRectilinearTrans[2].rotate(89.999999); 44 nonRectilinearTrans[2].rotate(89.999999);
44 nonRectilinearTrans[3].rotate(90.0000001); 45 nonRectilinearTrans[3].rotate(90.0000001);
45 nonRectilinearTrans[4].rotate(179.999999); 46 nonRectilinearTrans[4].rotate(179.999999);
46 nonRectilinearTrans[5].rotate(180.0000001); 47 nonRectilinearTrans[5].rotate(180.0000001);
47 nonRectilinearTrans[6].rotate(269.999999); 48 nonRectilinearTrans[6].rotate(269.999999);
48 nonRectilinearTrans[7].rotate(270.0000001); 49 nonRectilinearTrans[7].rotate(270.0000001);
49 nonRectilinearTrans[8].skewX(0.00001); 50 nonRectilinearTrans[8].skewX(0.00001);
50 nonRectilinearTrans[9].skewY(0.00001); 51 nonRectilinearTrans[9].skewY(0.00001);
51 52
52 for (int i = 0; i < numNonRectilinear; ++i) { 53 for (int i = 0; i < numNonRectilinear; ++i) {
53 bool clipped = false; 54 bool clipped = false;
54 FloatQuad quad = MathUtil::mapQuad(nonRectilinearTrans[i], gfx::RectF(0. 01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); 55 gfx::QuadF quad = MathUtil::mapQuad(nonRectilinearTrans[i], gfx::QuadF(g fx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)), clipped);
55 ASSERT_TRUE(!clipped); 56 ASSERT_TRUE(!clipped);
56 EXPECT_FALSE(quad.isRectilinear()); 57 EXPECT_FALSE(quad.IsRectilinear());
57 } 58 }
58 } 59 }
59 60
60 } // empty namespace 61 } // empty namespace
OLDNEW
« no previous file with comments | « cc/damage_tracker_unittest.cc ('k') | cc/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698