fixed #1270: Fixed some warning on win32.

This commit is contained in:
James Chen 2012-05-29 17:11:33 +08:00
parent 19c96632b5
commit ad50d6ee57
20 changed files with 66 additions and 61 deletions

View File

@ -226,7 +226,7 @@ void ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor
CC_INCREMENT_GL_DRAWS(1); CC_INCREMENT_GL_DRAWS(1);
} }
void ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter) void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
{ {
lazy_init(); lazy_init();
@ -265,7 +265,7 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, int segment
CC_INCREMENT_GL_DRAWS(1); CC_INCREMENT_GL_DRAWS(1);
} }
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments) void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments)
{ {
lazy_init(); lazy_init();
@ -294,7 +294,7 @@ void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoi
CC_INCREMENT_GL_DRAWS(1); CC_INCREMENT_GL_DRAWS(1);
} }
void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments) void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments)
{ {
lazy_init(); lazy_init();

View File

@ -73,17 +73,17 @@ void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, boo
void CC_DLL ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color ); void CC_DLL ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color );
/** draws a circle given the center, radius and number of segments. */ /** draws a circle given the center, radius and number of segments. */
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter); void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
/** draws a quad bezier path /** draws a quad bezier path
@since v0.8 @since v0.8
*/ */
void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments); void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments);
/** draws a cubic bezier path /** draws a cubic bezier path
@since v0.8 @since v0.8
*/ */
void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments); void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments);
/** set the drawing color with 4 unsigned bytes /** set the drawing color with 4 unsigned bytes
@since v2.0 @since v2.0

View File

@ -40,13 +40,13 @@ int CCBReader::intValFromDict(CCDictionary* dict, const std::string key)
float CCBReader::floatValFromDict(CCDictionary* dict, const std::string key) float CCBReader::floatValFromDict(CCDictionary* dict, const std::string key)
{ {
CCString* valueString = (CCString*) dict->objectForKey(key.c_str()); CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
return valueString? valueString->floatValue() : 0; return valueString? valueString->floatValue() : 0.0f;
} }
bool CCBReader::boolValFromDict(CCDictionary* dict, const std::string key) bool CCBReader::boolValFromDict(CCDictionary* dict, const std::string key)
{ {
CCString* valueString = (CCString*) dict->objectForKey(key.c_str()); CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
return valueString? ((bool)(valueString->intValue())) : false; return (valueString && valueString->intValue()) ? true : false;
} }
CCPoint CCBReader::pointValFromDict(CCDictionary* dict, const std::string key) CCPoint CCBReader::pointValFromDict(CCDictionary* dict, const std::string key)

View File

@ -94,8 +94,8 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
// Clamp the position of the icon within the circle // Clamp the position of the icon within the circle
// Get the center point of the bkgd image // Get the center point of the bkgd image
float centerX = m_startPos.x + m_background->boundingBox().size.width*.5; float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f;
float centerY = m_startPos.y + m_background->boundingBox().size.height*.5; float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f;
// Work out the distance difference between the location and center // Work out the distance difference between the location and center
float dx = sliderPosition.x - centerX; float dx = sliderPosition.x - centerX;
@ -106,7 +106,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
float angle = atan2f(dy, dx); float angle = atan2f(dy, dx);
// Set the limit to the slider movement within the colour picker // Set the limit to the slider movement within the colour picker
float limit = m_background->boundingBox().size.width*.5; float limit = m_background->boundingBox().size.width*0.5f;
// Check distance doesn't exceed the bounds of the circle // Check distance doesn't exceed the bounds of the circle
if (dist > limit) if (dist > limit)
@ -126,7 +126,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
else if (sliderPosition.y > m_startPos.y + boxPos + boxSize) sliderPosition.y = m_startPos.y + boxPos + boxSize; else if (sliderPosition.y > m_startPos.y + boxPos + boxSize) sliderPosition.y = m_startPos.y + boxPos + boxSize;
// Use the position / slider width to determin the percentage the dragger is at // Use the position / slider width to determin the percentage the dragger is at
m_saturation = 1.0 - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize); m_saturation = 1.0f - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize);
m_brightness = fabs((m_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize); m_brightness = fabs((m_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize);
} }
@ -135,8 +135,8 @@ bool CCControlSaturationBrightnessPicker::checkSliderPosition(CCPoint location)
// Clamp the position of the icon within the circle // Clamp the position of the icon within the circle
// get the center point of the bkgd image // get the center point of the bkgd image
float centerX = m_startPos.x + m_background->boundingBox().size.width*.5; float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f;
float centerY = m_startPos.y + m_background->boundingBox().size.height*.5; float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f;
// work out the distance difference between the location and center // work out the distance difference between the location and center
float dx = location.x - centerX; float dx = location.x - centerX;

View File

@ -206,7 +206,7 @@ void CCControlSwitchSprite::needsLayout()
m_pOffSprite->getContentSize().height / 2)); m_pOffSprite->getContentSize().height / 2));
} }
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight(m_pMaskTexture->getContentSize().width, m_pMaskTexture->getContentSize().height); CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight((int)m_pMaskTexture->getContentSize().width, (int)m_pMaskTexture->getContentSize().height);
rt->begin(); rt->begin();
m_pOnSprite->visit(); m_pOnSprite->visit();
@ -358,7 +358,7 @@ void CCControlSwitch::setIsEnabled(bool enabled)
{ {
m_bEnabled = enabled; m_bEnabled = enabled;
m_pSwitchSprite->setOpacity((enabled) ? 255.0f : 128.0f); m_pSwitchSprite->setOpacity((enabled) ? 255 : 128);
} }
CCPoint CCControlSwitch::locationFromTouch(CCTouch* pTouch) CCPoint CCControlSwitch::locationFromTouch(CCTouch* pTouch)

View File

@ -31,7 +31,7 @@ using namespace std;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
#define ND_LISTVIEW_ACTION_INTERVAL 0.6666 #define ND_LISTVIEW_ACTION_INTERVAL 0.6666f
/****************************************** /******************************************
**************Public Functions************* **************Public Functions*************
*******************************************/ *******************************************/
@ -1142,6 +1142,9 @@ unsigned int CCListView::triggerNumberOfCells(void)
{ {
unsigned int nRow = 0; unsigned int nRow = 0;
CCListViewProtrolData data; CCListViewProtrolData data;
data.nNumberOfRows = 0;
data.nRow = 0;
data.cell = NULL;
if (m_strDeletegate.size() > 0) if (m_strDeletegate.size() > 0)
{ {
@ -2151,7 +2154,7 @@ bool CCListView::isMenuTouch(CCTouch *touch, CCNode *parent)
CCArray *pChildrens = parent->getChildren(); CCArray *pChildrens = parent->getChildren();
if (pChildrens && pChildrens->count() > 0) if (pChildrens && pChildrens->count() > 0)
{ {
for (int i = 0; i < pChildrens->count(); i++) for (unsigned int i = 0; i < pChildrens->count(); i++)
{ {
CCNode *pChildren = (CCNode*)pChildrens->objectAtIndex(i); CCNode *pChildren = (CCNode*)pChildrens->objectAtIndex(i);
if (this->isMenuTouch(touch, pChildren)) if (this->isMenuTouch(touch, pChildren))

View File

@ -45,7 +45,7 @@ CCTextureWatcher::CCTextureWatcher()
// layer // layer
CCSize size = CCDirector::sharedDirector()->getWinSize(); CCSize size = CCDirector::sharedDirector()->getWinSize();
size.height *= 0.6; size.height *= 0.6f;
m_pLayer->setContentSize(size); m_pLayer->setContentSize(size);
// the menu of disabling touch event // the menu of disabling touch event
@ -256,12 +256,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
CCSize listItemSize = CCSize(m_pList->getContentSize().width / NUM_PER_PAGE, m_pList->getContentSize().height); CCSize listItemSize = CCSize(m_pList->getContentSize().width / NUM_PER_PAGE, m_pList->getContentSize().height);
CCSize size = CCSize(listItemSize.width * 0.9, listItemSize.height * 0.6); CCSize size = CCSize(listItemSize.width * 0.9f, listItemSize.height * 0.6f);
sprintf(m_pszString, "%d/%d", m_nCurrnetPage, m_nTotalPage); sprintf(m_pszString, "%d/%d", m_nCurrnetPage, m_nTotalPage);
m_labelPage->setString(m_pszString); m_labelPage->setString(m_pszString);
float offX = 0, offY = 0, offsetX = 0, offsetY = 0; float offX = 0.0f, offY = 0.0f, offsetX = 0.0f, offsetY = 0.0f;
CC_UNUSED_PARAM(offsetY); CC_UNUSED_PARAM(offsetY);
int nCount = 0; int nCount = 0;
int nStart = (m_nCurrnetPage - 1) * NUM_PER_PAGE; int nStart = (m_nCurrnetPage - 1) * NUM_PER_PAGE;
@ -288,8 +288,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
{ {
labelCount->setColor(ccc3(255, 0, 0)); labelCount->setColor(ccc3(255, 0, 0));
} }
offX = offsetX + listItemSize.width * 0.5 - labelCount->getContentSize().width * 0.5; offX = offsetX + listItemSize.width * 0.5f - labelCount->getContentSize().width * 0.5f;
offY = (listItemSize.height - size.height) * 0.5 - labelCount->getContentSize().height; offY = (listItemSize.height - size.height) * 0.5f - labelCount->getContentSize().height;
labelCount->setPosition(ccp(offX, offY)); labelCount->setPosition(ccp(offX, offY));
labelCount->setAnchorPoint(ccp(0, 0)); labelCount->setAnchorPoint(ccp(0, 0));
cell->addChild(labelCount); cell->addChild(labelCount);
@ -297,10 +297,10 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
// texture size // texture size
sprintf(m_pszString, "%.0f*%.0f", textrue->getContentSize().width, textrue->getContentSize().height); sprintf(m_pszString, "%.0f*%.0f", textrue->getContentSize().width, textrue->getContentSize().height);
CCLabelTTF *labelSize = CCLabelTTF::labelWithString(m_pszString, "Arial", 16); CCLabelTTF *labelSize = CCLabelTTF::labelWithString(m_pszString, "Arial", 16);
offX = offsetX + listItemSize.width * 0.5; offX = offsetX + listItemSize.width * 0.5f;
offY = (listItemSize.height - size.height) * 0.5 + size.height; offY = (listItemSize.height - size.height) * 0.5f + size.height;
labelSize->setPosition(ccp(offX, offY)); labelSize->setPosition(ccp(offX, offY));
labelSize->setAnchorPoint(ccp(0.5, 0)); labelSize->setAnchorPoint(ccp(0.5f, 0));
cell->addChild(labelSize); cell->addChild(labelSize);
// texture name // texture name
@ -313,12 +313,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
string name = key.substr(pos, len - pos); string name = key.substr(pos, len - pos);
sprintf(m_pszString, "%s", name.c_str()); sprintf(m_pszString, "%s", name.c_str());
CCSize dimensions = CCSizeMake(listItemSize.width * 0.9, labelSize->getContentSize().height); CCSize dimensions = CCSizeMake(listItemSize.width * 0.9f, labelSize->getContentSize().height);
CCLabelTTF *labelName = CCLabelTTF::labelWithString(m_pszString, dimensions, CCTextAlignmentCenter, "Arial", 16); CCLabelTTF *labelName = CCLabelTTF::labelWithString(m_pszString, dimensions, CCTextAlignmentCenter, "Arial", 16);
offX = offsetX + listItemSize.width * 0.5; offX = offsetX + listItemSize.width * 0.5f;
offY = offY + labelName->getContentSize().height; offY = offY + labelName->getContentSize().height;
labelName->setPosition(ccp(offX, offY)); labelName->setPosition(ccp(offX, offY));
labelName->setAnchorPoint(ccp(0.5, 0)); labelName->setAnchorPoint(ccp(0.5f, 0));
cell->addChild(labelName); cell->addChild(labelName);
CCSprite *sprite = CCSprite::spriteWithTexture(textrue); CCSprite *sprite = CCSprite::spriteWithTexture(textrue);
@ -341,8 +341,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
sprite->setScale(scale); sprite->setScale(scale);
spriteSize.width *= scale; spriteSize.width *= scale;
spriteSize.height *= scale; spriteSize.height *= scale;
offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5; offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5f;
offY = (listItemSize.height - spriteSize.height) * 0.5; offY = (listItemSize.height - spriteSize.height) * 0.5f;
sprite->setPosition(ccp(offX, offY)); sprite->setPosition(ccp(offX, offY));
cell->addChild(sprite); cell->addChild(sprite);
offsetX += listItemSize.width; offsetX += listItemSize.width;

View File

@ -92,7 +92,7 @@ kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmM
return NULL; return NULL;
} }
detInv = 1.0 / pDeterminate; detInv = 1.0f / pDeterminate;
kmMat3Adjugate(&adjugate, pM); kmMat3Adjugate(&adjugate, pM);
kmMat3ScalarMultiply(pOut, &adjugate, detInv); kmMat3ScalarMultiply(pOut, &adjugate, detInv);

View File

@ -864,7 +864,7 @@ void CCLabelBMFont::createFontChars()
} }
totalHeight = m_pConfiguration->m_uCommonHeight * quantityOfLines; totalHeight = m_pConfiguration->m_uCommonHeight * quantityOfLines;
nextFontPositionY = -(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines); nextFontPositionY = 0-(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines);
for (unsigned int i= 0; i < stringLen; i++) for (unsigned int i= 0; i < stringLen; i++)
{ {
@ -1086,7 +1086,7 @@ void CCLabelBMFont::updateLabel()
vector<unsigned short> last_word; vector<unsigned short> last_word;
last_word.reserve( stringLength ); last_word.reserve( stringLength );
int line = 1, i = 0; unsigned int line = 1, i = 0;
bool start_line = false, start_word = false; bool start_line = false, start_word = false;
float startOfLine = -1, startOfWord = -1; float startOfLine = -1, startOfWord = -1;
int skip = 0; int skip = 0;
@ -1101,7 +1101,7 @@ void CCLabelBMFont::updateLabel()
if (!characterSprite->getIsVisible()) continue; if (!characterSprite->getIsVisible()) continue;
if (i >= stringLength || i < 0) if (i >= stringLength)
break; break;
unsigned short character = str_whole[i]; unsigned short character = str_whole[i];
@ -1132,7 +1132,7 @@ void CCLabelBMFont::updateLabel()
i++; i++;
line++; line++;
if (i >= stringLength || i < 0) if (i >= stringLength)
break; break;
character = str_whole[i]; character = str_whole[i];
@ -1195,7 +1195,7 @@ void CCLabelBMFont::updateLabel()
startOfLine = -1; startOfLine = -1;
line++; line++;
if (i >= stringLength || i < 0) if (i >= stringLength)
break; break;
if (!startOfWord) if (!startOfWord)
@ -1229,7 +1229,9 @@ void CCLabelBMFont::updateLabel()
unsigned short* str_new = new unsigned short[size + 1]; unsigned short* str_new = new unsigned short[size + 1];
for (int i = 0; i < size; ++i) for (int i = 0; i < size; ++i)
{
str_new[i] = multiline_string[i]; str_new[i] = multiline_string[i];
}
str_new[size] = 0; str_new[size] = 0;

View File

@ -285,7 +285,7 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{ {
if (m_pScriptHandlerEntry) if (m_pScriptHandlerEntry)
{ {
return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch); return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch) == 0 ? false : true;
} }
CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent); CC_UNUSED_PARAM(pEvent);

View File

@ -62,7 +62,7 @@ void CCTransitionProgress::onEnter()
CCSize size = CCDirector::sharedDirector()->getWinSize(); CCSize size = CCDirector::sharedDirector()->getWinSize();
// create the second render texture for outScene // create the second render texture for outScene
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(size.width, size.height); CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
texture->setPosition(ccp(size.width/2, size.height/2)); texture->setPosition(ccp(size.width/2, size.height/2));
texture->setAnchorPoint(ccp(0.5f,0.5f)); texture->setAnchorPoint(ccp(0.5f,0.5f));

View File

@ -347,7 +347,7 @@ bool CCParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
if (m_pBatchNode) if (m_pBatchNode)
{ {
for (int i = 0; i < m_uTotalParticles; i++) for (unsigned int i = 0; i < m_uTotalParticles; i++)
{ {
m_pParticles[i].atlasIndex=i; m_pParticles[i].atlasIndex=i;
} }
@ -1203,7 +1203,7 @@ void CCParticleSystem::setBatchNode(CCParticleBatchNode* batchNode)
if( batchNode ) { if( batchNode ) {
//each particle needs a unique index //each particle needs a unique index
for (int i = 0; i < m_uTotalParticles; i++) for (unsigned int i = 0; i < m_uTotalParticles; i++)
{ {
m_pParticles[i].atlasIndex=i; m_pParticles[i].atlasIndex=i;
} }

View File

@ -416,7 +416,7 @@ void CCParticleSystemQuad::setTotalParticles(unsigned int tp)
// Init particles // Init particles
if (m_pBatchNode) if (m_pBatchNode)
{ {
for (int i = 0; i < m_uTotalParticles; i++) for (unsigned int i = 0; i < m_uTotalParticles; i++)
{ {
m_pParticles[i].atlasIndex=i; m_pParticles[i].atlasIndex=i;
} }

View File

@ -83,8 +83,8 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height)
// calculate the factor and the rect of viewport // calculate the factor and the rect of viewport
m_fScreenScaleFactor = MIN((float)m_sSizeInPixel.width / m_sSizeInPoint.width, m_fScreenScaleFactor = MIN((float)m_sSizeInPixel.width / m_sSizeInPoint.width,
(float)m_sSizeInPixel.height / m_sSizeInPoint.height); (float)m_sSizeInPixel.height / m_sSizeInPoint.height);
int viewPortW = (int)(m_sSizeInPoint.width * m_fScreenScaleFactor); float viewPortW = m_sSizeInPoint.width * m_fScreenScaleFactor;
int viewPortH = (int)(m_sSizeInPoint.height * m_fScreenScaleFactor); float viewPortH = m_sSizeInPoint.height * m_fScreenScaleFactor;
m_rcViewPort.setRect((m_sSizeInPixel.width - viewPortW) / 2, (m_sSizeInPixel.height - viewPortH) / 2, viewPortW, viewPortH); m_rcViewPort.setRect((m_sSizeInPixel.width - viewPortW) / 2, (m_sSizeInPixel.height - viewPortH) / 2, viewPortW, viewPortH);
@ -136,8 +136,8 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
if (m_bNeedScale) if (m_bNeedScale)
{ {
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR(); float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
glViewport((GLint)(x * factor) + m_rcViewPort.origin.x, glViewport((GLint)(x * factor + m_rcViewPort.origin.x),
(GLint)(y * factor) + m_rcViewPort.origin.y, (GLint)(y * factor + m_rcViewPort.origin.y),
(GLsizei)(w * factor), (GLsizei)(w * factor),
(GLsizei)(h * factor)); (GLsizei)(h * factor));
} }
@ -155,8 +155,8 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h
if (m_bNeedScale) if (m_bNeedScale)
{ {
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR(); float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
glScissor((GLint)(x * factor) + m_rcViewPort.origin.x, glScissor((GLint)(x * factor + m_rcViewPort.origin.x),
(GLint)(y * factor) + m_rcViewPort.origin.y, (GLint)(y * factor + m_rcViewPort.origin.y),
(GLsizei)(w * factor), (GLsizei)(w * factor),
(GLsizei)(h * factor)); (GLsizei)(h * factor));
} }

View File

@ -120,8 +120,8 @@ public:
*/ */
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true); bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);
CC_SYNTHESIZE_READONLY(short, m_nWidth, Width); CC_SYNTHESIZE_READONLY(unsigned short, m_nWidth, Width);
CC_SYNTHESIZE_READONLY(short, m_nHeight, Height); CC_SYNTHESIZE_READONLY(unsigned short, m_nHeight, Height);
CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent); CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent);
protected: protected:

View File

@ -354,7 +354,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
if (row_pointers) if (row_pointers)
{ {
const unsigned int stride = m_nWidth * channels; const unsigned int stride = m_nWidth * channels;
for (size_t i = 0; i < m_nHeight; ++i) for (unsigned short i = 0; i < m_nHeight; ++i)
{ {
png_uint_32 q = i * stride; png_uint_32 q = i * stride;
row_pointers[i] = (png_bytep)m_pData + q; row_pointers[i] = (png_bytep)m_pData + q;
@ -364,9 +364,9 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
if (m_bHasAlpha) if (m_bHasAlpha)
{ {
unsigned int *tmp = (unsigned int *)m_pData; unsigned int *tmp = (unsigned int *)m_pData;
for(unsigned int i = 0; i < m_nHeight; i++) for(unsigned short i = 0; i < m_nHeight; i++)
{ {
for(int j = 0; j < m_nWidth * channels; j += 4) for(unsigned int j = 0; j < m_nWidth * channels; j += 4)
{ {
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1], *tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1],
row_pointers[i][j + 2], row_pointers[i][j + 3] ); row_pointers[i][j + 2], row_pointers[i][j + 3] );
@ -515,9 +515,9 @@ bool CCImage::_initWithTiffData(void* pData, int nDataLen)
CC_BREAK_IF(NULL == tif); CC_BREAK_IF(NULL == tif);
uint32 w, h; uint32 w = 0, h = 0;
uint16 bitsPerSample, samplePerPixel, planarConfig, extraSample; uint16 bitsPerSample = 0, samplePerPixel = 0, planarConfig = 0;
size_t npixels; size_t npixels = 0;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);

View File

@ -461,7 +461,7 @@ void CCEGLView::resize(int width, int height)
void CCEGLView::setFrameSize(float width, float height) void CCEGLView::setFrameSize(float width, float height)
{ {
Create((LPCTSTR)m_szViewName, width, height); Create((LPCTSTR)m_szViewName, (int)width, (int)height);
CCEGLViewProtocol::setFrameSize(width, height); CCEGLViewProtocol::setFrameSize(width, height);
} }

View File

@ -163,10 +163,10 @@ void ccGLEnable( ccGLServerState flags )
{ {
#if CC_ENABLE_GL_STATE_CACHE #if CC_ENABLE_GL_STATE_CACHE
bool enabled = false; int enabled = 0;
/* GL_BLEND */ /* GL_BLEND */
if( (enabled=(flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) { if( (enabled = (flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) {
if( enabled ) { if( enabled ) {
glEnable( GL_BLEND ); glEnable( GL_BLEND );
s_eGLServerState |= CC_GL_BLEND; s_eGLServerState |= CC_GL_BLEND;

View File

@ -563,7 +563,7 @@ void CCTextureAtlas::fillWithEmptyQuadsFromIndex(unsigned int index, unsigned in
memset(&quad, 0, sizeof(quad)); memset(&quad, 0, sizeof(quad));
unsigned int to = index + amount; unsigned int to = index + amount;
for (int i = index ; i < to ; i++) for (unsigned int i = index ; i < to ; i++)
{ {
m_pQuads[i] = quad; m_pQuads[i] = quad;
} }

View File

@ -244,7 +244,7 @@ bool CCTexturePVR::unpackPVRData(unsigned char* data, unsigned int len)
It means that image is compressed as flipped. We don't It means that image is compressed as flipped. We don't
support automatic flipping. support automatic flipping.
*/ */
bool flipped = (bool)(flags & kPVRTextureFlagVerticalFlip); bool flipped = (flags & kPVRTextureFlagVerticalFlip) ? true : false;
if ( flipped ) if ( flipped )
{ {
CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool"); CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool");