2008-04-19 19:02:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-04-19 19:02:52 +04:00
|
|
|
|
|
|
|
#ifndef GFX_PLATFORM_QT_H
|
|
|
|
#define GFX_PLATFORM_QT_H
|
|
|
|
|
|
|
|
#include "gfxPlatform.h"
|
2010-03-06 16:29:55 +03:00
|
|
|
#include "nsAutoRef.h"
|
2008-04-19 19:02:52 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2009-01-18 23:14:14 +03:00
|
|
|
#include "nsTArray.h"
|
2012-03-23 03:24:40 +04:00
|
|
|
#ifdef MOZ_X11
|
|
|
|
#include "X11/Xlib.h"
|
|
|
|
#endif
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2010-03-06 16:29:55 +03:00
|
|
|
class gfxFontconfigUtils;
|
2014-02-21 06:09:02 +04:00
|
|
|
class QWindow;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2013-05-30 01:59:24 +04:00
|
|
|
class gfxQtPlatform : public gfxPlatform {
|
2008-04-19 19:02:52 +04:00
|
|
|
public:
|
|
|
|
gfxQtPlatform();
|
|
|
|
virtual ~gfxQtPlatform();
|
|
|
|
|
|
|
|
static gfxQtPlatform *GetPlatform() {
|
2014-02-21 06:09:02 +04:00
|
|
|
return static_cast<gfxQtPlatform*>(gfxPlatform::GetPlatform());
|
2008-04-19 19:02:52 +04:00
|
|
|
}
|
|
|
|
|
2014-02-09 12:04:38 +04:00
|
|
|
virtual already_AddRefed<gfxASurface>
|
2015-07-07 04:21:47 +03:00
|
|
|
CreateOffscreenSurface(const IntSize& aSize,
|
|
|
|
gfxImageFormat aFormat) override;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<mozilla::gfx::ScaledFont>
|
2015-03-21 19:28:04 +03:00
|
|
|
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override;
|
2014-01-30 11:01:16 +04:00
|
|
|
|
2014-02-21 06:09:02 +04:00
|
|
|
virtual nsresult GetFontList(nsIAtom *aLangGroup,
|
|
|
|
const nsACString& aGenericFamily,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsTArray<nsString>& aListOfFonts) override;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult UpdateFontList() override;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2014-06-06 10:09:23 +04:00
|
|
|
virtual gfxFontGroup *CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
2014-02-21 06:09:02 +04:00
|
|
|
const gfxFontStyle *aStyle,
|
2015-03-21 19:28:04 +03:00
|
|
|
gfxUserFontSet* aUserFontSet) override;
|
2008-04-19 19:02:52 +04:00
|
|
|
|
2010-03-06 16:29:55 +03:00
|
|
|
/**
|
|
|
|
* Look up a local platform font using the full font face name (needed to
|
|
|
|
* support @font-face src local() )
|
|
|
|
*/
|
2014-09-08 11:23:19 +04:00
|
|
|
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aItalic) override;
|
2010-03-06 16:29:55 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Activate a platform font (needed to support @font-face src url() )
|
|
|
|
*
|
|
|
|
*/
|
2014-09-08 11:23:19 +04:00
|
|
|
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
|
|
|
bool aItalic,
|
|
|
|
const uint8_t* aFontData,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aLength) override;
|
2010-03-06 16:29:55 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether format is supported on a platform or not (if unclear,
|
|
|
|
* returns true).
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsFontFormatSupported(nsIURI *aFontURI,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFormatFlags) override;
|
2010-01-11 23:31:43 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t GetDPI();
|
2010-08-13 13:58:01 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfxImageFormat GetOffscreenFormat() override;
|
2012-03-23 03:24:40 +04:00
|
|
|
#ifdef MOZ_X11
|
2014-02-21 06:09:02 +04:00
|
|
|
static Display* GetXDisplay(QWindow* aWindow = 0);
|
|
|
|
static Screen* GetXScreen(QWindow* aWindow = 0);
|
2012-03-23 03:24:40 +04:00
|
|
|
#endif
|
2010-12-15 21:17:26 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int GetScreenDepth() const override;
|
2014-02-21 06:09:02 +04:00
|
|
|
|
2015-07-17 01:18:05 +03:00
|
|
|
bool AccelerateLayersByDefault() override {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-09-27 04:21:32 +04:00
|
|
|
protected:
|
2008-04-19 19:02:52 +04:00
|
|
|
static gfxFontconfigUtils *sFontconfigUtils;
|
|
|
|
|
|
|
|
private:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size) override;
|
2010-01-11 23:31:43 +03:00
|
|
|
|
2012-08-01 23:00:24 +04:00
|
|
|
int mScreenDepth;
|
2008-04-19 19:02:52 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_PLATFORM_QT_H */
|
|
|
|
|