summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-06-26 09:27:34 -0600
committerBrian Paul <brianp@vmware.com>2013-06-26 10:42:59 -0600
commit21f8729c3da4443b2db00da20f5afd880362701e (patch)
tree166d4f4798cfbca2d2dc7457da159ddb70ee9421
parent4d452f1988931e7101146d1cf2807c2a02437dbb (diff)
vega: add some casts to silence MSVC warnings
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c8
-rw-r--r--src/gallium/state_trackers/vega/matrix.h14
2 files changed, 11 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index f5856db4405..480ced16c51 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -273,7 +273,7 @@ void vegaColorMatrix(VGImage dst, VGImage src,
static VGfloat texture_offset(VGfloat width, VGint kernelSize, VGint current, VGint shift)
{
- VGfloat diff = current - shift;
+ VGfloat diff = (VGfloat) (current - shift);
return diff / width;
}
@@ -336,7 +336,7 @@ void vegaConvolve(VGImage dst, VGImage src,
buffer[2] = 2.f; /*unused*/
buffer[3] = 4.f; /*unused*/
- buffer[4] = kernelWidth * kernelHeight;
+ buffer[4] = (VGfloat) (kernelWidth * kernelHeight);
buffer[5] = scale;
buffer[6] = bias;
buffer[7] = 0.f;
@@ -347,8 +347,8 @@ void vegaConvolve(VGImage dst, VGImage src,
VGint index = j * kernelWidth + i;
VGfloat x, y;
- x = texture_offset(s->width, kernelWidth, i, shiftX);
- y = texture_offset(s->height, kernelHeight, j, shiftY);
+ x = (VGfloat) texture_offset(s->width, kernelWidth, i, shiftX);
+ y = (VGfloat) texture_offset(s->height, kernelHeight, j, shiftY);
buffer[idx + index*4 + 0] = x;
buffer[idx + index*4 + 1] = y;
diff --git a/src/gallium/state_trackers/vega/matrix.h b/src/gallium/state_trackers/vega/matrix.h
index bed2b3193d0..794c7e7a4ce 100644
--- a/src/gallium/state_trackers/vega/matrix.h
+++ b/src/gallium/state_trackers/vega/matrix.h
@@ -221,9 +221,9 @@ static INLINE void matrix_rotate(struct matrix *dst,
else if (floatsEqual(angle, 180))
cos_val = -1.f;
else {
- float radians = DEGREES_TO_RADIANS(angle);
- sin_val = sin(radians);
- cos_val = cos(radians);
+ double radians = DEGREES_TO_RADIANS(angle);
+ sin_val = (float) sin(radians);
+ cos_val = (float) cos(radians);
}
if (!matrix_is_affine(dst)) {
@@ -410,7 +410,7 @@ static INLINE void line_normalize(float *l)
{
float x = l[2] - l[0];
float y = l[3] - l[1];
- float len = sqrt(x*x + y*y);
+ float len = (float) sqrt(x*x + y*y);
l[2] = l[0] + x/len;
l[3] = l[1] + y/len;
}
@@ -420,14 +420,14 @@ static INLINE VGfloat line_length(VGfloat x1, VGfloat y1,
{
VGfloat x = x2 - x1;
VGfloat y = y2 - y1;
- return sqrt(x*x + y*y);
+ return (VGfloat) sqrt(x*x + y*y);
}
static INLINE VGfloat line_lengthv(const VGfloat *l)
{
VGfloat x = l[2] - l[0];
VGfloat y = l[3] - l[1];
- return sqrt(x*x + y*y);
+ return (VGfloat) sqrt(x*x + y*y);
}
@@ -442,7 +442,7 @@ static INLINE void line_point_at(float *l, float t, float *pt)
static INLINE void vector_unit(float *vec)
{
- float len = sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
+ float len = (float) sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
vec[0] /= len;
vec[1] /= len;
}