Bug 1470973 - Fix cairo-d2d-surface.cpp mingw clang compilation r?jrmuizel
MozReview-Commit-ID: Jt7MvFZTMYY
--- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
+++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
@@ -1406,17 +1406,16 @@ static RefPtr<ID2D1Brush>
D2D_POINT_2F origin =
_d2d_point_from_cairo_point(&source_pattern->c1);
origin.x -= center.x;
origin.y -= center.y;
float outer_radius = _cairo_fixed_to_float(source_pattern->r2);
float inner_radius = _cairo_fixed_to_float(source_pattern->r1);
int num_stops = source_pattern->base.n_stops;
- int repeat_count = 1;
D2D1_GRADIENT_STOP *stops;
if (source_pattern->base.base.extend == CAIRO_EXTEND_REPEAT || source_pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
bool reflected = false;
bool reflect = source_pattern->base.base.extend == CAIRO_EXTEND_REFLECT;
RefPtr<IDXGISurface> surf;
d2dsurf->surface->QueryInterface(&surf);
@@ -1456,17 +1455,16 @@ static RefPtr<ID2D1Brush>
stops = new D2D1_GRADIENT_STOP[num_stops];
// Change outer_radius to the true outer radius after taking into account the needed
// repeats.
outer_radius = (inner_repeat + outer_repeat) * gradient_length;
float stop_scale = 1.0f / (inner_repeat + outer_repeat);
- float inner_position = (inner_repeat * gradient_length) / outer_radius;
if (reflect) {
// We start out reflected (meaning reflected starts as false since it will
// immediately be inverted) if the inner_repeats are uneven.
reflected = !(inner_repeat & 0x1);
for (int i = 0; i < num_stops; i++) {
if (!(i % source_pattern->base.n_stops)) {
// Reflect here
@@ -1653,17 +1651,16 @@ static RefPtr<ID2D1Brush>
num_stops *= (after_repeat + before_repeat);
p2.x = p1.x + u.x * after_repeat * gradient_length;
p2.y = p1.y + u.y * after_repeat * gradient_length;
p1.x = p1.x - u.x * before_repeat * gradient_length;
p1.y = p1.y - u.y * before_repeat * gradient_length;
float stop_scale = 1.0f / (float)(after_repeat + before_repeat);
- float begin_position = (float)before_repeat / (float)(after_repeat + before_repeat);
stops = new D2D1_GRADIENT_STOP[num_stops];
if (source_pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
// We start out reflected (meaning reflected starts as false since it will
// immediately be inverted) if the inner_repeats are uneven.
bool reflected = !(before_repeat & 0x1);
for (int i = 0; i < num_stops; i++) {
@@ -2651,17 +2648,16 @@ static cairo_status_t
static void
_cairo_d2d_release_source_image(void *abstract_surface,
cairo_image_surface_t *image,
void *image_extra)
{
if (((cairo_surface_t*)abstract_surface)->type != CAIRO_SURFACE_TYPE_D2D) {
return;
}
- cairo_d2d_surface_t *d2dsurf = static_cast<cairo_d2d_surface_t*>(abstract_surface);
cairo_surface_destroy(&image->base);
ID3D10Texture2D *softTexture = (ID3D10Texture2D*)image_extra;
softTexture->Unmap(0);
softTexture->Release();
softTexture = NULL;
}
@@ -2800,17 +2796,19 @@ static cairo_int_status_t
D3D10_BOX rect;
cairo_rectangle_int_t area_to_copy;
cairo_region_get_rectangle(region, i, &area_to_copy);
cairo_rectangle_int_t transformed_rect = { area_to_copy.x + translation->x,
area_to_copy.y + translation->y,
area_to_copy.width, area_to_copy.height };
- cairo_rectangle_int_t surface_rect = { 0, 0, srcDesc.Width, srcDesc.Height };
+ cairo_rectangle_int_t surface_rect = { 0, 0,
+ static_cast<int>(srcDesc.Width),
+ static_cast<int>(srcDesc.Height) };
if (!_cairo_rectangle_contains(&surface_rect, &transformed_rect)) {
/* We cannot do any sort of extend, in the future a little bit of extra code could
* allow us to support EXTEND_NONE.
*/
rv = CAIRO_INT_STATUS_UNSUPPORTED;
break;
@@ -3015,18 +3013,18 @@ static cairo_int_status_t
return CAIRO_INT_STATUS_SUCCESS;
}
} else {
region = cairo_region_create_rectangle(&rect);
region_ptr.set(region);
// Areas outside of the surface do not matter.
cairo_rectangle_int_t surface_rect = { 0, 0,
- dst->rt->GetPixelSize().width,
- dst->rt->GetPixelSize().height };
+ static_cast<int>(dst->rt->GetPixelSize().width),
+ static_cast<int>(dst->rt->GetPixelSize().height) };
cairo_region_intersect_rectangle(region, &surface_rect);
}
cairo_int_status_t rv = _cairo_d2d_copy_surface(dst, d2dsrc, &translation, region);
return rv;
}