Bug 958906: Remove reliance on implicit conversion from enum types to integers to fix VS2013 build bustage, r=bjacob
authorBrian Smith <brian@briansmith.org>
Sat, 11 Jan 2014 22:26:20 -0800
changeset 163043 9380208b53cfeeac30e0e2f4544816248a3ce256
parent 163042 38807790e001de6aabeb2888b624fd28d836b4bd
child 163044 bcc2c29c1e16ef9d75adb626ae60ec17599e155f
push id25979
push usercbook@mozilla.com
push dateMon, 13 Jan 2014 11:46:02 +0000
treeherdermozilla-central@ea6657f1d682 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs958906
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 958906: Remove reliance on implicit conversion from enum types to integers to fix VS2013 build bustage, r=bjacob
gfx/2d/DrawTargetD2D.cpp
gfx/2d/FilterNodeD2D1.cpp
gfx/cairo/cairo/src/cairo-d2d-surface.cpp
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -1542,18 +1542,19 @@ DrawTargetD2D::MarkChanged()
     // The Flush() should have broken all dependencies on this target.
     MOZ_ASSERT(!mDependentTargets.size());
   }
 }
 
 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;
 
   memset(&desc, 0, sizeof(D3D10_BLEND_DESC));
 
   desc.AlphaToCoverageEnable = FALSE;
   desc.BlendEnable[0] = TRUE;
@@ -1601,19 +1602,19 @@ DrawTargetD2D::GetBlendStateForOperator(
     desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE;
     desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO;
     break;
   default:
     desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE;
     desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
   }
   
-  mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[aOperator]));
-
-  return mPrivateData->mBlendStates[aOperator];
+  mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[operatorIndex]));
+
+  return mPrivateData->mBlendStates[operatorIndex];
 }
 
 /* This function prepares the temporary RT for drawing and returns it when a
  * drawing operation other than OVER is required.
  */
 ID2D1RenderTarget*
 DrawTargetD2D::GetRTForOperation(CompositionOp aOperator, const Pattern &aPattern)
 {
--- a/gfx/2d/FilterNodeD2D1.cpp
+++ b/gfx/2d/FilterNodeD2D1.cpp
@@ -148,17 +148,17 @@ TemporaryRef<ID2D1Image> GetImageForSour
   default:
     gfxWarning() << "Unknown input SourceSurface set on effect.";
     MOZ_ASSERT(0);
   }
 
   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:
     if (aAttribute == ATT_COLOR_MATRIX_ALPHA_MODE) {
       aValue = D2DAlphaMode(aValue);
     }
     break;
   case FilterType::TRANSFORM:
@@ -192,42 +192,42 @@ uint32_t ConvertValue(uint32_t aType, ui
       aValue = D2DFilterCompositionMode(aValue);
     }
     break;
   }
 
   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:
     if (aAttribute == ATT_MORPHOLOGY_RADII) {
       aValue.width *= 2;
       aValue.width += 1;
       aValue.height *= 2;
       aValue.height += 1;
     }
     break;
   }
 }
 
 UINT32
-GetD2D1InputForInput(uint32_t aType, uint32_t aIndex)
+GetD2D1InputForInput(FilterType aType, uint32_t aIndex)
 {
   return aIndex;
 }
 
 #define CONVERT_PROP(moz2dname, d2dname) \
   case ATT_##moz2dname: \
   return D2D1_##d2dname
 
 UINT32
-GetD2D1PropForAttribute(uint32_t aType, uint32_t aIndex)
+GetD2D1PropForAttribute(FilterType aType, uint32_t aIndex)
 {
   switch (aType) {
   case FilterType::COLOR_MATRIX:
     switch (aIndex) {
       CONVERT_PROP(COLOR_MATRIX_MATRIX, COLORMATRIX_PROP_COLOR_MATRIX);
       CONVERT_PROP(COLOR_MATRIX_ALPHA_MODE, COLORMATRIX_PROP_ALPHA_MODE);
     }
     break;
@@ -432,17 +432,17 @@ GetD2D1PropForAttribute(uint32_t aType, 
     }
     break;
   }
 
   return UINT32_MAX;
 }
 
 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:
     if (aIndex == ATT_MORPHOLOGY_RADII) {
       *aPropWidth = D2D1_MORPHOLOGY_PROP_WIDTH;
       *aPropHeight = D2D1_MORPHOLOGY_PROP_HEIGHT;
       return true;
     }
--- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
+++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
@@ -82,17 +82,17 @@ static cairo_int_status_t
 			cairo_operator_t op)
 {
     assert(op < MAX_OPERATORS);
     if (op >= MAX_OPERATORS) {
 	// Eep! Someone forgot to update MAX_OPERATORS probably.
 	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;
     }
 
     D3D10_BLEND_DESC desc;
     memset(&desc, 0, sizeof(desc));
     desc.BlendEnable[0] = TRUE;
     desc.AlphaToCoverageEnable = FALSE;