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

Side by Side Diff: tests/PointTest.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « tests/PixelRefTest.cpp ('k') | tests/PremulAlphaRoundTripTest.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 // Unit tests for src/core/SkPoint.cpp and its header 8 // Unit tests for src/core/SkPoint.cpp and its header
9 9
10 #include "SkPoint.h" 10 #include "SkPoint.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // 67 //
68 // force_as_float is meant to capture our latest technique (horrible as 68 // force_as_float is meant to capture our latest technique (horrible as
69 // it is) to force the value to be a float, so we can test whether it was 69 // it is) to force the value to be a float, so we can test whether it was
70 // finite or not. 70 // finite or not.
71 static float force_as_float(skiatest::Reporter* reporter, float value) { 71 static float force_as_float(skiatest::Reporter* reporter, float value) {
72 uint32_t storage; 72 uint32_t storage;
73 memcpy(&storage, &value, 4); 73 memcpy(&storage, &value, 4);
74 // even the pair of memcpy calls are not sufficient, since those seem to 74 // even the pair of memcpy calls are not sufficient, since those seem to
75 // be no-op'd, so we add a runtime tests (just like get_value) to force 75 // be no-op'd, so we add a runtime tests (just like get_value) to force
76 // the compiler to give us an actual float. 76 // the compiler to give us an actual float.
77 if (NULL == reporter) { 77 if (nullptr == reporter) {
78 storage = ~storage; 78 storage = ~storage;
79 } 79 }
80 memcpy(&value, &storage, 4); 80 memcpy(&value, &storage, 4);
81 return value; 81 return value;
82 } 82 }
83 83
84 // test that we handle very large values correctly. i.e. that we can 84 // test that we handle very large values correctly. i.e. that we can
85 // successfully normalize something whose mag overflows a float. 85 // successfully normalize something whose mag overflows a float.
86 static void test_overflow(skiatest::Reporter* reporter) { 86 static void test_overflow(skiatest::Reporter* reporter) {
87 SkScalar bigFloat = get_value(reporter, 3.4e38f); 87 SkScalar bigFloat = get_value(reporter, 3.4e38f);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 slow.setLength(tests[i]); 149 slow.setLength(tests[i]);
150 fast.setLengthFast(tests[i]); 150 fast.setLengthFast(tests[i]);
151 151
152 if (slow.length() < FLT_MIN && fast.length() < FLT_MIN) continue; 152 if (slow.length() < FLT_MIN && fast.length() < FLT_MIN) continue;
153 153
154 SkScalar ratio = slow.length() / fast.length(); 154 SkScalar ratio = slow.length() / fast.length();
155 REPORTER_ASSERT(reporter, ratio > 0.999f); 155 REPORTER_ASSERT(reporter, ratio > 0.999f);
156 REPORTER_ASSERT(reporter, ratio < 1.001f); 156 REPORTER_ASSERT(reporter, ratio < 1.001f);
157 } 157 }
158 } 158 }
OLDNEW
« no previous file with comments | « tests/PixelRefTest.cpp ('k') | tests/PremulAlphaRoundTripTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698