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

Side by Side Diff: tests/RectTest.cpp

Issue 2136343002: Revert of try to speed-up maprect + round2i + contains (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 paint.setColor(0xff000000); 81 paint.setColor(0xff000000);
82 paint.setStrokeWidth(0.99f); 82 paint.setStrokeWidth(0.99f);
83 canvas.drawRect(r, paint); 83 canvas.drawRect(r, paint);
84 REPORTER_ASSERT(reporter, has_green_pixels(bm)); 84 REPORTER_ASSERT(reporter, has_green_pixels(bm));
85 } 85 }
86 86
87 DEF_TEST(Rect, reporter) { 87 DEF_TEST(Rect, reporter) {
88 test_stroke_width_clipping(reporter); 88 test_stroke_width_clipping(reporter);
89 test_skbug4406(reporter); 89 test_skbug4406(reporter);
90 } 90 }
91
92 DEF_TEST(Rect_round, reporter) {
93 SkRandom rand;
94
95 for (int i = 0; i < 100000; ++i) {
96 SkRect src = SkRect::MakeXYWH(rand.nextSScalar1() * 1000,
97 rand.nextSScalar1() * 1000,
98 rand.nextUScalar1() * 1000,
99 rand.nextUScalar1() * 1000);
100 SkRect rd0 = {
101 SkScalarRoundToScalar(src.fLeft),
102 SkScalarRoundToScalar(src.fTop),
103 SkScalarRoundToScalar(src.fRight),
104 SkScalarRoundToScalar(src.fBottom)
105 };
106 SkRect rd1 = src.round2s();
107
108 REPORTER_ASSERT(reporter, rd0 == rd1);
109
110 SkIRect ir0 = {
111 SkScalarRoundToInt(src.fLeft),
112 SkScalarRoundToInt(src.fTop),
113 SkScalarRoundToInt(src.fRight),
114 SkScalarRoundToInt(src.fBottom)
115 };
116 SkIRect ir1 = src.round();
117 SkIRect ir2 = src.round2i();
118
119 REPORTER_ASSERT(reporter, ir0 == ir1);
120 REPORTER_ASSERT(reporter, ir0 == ir2);
121 }
122 }
OLDNEW
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698