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

Unified Diff: src/core/SkXfermodeU64.cpp

Issue 1685133005: SkHalfToFloat_01 / SkFloatToHalf_01 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkHalf.h ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermodeU64.cpp
diff --git a/src/core/SkXfermodeU64.cpp b/src/core/SkXfermodeU64.cpp
index 6435e6a2e2b0aa170e8a6fb5502283a9e13f8fa1..6de5f1b09f871c4043aa70e001ba536c040ab98a 100644
--- a/src/core/SkXfermodeU64.cpp
+++ b/src/core/SkXfermodeU64.cpp
@@ -46,36 +46,15 @@ static uint64_t store_to_u16(const Sk4f& x4) {
return value;
}
-static Sk4f load_from_f16(uint64_t value) {
- const uint16_t* u16 = reinterpret_cast<const uint16_t*>(&value);
- float f4[4];
- for (int i = 0; i < 4; ++i) {
- f4[i] = SkHalfToFloat(u16[i]);
- }
- return Sk4f::Load(f4);
-}
-
-static uint64_t store_to_f16(const Sk4f& x4) {
- uint64_t value;
- uint16_t* u16 = reinterpret_cast<uint16_t*>(&value);
-
- float f4[4];
- x4.store(f4);
- for (int i = 0; i < 4; ++i) {
- u16[i] = SkFloatToHalf(f4[i]);
- }
- return value;
-}
-
// Returns dst in its "natural" bias (either unit-float or 16bit int)
//
template <DstType D> Sk4f load_from_dst(uint64_t dst) {
- return (D == kU16_Dst) ? load_from_u16(dst) : load_from_f16(dst);
+ return (D == kU16_Dst) ? load_from_u16(dst) : SkHalfToFloat_01(dst);
}
// Assumes x4 is already in the "natural" bias (either unit-float or 16bit int)
template <DstType D> uint64_t store_to_dst(const Sk4f& x4) {
- return (D == kU16_Dst) ? store_to_u16(x4) : store_to_f16(x4);
+ return (D == kU16_Dst) ? store_to_u16(x4) : SkFloatToHalf_01(x4);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkHalf.h ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698