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 101087 e54118dd247177942a56d4e3aaf2687a1b120830
parent 101086 bcfe6817a2139bccbf423afe588554a57d56ba7b
child 101088 278d4641b7391eb06cdeb09176794fd49c1d965c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersme, dougt
bugs778184
milestone17.0a1
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 */