Bug 585817. Part 1: Create a single static 1x1 surface in gfxPlatform that can be used to create contexts for text measurement etc. r=vlad

This commit is contained in:
Robert O'Callahan 2010-08-20 14:29:01 -05:00
Родитель efa1655e68
Коммит 3f83dd98b9
2 изменённых файлов: 16 добавлений и 1 удалений

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

@ -238,6 +238,15 @@ gfxPlatform::Init()
if (!gPlatform) if (!gPlatform)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
gPlatform->mScreenReferenceSurface =
gPlatform->CreateOffscreenSurface(gfxIntSize(1,1),
gfxASurface::ImageFormatARGB32);
if (!gPlatform->mScreenReferenceSurface) {
NS_ERROR("Could not initialize mScreenReferenceSurface");
Shutdown();
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv; nsresult rv;
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID) // temporary, until this is implemented on others #if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID) // temporary, until this is implemented on others

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

@ -339,6 +339,12 @@ public:
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref); virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
/**
* Returns a 1x1 surface that can be used to create graphics contexts
* for measuring text etc as if they will be rendered to the screen
*/
gfxASurface* ScreenReferenceSurface() { return mScreenReferenceSurface; }
protected: protected:
gfxPlatform(); gfxPlatform();
virtual ~gfxPlatform(); virtual ~gfxPlatform();
@ -356,8 +362,8 @@ protected:
private: private:
virtual qcms_profile* GetPlatformCMSOutputProfile(); virtual qcms_profile* GetPlatformCMSOutputProfile();
nsRefPtr<gfxASurface> mScreenReferenceSurface;
nsTArray<PRUint32> mCJKPrefLangs; nsTArray<PRUint32> mCJKPrefLangs;
nsCOMPtr<nsIObserver> overrideObserver; nsCOMPtr<nsIObserver> overrideObserver;
}; };