osd: fix conversion warnings in glDrawContext

warning C4242: 'argument' : conversion from 'int' to 'unsigned char', possible loss of data
This commit is contained in:
Andrew Wong 2013-02-09 23:33:26 -05:00
parent e04c95988c
commit d4c62d4aef

View File

@ -235,14 +235,14 @@ OsdGLDrawContext::allocate(FarMesh<OsdVertex> *farMesh,
patchTables->GetFullGregoryPatches().GetSize()/patchTables->GetGregoryPatchRingsize() +
patchTables->GetFullBoundaryGregoryPatches().GetSize()/patchTables->GetGregoryPatchRingsize();
for (int p=0; p<5; ++p) {
for (unsigned char p=0; p<5; ++p) {
totalPatchIndices +=
patchTables->GetTransitionRegularPatches(p).GetSize();
totalPatchLevels +=
patchTables->GetTransitionRegularPatches(p).GetSize()/patchTables->GetRegularPatchRingsize();
for (int r=0; r<4; ++r) {
for (unsigned char r=0; r<4; ++r) {
totalPatchIndices +=
patchTables->GetTransitionBoundaryPatches(p, r).GetSize() +
patchTables->GetTransitionCornerPatches(p, r).GetSize();
@ -323,7 +323,8 @@ OsdGLDrawContext::allocate(FarMesh<OsdVertex> *farMesh,
patchTables->GetFullGregoryFVarData(),
farMesh->GetTotalFVarWidth(),
OsdPatchDescriptor(kGregory, 0, 0,
maxValence, numElements), 0);
static_cast<unsigned char>(maxValence), static_cast<unsigned char>(numElements)),
0);
_AppendPatchArray(&indexBase, &levelBase,
patchTables->GetFullBoundaryGregoryPatches(),
patchTables->GetGregoryPatchRingsize(),
@ -331,10 +332,10 @@ OsdGLDrawContext::allocate(FarMesh<OsdVertex> *farMesh,
patchTables->GetFullBoundaryGregoryFVarData(),
farMesh->GetTotalFVarWidth(),
OsdPatchDescriptor(kBoundaryGregory, 0, 0,
maxValence, numElements),
static_cast<unsigned char>(maxValence), static_cast<unsigned char>(numElements)),
(int)patchTables->GetFullGregoryPatches().GetSize());
for (int p=0; p<5; ++p) {
for (unsigned char p=0; p<5; ++p) {
_AppendPatchArray(&indexBase, &levelBase,
patchTables->GetTransitionRegularPatches(p),
patchTables->GetRegularPatchRingsize(),
@ -342,7 +343,7 @@ OsdGLDrawContext::allocate(FarMesh<OsdVertex> *farMesh,
patchTables->GetTransitionRegularFVarData(p),
farMesh->GetTotalFVarWidth(),
OsdPatchDescriptor(kTransitionRegular, p, 0, 0, 0), 0);
for (int r=0; r<4; ++r) {
for (unsigned char r=0; r<4; ++r) {
_AppendPatchArray(&indexBase, &levelBase,
patchTables->GetTransitionBoundaryPatches(p, r),
patchTables->GetBoundaryPatchRingsize(),
@ -482,7 +483,7 @@ OsdGLDrawContext::_AppendPatchArray(
for (int i = 0; i < (int) ptable.GetMarkers().size()-1; ++i) {
int numPrims = ptable.GetNumElements(i)/array.patchSize;
for (int j = 0; j < numPrims; ++j) {
levels.push_back(i);
levels.push_back(static_cast<unsigned char>(i));
}
}