mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1034702 - Remove gfxPlatform::GetThebesSurfaceForDrawTarget(). r=Bas
This commit is contained in:
parent
3b63b51b29
commit
699556edfb
@ -827,20 +827,6 @@ gfxPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
|||||||
return scaledFont;
|
return scaledFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_user_data_key_t kDrawSourceSurface;
|
|
||||||
static void
|
|
||||||
DataSourceSurfaceDestroy(void *dataSourceSurface)
|
|
||||||
{
|
|
||||||
static_cast<DataSourceSurface*>(dataSourceSurface)->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_user_data_key_t kDrawTargetForSurface;
|
|
||||||
static void
|
|
||||||
DataDrawTargetDestroy(void *aTarget)
|
|
||||||
{
|
|
||||||
static_cast<DrawTarget*>(aTarget)->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
|
gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
|
||||||
{
|
{
|
||||||
@ -926,49 +912,6 @@ gfxPlatform::PurgeSkiaCache()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
|
||||||
gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|
||||||
{
|
|
||||||
if (aTarget->GetBackendType() == BackendType::CAIRO) {
|
|
||||||
cairo_surface_t* csurf =
|
|
||||||
static_cast<cairo_surface_t*>(aTarget->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE));
|
|
||||||
if (csurf) {
|
|
||||||
return gfxASurface::Wrap(csurf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The semantics of this part of the function are sort of weird. If we
|
|
||||||
// don't have direct support for the backend, we snapshot the first time
|
|
||||||
// and then return the snapshotted surface for the lifetime of the draw
|
|
||||||
// target. Sometimes it seems like this works out, but it seems like it
|
|
||||||
// might result in no updates ever.
|
|
||||||
RefPtr<SourceSurface> source = aTarget->Snapshot();
|
|
||||||
RefPtr<DataSourceSurface> data = source->GetDataSurface();
|
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize size = data->GetSize();
|
|
||||||
gfxImageFormat format = SurfaceFormatToImageFormat(data->GetFormat());
|
|
||||||
|
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surf =
|
|
||||||
new gfxImageSurface(data->GetData(), gfxIntSize(size.width, size.height),
|
|
||||||
data->Stride(), format);
|
|
||||||
|
|
||||||
if (surf->CairoStatus()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
surf->SetData(&kDrawSourceSurface, data.forget().drop(), DataSourceSurfaceDestroy);
|
|
||||||
// keep the draw target alive as long as we need its data
|
|
||||||
aTarget->AddRef();
|
|
||||||
surf->SetData(&kDrawTargetForSurface, aTarget, DataDrawTargetDestroy);
|
|
||||||
|
|
||||||
return surf.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
TemporaryRef<DrawTarget>
|
TemporaryRef<DrawTarget>
|
||||||
gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat)
|
gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat)
|
||||||
{
|
{
|
||||||
|
@ -222,9 +222,6 @@ public:
|
|||||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
||||||
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
||||||
|
|
||||||
virtual already_AddRefed<gfxASurface>
|
|
||||||
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
|
|
||||||
|
|
||||||
mozilla::TemporaryRef<DrawTarget>
|
mozilla::TemporaryRef<DrawTarget>
|
||||||
CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||||
|
|
||||||
|
@ -380,35 +380,6 @@ gfxPlatformMac::ReadAntiAliasingThreshold()
|
|||||||
return threshold;
|
return threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
|
||||||
gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|
||||||
{
|
|
||||||
if (aTarget->GetBackendType() == BackendType::COREGRAPHICS_ACCELERATED) {
|
|
||||||
RefPtr<SourceSurface> source = aTarget->Snapshot();
|
|
||||||
RefPtr<DataSourceSurface> sourceData = source->GetDataSurface();
|
|
||||||
unsigned char* data = sourceData->GetData();
|
|
||||||
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(data, ThebesIntSize(sourceData->GetSize()), sourceData->Stride(),
|
|
||||||
gfxImageFormat::ARGB32);
|
|
||||||
// We could fix this by telling gfxImageSurface it owns data.
|
|
||||||
nsRefPtr<gfxImageSurface> cpy = new gfxImageSurface(ThebesIntSize(sourceData->GetSize()), gfxImageFormat::ARGB32);
|
|
||||||
cpy->CopyFrom(surf);
|
|
||||||
return cpy.forget();
|
|
||||||
} else if (aTarget->GetBackendType() == BackendType::COREGRAPHICS) {
|
|
||||||
CGContextRef cg = static_cast<CGContextRef>(aTarget->GetNativeSurface(NativeSurfaceType::CGCONTEXT));
|
|
||||||
|
|
||||||
//XXX: it would be nice to have an implicit conversion from IntSize to gfxIntSize
|
|
||||||
IntSize intSize = aTarget->GetSize();
|
|
||||||
gfxIntSize size(intSize.width, intSize.height);
|
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surf =
|
|
||||||
new gfxQuartzSurface(cg, size);
|
|
||||||
|
|
||||||
return surf.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxPlatformMac::UseAcceleratedCanvas()
|
gfxPlatformMac::UseAcceleratedCanvas()
|
||||||
{
|
{
|
||||||
|
@ -64,8 +64,6 @@ public:
|
|||||||
// lower threshold on font anti-aliasing
|
// lower threshold on font anti-aliasing
|
||||||
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
|
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
|
||||||
|
|
||||||
virtual already_AddRefed<gfxASurface>
|
|
||||||
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
|
|
||||||
private:
|
private:
|
||||||
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
|
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
|
||||||
|
|
||||||
|
@ -647,37 +647,6 @@ gfxWindowsPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
|||||||
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
|
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
|
||||||
gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|
||||||
{
|
|
||||||
#ifdef XP_WIN
|
|
||||||
if (aTarget->GetBackendType() == BackendType::DIRECT2D) {
|
|
||||||
if (!GetD2DDevice()) {
|
|
||||||
// We no longer have a D2D device, can't do this.
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<ID3D10Texture2D> texture =
|
|
||||||
static_cast<ID3D10Texture2D*>(aTarget->GetNativeSurface(NativeSurfaceType::D3D10_TEXTURE));
|
|
||||||
|
|
||||||
if (!texture) {
|
|
||||||
return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
aTarget->Flush();
|
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surf =
|
|
||||||
new gfxD2DSurface(texture, ContentForFormat(aTarget->GetFormat()));
|
|
||||||
|
|
||||||
// shouldn't this hold a reference?
|
|
||||||
surf->SetData(&kDrawTarget, aTarget, nullptr);
|
|
||||||
return surf.forget();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup,
|
gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup,
|
||||||
const nsACString& aGenericFamily,
|
const nsACString& aGenericFamily,
|
||||||
|
@ -130,8 +130,6 @@ public:
|
|||||||
|
|
||||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
||||||
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
||||||
virtual already_AddRefed<gfxASurface>
|
|
||||||
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
|
|
||||||
|
|
||||||
enum RenderMode {
|
enum RenderMode {
|
||||||
/* Use GDI and windows surfaces */
|
/* Use GDI and windows surfaces */
|
||||||
|
Loading…
Reference in New Issue
Block a user