Переглянути джерело

Add double-precision versions of encode_sRGB_uchar

rdb 8 роки тому
батько
коміт
096d54de00
2 змінених файлів з 19 додано та 0 видалено
  1. 14 0
      panda/src/pnmimage/convert_srgb.I
  2. 5 0
      panda/src/pnmimage/convert_srgb.h

+ 14 - 0
panda/src/pnmimage/convert_srgb.I

@@ -153,3 +153,17 @@ encode_sRGB_uchar(const LColorf &color, xel &into, xelval &into_alpha) {
   into_alpha = (xelval) (color[3] * 255.f + 0.5f);
 #endif
 }
+
+
+/**
+ * Double-precision versions of the above.
+ */
+INLINE void
+encode_sRGB_uchar(const LColord &color, xel &into) {
+  return encode_sRGB_uchar(LCAST(float, color), into);
+}
+
+INLINE void
+encode_sRGB_uchar(const LColord &color, xel &into, xelval &into_alpha) {
+  return encode_sRGB_uchar(LCAST(float, color), into, into_alpha);
+}

+ 5 - 0
panda/src/pnmimage/convert_srgb.h

@@ -46,6 +46,11 @@ EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColorf &from,
 EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColorf &from,
                                                    xel &into, xelval &into_alpha);
 
+EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColord &from,
+                                                   xel &into);
+EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColord &from,
+                                                   xel &into, xelval &into_alpha);
+
 // Use these functions if you know that SSE2 support is available.  Otherwise,
 // they will crash!
 #if defined(__SSE2__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)