Fixed // comments in c files (changed them to /* */ )
This commit is contained in:
27
intern/img/extern/IMG_Pixmap.h
vendored
27
intern/img/extern/IMG_Pixmap.h
vendored
@@ -49,15 +49,15 @@ class IMG_Pixmap
|
||||
{
|
||||
public:
|
||||
/** The type of pixels that are stored in this pixmap. */
|
||||
typedef enum {
|
||||
kPixelTypeUnknown = 0, /**< R:8, G:8, B:8, Ignore:8 */
|
||||
// kPixelTypeRGB32 = 1, /**< R:8, G:8, B:8, Ignore:8 */
|
||||
kPixelTypeRGBA32 = 2, /**< R:8, G:8, B:8, Alpha:8 */
|
||||
// kPixelTypeRGB16 = 3, /**< Ignore:1, R:5, G:5, B:5 */
|
||||
// kPixelTypeRGBA16 = 4, /**< Alpha:1, R:5, G:5, B:5 */
|
||||
// kPixelTypeRGB16_565 = 5, /**< R:5, G:6, B:5 */
|
||||
// kPixelTypeRGB24 = 6 /**< R:8, G:8, B:8 */
|
||||
} TPixelType;
|
||||
typedef enum {
|
||||
kPixelTypeUnknown = 0, /**< R:8, G:8, B:8, Ignore:8 */
|
||||
/* kPixelTypeRGB32 = 1, */ /*< R:8, G:8, B:8, Ignore:8 */
|
||||
kPixelTypeRGBA32 = 2, /**< R:8, G:8, B:8, Alpha:8 */
|
||||
/* kPixelTypeRGB16 = 3, */ /**< Ignore:1, R:5, G:5, B:5 */
|
||||
/* kPixelTypeRGBA16 = 4, */ /**< Alpha:1, R:5, G:5, B:5 */
|
||||
/* kPixelTypeRGB16_565 = 5, */ /**< R:5, G:6, B:5 */
|
||||
/* kPixelTypeRGB24 = 6 */ /**< R:8, G:8, B:8 */
|
||||
} TPixelType;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
* @param r requested bounds rectangle in the image
|
||||
* @param c color to use
|
||||
*/
|
||||
//virtual void fillRect(const GEN_Rect& r, const IMG_ColorRGBA& c) = 0;
|
||||
/*virtual void fillRect(const GEN_Rect& r, const IMG_ColorRGBA& c) = 0; */
|
||||
|
||||
protected:
|
||||
/** Width of the image in pixels */
|
||||
@@ -149,8 +149,9 @@ protected:
|
||||
GEN_TUns32 m_pixelSize;
|
||||
/** Type of pixels in this image. */
|
||||
TPixelType m_pixelType;
|
||||
// TEndian m_bitOrder;
|
||||
// TEndian m_byteOrder;
|
||||
/* TEndian m_bitOrder;
|
||||
TEndian m_byteOrder;
|
||||
*/
|
||||
};
|
||||
|
||||
inline GEN_TUns32 IMG_Pixmap::getWidth() const
|
||||
@@ -195,4 +196,4 @@ inline void IMG_Pixmap::getPixelAddress(float u, float v, GEN_TInt32& x, GEN_TIn
|
||||
y = (GEN_TInt32)(((float)m_height) * v);
|
||||
}
|
||||
|
||||
#endif // _H_IMG_Pixmap
|
||||
#endif /* _H_IMG_Pixmap */
|
||||
|
10
intern/img/extern/IMG_PixmapRGBA32.h
vendored
10
intern/img/extern/IMG_PixmapRGBA32.h
vendored
@@ -178,14 +178,14 @@ inline IMG_PixmapRGBA32::TPixelPtr IMG_PixmapRGBA32::getPixelPtr(GEN_TUns32 x, G
|
||||
inline IMG_PixmapRGBA32::TPixelRGBA32 IMG_PixmapRGBA32::getPixelValue(const IMG_ColorRGBA& c) const
|
||||
{
|
||||
#if 0
|
||||
// Obtain pixel value through shifting
|
||||
/* Obtain pixel value through shifting */
|
||||
TPixelRGBA32 p = ((TPixelRGBA32) (((float) 0xFF) * c.m_a)) << 24;
|
||||
p |= ((TPixelRGBA32) (((float) 0xFF) * c.m_b)) << 16;
|
||||
p |= ((TPixelRGBA32) (((float) 0xFF) * c.m_g)) << 8;
|
||||
p |= ((TPixelRGBA32) (((float) 0xFF) * c.m_r));
|
||||
return p;
|
||||
#else
|
||||
// Obtain pixel value through byte indexing
|
||||
/* Obtain pixel value through byte indexing */
|
||||
TPixelRGBA32 pixel;
|
||||
GEN_TUns8* bytes = (GEN_TUns8*)&pixel;
|
||||
bytes[bi_r] = (GEN_TUns8)(((float) 0xFF) * c.m_r);
|
||||
@@ -199,13 +199,13 @@ inline IMG_PixmapRGBA32::TPixelRGBA32 IMG_PixmapRGBA32::getPixelValue(const IMG_
|
||||
inline void IMG_PixmapRGBA32::getColor(TPixelRGBA32 p, IMG_ColorRGBA& c) const
|
||||
{
|
||||
#if 0
|
||||
// Obtain color value through shifting
|
||||
/* Obtain color value through shifting */
|
||||
c.m_a = ((float) ((p >> 24) & 0x00FF)) / ((float) 0xFF);
|
||||
c.m_b = ((float) ((p >> 16) & 0x00FF)) / ((float) 0xFF);
|
||||
c.m_g = ((float) ((p >> 8) & 0x00FF)) / ((float) 0xFF);
|
||||
c.m_r = ((float) ( p & 0x00FF)) / ((float) 0xFF);
|
||||
#else
|
||||
// Obtain color value through byte indexing
|
||||
/* Obtain color value through byte indexing */
|
||||
GEN_TUns8* bytes = (GEN_TUns8*)&p;
|
||||
c.m_r = ((float)bytes[bi_r]) / ((float) 0xFF);
|
||||
c.m_g = ((float)bytes[bi_g]) / ((float) 0xFF);
|
||||
@@ -214,4 +214,4 @@ inline void IMG_PixmapRGBA32::getColor(TPixelRGBA32 p, IMG_ColorRGBA& c) const
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _H_IMG_PixmapRGBA32
|
||||
#endif /* _H_IMG_PixmapRGBA32 */
|
||||
|
@@ -128,7 +128,7 @@ inline IMG_ColorRGB::IMG_ColorRGB(const IMG_ColorRGBA& c)
|
||||
|
||||
inline void IMG_ColorRGBA::blendColor(const IMG_ColorRGBA& c)
|
||||
{
|
||||
float r1 = 1 - c.m_a; // The reverse of alpha
|
||||
float r1 = 1 - c.m_a; /* The reverse of alpha */
|
||||
#if IMG_REVERSED_ALPHA
|
||||
m_r = c.m_a * m_r + r1 * c.m_r;
|
||||
m_g = c.m_a * m_g + r1 * c.m_g;
|
||||
@@ -141,4 +141,4 @@ inline void IMG_ColorRGBA::blendColor(const IMG_ColorRGBA& c)
|
||||
}
|
||||
|
||||
|
||||
#endif // _H_IMG_Color
|
||||
#endif /* _H_IMG_Color */
|
||||
|
@@ -114,4 +114,4 @@ public:
|
||||
operator T*() { return m_p; }
|
||||
};
|
||||
|
||||
#endif // _H_IMG_MemPtr
|
||||
#endif /* _H_IMG_MemPtr */
|
||||
|
@@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "../extern/IMG_PixmapRGBA32.h"
|
||||
#include "IMG_PixmapRGBA32.h"
|
||||
|
||||
IMG_PixmapRGBA32::IMG_PixmapRGBA32(GEN_TUns32 width, GEN_TUns32 height)
|
||||
: IMG_Pixmap(), m_pixels(width * height)
|
||||
@@ -67,14 +67,15 @@ IMG_PixmapRGBA32::IMG_PixmapRGBA32(void* image, GEN_TUns32 width, GEN_TUns32 hei
|
||||
|
||||
void IMG_PixmapRGBA32::fillRect(const GEN_Rect& r, const IMG_ColorRGB& c)
|
||||
{
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); // Bounds of this pixmap
|
||||
GEN_Rect r_bnds (r); // Area to set
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); /* Bounds of this pixmap */
|
||||
GEN_Rect r_bnds (r); /* Area to set */
|
||||
|
||||
// Determine visibility
|
||||
/* Determine visibility */
|
||||
GEN_TVisibility v = t_bnds.getVisibility(r_bnds);
|
||||
if (v == GEN_kNotVisible) return;
|
||||
if (v == GEN_kPartiallyVisible) {
|
||||
// Clip the destination rectangle to the bounds of this pixmap
|
||||
/* Clip the destination rectangle to the bounds of this pixmap
|
||||
*/
|
||||
t_bnds.clip(r_bnds);
|
||||
if (r_bnds.isEmpty()) {
|
||||
return;
|
||||
@@ -82,35 +83,35 @@ void IMG_PixmapRGBA32::fillRect(const GEN_Rect& r, const IMG_ColorRGB& c)
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Set new pixels using shifting
|
||||
// Prepare the pixel value to set
|
||||
/* Set new pixels using shifting */
|
||||
/* Prepare the pixel value to set */
|
||||
IMG_ColorRGBA ca (c);
|
||||
TPixelRGBA32 pv = getPixelValue(c);
|
||||
// Mask off the alpha bits
|
||||
pv &= 0x00FFFFFF; //0xFFFFFF00;
|
||||
/* Mask off the alpha bits */
|
||||
pv &= 0x00FFFFFF; /* 0xFFFFFF00; */
|
||||
|
||||
// Set the pixels in the destination rectangle
|
||||
/* Set the pixels in the destination rectangle */
|
||||
for (GEN_TInt32 y = r.m_t; y < r.m_b; y++) {
|
||||
// Park pixel pointer at the start pixels
|
||||
/* Park pixel pointer at the start pixels */
|
||||
TPixelPtr desPtr = getPixelPtr(r_bnds.m_l, y);
|
||||
for (GEN_TInt32 x = r.m_l; x < r.m_r; x++) {
|
||||
// Set the new pixel value (retain current alpha)
|
||||
*(desPtr++) = pv | ((*desPtr) & 0xFF000000); //0x000000FF);
|
||||
/* Set the new pixel value (retain current alpha) */
|
||||
*(desPtr++) = pv | ((*desPtr) & 0xFF000000); /*0x000000FF); */
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Set new values using byte indexing
|
||||
//IMG_ColorRGBA ca (c);
|
||||
/* Set new values using byte indexing */
|
||||
/*IMG_ColorRGBA ca (c); */
|
||||
TPixelRGBA32 src = getPixelValue(c);
|
||||
TPixelPtr desPtr;
|
||||
GEN_TUns8* srcBytes = (GEN_TUns8*) &src;
|
||||
|
||||
// Set the pixels in the destination rectangle
|
||||
/* Set the pixels in the destination rectangle */
|
||||
for (GEN_TInt32 y = r.m_t; y < r.m_b; y++) {
|
||||
// Park pixel pointer at the start pixels
|
||||
/* Park pixel pointer at the start pixels */
|
||||
desPtr = getPixelPtr(r_bnds.m_l, y);
|
||||
for (GEN_TInt32 x = r.m_l; x < r.m_r; x++) {
|
||||
// Set the new pixel value (retain current alpha)
|
||||
/* Set the new pixel value (retain current alpha) */
|
||||
((GEN_TUns8*)desPtr)[bi_r] = srcBytes[bi_r];
|
||||
((GEN_TUns8*)desPtr)[bi_g] = srcBytes[bi_g];
|
||||
((GEN_TUns8*)desPtr)[bi_b] = srcBytes[bi_b];
|
||||
@@ -123,24 +124,25 @@ void IMG_PixmapRGBA32::fillRect(const GEN_Rect& r, const IMG_ColorRGB& c)
|
||||
|
||||
void IMG_PixmapRGBA32::fillRect(const GEN_Rect& r, const IMG_ColorRGBA& c)
|
||||
{
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); // Bounds of this pixmap
|
||||
GEN_Rect r_bnds (r); // Area to set
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); /* Bounds of this pixmap */
|
||||
GEN_Rect r_bnds (r); /* Area to set */
|
||||
|
||||
// Determine visibility
|
||||
/* Determine visibility */
|
||||
GEN_TVisibility v = t_bnds.getVisibility(r_bnds);
|
||||
if (v == GEN_kNotVisible) return;
|
||||
if (v == GEN_kPartiallyVisible) {
|
||||
// Clip the destination rectangle to the bounds of this pixmap
|
||||
/* Clip the destination rectangle to the bounds of this pixmap
|
||||
*/
|
||||
t_bnds.clip(r_bnds);
|
||||
if (r_bnds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the pixels in the destination rectangle
|
||||
/* Set the pixels in the destination rectangle */
|
||||
TPixelRGBA32 pixel = getPixelValue(c);
|
||||
for (GEN_TInt32 y = r.m_t; y < r.m_b; y++) {
|
||||
// Park pixel pointer at the start pixels
|
||||
/* Park pixel pointer at the start pixels */
|
||||
TPixelPtr desPtr = getPixelPtr(r_bnds.m_l, y);
|
||||
for (GEN_TInt32 x = r.m_l; x < r.m_r; x++) {
|
||||
*(desPtr++) = pixel;
|
||||
@@ -151,21 +153,22 @@ void IMG_PixmapRGBA32::fillRect(const GEN_Rect& r, const IMG_ColorRGBA& c)
|
||||
|
||||
void IMG_PixmapRGBA32::setPixmap(const IMG_PixmapRGBA32& src, const GEN_Rect& srcBnds, const GEN_Rect& destBnds)
|
||||
{
|
||||
GEN_Rect i_bnds (srcBnds); // Bounds of input pixmap
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); // Bounds of this pixmap
|
||||
GEN_Rect p_bnds (destBnds); // Bounds of the paste area
|
||||
GEN_Rect i_bnds (srcBnds); /* Bounds of input pixmap */
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); /* Bounds of this pixmap */
|
||||
GEN_Rect p_bnds (destBnds); /* Bounds of the paste area */
|
||||
|
||||
// The next check could be removed if the caller is made responsible for handing us non-empty rectangles
|
||||
/* The next check could be removed if the caller is made
|
||||
responsible for handing us non-empty rectangles */
|
||||
if (i_bnds.isEmpty()) {
|
||||
// Nothing to do
|
||||
/* Nothing to do */
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine visibility of the paste area
|
||||
/* Determine visibility of the paste area */
|
||||
GEN_TVisibility v = t_bnds.getVisibility(p_bnds);
|
||||
if (v == GEN_kNotVisible) return;
|
||||
if (v == GEN_kPartiallyVisible) {
|
||||
// Clipping is needed
|
||||
/* Clipping is needed */
|
||||
if (p_bnds.m_l < 0) {
|
||||
i_bnds.m_l += -p_bnds.m_l;
|
||||
p_bnds.m_l = 0;
|
||||
@@ -186,12 +189,12 @@ void IMG_PixmapRGBA32::setPixmap(const IMG_PixmapRGBA32& src, const GEN_Rect& sr
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through the rows
|
||||
/* Iterate through the rows */
|
||||
for (GEN_TInt32 r = 0; r < p_bnds.getHeight(); r++) {
|
||||
// Park pixel pointers at the start pixels
|
||||
/* Park pixel pointers at the start pixels */
|
||||
TPixelPtr srcPtr = src.getPixelPtr(i_bnds.m_l, i_bnds.m_t + r);
|
||||
TPixelPtr desPtr = getPixelPtr(p_bnds.m_l, p_bnds.m_t + r);
|
||||
// Iterate through the columns
|
||||
/* Iterate through the columns */
|
||||
for (int c = 0; c < p_bnds.getWidth(); c++) {
|
||||
*(desPtr++) = *(srcPtr++);
|
||||
}
|
||||
@@ -201,21 +204,22 @@ void IMG_PixmapRGBA32::setPixmap(const IMG_PixmapRGBA32& src, const GEN_Rect& sr
|
||||
|
||||
void IMG_PixmapRGBA32::blendPixmap(const IMG_PixmapRGBA32& src, const GEN_Rect& srcBnds, const GEN_Rect& destBnds)
|
||||
{
|
||||
GEN_Rect i_bnds (srcBnds); // Bounds of input pixmap
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); // Bounds of this pixmap
|
||||
GEN_Rect p_bnds (destBnds); // Bounds of the paste area
|
||||
GEN_Rect i_bnds (srcBnds); /* Bounds of input pixmap */
|
||||
GEN_Rect t_bnds (0, 0, m_width, m_height); /* Bounds of this pixmap */
|
||||
GEN_Rect p_bnds (destBnds); /* Bounds of the paste area */
|
||||
|
||||
// The next check could be removed if the caller is made responsible for handing us non-empty rectangles
|
||||
/* The next check could be removed if the caller is made responsible
|
||||
for handing us non-empty rectangles */
|
||||
if (i_bnds.isEmpty()) {
|
||||
// Nothing to do
|
||||
/* Nothing to do */
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine visibility of the paste area
|
||||
/* Determine visibility of the paste area */
|
||||
GEN_TVisibility v = t_bnds.getVisibility(p_bnds);
|
||||
if (v == GEN_kNotVisible) return;
|
||||
if (v == GEN_kPartiallyVisible) {
|
||||
// Clipping is needed
|
||||
/* Clipping is needed */
|
||||
if (p_bnds.m_l < 0) {
|
||||
i_bnds.m_l += -p_bnds.m_l;
|
||||
p_bnds.m_l = 0;
|
||||
@@ -239,19 +243,19 @@ void IMG_PixmapRGBA32::blendPixmap(const IMG_PixmapRGBA32& src, const GEN_Rect&
|
||||
IMG_ColorRGBA srcColor;
|
||||
IMG_ColorRGBA desColor;
|
||||
|
||||
// Iterate through the rows
|
||||
/* Iterate through the rows */
|
||||
for (int r = 0; r < p_bnds.getHeight(); r++) {
|
||||
// Park pixel pointers at the start pixels
|
||||
/* Park pixel pointers at the start pixels */
|
||||
TPixelPtr srcPtr = src.getPixelPtr(i_bnds.m_l, i_bnds.m_t + r);
|
||||
TPixelPtr desPtr = getPixelPtr(p_bnds.m_l, p_bnds.m_t + r);
|
||||
// Iterate through the columns
|
||||
/* Iterate through the columns */
|
||||
for (int c = 0; c < p_bnds.getWidth(); c++) {
|
||||
// Retrieve colors from source and destination pixmaps
|
||||
/* Retrieve colors from source and destination pixmaps*/
|
||||
getColor(*srcPtr, srcColor);
|
||||
getColor(*desPtr, desColor);
|
||||
// Blend the colors
|
||||
/* Blend the colors */
|
||||
desColor.blendColor(srcColor);
|
||||
// Write color back to destination pixmap
|
||||
/* Write color back to destination pixmap */
|
||||
*desPtr = getPixelValue(desColor);
|
||||
srcPtr++;
|
||||
desPtr++;
|
||||
|
Reference in New Issue
Block a user