Bug 935923 - Rename AlphaMode helper function to D2DAlphaModeForFormat and replace most of its uses with D2DPixelFormat. r=Bas

--HG--
extra : rebase_source : c01334a631fae221d474c89502057892c9f540fd
This commit is contained in:
Markus Stange 2013-11-20 17:20:50 +01:00
parent ca59701e6c
commit 8e374e30b3
4 changed files with 9 additions and 15 deletions

View File

@ -85,9 +85,7 @@ public:
}
mDT->mDevice->CopyResource(tmpTexture, mDT->mTexture);
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(format),
AlphaMode(format)));
D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(format));
RefPtr<IDXGISurface> surf;
@ -306,7 +304,7 @@ DrawTargetD2D::GetBitmapForSurface(SourceSurface *aSurface,
(uint32_t)aSource.x * BytesPerPixel(srcSurf->GetFormat());
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(srcSurf->GetFormat()), AlphaMode(srcSurf->GetFormat())));
D2D1::BitmapProperties(D2DPixelFormat(srcSurf->GetFormat()));
mRT->CreateBitmap(D2D1::SizeU(UINT32(aSource.width), UINT32(aSource.height)), data, stride, props, byRef(bitmap));
// subtract the integer part leaving the fractional part

View File

@ -162,7 +162,7 @@ static inline DXGI_FORMAT DXGIFormat(SurfaceFormat aFormat)
}
}
static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat)
static inline D2D1_ALPHA_MODE D2DAlphaModeForFormat(SurfaceFormat aFormat)
{
switch (aFormat) {
case FORMAT_B8G8R8X8:
@ -174,7 +174,7 @@ static inline D2D1_ALPHA_MODE AlphaMode(SurfaceFormat aFormat)
static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat)
{
return D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat));
return D2D1::PixelFormat(DXGIFormat(aFormat), D2DAlphaModeForFormat(aFormat));
}
#ifdef USE_D2D1_1

View File

@ -68,8 +68,7 @@ SourceSurfaceD2D::InitFromData(unsigned char *aData,
return false;
}
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat)));
D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(aFormat));
hr = aRT->CreateBitmap(D2DIntSize(aSize), aData, aStride, props, byRef(mBitmap));
if (FAILED(hr)) {
@ -105,8 +104,7 @@ SourceSurfaceD2D::InitFromTexture(ID3D10Texture2D *aTexture,
mSize = IntSize(desc.Width, desc.Height);
mFormat = aFormat;
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(aFormat), AlphaMode(aFormat)));
D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(aFormat));
hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap));
if (FAILED(hr)) {

View File

@ -138,15 +138,13 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT)
return nullptr;
}
D2D1_BITMAP_PROPERTIES props =
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(mFormat), AlphaMode(mFormat)));
D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(mFormat));
hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap));
if (FAILED(hr)) {
// This seems to happen for FORMAT_A8 sometimes...
aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height),
D2D1::BitmapProperties(D2D1::PixelFormat(DXGIFormat(mFormat),
AlphaMode(mFormat))),
D2D1::BitmapProperties(D2DPixelFormat(mFormat)),
byRef(mBitmap));
RefPtr<ID2D1RenderTarget> rt;
@ -169,7 +167,7 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT)
}
D2D1_RENDER_TARGET_PROPERTIES props =
D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(DXGIFormat(mFormat), AlphaMode(mFormat)));
D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2DPixelFormat(mFormat));
hr = DrawTargetD2D::factory()->CreateDxgiSurfaceRenderTarget(surface, props, byRef(rt));
if (FAILED(hr)) {