mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset c5953a778276 (bug 1019753) for crashes on a CLOSED TREE
This commit is contained in:
parent
5ad3e8194e
commit
7d4c6ef58f
@ -3,11 +3,8 @@
|
||||
* 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/. */
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "2D.h"
|
||||
#include "DataSurfaceHelpers.h"
|
||||
#include "Tools.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
@ -140,30 +137,5 @@ SurfaceToPackedBGR(DataSourceSurface *aSurface)
|
||||
return imageBuffer;
|
||||
}
|
||||
|
||||
void
|
||||
ClearDataSourceSurface(DataSourceSurface *aSurface)
|
||||
{
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!aSurface->Map(DataSourceSurface::MapType::WRITE, &map)) {
|
||||
MOZ_ASSERT(false, "Failed to map DataSourceSurface");
|
||||
return;
|
||||
}
|
||||
|
||||
// We avoid writing into the gaps between the rows here since we can't be
|
||||
// sure that some drivers don't use those bytes.
|
||||
|
||||
uint32_t width = aSurface->GetSize().width;
|
||||
uint32_t bytesPerRow = width * BytesPerPixel(aSurface->GetFormat());
|
||||
uint8_t* row = map.mData;
|
||||
uint8_t* end = row + map.mStride * aSurface->GetSize().height;
|
||||
|
||||
while (row != end) {
|
||||
memset(row, 0, bytesPerRow);
|
||||
row += map.mStride;
|
||||
}
|
||||
|
||||
aSurface->Unmap();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -45,13 +45,6 @@ SurfaceToPackedBGRA(DataSourceSurface *aSurface);
|
||||
uint8_t*
|
||||
SurfaceToPackedBGR(DataSourceSurface *aSurface);
|
||||
|
||||
/**
|
||||
* Clears all the bytes in a DataSourceSurface's data array to zero (so to
|
||||
* transparent black for SurfaceFormat::B8G8R8A8, for example).
|
||||
*/
|
||||
void
|
||||
ClearDataSourceSurface(DataSourceSurface *aSurface);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
#include <cmath>
|
||||
#include "DataSurfaceHelpers.h"
|
||||
#include "FilterNodeSoftware.h"
|
||||
#include "2D.h"
|
||||
#include "Tools.h"
|
||||
@ -194,6 +193,14 @@ NS_lround(double x)
|
||||
return x >= 0.0 ? int32_t(x + 0.5) : int32_t(x - 0.5);
|
||||
}
|
||||
|
||||
void
|
||||
ClearDataSourceSurface(DataSourceSurface *aSurface)
|
||||
{
|
||||
size_t numBytes = aSurface->GetSize().height * aSurface->Stride();
|
||||
uint8_t* data = aSurface->GetData();
|
||||
PodZero(data, numBytes);
|
||||
}
|
||||
|
||||
// This check is safe against integer overflow.
|
||||
static bool
|
||||
SurfaceContainsPoint(SourceSurface* aSurface, const IntPoint& aPoint)
|
||||
|
Loading…
Reference in New Issue
Block a user