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

Side by Side Diff: tests/SRGBTest.cpp

Issue 2221803002: Test sk_linear_to_srgb() less exhaustively in Debug mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 2016 Google Inc. 2 * Copyright 2016 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 "SkSRGB.h" 8 #include "SkSRGB.h"
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 15 matching lines...) Expand all
26 // Should be monotonic between 0 and 1. 26 // Should be monotonic between 0 and 1.
27 uint8_t prev = 0; 27 uint8_t prev = 0;
28 for (float f = FLT_MIN; f <= 1.0f; ) { // We don't bother checking denorm v alues. 28 for (float f = FLT_MIN; f <= 1.0f; ) { // We don't bother checking denorm v alues.
29 uint8_t srgb = linear_to_srgb(f); 29 uint8_t srgb = linear_to_srgb(f);
30 30
31 REPORTER_ASSERT(r, srgb >= prev); 31 REPORTER_ASSERT(r, srgb >= prev);
32 prev = srgb; 32 prev = srgb;
33 33
34 union { float flt; uint32_t bits; } pun = { f }; 34 union { float flt; uint32_t bits; } pun = { f };
35 pun.bits++; 35 pun.bits++;
36 SkDEBUGCODE(pun.bits += 127);
36 f = pun.flt; 37 f = pun.flt;
37 } 38 }
38 } 39 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698