From 4f504d46be3df72acba5892da090355b2189974d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 30 Aug 2018 12:36:03 +0200 Subject: Revert "Bug 1388020. r=nical, a=RyanVM" This reverts commit e7189e33f533f9b974b22c2110b522a13bc4c7f6. --- gfx/gl/GLUploadHelpers.cpp | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'gfx/gl/GLUploadHelpers.cpp') diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp index ca1c890a4..75165eedf 100644 --- a/gfx/gl/GLUploadHelpers.cpp +++ b/gfx/gl/GLUploadHelpers.cpp @@ -27,23 +27,6 @@ DataOffset(const IntPoint& aPoint, int32_t aStride, SurfaceFormat aFormat) return data; } -static bool -CheckUploadBounds(const IntSize& aDst, const IntSize& aSrc, const IntPoint& aOffset) -{ - if (aOffset.x < 0 || aOffset.y < 0 || - aOffset.x >= aSrc.width || - aOffset.y >= aSrc.height) { - MOZ_ASSERT_UNREACHABLE("Offset outside source bounds"); - return false; - } - if (aDst.width > (aSrc.width - aOffset.x) || - aDst.height > (aSrc.height - aOffset.y)) { - MOZ_ASSERT_UNREACHABLE("Source has insufficient data"); - return false; - } - return true; -} - static GLint GetAddressAlignment(ptrdiff_t aAddress) { if (!(aAddress & 0x7)) { @@ -392,7 +375,6 @@ TexImage2DHelper(GLContext* gl, SurfaceFormat UploadImageDataToTexture(GLContext* gl, unsigned char* aData, - const gfx::IntSize& aDataSize, int32_t aStride, SurfaceFormat aFormat, const nsIntRegion& aDstRegion, @@ -516,10 +498,6 @@ UploadImageDataToTexture(GLContext* gl, // Upload each rect in the region to the texture for (auto iter = aDstRegion.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); - if (!CheckUploadBounds(rect.Size(), aDataSize, rect.TopLeft())) { - return SurfaceFormat::UNKNOWN; - } - const unsigned char* rectData = aData + DataOffset(rect.TopLeft(), aStride, aFormat); @@ -556,17 +534,10 @@ UploadSurfaceToTexture(GLContext* gl, int32_t stride = aSurface->Stride(); SurfaceFormat format = aSurface->GetFormat(); - gfx::IntSize size = aSurface->GetSize(); - if (!CheckUploadBounds(aSize, size, aSrcPoint)) { - return SurfaceFormat::UNKNOWN; - } - unsigned char* data = aSurface->GetData() + DataOffset(aSrcPoint, stride, format); - size.width -= aSrcPoint.x; - size.height -= aSrcPoint.y; - return UploadImageDataToTexture(gl, data, size, stride, format, + return UploadImageDataToTexture(gl, data, stride, format, aDstRegion, aTexture, aSize, aOutUploadSize, aNeedInit, aTextureUnit, aTextureTarget); -- cgit v1.2.3