Backout a693c64dc64e (bug 715768), c520957cc03f & 713ed280a80d (bug 756767), 20cb25a8b8ba (bug 756454), f3b5ad2320cb (bug 756424) for crashes

This commit is contained in:
Ed Morley 2012-05-21 18:56:46 +01:00
Родитель 2634194c33
Коммит d922d5d2d6
22 изменённых файлов: 11399 добавлений и 11552 удалений

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

@ -311,7 +311,7 @@ class DataSourceSurface : public SourceSurface
public:
virtual SurfaceType GetType() const { return SURFACE_DATA; }
/* Get the raw bitmap data of the surface */
virtual uint8_t *GetData() = 0;
virtual unsigned char *GetData() = 0;
/*
* Stride of the surface, distance in bytes between the start of the image
* data belonging to row y and row y+1. This may be negative.
@ -748,8 +748,8 @@ public:
return mUserData.Get(key);
}
/* Within this rectangle all pixels will be opaque by the time the result of
* this DrawTarget is first used for drawing. Either by the underlying surface
/* Within this rectangle all pixels will be opaque by the time the result of
* this DrawTarget is first used for drawing. Either by the underlying surface
* being used as an input to external drawing, or Snapshot() being called.
* This rectangle is specified in device space.
*/
@ -810,7 +810,7 @@ public:
*/
static TemporaryRef<DataSourceSurface>
CreateDataSourceSurface(const IntSize &aSize, SurfaceFormat aFormat);
/*
* This creates a simple data source surface for some existing data. It will
* wrap this data and the data for this source surface. The caller is
@ -818,7 +818,7 @@ public:
* surface.
*/
static TemporaryRef<DataSourceSurface>
CreateWrappingDataSourceSurface(uint8_t *aData, int32_t aStride,
CreateDataSourceSurfaceFromData(unsigned char *aData, int32_t aStride,
const IntSize &aSize, SurfaceFormat aFormat);
#ifdef WIN32

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

@ -258,7 +258,25 @@ DrawTargetD2D::DrawSurface(SourceSurface *aSurface,
bitmap = srcSurf->GetBitmap();
if (!bitmap) {
return;
if (aSource.width > rt->GetMaximumBitmapSize() ||
aSource.height > rt->GetMaximumBitmapSize()) {
gfxDebug() << "Bitmap source larger than texture size specified. DrawBitmap will silently fail.";
// Don't know how to deal with this yet.
return;
}
int stride = srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat());
unsigned char *data = srcSurf->mRawData +
(uint32_t)aSource.y * stride +
(uint32_t)aSource.x * BytesPerPixel(srcSurf->GetFormat());
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(srcSurf->GetFormat()), AlphaMode(srcSurf->GetFormat())));
mRT->CreateBitmap(D2D1::SizeU(UINT32(aSource.width), UINT32(aSource.height)), data, stride, props, byRef(bitmap));
srcRect.x -= (uint32_t)aSource.x;
srcRect.y -= (uint32_t)aSource.y;
}
}
break;
@ -269,30 +287,6 @@ DrawTargetD2D::DrawSurface(SourceSurface *aSurface,
AddDependencyOnSource(srcSurf);
}
break;
case SURFACE_DATA:
{
DataSourceSurface *srcSurf = static_cast<DataSourceSurface*>(aSurface);
if (aSource.width > rt->GetMaximumBitmapSize() ||
aSource.height > rt->GetMaximumBitmapSize()) {
gfxDebug() << "Bitmap source larger than texture size specified. DrawBitmap will silently fail.";
// Don't know how to deal with this yet.
return;
}
int stride = srcSurf->Stride();
unsigned char *data = srcSurf->GetData() +
(uint32_t)aSource.y * stride +
(uint32_t)aSource.x * BytesPerPixel(srcSurf->GetFormat());
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(srcSurf->GetFormat()), AlphaMode(srcSurf->GetFormat())));
mRT->CreateBitmap(D2D1::SizeU(UINT32(aSource.width), UINT32(aSource.height)), data, stride, props, byRef(bitmap));
srcRect.x -= (uint32_t)aSource.x;
srcRect.y -= (uint32_t)aSource.y;
}
break;
}
rt->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(srcRect));
@ -1986,7 +1980,11 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
bitmap = surf->mBitmap;
if (!bitmap) {
return NULL;
bitmap = CreatePartialBitmapForSurface(surf, mat);
if (!bitmap) {
return NULL;
}
}
}
break;
@ -1998,17 +1996,6 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
AddDependencyOnSource(surf);
}
break;
case SURFACE_DATA:
{
DataSourceSurface *dataSurf =
static_cast<DataSourceSurface*>(pat->mSurface.get());
bitmap = CreatePartialBitmapForSurface(dataSurf, mat);
if (!bitmap) {
return NULL;
}
}
break;
}
mRT->CreateBitmapBrush(bitmap,
@ -2099,10 +2086,10 @@ DrawTargetD2D::CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions)
return style;
}
TemporaryRef<ID3D10Texture2D>
TemporaryRef<ID3D10Texture1D>
DrawTargetD2D::CreateGradientTexture(const GradientStopsD2D *aStops)
{
CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, 4096, 1, 1, 1);
CD3D10_TEXTURE1D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, 4096, 1, 1);
std::vector<D2D1_GRADIENT_STOP> rawStops;
rawStops.resize(aStops->mStopCollection->GetGradientStopCount());
@ -2157,10 +2144,9 @@ DrawTargetD2D::CreateGradientTexture(const GradientStopsD2D *aStops)
D3D10_SUBRESOURCE_DATA data;
data.pSysMem = &textureData.front();
data.SysMemPitch = 4096 * 4;
RefPtr<ID3D10Texture2D> tex;
mDevice->CreateTexture2D(&desc, &data, byRef(tex));
RefPtr<ID3D10Texture1D> tex;
mDevice->CreateTexture1D(&desc, &data, byRef(tex));
return tex;
}
@ -2230,7 +2216,7 @@ DrawTargetD2D::CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, cons
return tex;
}
TemporaryRef<ID2D1Bitmap>
DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix &aMatrix)
DrawTargetD2D::CreatePartialBitmapForSurface(SourceSurfaceD2D *aSurface, Matrix &aMatrix)
{
RefPtr<ID2D1Bitmap> bitmap;
@ -2252,9 +2238,7 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
rect = invTransform.TransformBounds(rect);
rect.RoundOut();
IntSize size = aSurface->GetSize();
Rect uploadRect(0, 0, size.width, size.height);
Rect uploadRect(0, 0, aSurface->mSize.width, aSurface->mSize.height);
// Calculate the rectangle on the source bitmap that touches our
// surface.
@ -2266,25 +2250,24 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
return NULL;
}
int stride = aSurface->Stride();
if (uploadRect.width <= mRT->GetMaximumBitmapSize() &&
uploadRect.height <= mRT->GetMaximumBitmapSize()) {
int Bpp = BytesPerPixel(aSurface->GetFormat());
int Bpp = BytesPerPixel(aSurface->mFormat);
int stride = Bpp * aSurface->mSize.width;
// A partial upload will suffice.
mRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)),
aSurface->GetData() + int(uploadRect.x) * 4 + int(uploadRect.y) * stride,
aSurface->mRawData + int(uploadRect.x) * 4 + int(uploadRect.y) * stride,
stride,
D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
D2D1::BitmapProperties(D2DPixelFormat(aSurface->mFormat)),
byRef(bitmap));
aMatrix.Translate(uploadRect.x, uploadRect.y);
return bitmap;
} else {
int Bpp = BytesPerPixel(aSurface->GetFormat());
int Bpp = BytesPerPixel(aSurface->mFormat);
if (Bpp != 4) {
// This shouldn't actually happen in practice!
@ -2292,13 +2275,15 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
return NULL;
}
ImageHalfScaler scaler(aSurface->GetData(), stride, size);
int stride = Bpp * aSurface->mSize.width;
ImageHalfScaler scaler(aSurface->mRawData, stride, IntSize(aSurface->mSize));
// Calculate the maximum width/height of the image post transform.
Point topRight = transform * Point(size.width, 0);
Point topRight = transform * Point(aSurface->mSize.width, 0);
Point topLeft = transform * Point(0, 0);
Point bottomRight = transform * Point(size.width, size.height);
Point bottomLeft = transform * Point(0, size.height);
Point bottomRight = transform * Point(aSurface->mSize.width, aSurface->mSize.height);
Point bottomLeft = transform * Point(0, aSurface->mSize.height);
IntSize scaleSize;
@ -2321,10 +2306,10 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
mRT->CreateBitmap(D2D1::SizeU(newSize.width, newSize.height),
scaler.GetScaledData(), scaler.GetStride(),
D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
D2D1::BitmapProperties(D2DPixelFormat(aSurface->mFormat)),
byRef(bitmap));
aMatrix.Scale(size.width / newSize.width, size.height / newSize.height);
aMatrix.Scale(aSurface->mSize.width / newSize.width, aSurface->mSize.height / newSize.height);
return bitmap;
}
}
@ -2343,7 +2328,7 @@ DrawTargetD2D::SetupEffectForRadialGradient(const RadialGradientPattern *aPatter
const GradientStopsD2D *stops =
static_cast<const GradientStopsD2D*>(aPattern->mStops.get());
RefPtr<ID3D10Texture2D> tex = CreateGradientTexture(stops);
RefPtr<ID3D10Texture1D> tex = CreateGradientTexture(stops);
RefPtr<ID3D10ShaderResourceView> srView;
mDevice->CreateShaderResourceView(tex, NULL, byRef(srView));

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

@ -177,13 +177,13 @@ private:
TemporaryRef<ID2D1Brush> CreateBrushForPattern(const Pattern &aPattern, Float aAlpha = 1.0f);
TemporaryRef<ID3D10Texture2D> CreateGradientTexture(const GradientStopsD2D *aStops);
TemporaryRef<ID3D10Texture1D> CreateGradientTexture(const GradientStopsD2D *aStops);
TemporaryRef<ID3D10Texture2D> CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, const IntRect &aBounds);
// This creates a (partially) uploaded bitmap for a DataSourceSurface. It
// uploads the minimum requirement and possibly downscales. It adjusts the
// input Matrix to compensate.
TemporaryRef<ID2D1Bitmap> CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix &aMatrix);
// This creates a partially uploaded bitmap for a SourceSurfaceD2D that is
// too big to fit in a bitmap. It adjusts the passed Matrix to accomodate the
// partial upload.
TemporaryRef<ID2D1Bitmap> CreatePartialBitmapForSurface(SourceSurfaceD2D *aSurface, Matrix &aMatrix);
void SetupEffectForRadialGradient(const RadialGradientPattern *aPattern);
void SetupStateForRendering();

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

@ -37,8 +37,6 @@
#include "DrawTargetDual.h"
#include "SourceSurfaceRawData.h"
#include "Logging.h"
#ifdef PR_LOGGING
@ -363,19 +361,5 @@ Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface)
return NULL;
}
TemporaryRef<DataSourceSurface>
Factory::CreateWrappingDataSourceSurface(uint8_t *aData, int32_t aStride,
const IntSize &aSize,
SurfaceFormat aFormat)
{
RefPtr<SourceSurfaceRawData> newSurf = new SourceSurfaceRawData();
if (newSurf->InitWrappingData(aData, aSize, aStride, aFormat, false)) {
return newSurf;
}
return NULL;
}
}
}

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

@ -132,6 +132,16 @@ static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat)
return D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat));
}
static inline int BytesPerPixel(SurfaceFormat aFormat)
{
switch (aFormat) {
case FORMAT_A8:
return 1;
default:
return 4;
}
}
static bool IsPatternSupportedByD2D(const Pattern &aPattern)
{
if (aPattern.GetType() != PATTERN_RADIAL_GRADIENT) {

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

@ -43,7 +43,6 @@ CPPSRCS = \
ScaledFontBase.cpp \
DrawTargetDual.cpp \
ImageScaling.cpp \
SourceSurfaceRawData.cpp \
$(NULL)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))

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

@ -421,7 +421,6 @@ technique10 SampleTextTexture
{
pass Unmasked
{
SetRasterizerState(TextureRast);
SetBlendState(bTextBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
SetVertexShader(CompileShader(vs_4_0_level_9_3, SampleTextureVS()));
SetGeometryShader(NULL);
@ -429,7 +428,6 @@ technique10 SampleTextTexture
}
pass Masked
{
SetRasterizerState(TextureRast);
SetBlendState(bTextBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
SetVertexShader(CompileShader(vs_4_0_level_9_3, SampleTextureVS()));
SetGeometryShader(NULL);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -10,11 +10,13 @@ namespace mozilla {
namespace gfx {
SourceSurfaceD2D::SourceSurfaceD2D()
: mRawData(NULL)
{
}
SourceSurfaceD2D::~SourceSurfaceD2D()
{
delete [] mRawData;
}
IntSize
@ -49,8 +51,15 @@ SourceSurfaceD2D::InitFromData(unsigned char *aData,
if ((uint32_t)aSize.width > aRT->GetMaximumBitmapSize() ||
(uint32_t)aSize.height > aRT->GetMaximumBitmapSize()) {
gfxDebug() << "Bitmap does not fit in texture.";
return false;
int newStride = BytesPerPixel(aFormat) * aSize.width;
// This should only be called once!
MOZ_ASSERT(!mRawData);
mRawData = new uint8_t[aSize.height * newStride];
for (int y = 0; y < aSize.height; y++) {
memcpy(mRawData + y * newStride, aData + y * aStride, newStride);
}
gfxDebug() << "Bitmap does not fit in texture, saving raw data.";
return true;
}
D2D1_BITMAP_PROPERTIES props =

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

@ -39,6 +39,7 @@ private:
friend class DrawTargetD2D;
RefPtr<ID2D1Bitmap> mBitmap;
uint8_t *mRawData;
SurfaceFormat mFormat;
IntSize mSize;
};

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

@ -208,7 +208,7 @@ DataSourceSurfaceD2DTarget::GetFormat() const
return mFormat;
}
uint8_t*
unsigned char*
DataSourceSurfaceD2DTarget::GetData()
{
EnsureMapped();

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

@ -63,7 +63,7 @@ public:
virtual SurfaceType GetType() const { return SURFACE_DATA; }
virtual IntSize GetSize() const;
virtual SurfaceFormat GetFormat() const;
virtual uint8_t *GetData();
virtual unsigned char *GetData();
virtual int32_t Stride();
private:

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

@ -1,30 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "SourceSurfaceRawData.h"
#include "Logging.h"
#include "Tools.h"
namespace mozilla {
namespace gfx {
bool
SourceSurfaceRawData::InitWrappingData(uint8_t *aData,
const IntSize &aSize,
int32_t aStride,
SurfaceFormat aFormat,
bool aOwnData)
{
mRawData = aData;
mSize = aSize;
mStride = aStride;
mFormat = aFormat;
mOwnData = aOwnData;
return true;
}
}
}

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

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef MOZILLA_GFX_SOURCESURFACERAWDATA_H_
#define MOZILLA_GFX_SOURCESURFACERAWDATA_H_
#include "2D.h"
namespace mozilla {
namespace gfx {
class SourceSurfaceRawData : public DataSourceSurface
{
public:
SourceSurfaceRawData() {}
~SourceSurfaceRawData() { if(mOwnData) delete [] mRawData; }
virtual uint8_t *GetData() { return mRawData; }
virtual int32_t Stride() { return mStride; }
virtual SurfaceType GetType() const { return SURFACE_DATA; }
virtual IntSize GetSize() const { return mSize; }
virtual SurfaceFormat GetFormat() const { return mFormat; }
bool InitWrappingData(unsigned char *aData,
const IntSize &aSize,
int32_t aStride,
SurfaceFormat aFormat,
bool aOwnData);
private:
uint8_t *mRawData;
int32_t mStride;
SurfaceFormat mFormat;
IntSize mSize;
bool mOwnData;
};
}
}
#endif /* MOZILLA_GFX_SOURCESURFACERAWDATA_H_ */

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

@ -52,19 +52,6 @@ Distance(Point aA, Point aB)
return hypotf(aB.x - aA.x, aB.y - aA.y);
}
static inline int
BytesPerPixel(SurfaceFormat aFormat)
{
switch (aFormat) {
case FORMAT_A8:
return 1;
case FORMAT_R5G6B5:
return 2;
default:
return 4;
}
}
}
}

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

@ -1,121 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(DXSDK_DIR)\Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="2D.h" />
<ClInclude Include="BaseMargin.h" />
<ClInclude Include="BasePoint.h" />
<ClInclude Include="BaseRect.h" />
<ClInclude Include="BaseSize.h" />
<ClInclude Include="DrawTargetD2D.h" />
<ClInclude Include="DrawTargetDual.h" />
<ClInclude Include="GradientStopsD2D.h" />
<ClInclude Include="HelpersD2D.h" />
<ClInclude Include="ImageScaling.h" />
<ClInclude Include="Logging.h" />
<ClInclude Include="Matrix.h" />
<ClInclude Include="PathD2D.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="Rect.h" />
<ClInclude Include="ScaledFontDWrite.h" />
<ClInclude Include="SourceSurfaceD2D.h" />
<ClInclude Include="SourceSurfaceD2DTarget.h" />
<ClInclude Include="SourceSurfaceRawData.h" />
<ClInclude Include="Tools.h" />
<ClInclude Include="Types.h" />
<ClInclude Include="UserData.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DrawTargetD2D.cpp" />
<ClCompile Include="DrawTargetDual.cpp" />
<ClCompile Include="Factory.cpp" />
<ClCompile Include="ImageScaling.cpp" />
<ClCompile Include="ImageScalingSSE2.cpp" />
<ClCompile Include="Matrix.cpp" />
<ClCompile Include="PathD2D.cpp" />
<ClCompile Include="ScaledFontDWrite.cpp" />
<ClCompile Include="SourceSurfaceD2D.cpp" />
<ClCompile Include="SourceSurfaceD2DTarget.cpp" />
<ClCompile Include="SourceSurfaceRawData.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.in" />
<CustomBuild Include="ShadersD2D.fx">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxc /Tfx_4_0 /FhShadersD2D.h ShadersD2D.fx /Vn d2deffect</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ShadersD2D.h</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(DXSDK_DIR)\Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="2D.h" />
<ClInclude Include="BaseMargin.h" />
<ClInclude Include="BasePoint.h" />
<ClInclude Include="BaseRect.h" />
<ClInclude Include="BaseSize.h" />
<ClInclude Include="DrawTargetD2D.h" />
<ClInclude Include="DrawTargetDual.h" />
<ClInclude Include="GradientStopsD2D.h" />
<ClInclude Include="HelpersD2D.h" />
<ClInclude Include="ImageScaling.h" />
<ClInclude Include="Logging.h" />
<ClInclude Include="Matrix.h" />
<ClInclude Include="PathD2D.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="Rect.h" />
<ClInclude Include="ScaledFontDWrite.h" />
<ClInclude Include="SourceSurfaceD2D.h" />
<ClInclude Include="SourceSurfaceD2DTarget.h" />
<ClInclude Include="Tools.h" />
<ClInclude Include="Types.h" />
<ClInclude Include="UserData.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DrawTargetD2D.cpp" />
<ClCompile Include="DrawTargetDual.cpp" />
<ClCompile Include="Factory.cpp" />
<ClCompile Include="ImageScaling.cpp" />
<ClCompile Include="ImageScalingSSE2.cpp" />
<ClCompile Include="Matrix.cpp" />
<ClCompile Include="PathD2D.cpp" />
<ClCompile Include="ScaledFontDWrite.cpp" />
<ClCompile Include="SourceSurfaceD2D.cpp" />
<ClCompile Include="SourceSurfaceD2DTarget.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.in" />
<CustomBuild Include="ShadersD2D.fx">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxc /Tfx_4_0 /FhShadersD2D.h ShadersD2D.fx /Vn d2deffect</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ShadersD2D.h</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

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

@ -532,7 +532,6 @@ gfxContext::DrawSurface(gfxASurface *surface, const gfxSize& size)
cairo_fill(mCairo);
cairo_restore(mCairo);
} else {
// Lifetime needs to be limited here since we may wrap surface's data.
RefPtr<SourceSurface> surf =
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
@ -1294,7 +1293,6 @@ gfxContext::SetColor(const gfxRGBA& c)
cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
} else {
CurrentState().pattern = NULL;
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
@ -1318,7 +1316,6 @@ gfxContext::SetDeviceColor(const gfxRGBA& c)
cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
} else {
CurrentState().pattern = NULL;
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
CurrentState().color = ToColor(c);
}
@ -1357,9 +1354,6 @@ gfxContext::SetSource(gfxASurface *surface, const gfxPoint& offset)
CurrentState().surfTransform = Matrix(1.0f, 0, 0, 1.0f, Float(offset.x), Float(offset.y));
CurrentState().pattern = NULL;
CurrentState().patternTransformChanged = false;
// Keep the underlying cairo surface around while we keep the
// sourceSurface.
CurrentState().sourceSurfCairo = surface;
CurrentState().sourceSurface =
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
}
@ -1371,7 +1365,6 @@ gfxContext::SetPattern(gfxPattern *pattern)
if (mCairo) {
cairo_set_source(mCairo, pattern->CairoPattern());
} else {
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = NULL;
CurrentState().patternTransformChanged = false;
CurrentState().pattern = pattern;
@ -1428,7 +1421,6 @@ gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset)
if (mCairo) {
cairo_mask_surface(mCairo, surface->CairoSurface(), offset.x, offset.y);
} else {
// Lifetime needs to be limited here as we may simply wrap surface's data.
RefPtr<SourceSurface> sourceSurf =
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface);
@ -1590,7 +1582,6 @@ gfxContext::PopGroupToSource()
} else {
RefPtr<SourceSurface> src = mDT->Snapshot();
Restore();
CurrentState().sourceSurfCairo = NULL;
CurrentState().sourceSurface = src;
CurrentState().pattern = NULL;
CurrentState().patternTransformChanged = false;

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

@ -713,7 +713,6 @@ private:
bool opIsClear;
Color color;
nsRefPtr<gfxPattern> pattern;
nsRefPtr<gfxASurface> sourceSurfCairo;
mozilla::RefPtr<SourceSurface> sourceSurface;
Matrix surfTransform;
Matrix transform;

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

@ -151,8 +151,6 @@ gfxPattern::GetPattern(DrawTarget *aTarget, Matrix *aPatternTransform)
if (!mSourceSurface) {
nsRefPtr<gfxASurface> gfxSurf = gfxASurface::Wrap(surf);
// The underlying surface here will be kept around by the gfxPattern.
// This function is intended to be used right away.
mSourceSurface =
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(aTarget, gfxSurf);
}

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
@ -472,12 +472,6 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
if (!srcBuffer) {
nsRefPtr<gfxImageSurface> imgSurface = aSurface->GetAsImageSurface();
bool isWin32ImageSurf = false;
if (imgSurface && aSurface->GetType() != gfxASurface::SurfaceTypeWin32) {
isWin32ImageSurf = true;
}
if (!imgSurface) {
imgSurface = new gfxImageSurface(aSurface->GetSize(), gfxASurface::FormatFromContent(aSurface->GetContentType()));
nsRefPtr<gfxContext> ctx = new gfxContext(imgSurface);
@ -504,36 +498,17 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
NS_RUNTIMEABORT("Invalid surface format!");
}
IntSize size = IntSize(imgSurface->GetSize().width, imgSurface->GetSize().height);
srcBuffer = aTarget->CreateSourceSurfaceFromData(imgSurface->Data(),
size,
IntSize(imgSurface->GetSize().width, imgSurface->GetSize().height),
imgSurface->Stride(),
format);
if (!srcBuffer) {
// We need to check if our gfxASurface will keep the underlying data
// alive! This is true if gfxASurface actually -is- an ImageSurface or
// if it is a gfxWindowsSurface which supportes GetAsImageSurface.
if (imgSurface != aSurface && !isWin32ImageSurf) {
// This shouldn't happen for now, it can be easily supported by making
// a copy. For now let's just abort.
NS_RUNTIMEABORT("Attempt to create unsupported SourceSurface from"
"non-image surface.");
return nsnull;
}
srcBuffer = Factory::CreateWrappingDataSourceSurface(imgSurface->Data(),
imgSurface->Stride(),
size, format);
}
cairo_surface_t *nullSurf =
cairo_null_surface_create(CAIRO_CONTENT_COLOR_ALPHA);
cairo_surface_set_user_data(nullSurf,
&kSourceSurface,
imgSurface,
NULL);
&kSourceSurface,
imgSurface,
NULL);
cairo_surface_attach_snapshot(imgSurface->CairoSurface(), nullSurf, SourceSnapshotDetached);
cairo_surface_destroy(nullSurf);
}

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

@ -163,11 +163,6 @@ public:
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateDrawTargetForSurface(gfxASurface *aSurface);
/*
* Creates a SourceSurface for a gfxASurface. This surface should -not- be
* held around by the user after the underlying gfxASurface has been
* destroyed as a copy of the data is not guaranteed.
*/
virtual mozilla::RefPtr<mozilla::gfx::SourceSurface>
GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface);

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

@ -211,7 +211,6 @@ pref("gfx.font_rendering.directwrite.use_gdi_table_loading", true);
#ifdef XP_WIN
pref("gfx.canvas.azure.enabled", true);
pref("gfx.content.azure.enabled", true);
#else
#ifdef XP_MACOSX
pref("gfx.canvas.azure.enabled", true);