Bug 958906: Remove reliance on implicit conversion from enum types to integers to fix VS2013 build bustage, r=bjacob

--HG--
extra : rebase_source : 2e197e5f74cf20eae6f9b1801056d0438e527696
This commit is contained in:
Brian Smith 2014-01-11 22:26:20 -08:00
parent 367c980791
commit 6677116ee0
3 changed files with 11 additions and 10 deletions

View File

@ -1547,8 +1547,9 @@ DrawTargetD2D::MarkChanged()
ID3D10BlendState*
DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator)
{
if (mPrivateData->mBlendStates[aOperator]) {
return mPrivateData->mBlendStates[aOperator];
size_t operatorIndex = static_cast<size_t>(aOperator);
if (mPrivateData->mBlendStates[operatorIndex]) {
return mPrivateData->mBlendStates[operatorIndex];
}
D3D10_BLEND_DESC desc;
@ -1606,9 +1607,9 @@ DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator)
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
}
mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[aOperator]));
mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[operatorIndex]));
return mPrivateData->mBlendStates[aOperator];
return mPrivateData->mBlendStates[operatorIndex];
}
/* This function prepares the temporary RT for drawing and returns it when a

View File

@ -153,7 +153,7 @@ TemporaryRef<ID2D1Image> GetImageForSourceSurface(DrawTarget *aDT, SourceSurface
return image;
}
uint32_t ConvertValue(uint32_t aType, uint32_t aAttribute, uint32_t aValue)
uint32_t ConvertValue(FilterType aType, uint32_t aAttribute, uint32_t aValue)
{
switch (aType) {
case FilterType::COLOR_MATRIX:
@ -197,7 +197,7 @@ uint32_t ConvertValue(uint32_t aType, uint32_t aAttribute, uint32_t aValue)
return aValue;
}
void ConvertValue(uint32_t aType, uint32_t aAttribute, IntSize &aValue)
void ConvertValue(FilterType aType, uint32_t aAttribute, IntSize &aValue)
{
switch (aType) {
case FilterType::MORPHOLOGY:
@ -212,7 +212,7 @@ void ConvertValue(uint32_t aType, uint32_t aAttribute, IntSize &aValue)
}
UINT32
GetD2D1InputForInput(uint32_t aType, uint32_t aIndex)
GetD2D1InputForInput(FilterType aType, uint32_t aIndex)
{
return aIndex;
}
@ -222,7 +222,7 @@ GetD2D1InputForInput(uint32_t aType, uint32_t aIndex)
return D2D1_##d2dname
UINT32
GetD2D1PropForAttribute(uint32_t aType, uint32_t aIndex)
GetD2D1PropForAttribute(FilterType aType, uint32_t aIndex)
{
switch (aType) {
case FilterType::COLOR_MATRIX:
@ -437,7 +437,7 @@ GetD2D1PropForAttribute(uint32_t aType, uint32_t aIndex)
}
bool
GetD2D1PropsForIntSize(uint32_t aType, uint32_t aIndex, UINT32 *aPropWidth, UINT32 *aPropHeight)
GetD2D1PropsForIntSize(FilterType aType, uint32_t aIndex, UINT32 *aPropWidth, UINT32 *aPropHeight)
{
switch (aType) {
case FilterType::MORPHOLOGY:

View File

@ -87,7 +87,7 @@ _cairo_d2d_set_operator(cairo_d2d_device_t *device,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (device->mBlendStates[op]) {
if (device->mBlendStates[static_cast<size_t>(op)]) {
device->mD3D10Device->OMSetBlendState(device->mBlendStates[op], NULL, 0xffffffff);
return CAIRO_INT_STATUS_SUCCESS;
}