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

Side by Side Diff: tests/Float16Test.cpp

Issue 2093763003: Change SkColor4f to RGBA channel order (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reorder Pin arguments, too Created 4 years, 6 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/core/SkPixmap.cpp ('k') | tests/SkColor4fTest.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 * 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 "Test.h" 8 #include "Test.h"
9 #include "SkAutoPixmapStorage.h" 9 #include "SkAutoPixmapStorage.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 25 matching lines...) Expand all
36 DEF_TEST(color_half_float, reporter) { 36 DEF_TEST(color_half_float, reporter) {
37 const int w = 100; 37 const int w = 100;
38 const int h = 100; 38 const int h = 100;
39 39
40 SkImageInfo info = SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_Sk AlphaType); 40 SkImageInfo info = SkImageInfo::Make(w, h, kRGBA_F16_SkColorType, kPremul_Sk AlphaType);
41 41
42 SkAutoPixmapStorage pm; 42 SkAutoPixmapStorage pm;
43 pm.alloc(info); 43 pm.alloc(info);
44 REPORTER_ASSERT(reporter, pm.getSafeSize() == SkToSizeT(w * h * sizeof(uint6 4_t))); 44 REPORTER_ASSERT(reporter, pm.getSafeSize() == SkToSizeT(w * h * sizeof(uint6 4_t)));
45 45
46 SkColor4f c4 { 0.5f, 1, 0.5f, 0.25f }; 46 SkColor4f c4 { 1, 0.5f, 0.25f, 0.5f };
47 pm.erase(c4); 47 pm.erase(c4);
48 48
49 SkPM4f origpm4 = c4.premul(); 49 SkPM4f origpm4 = c4.premul();
50 for (int y = 0; y < pm.height(); ++y) { 50 for (int y = 0; y < pm.height(); ++y) {
51 for (int x = 0; x < pm.width(); ++x) { 51 for (int x = 0; x < pm.width(); ++x) {
52 SkPM4f pm4 = SkPM4f::FromF16(pm.addrF16(x, y)); 52 SkPM4f pm4 = SkPM4f::FromF16(pm.addrF16(x, y));
53 REPORTER_ASSERT(reporter, eq_within_half_float(origpm4, pm4)); 53 REPORTER_ASSERT(reporter, eq_within_half_float(origpm4, pm4));
54 } 54 }
55 } 55 }
56 } 56 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 bool ok = (h1 == h2 || h1 == h2-1); 107 bool ok = (h1 == h2 || h1 == h2-1);
108 REPORTER_ASSERT(r, ok); 108 REPORTER_ASSERT(r, ok);
109 if (!ok) { 109 if (!ok) {
110 SkDebugf("%08x (%d) -> %04x (%d), want %04x (%d)\n", 110 SkDebugf("%08x (%d) -> %04x (%d), want %04x (%d)\n",
111 bits, bits>>23, h1, h1>>10, h2, h2>>10); 111 bits, bits>>23, h1, h1>>10, h2, h2>>10);
112 break; 112 break;
113 } 113 }
114 } 114 }
115 } 115 }
116 } 116 }
OLDNEW
« no previous file with comments | « src/core/SkPixmap.cpp ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698