Bug 756996 - GCC warnings in gfx/2d r=bas

This commit is contained in:
Jacek Caban 2012-06-04 13:02:02 +02:00
Родитель f9d213c7cb
Коммит 61502911db
5 изменённых файлов: 28 добавлений и 31 удалений

Просмотреть файл

@ -129,8 +129,7 @@ public:
RefPtr<ID2D1GeometrySink> sink; RefPtr<ID2D1GeometrySink> sink;
invClippedArea->Open(byRef(sink)); invClippedArea->Open(byRef(sink));
HRESULT hr = rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, NULL, sink);
NULL, sink);
sink->Close(); sink->Close();
RefPtr<ID2D1BitmapBrush> brush; RefPtr<ID2D1BitmapBrush> brush;
@ -293,6 +292,8 @@ DrawTargetD2D::DrawSurface(SourceSurface *aSurface,
srcRect.y -= (uint32_t)aSource.y; srcRect.y -= (uint32_t)aSource.y;
} }
break; break;
default:
break;
} }
rt->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(srcRect)); rt->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(srcRect));
@ -699,6 +700,8 @@ DrawTargetD2D::CopySurface(SourceSurface *aSurface,
AddDependencyOnSource(srcSurf); AddDependencyOnSource(srcSurf);
} }
break; break;
default:
return;
} }
if (!bitmap) { if (!bitmap) {
@ -2009,6 +2012,8 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
} }
} }
break; break;
default:
break;
} }
mRT->CreateBitmapBrush(bitmap, mRT->CreateBitmapBrush(bitmap,
@ -2276,8 +2281,6 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
if (uploadRect.width <= mRT->GetMaximumBitmapSize() && if (uploadRect.width <= mRT->GetMaximumBitmapSize() &&
uploadRect.height <= mRT->GetMaximumBitmapSize()) { uploadRect.height <= mRT->GetMaximumBitmapSize()) {
int Bpp = BytesPerPixel(aSurface->GetFormat());
// A partial upload will suffice. // A partial upload will suffice.
mRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)), mRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)),
@ -2311,13 +2314,13 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
scaleSize.width = max(Distance(topRight, topLeft), Distance(bottomRight, bottomLeft)); scaleSize.width = max(Distance(topRight, topLeft), Distance(bottomRight, bottomLeft));
scaleSize.height = max(Distance(topRight, bottomRight), Distance(topLeft, bottomLeft)); scaleSize.height = max(Distance(topRight, bottomRight), Distance(topLeft, bottomLeft));
if (scaleSize.width > mRT->GetMaximumBitmapSize()) { if (unsigned(scaleSize.width) > mRT->GetMaximumBitmapSize()) {
// Ok, in this case we'd really want a downscale of a part of the bitmap, // Ok, in this case we'd really want a downscale of a part of the bitmap,
// perhaps we can do this later but for simplicity let's do something // perhaps we can do this later but for simplicity let's do something
// different here and assume it's good enough, this should be rare! // different here and assume it's good enough, this should be rare!
scaleSize.width = 4095; scaleSize.width = 4095;
} }
if (scaleSize.height > mRT->GetMaximumBitmapSize()) { if (unsigned(scaleSize.height) > mRT->GetMaximumBitmapSize()) {
scaleSize.height = 4095; scaleSize.height = 4095;
} }

Просмотреть файл

@ -32,7 +32,7 @@ static inline D2D1_RECT_F D2DRect(const Rect &aRect)
static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode) static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode)
{ {
D2D1_EXTEND_MODE extend = D2D1_EXTEND_MODE_CLAMP; D2D1_EXTEND_MODE extend;
switch (aExtendMode) { switch (aExtendMode) {
case EXTEND_REPEAT: case EXTEND_REPEAT:
extend = D2D1_EXTEND_MODE_WRAP; extend = D2D1_EXTEND_MODE_WRAP;
@ -40,6 +40,8 @@ static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode)
case EXTEND_REFLECT: case EXTEND_REFLECT:
extend = D2D1_EXTEND_MODE_MIRROR; extend = D2D1_EXTEND_MODE_MIRROR;
break; break;
default:
extend = D2D1_EXTEND_MODE_CLAMP;
} }
return extend; return extend;
@ -50,9 +52,9 @@ static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const Filter &aFilter)
switch (aFilter) { switch (aFilter) {
case FILTER_POINT: case FILTER_POINT:
return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR; return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
default:
return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
} }
return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
} }
static inline D2D1_ANTIALIAS_MODE D2DAAMode(AntialiasMode aMode) static inline D2D1_ANTIALIAS_MODE D2DAAMode(AntialiasMode aMode)
@ -60,9 +62,9 @@ static inline D2D1_ANTIALIAS_MODE D2DAAMode(AntialiasMode aMode)
switch (aMode) { switch (aMode) {
case AA_NONE: case AA_NONE:
return D2D1_ANTIALIAS_MODE_ALIASED; return D2D1_ANTIALIAS_MODE_ALIASED;
default:
return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
} }
return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
} }
static inline D2D1_MATRIX_3X2_F D2DMatrix(const Matrix &aTransform) static inline D2D1_MATRIX_3X2_F D2DMatrix(const Matrix &aTransform)
@ -93,9 +95,9 @@ static inline SurfaceFormat ToPixelFormat(const D2D1_PIXEL_FORMAT &aFormat)
} else { } else {
return FORMAT_B8G8R8A8; return FORMAT_B8G8R8A8;
} }
default:
return FORMAT_B8G8R8A8;
} }
return FORMAT_B8G8R8A8;
} }
static inline Rect ToRect(const D2D1_RECT_F &aRect) static inline Rect ToRect(const D2D1_RECT_F &aRect)
@ -112,9 +114,9 @@ static inline DXGI_FORMAT DXGIFormat(SurfaceFormat aFormat)
return DXGI_FORMAT_B8G8R8A8_UNORM; return DXGI_FORMAT_B8G8R8A8_UNORM;
case FORMAT_A8: case FORMAT_A8:
return DXGI_FORMAT_A8_UNORM; return DXGI_FORMAT_A8_UNORM;
default:
return DXGI_FORMAT_UNKNOWN;
} }
return DXGI_FORMAT_UNKNOWN;
} }
static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat) static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat)
@ -122,9 +124,9 @@ static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat)
switch (aFormat) { switch (aFormat) {
case FORMAT_B8G8R8X8: case FORMAT_B8G8R8X8:
return D2D1_ALPHA_MODE_IGNORE; return D2D1_ALPHA_MODE_IGNORE;
default:
return D2D1_ALPHA_MODE_PREMULTIPLIED;
} }
return D2D1_ALPHA_MODE_PREMULTIPLIED;
} }
static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat) static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat)
@ -132,7 +134,7 @@ static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat)
return D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat)); return D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat));
} }
static bool IsPatternSupportedByD2D(const Pattern &aPattern) static inline bool IsPatternSupportedByD2D(const Pattern &aPattern)
{ {
if (aPattern.GetType() != PATTERN_RADIAL_GRADIENT) { if (aPattern.GetType() != PATTERN_RADIAL_GRADIENT) {
return false; return false;
@ -173,7 +175,7 @@ struct ShaderConstantRectD3D10
operator float* () { return &mX; } operator float* () { return &mX; }
}; };
static DWRITE_MATRIX static inline DWRITE_MATRIX
DWriteMatrixFromMatrix(Matrix &aMatrix) DWriteMatrixFromMatrix(Matrix &aMatrix)
{ {
DWRITE_MATRIX mat; DWRITE_MATRIX mat;
@ -188,7 +190,7 @@ DWriteMatrixFromMatrix(Matrix &aMatrix)
class AutoDWriteGlyphRun : public DWRITE_GLYPH_RUN class AutoDWriteGlyphRun : public DWRITE_GLYPH_RUN
{ {
static const int kNumAutoGlyphs = 256; static const unsigned kNumAutoGlyphs = 256;
public: public:
AutoDWriteGlyphRun() { AutoDWriteGlyphRun() {
@ -203,7 +205,7 @@ public:
} }
} }
void allocate(int aNumGlyphs) { void allocate(unsigned aNumGlyphs) {
glyphCount = aNumGlyphs; glyphCount = aNumGlyphs;
if (aNumGlyphs <= kNumAutoGlyphs) { if (aNumGlyphs <= kNumAutoGlyphs) {
glyphIndices = &mAutoIndices[0]; glyphIndices = &mAutoIndices[0];
@ -222,7 +224,7 @@ private:
UINT16 mAutoIndices[kNumAutoGlyphs]; UINT16 mAutoIndices[kNumAutoGlyphs];
}; };
static void static inline void
DWriteGlyphRunFromGlyphs(const GlyphBuffer &aGlyphs, ScaledFontDWrite *aFont, AutoDWriteGlyphRun *run) DWriteGlyphRunFromGlyphs(const GlyphBuffer &aGlyphs, ScaledFontDWrite *aFont, AutoDWriteGlyphRun *run)
{ {
run->allocate(aGlyphs.mNumGlyphs); run->allocate(aGlyphs.mNumGlyphs);

Просмотреть файл

@ -89,8 +89,6 @@ MOZ_ALWAYS_INLINE __m128i avg_sse2_8x2(__m128i *a, __m128i *b, __m128i *c, __m12
__m128i carry = _mm_or_si128(_mm_and_si128(*a, *b), _mm_or_si128(_mm_and_si128(*a, *c), _mm_and_si128(*b, *c))); __m128i carry = _mm_or_si128(_mm_and_si128(*a, *b), _mm_or_si128(_mm_and_si128(*a, *c), _mm_and_si128(*b, *c)));
__m128i minusone = _mm_set1_epi32(0xffffffff);
sum = _mm_avg_epu8(_mm_not_si128(sum), _mm_not_si128(*d)); sum = _mm_avg_epu8(_mm_not_si128(sum), _mm_not_si128(*d));
return _mm_not_si128(_mm_avg_epu8(sum, _mm_not_si128(carry))); return _mm_not_si128(_mm_avg_epu8(sum, _mm_not_si128(carry)));
@ -98,8 +96,6 @@ MOZ_ALWAYS_INLINE __m128i avg_sse2_8x2(__m128i *a, __m128i *b, __m128i *c, __m12
MOZ_ALWAYS_INLINE __m128i avg_sse2_4x2_4x1(__m128i a, __m128i b) MOZ_ALWAYS_INLINE __m128i avg_sse2_4x2_4x1(__m128i a, __m128i b)
{ {
__m128i minusone = _mm_set1_epi32(0xffffffff);
return _mm_not_si128(_mm_avg_epu8(_mm_not_si128(a), _mm_not_si128(b))); return _mm_not_si128(_mm_avg_epu8(_mm_not_si128(a), _mm_not_si128(b)));
} }
@ -109,8 +105,6 @@ MOZ_ALWAYS_INLINE __m128i avg_sse2_8x1_4x1(__m128i a, __m128i b)
b = _mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps(b), _mm_castsi128_ps(a), _MM_SHUFFLE(2, 0, 2, 0))); b = _mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps(b), _mm_castsi128_ps(a), _MM_SHUFFLE(2, 0, 2, 0)));
a = t; a = t;
__m128i minusone = _mm_set1_epi32(0xffffffff);
return _mm_not_si128(_mm_avg_epu8(_mm_not_si128(a), _mm_not_si128(b))); return _mm_not_si128(_mm_avg_epu8(_mm_not_si128(a), _mm_not_si128(b)));
} }

Просмотреть файл

@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#pragma once
#include "PathD2D.h" #include "PathD2D.h"
#include "HelpersD2D.h" #include "HelpersD2D.h"
#include <math.h> #include <math.h>

Просмотреть файл

@ -484,7 +484,7 @@ RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
return nsnull; return nsnull;
} }
nsAutoPtr<TextureD3D10BackendData> data = new TextureD3D10BackendData(); nsAutoPtr<TextureD3D10BackendData> data(new TextureD3D10BackendData());
data->mTexture = texture; data->mTexture = texture;