зеркало из https://github.com/mozilla/gecko-dev.git
Bug 764125; pass around the size of a gfxASurface when creating a DrawTarget. r=Bas
This commit is contained in:
Родитель
30018721c2
Коммит
1292400ee5
|
@ -802,7 +802,7 @@ class GFX2D_API Factory
|
|||
public:
|
||||
static bool HasSSE2();
|
||||
|
||||
static TemporaryRef<DrawTarget> CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface);
|
||||
static TemporaryRef<DrawTarget> CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSize& aSize);
|
||||
|
||||
static TemporaryRef<DrawTarget>
|
||||
CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFormat aFormat);
|
||||
|
|
|
@ -250,7 +250,7 @@ DrawTargetCairo::~DrawTargetCairo()
|
|||
IntSize
|
||||
DrawTargetCairo::GetSize()
|
||||
{
|
||||
return IntSize();
|
||||
return mSize;
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
|
@ -712,7 +712,7 @@ DrawTargetCairo::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFo
|
|||
|
||||
if (!cairo_surface_status(similar)) {
|
||||
RefPtr<DrawTargetCairo> target = new DrawTargetCairo();
|
||||
target->Init(similar);
|
||||
target->Init(similar, aSize);
|
||||
return target;
|
||||
}
|
||||
|
||||
|
@ -720,9 +720,10 @@ DrawTargetCairo::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFo
|
|||
}
|
||||
|
||||
bool
|
||||
DrawTargetCairo::Init(cairo_surface_t* aSurface)
|
||||
DrawTargetCairo::Init(cairo_surface_t* aSurface, const IntSize& aSize)
|
||||
{
|
||||
mContext = cairo_create(aSurface);
|
||||
mSize = aSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType);
|
||||
|
||||
bool Init(cairo_surface_t* aSurface);
|
||||
bool Init(cairo_surface_t* aSurface, const IntSize& aSize);
|
||||
|
||||
void SetPathObserver(CairoPathContext* aPathObserver);
|
||||
|
||||
|
@ -157,6 +157,7 @@ private: // methods
|
|||
|
||||
private: // data
|
||||
cairo_t* mContext;
|
||||
IntSize mSize;
|
||||
std::vector<SourceSurfaceCairo*> mSnapshots;
|
||||
mutable RefPtr<CairoPathContext> mPathObserver;
|
||||
};
|
||||
|
|
|
@ -365,11 +365,11 @@ Factory::GetD2DVRAMUsageSourceSurface()
|
|||
#endif // XP_WIN
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface)
|
||||
Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSize& aSize)
|
||||
{
|
||||
#ifdef USE_CAIRO
|
||||
RefPtr<DrawTargetCairo> newTarget = new DrawTargetCairo();
|
||||
if (newTarget->Init(aSurface)) {
|
||||
if (newTarget->Init(aSurface, aSize)) {
|
||||
return newTarget;
|
||||
}
|
||||
|
||||
|
|
|
@ -473,9 +473,9 @@ gfxPlatform::OptimizeImage(gfxImageSurface *aSurface,
|
|||
cairo_user_data_key_t kDrawTarget;
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface)
|
||||
gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize)
|
||||
{
|
||||
RefPtr<DrawTarget> drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface());
|
||||
RefPtr<DrawTarget> drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize);
|
||||
aSurface->SetData(&kDrawTarget, drawTarget, NULL);
|
||||
return drawTarget;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aForm
|
|||
nsRefPtr<gfxASurface> surf = CreateOffscreenSurface(ThebesIntSize(aSize),
|
||||
ContentForFormat(aFormat));
|
||||
|
||||
return CreateDrawTargetForSurface(surf);
|
||||
return CreateDrawTargetForSurface(surf, aSize);
|
||||
} else {
|
||||
return Factory::CreateDrawTarget(backend, aSize, aFormat);
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
gfxASurface::gfxImageFormat format);
|
||||
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
CreateDrawTargetForSurface(gfxASurface *aSurface);
|
||||
CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize);
|
||||
|
||||
/*
|
||||
* Creates a SourceSurface for a gfxASurface. This surface should -not- be
|
||||
|
|
Загрузка…
Ссылка в новой задаче