Fixed C4244 warnings.

This commit is contained in:
bkaradzic 2014-01-20 22:07:08 -08:00
parent 3e4ec1dc24
commit b25a7cc9ff
3 changed files with 18 additions and 29 deletions

View file

@ -89,18 +89,6 @@ public:
/// Same as packUV but pack a whole face of the atlas cube, mostly used for debugging and visualizing atlas /// Same as packUV but pack a whole face of the atlas cube, mostly used for debugging and visualizing atlas
void packFaceLayerUV(uint32_t _idx, uint8_t* _vertexBuffer, uint32_t _offset, uint32_t _stride) const; void packFaceLayerUV(uint32_t _idx, uint8_t* _vertexBuffer, uint32_t _offset, uint32_t _stride) const;
/// Pack the vertex index of the region as 2 quad into an index buffer
static void packIndex(uint16_t* _indexBuffer, uint32_t _startIndex, uint32_t _startVertex)
{
uint16_t* indices = &_indexBuffer[_startIndex];
*indices++ = _startVertex + 0;
*indices++ = _startVertex + 1;
*indices++ = _startVertex + 2;
*indices++ = _startVertex + 0;
*indices++ = _startVertex + 2;
*indices++ = _startVertex + 3;
}
/// return the TextureHandle (cube) of the atlas /// return the TextureHandle (cube) of the atlas
bgfx::TextureHandle getTextureHandle() const bgfx::TextureHandle getTextureHandle() const
{ {

View file

@ -184,9 +184,9 @@ private:
uint16_t* m_indexBuffer; uint16_t* m_indexBuffer;
uint8_t* m_styleBuffer; uint8_t* m_styleBuffer;
uint32_t m_vertexCount;
uint32_t m_indexCount; uint32_t m_indexCount;
uint32_t m_lineStartIndex; uint32_t m_lineStartIndex;
uint16_t m_vertexCount;
}; };
TextBuffer::TextBuffer(FontManager* _fontManager) TextBuffer::TextBuffer(FontManager* _fontManager)
@ -384,17 +384,18 @@ void TextBuffer::appendGlyph(FontHandle _handle, CodePoint _codePoint)
, sizeof(TextVertex) , sizeof(TextVertex)
); );
setVertex(m_vertexCount + 0, x0, y0, m_backgroundColor, STYLE_BACKGROUND); const uint16_t vertexCount = m_vertexCount;
setVertex(m_vertexCount + 1, x0, y1, m_backgroundColor, STYLE_BACKGROUND); setVertex(vertexCount + 0, x0, y0, m_backgroundColor, STYLE_BACKGROUND);
setVertex(m_vertexCount + 2, x1, y1, m_backgroundColor, STYLE_BACKGROUND); setVertex(vertexCount + 1, x0, y1, m_backgroundColor, STYLE_BACKGROUND);
setVertex(m_vertexCount + 3, x1, y0, m_backgroundColor, STYLE_BACKGROUND); setVertex(vertexCount + 2, x1, y1, m_backgroundColor, STYLE_BACKGROUND);
setVertex(vertexCount + 3, x1, y0, m_backgroundColor, STYLE_BACKGROUND);
m_indexBuffer[m_indexCount + 0] = m_vertexCount + 0; m_indexBuffer[m_indexCount + 0] = vertexCount + 0;
m_indexBuffer[m_indexCount + 1] = m_vertexCount + 1; m_indexBuffer[m_indexCount + 1] = vertexCount + 1;
m_indexBuffer[m_indexCount + 2] = m_vertexCount + 2; m_indexBuffer[m_indexCount + 2] = vertexCount + 2;
m_indexBuffer[m_indexCount + 3] = m_vertexCount + 0; m_indexBuffer[m_indexCount + 3] = vertexCount + 0;
m_indexBuffer[m_indexCount + 4] = m_vertexCount + 2; m_indexBuffer[m_indexCount + 4] = vertexCount + 2;
m_indexBuffer[m_indexCount + 5] = m_vertexCount + 3; m_indexBuffer[m_indexCount + 5] = vertexCount + 3;
m_vertexCount += 4; m_vertexCount += 4;
m_indexCount += 6; m_indexCount += 6;
} }

View file

@ -511,7 +511,7 @@ namespace bgfx
continue; continue;
} }
_output[ii] = ii; _output[ii] = (uint16_t)ii;
++numVertices; ++numVertices;
float pos[4]; float pos[4];
@ -529,12 +529,12 @@ namespace bgfx
if (sqLength(test, pos) < epsilonSq) if (sqLength(test, pos) < epsilonSq)
{ {
_output[jj] = ii; _output[jj] = (uint16_t)ii;
} }
} }
} }
return numVertices; return (uint16_t)numVertices;
} }
uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon) uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon)
@ -572,13 +572,13 @@ namespace bgfx
if (UINT16_MAX == offset) if (UINT16_MAX == offset)
{ {
_output[ii] = ii; _output[ii] = (uint16_t)ii;
next[ii] = hashTable[hashValue]; next[ii] = hashTable[hashValue];
hashTable[hashValue] = ii; hashTable[hashValue] = (uint16_t)ii;
numVertices++; numVertices++;
} }
} }
return numVertices; return (uint16_t)numVertices;
} }
} // namespace bgfx } // namespace bgfx