@@ -488,7 +488,7 @@ Image::Image()
488
488
, _height(0 )
489
489
, _unpack(false )
490
490
, _fileType(Format::UNKNOWN)
491
- , _renderFormat (Texture2D::PixelFormat::NONE)
491
+ , _pixelFormat (Texture2D::PixelFormat::NONE)
492
492
, _numberOfMipmaps(0 )
493
493
, _hasPremultipliedAlpha(false )
494
494
{
@@ -755,17 +755,17 @@ Image::Format Image::detectFormat(const unsigned char * data, ssize_t dataLen)
755
755
756
756
int Image::getBitPerPixel ()
757
757
{
758
- return Texture2D::getPixelFormatInfoMap ().at (_renderFormat ).bpp ;
758
+ return Texture2D::getPixelFormatInfoMap ().at (_pixelFormat ).bpp ;
759
759
}
760
760
761
761
bool Image::hasAlpha ()
762
762
{
763
- return Texture2D::getPixelFormatInfoMap ().at (_renderFormat ).alpha ;
763
+ return Texture2D::getPixelFormatInfoMap ().at (_pixelFormat ).alpha ;
764
764
}
765
765
766
766
bool Image::isCompressed ()
767
767
{
768
- return Texture2D::getPixelFormatInfoMap ().at (_renderFormat ).compressed ;
768
+ return Texture2D::getPixelFormatInfoMap ().at (_pixelFormat ).compressed ;
769
769
}
770
770
771
771
namespace
@@ -875,11 +875,11 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
875
875
// we only support RGB or grayscale
876
876
if (cinfo.jpeg_color_space == JCS_GRAYSCALE)
877
877
{
878
- _renderFormat = Texture2D::PixelFormat::I8;
878
+ _pixelFormat = Texture2D::PixelFormat::I8;
879
879
}else
880
880
{
881
881
cinfo.out_color_space = JCS_RGB;
882
- _renderFormat = Texture2D::PixelFormat::RGB888;
882
+ _pixelFormat = Texture2D::PixelFormat::RGB888;
883
883
}
884
884
885
885
/* Start decompression jpeg here */
@@ -1003,16 +1003,16 @@ bool Image::initWithPngData(const unsigned char * data, ssize_t dataLen)
1003
1003
switch (color_type)
1004
1004
{
1005
1005
case PNG_COLOR_TYPE_GRAY:
1006
- _renderFormat = Texture2D::PixelFormat::I8;
1006
+ _pixelFormat = Texture2D::PixelFormat::I8;
1007
1007
break ;
1008
1008
case PNG_COLOR_TYPE_GRAY_ALPHA:
1009
- _renderFormat = Texture2D::PixelFormat::AI88;
1009
+ _pixelFormat = Texture2D::PixelFormat::AI88;
1010
1010
break ;
1011
1011
case PNG_COLOR_TYPE_RGB:
1012
- _renderFormat = Texture2D::PixelFormat::RGB888;
1012
+ _pixelFormat = Texture2D::PixelFormat::RGB888;
1013
1013
break ;
1014
1014
case PNG_COLOR_TYPE_RGB_ALPHA:
1015
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
1015
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
1016
1016
break ;
1017
1017
default :
1018
1018
break ;
@@ -1202,7 +1202,7 @@ bool Image::initWithTiffData(const unsigned char * data, ssize_t dataLen)
1202
1202
1203
1203
npixels = w * h;
1204
1204
1205
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
1205
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
1206
1206
_width = w;
1207
1207
_height = h;
1208
1208
@@ -1331,7 +1331,7 @@ bool Image::initWithPVRv2Data(const unsigned char * data, ssize_t dataLen)
1331
1331
return false ;
1332
1332
}
1333
1333
1334
- _renderFormat = it->first ;
1334
+ _pixelFormat = it->first ;
1335
1335
int bpp = it->second .bpp ;
1336
1336
1337
1337
// Reset num of mipmaps
@@ -1475,7 +1475,7 @@ bool Image::initWithPVRv3Data(const unsigned char * data, ssize_t dataLen)
1475
1475
return false ;
1476
1476
}
1477
1477
1478
- _renderFormat = it->first ;
1478
+ _pixelFormat = it->first ;
1479
1479
int bpp = it->second .bpp ;
1480
1480
1481
1481
// flags
@@ -1626,7 +1626,7 @@ bool Image::initWithETCData(const unsigned char * data, ssize_t dataLen)
1626
1626
{
1627
1627
// old opengl version has no define for GL_ETC1_RGB8_OES, add macro to make compiler happy.
1628
1628
#ifdef GL_ETC1_RGB8_OES
1629
- _renderFormat = Texture2D::PixelFormat::ETC;
1629
+ _pixelFormat = Texture2D::PixelFormat::ETC;
1630
1630
_dataLen = dataLen - ETC_PKM_HEADER_SIZE;
1631
1631
_data = static_cast <unsigned char *>(malloc (_dataLen * sizeof (unsigned char )));
1632
1632
memcpy (_data, static_cast <const unsigned char *>(data) + ETC_PKM_HEADER_SIZE, _dataLen);
@@ -1642,7 +1642,7 @@ bool Image::initWithETCData(const unsigned char * data, ssize_t dataLen)
1642
1642
// if it is not gles or device do not support ETC, decode texture by software
1643
1643
int bytePerPixel = 3 ;
1644
1644
unsigned int stride = _width * bytePerPixel;
1645
- _renderFormat = Texture2D::PixelFormat::RGB888;
1645
+ _pixelFormat = Texture2D::PixelFormat::RGB888;
1646
1646
1647
1647
_dataLen = _width * _height * bytePerPixel;
1648
1648
_data = static_cast <unsigned char *>(malloc (_dataLen * sizeof (unsigned char )));
@@ -1677,15 +1677,15 @@ bool Image::initWithTGAData(tImageTGA* tgaData)
1677
1677
// unsupported RGB555
1678
1678
if (tgaData->pixelDepth == 16 )
1679
1679
{
1680
- _renderFormat = Texture2D::PixelFormat::RGB5A1;
1680
+ _pixelFormat = Texture2D::PixelFormat::RGB5A1;
1681
1681
}
1682
1682
else if (tgaData->pixelDepth == 24 )
1683
1683
{
1684
- _renderFormat = Texture2D::PixelFormat::RGB888;
1684
+ _pixelFormat = Texture2D::PixelFormat::RGB888;
1685
1685
}
1686
1686
else if (tgaData->pixelDepth == 32 )
1687
1687
{
1688
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
1688
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
1689
1689
}
1690
1690
else
1691
1691
{
@@ -1698,7 +1698,7 @@ bool Image::initWithTGAData(tImageTGA* tgaData)
1698
1698
// gray
1699
1699
if (8 == tgaData->pixelDepth )
1700
1700
{
1701
- _renderFormat = Texture2D::PixelFormat::I8;
1701
+ _pixelFormat = Texture2D::PixelFormat::I8;
1702
1702
}
1703
1703
else
1704
1704
{
@@ -1796,18 +1796,18 @@ bool Image::initWithS3TCData(const unsigned char * data, ssize_t dataLen)
1796
1796
1797
1797
if (FOURCC_DXT1 == header->ddsd .DUMMYUNIONNAMEN4 .ddpfPixelFormat .fourCC )
1798
1798
{
1799
- _renderFormat = Texture2D::PixelFormat::S3TC_DXT1;
1799
+ _pixelFormat = Texture2D::PixelFormat::S3TC_DXT1;
1800
1800
}
1801
1801
else if (FOURCC_DXT3 == header->ddsd .DUMMYUNIONNAMEN4 .ddpfPixelFormat .fourCC )
1802
1802
{
1803
- _renderFormat = Texture2D::PixelFormat::S3TC_DXT3;
1803
+ _pixelFormat = Texture2D::PixelFormat::S3TC_DXT3;
1804
1804
}
1805
1805
else if (FOURCC_DXT5 == header->ddsd .DUMMYUNIONNAMEN4 .ddpfPixelFormat .fourCC )
1806
1806
{
1807
- _renderFormat = Texture2D::PixelFormat::S3TC_DXT5;
1807
+ _pixelFormat = Texture2D::PixelFormat::S3TC_DXT5;
1808
1808
}
1809
1809
} else { // will software decode
1810
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
1810
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
1811
1811
}
1812
1812
1813
1813
/* load the mipmaps */
@@ -1945,13 +1945,13 @@ bool Image::initWithATITCData(const unsigned char *data, ssize_t dataLen)
1945
1945
switch (header->glInternalFormat )
1946
1946
{
1947
1947
case CC_GL_ATC_RGB_AMD:
1948
- _renderFormat = Texture2D::PixelFormat::ATC_RGB;
1948
+ _pixelFormat = Texture2D::PixelFormat::ATC_RGB;
1949
1949
break ;
1950
1950
case CC_GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:
1951
- _renderFormat = Texture2D::PixelFormat::ATC_EXPLICIT_ALPHA;
1951
+ _pixelFormat = Texture2D::PixelFormat::ATC_EXPLICIT_ALPHA;
1952
1952
break ;
1953
1953
case CC_GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
1954
- _renderFormat = Texture2D::PixelFormat::ATC_INTERPOLATED_ALPHA;
1954
+ _pixelFormat = Texture2D::PixelFormat::ATC_INTERPOLATED_ALPHA;
1955
1955
break ;
1956
1956
default :
1957
1957
break ;
@@ -1968,7 +1968,7 @@ bool Image::initWithATITCData(const unsigned char *data, ssize_t dataLen)
1968
1968
1969
1969
int bytePerPixel = 4 ;
1970
1970
unsigned int stride = width * bytePerPixel;
1971
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
1971
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
1972
1972
1973
1973
std::vector<unsigned char > decodeImageData (stride * height);
1974
1974
switch (header->glInternalFormat )
@@ -2019,7 +2019,7 @@ bool Image::initWithWebpData(const unsigned char * data, ssize_t dataLen)
2019
2019
if (config.input .width == 0 || config.input .height == 0 ) break ;
2020
2020
2021
2021
config.output .colorspace = config.input .has_alpha ?MODE_rgbA:MODE_RGB;
2022
- _renderFormat = config.input .has_alpha ?Texture2D::PixelFormat::RGBA8888:Texture2D::PixelFormat::RGB888;
2022
+ _pixelFormat = config.input .has_alpha ?Texture2D::PixelFormat::RGBA8888:Texture2D::PixelFormat::RGB888;
2023
2023
_width = config.input .width ;
2024
2024
_height = config.input .height ;
2025
2025
@@ -2061,7 +2061,7 @@ bool Image::initWithRawData(const unsigned char * data, ssize_t /*dataLen*/, int
2061
2061
_height = height;
2062
2062
_width = width;
2063
2063
_hasPremultipliedAlpha = preMulti;
2064
- _renderFormat = Texture2D::PixelFormat::RGBA8888;
2064
+ _pixelFormat = Texture2D::PixelFormat::RGBA8888;
2065
2065
2066
2066
// only RGBA8888 supported
2067
2067
int bytesPerComponent = 4 ;
@@ -2081,7 +2081,7 @@ bool Image::initWithRawData(const unsigned char * data, ssize_t /*dataLen*/, int
2081
2081
bool Image::saveToFile (const std::string& filename, bool isToRGB)
2082
2082
{
2083
2083
// only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data
2084
- if (isCompressed () || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
2084
+ if (isCompressed () || (_pixelFormat != Texture2D::PixelFormat::RGB888 && _pixelFormat != Texture2D::PixelFormat::RGBA8888))
2085
2085
{
2086
2086
CCLOG (" cocos2d: Image: saveToFile is only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data for now" );
2087
2087
return false ;
@@ -2338,7 +2338,7 @@ void Image::premultipliedAlpha()
2338
2338
_hasPremultipliedAlpha = false ;
2339
2339
return ;
2340
2340
#else
2341
- CCASSERT (_renderFormat == Texture2D::PixelFormat::RGBA8888, " The pixel format should be RGBA8888!" );
2341
+ CCASSERT (_pixelFormat == Texture2D::PixelFormat::RGBA8888, " The pixel format should be RGBA8888!" );
2342
2342
2343
2343
unsigned int * fourBytes = (unsigned int *)_data;
2344
2344
for (int i = 0 ; i < _width * _height; i++)
0 commit comments