Bug 778184 - Add GetScreenDepth API for Qt gfx platform port. r=me,dougt NPODB
authorOleg Romashin <oleg.romashin@nokia.com>
Wed, 01 Aug 2012 12:00:24 -0700
changeset 107081 e54118dd247177942a56d4e3aaf2687a1b120830
parent 107080 bcfe6817a2139bccbf423afe588554a57d56ba7b
child 107082 278d4641b7391eb06cdeb09176794fd49c1d965c
push id214
push userakeybl@mozilla.com
push dateWed, 14 Nov 2012 20:38:59 +0000
treeherdermozilla-release@c8b08ec8e1aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, dougt
bugs778184
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 778184 - Add GetScreenDepth API for Qt gfx platform port. r=me,dougt NPODB
gfx/thebes/gfxQtPlatform.cpp
gfx/thebes/gfxQtPlatform.h
--- a/gfx/thebes/gfxQtPlatform.cpp
+++ b/gfx/thebes/gfxQtPlatform.cpp
@@ -130,16 +130,17 @@ gfxQtPlatform::gfxQtPlatform()
     }
 
     // Qt doesn't provide a public API to detect the graphicssystem type. We hack
     // around this by checking what type of graphicssystem a test QPixmap uses.
     QPixmap pixmap(1, 1);
     if (pixmap.depth() == 16) {
         sOffscreenFormat = gfxASurface::ImageFormatRGB16_565;
     }
+    mScreenDepth = pixmap.depth();
 #if (QT_VERSION < QT_VERSION_CHECK(4,8,0))
     if (pixmap.paintEngine())
         sDefaultQtPaintEngineType = pixmap.paintEngine()->type();
 #endif
 }
 
 gfxQtPlatform::~gfxQtPlatform()
 {
@@ -601,8 +602,14 @@ gfxQtPlatform::GetDPI()
 }
 
 gfxImageFormat
 gfxQtPlatform::GetOffscreenFormat()
 {
     return sOffscreenFormat;
 }
 
+int
+gfxQtPlatform::GetScreenDepth() const
+{
+    return mScreenDepth;
+}
+
--- a/gfx/thebes/gfxQtPlatform.h
+++ b/gfx/thebes/gfxQtPlatform.h
@@ -107,22 +107,25 @@ public:
     static PRInt32 GetDPI();
 
     virtual gfxImageFormat GetOffscreenFormat();
 #ifdef MOZ_X11
     static Display* GetXDisplay(QWidget* aWindow = 0);
     static Screen* GetXScreen(QWidget* aWindow = 0);
 #endif
 
+    virtual int GetScreenDepth() const;
+
 protected:
     static gfxFontconfigUtils *sFontconfigUtils;
 
 private:
     virtual qcms_profile *GetPlatformCMSOutputProfile();
 
     // TODO: unify this with mPrefFonts (NB: holds families, not fonts) in gfxPlatformFontList
     nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > mPrefFonts;
 
     RenderMode mRenderMode;
+    int mScreenDepth;
 };
 
 #endif /* GFX_PLATFORM_QT_H */