mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959380 - 3/5 - Make gfxSurfaceType a typed enum - r=jrmuizel
find . -type f | grep -v '\./obj' | grep -v '\.hg' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)gfxSurfaceType\(Image\|PDF\|PS\|Xlib\|Xcb\|Glitz\|Quartz\|Win32\|BeOS\|DirectFB\|SVG\|OS2\|Win32Printing\|QuartzImage\|Script\|QPainter\|Recording\|VG\|GL\|DRM\|Tee\|XML\|Skia\|Subsurface\|D2D\|Max\)\($\|[^A-Za-z0-9_]\)/\1gfxSurfaceType::\2\3/g'
This commit is contained in:
parent
3369ca8bb6
commit
3846defaec
@ -137,7 +137,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
|
||||
#endif
|
||||
, mAccumulatedInvalidRect(0,0,0,0)
|
||||
, mIsTransparent(false)
|
||||
, mSurfaceType(gfxSurfaceTypeMax)
|
||||
, mSurfaceType(gfxSurfaceType::Max)
|
||||
, mCurrentInvalidateTask(nullptr)
|
||||
, mCurrentAsyncSetWindowTask(nullptr)
|
||||
, mPendingPluginCall(false)
|
||||
@ -2773,7 +2773,7 @@ GfxFromNsRect(const nsIntRect& aRect)
|
||||
bool
|
||||
PluginInstanceChild::CreateOptSurface(void)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceTypeMax,
|
||||
NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceType::Max,
|
||||
"Need a valid surface type here");
|
||||
NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync.");
|
||||
|
||||
@ -2792,7 +2792,7 @@ PluginInstanceChild::CreateOptSurface(void)
|
||||
format = gfxImageFormat::RGB16_565;
|
||||
}
|
||||
|
||||
if (mSurfaceType == gfxSurfaceTypeXlib) {
|
||||
if (mSurfaceType == gfxSurfaceType::Xlib) {
|
||||
if (!mIsTransparent || mBackground) {
|
||||
Visual* defaultVisual = DefaultVisualOfScreen(screen);
|
||||
mCurrentSurface =
|
||||
@ -2816,8 +2816,8 @@ PluginInstanceChild::CreateOptSurface(void)
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (mSurfaceType == gfxSurfaceTypeWin32 ||
|
||||
mSurfaceType == gfxSurfaceTypeD2D) {
|
||||
if (mSurfaceType == gfxSurfaceType::Win32 ||
|
||||
mSurfaceType == gfxSurfaceType::D2D) {
|
||||
bool willHaveTransparentPixels = mIsTransparent && !mBackground;
|
||||
|
||||
SharedDIBSurface* s = new SharedDIBSurface();
|
||||
@ -2856,7 +2856,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
|
||||
mDoAlphaExtraction = false;
|
||||
bool createHelperSurface = false;
|
||||
|
||||
if (mCurrentSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (mCurrentSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
static_cast<gfxXlibSurface*>(mCurrentSurface.get())->
|
||||
GetColormapAndVisual(&colormap, &visual);
|
||||
// Create helper surface if layer surface visual not same as default
|
||||
@ -2866,7 +2866,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
|
||||
visual = defaultVisual;
|
||||
mDoAlphaExtraction = mIsTransparent;
|
||||
}
|
||||
} else if (mCurrentSurface->GetType() == gfxSurfaceTypeImage) {
|
||||
} else if (mCurrentSurface->GetType() == gfxSurfaceType::Image) {
|
||||
// For image layer surface we should always create helper surface
|
||||
createHelperSurface = true;
|
||||
// Check if we can create helper surface with non-default visual
|
||||
@ -3014,7 +3014,7 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
|
||||
#ifdef MOZ_X11
|
||||
Visual* visual = nullptr;
|
||||
Colormap colormap = 0;
|
||||
if (curSurface && curSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (curSurface && curSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
static_cast<gfxXlibSurface*>(curSurface.get())->
|
||||
GetColormapAndVisual(&colormap, &visual);
|
||||
if (visual != mWsInfo.visual || colormap != mWsInfo.colormap) {
|
||||
@ -3106,7 +3106,7 @@ PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
|
||||
|
||||
#ifdef MOZ_X11
|
||||
{
|
||||
NS_ASSERTION(aSurface->GetType() == gfxSurfaceTypeXlib,
|
||||
NS_ASSERTION(aSurface->GetType() == gfxSurfaceType::Xlib,
|
||||
"Non supported platform surface type");
|
||||
|
||||
NPEvent pluginEvent;
|
||||
@ -3208,7 +3208,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
|
||||
// recovered directly to it, do that to save a tmp surface and
|
||||
// copy.
|
||||
bool useSurfaceSubimageForBlack = false;
|
||||
if (gfxSurfaceTypeImage == aSurface->GetType()) {
|
||||
if (gfxSurfaceType::Image == aSurface->GetType()) {
|
||||
gfxImageSurface* surfaceAsImage =
|
||||
static_cast<gfxImageSurface*>(aSurface);
|
||||
useSurfaceSubimageForBlack =
|
||||
@ -3484,7 +3484,7 @@ PluginInstanceChild::ShowPluginFrame()
|
||||
(uint16_t)rect.YMost(), (uint16_t)rect.XMost() };
|
||||
SurfaceDescriptor currSurf;
|
||||
#ifdef MOZ_X11
|
||||
if (mCurrentSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (mCurrentSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mCurrentSurface.get());
|
||||
currSurf = SurfaceDescriptorX11(xsurf);
|
||||
// Need to sync all pending x-paint requests
|
||||
@ -3536,7 +3536,7 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
|
||||
// We can read safely from XSurface,SharedDIBSurface and Unsafe SharedMemory,
|
||||
// because PluginHost is not able to modify that surface
|
||||
#if defined(MOZ_X11)
|
||||
if (mBackSurface->GetType() != gfxSurfaceTypeXlib &&
|
||||
if (mBackSurface->GetType() != gfxSurfaceType::Xlib &&
|
||||
!gfxSharedImageSurface::IsSharedImage(mBackSurface))
|
||||
return false;
|
||||
#elif defined(XP_WIN)
|
||||
|
@ -611,7 +611,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
|
||||
// the plugin. We might still have drawing operations
|
||||
// referencing it.
|
||||
#ifdef MOZ_X11
|
||||
if (mFrontSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (mFrontSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
// Finish with the surface and XSync here to ensure the server has
|
||||
// finished operations on the surface before the plugin starts
|
||||
// scribbling on it again, or worse, destroys it.
|
||||
|
@ -257,7 +257,7 @@ GLXLibrary::SupportsTextureFromPixmap(gfxASurface* aSurface)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aSurface->GetType() != gfxSurfaceTypeXlib || !mUseTextureFromPixmap) {
|
||||
if (aSurface->GetType() != gfxSurfaceType::Xlib || !mUseTextureFromPixmap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ TextureImageEGL::EndUpdate()
|
||||
nsRefPtr<gfxImageSurface> uploadImage = nullptr;
|
||||
gfxIntSize updateSize(mUpdateRect.width, mUpdateRect.height);
|
||||
|
||||
NS_ASSERTION(mUpdateSurface->GetType() == gfxSurfaceTypeImage &&
|
||||
NS_ASSERTION(mUpdateSurface->GetType() == gfxSurfaceType::Image &&
|
||||
mUpdateSurface->GetSize() == updateSize,
|
||||
"Upload image isn't an image surface when one is expected, or is wrong size!");
|
||||
|
||||
|
@ -196,9 +196,9 @@ struct ParamTraits<gfxContentType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<gfxSurfaceType>
|
||||
: public EnumSerializer<gfxSurfaceType,
|
||||
gfxSurfaceTypeImage,
|
||||
gfxSurfaceTypeMax>
|
||||
: public TypedEnumSerializer<gfxSurfaceType,
|
||||
gfxSurfaceType::Image,
|
||||
gfxSurfaceType::Max>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
@ -57,7 +57,7 @@ bool
|
||||
SharedDIBSurface::IsSharedDIBSurface(gfxASurface* aSurface)
|
||||
{
|
||||
return aSurface &&
|
||||
aSurface->GetType() == gfxSurfaceTypeImage &&
|
||||
aSurface->GetType() == gfxSurfaceType::Image &&
|
||||
aSurface->GetData(&SHAREDDIB_KEY);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ PaintContext(gfxPattern* aPattern,
|
||||
// correctness and use NONE.
|
||||
if (aContext->IsCairo()) {
|
||||
nsRefPtr<gfxASurface> target = aContext->CurrentSurface();
|
||||
if (target->GetType() == gfxSurfaceTypeXlib &&
|
||||
if (target->GetType() == gfxSurfaceType::Xlib &&
|
||||
static_cast<gfxXlibSurface*>(target.get())->IsPadSlow()) {
|
||||
extend = gfxPattern::EXTEND_NONE;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ CanvasLayerD3D10::Initialize(const Data& aData)
|
||||
|
||||
mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
|
||||
|
||||
if (mSurface && mSurface->GetType() == gfxSurfaceTypeD2D) {
|
||||
if (mSurface && mSurface->GetType() == gfxSurfaceType::D2D) {
|
||||
void *data = mSurface->GetData(&gKeyD3D10Texture);
|
||||
if (data) {
|
||||
mTexture = static_cast<ID3D10Texture2D*>(data);
|
||||
|
@ -57,7 +57,7 @@ SurfaceToTexture(ID3D10Device *aDevice,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aSurface->GetType() == gfxSurfaceTypeD2D) {
|
||||
if (aSurface->GetType() == gfxSurfaceType::D2D) {
|
||||
void *data = aSurface->GetData(&gKeyD3D10Texture);
|
||||
if (data) {
|
||||
nsRefPtr<ID3D10Texture2D> texture = static_cast<ID3D10Texture2D*>(data);
|
||||
|
@ -132,9 +132,9 @@ CanvasLayerD3D9::UpdateSurface()
|
||||
|
||||
nsRefPtr<gfxImageSurface> sourceSurface;
|
||||
|
||||
if (mSurface->GetType() == gfxSurfaceTypeWin32) {
|
||||
if (mSurface->GetType() == gfxSurfaceType::Win32) {
|
||||
sourceSurface = mSurface->GetAsImageSurface();
|
||||
} else if (mSurface->GetType() == gfxSurfaceTypeImage) {
|
||||
} else if (mSurface->GetType() == gfxSurfaceType::Image) {
|
||||
sourceSurface = static_cast<gfxImageSurface*>(mSurface.get());
|
||||
if (sourceSurface->Format() != gfxImageFormat::ARGB32 &&
|
||||
sourceSurface->Format() != gfxImageFormat::RGB24)
|
||||
|
@ -49,7 +49,7 @@ UsingXCompositing()
|
||||
if (!PR_GetEnv("MOZ_LAYERS_ENABLE_XLIB_SURFACES")) {
|
||||
return false;
|
||||
}
|
||||
return (gfxSurfaceTypeXlib ==
|
||||
return (gfxSurfaceType::Xlib ==
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType());
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
nsRefPtr<gfxASurface> buffer =
|
||||
platform->CreateOffscreenSurface(gfx::ThebesIntSize(aSize), aContent);
|
||||
if (!buffer ||
|
||||
buffer->GetType() != gfxSurfaceTypeXlib) {
|
||||
buffer->GetType() != gfxSurfaceType::Xlib) {
|
||||
NS_ERROR("creating Xlib front/back surfaces failed!");
|
||||
return false;
|
||||
}
|
||||
|
@ -307,14 +307,14 @@ nsDeviceContext::SetDPI()
|
||||
// Use a printing DC to determine the other dpi values
|
||||
if (mPrintingSurface) {
|
||||
switch (mPrintingSurface->GetType()) {
|
||||
case gfxSurfaceTypePDF:
|
||||
case gfxSurfaceTypePS:
|
||||
case gfxSurfaceTypeQuartz:
|
||||
case gfxSurfaceType::PDF:
|
||||
case gfxSurfaceType::PS:
|
||||
case gfxSurfaceType::Quartz:
|
||||
dpi = 72.0f;
|
||||
break;
|
||||
#ifdef XP_WIN
|
||||
case gfxSurfaceTypeWin32:
|
||||
case gfxSurfaceTypeWin32Printing: {
|
||||
case gfxSurfaceType::Win32:
|
||||
case gfxSurfaceType::Win32Printing: {
|
||||
HDC dc = reinterpret_cast<gfxWindowsSurface*>(mPrintingSurface.get())->GetDC();
|
||||
int32_t OSVal = GetDeviceCaps(dc, LOGPIXELSY);
|
||||
dpi = 144.0f;
|
||||
@ -323,7 +323,7 @@ nsDeviceContext::SetDPI()
|
||||
}
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
case gfxSurfaceTypeOS2: {
|
||||
case gfxSurfaceType::OS2: {
|
||||
LONG lDPI;
|
||||
HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS());
|
||||
if (DevQueryCaps(dc, CAPS_VERTICAL_FONT_RES, 1, &lDPI))
|
||||
@ -655,35 +655,35 @@ nsDeviceContext::CalcPrintingSize()
|
||||
|
||||
gfxSize size(0, 0);
|
||||
switch (mPrintingSurface->GetType()) {
|
||||
case gfxSurfaceTypeImage:
|
||||
case gfxSurfaceType::Image:
|
||||
inPoints = false;
|
||||
size = reinterpret_cast<gfxImageSurface*>(mPrintingSurface.get())->GetSize();
|
||||
break;
|
||||
|
||||
#if defined(MOZ_PDF_PRINTING)
|
||||
case gfxSurfaceTypePDF:
|
||||
case gfxSurfaceType::PDF:
|
||||
inPoints = true;
|
||||
size = reinterpret_cast<gfxPDFSurface*>(mPrintingSurface.get())->GetSize();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
case gfxSurfaceTypePS:
|
||||
case gfxSurfaceType::PS:
|
||||
inPoints = true;
|
||||
size = reinterpret_cast<gfxPSSurface*>(mPrintingSurface.get())->GetSize();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
case gfxSurfaceTypeQuartz:
|
||||
case gfxSurfaceType::Quartz:
|
||||
inPoints = true; // this is really only true when we're printing
|
||||
size = reinterpret_cast<gfxQuartzSurface*>(mPrintingSurface.get())->GetSize();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
case gfxSurfaceTypeWin32:
|
||||
case gfxSurfaceTypeWin32Printing:
|
||||
case gfxSurfaceType::Win32:
|
||||
case gfxSurfaceType::Win32Printing:
|
||||
{
|
||||
inPoints = false;
|
||||
HDC dc = reinterpret_cast<gfxWindowsSurface*>(mPrintingSurface.get())->GetDC();
|
||||
@ -699,7 +699,7 @@ nsDeviceContext::CalcPrintingSize()
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
case gfxSurfaceTypeOS2:
|
||||
case gfxSurfaceType::OS2:
|
||||
{
|
||||
inPoints = false;
|
||||
// we already set the size in the surface constructor we set for
|
||||
|
@ -619,17 +619,17 @@ static const SurfaceMemoryReporterAttrs sSurfaceMemoryReporterAttrs[] = {
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sSurfaceMemoryReporterAttrs) ==
|
||||
gfxSurfaceTypeMax);
|
||||
size_t(gfxSurfaceType::Max));
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
PR_STATIC_ASSERT(uint32_t(CAIRO_SURFACE_TYPE_D2D) ==
|
||||
uint32_t(gfxSurfaceTypeD2D));
|
||||
uint32_t(gfxSurfaceType::D2D));
|
||||
#endif
|
||||
PR_STATIC_ASSERT(uint32_t(CAIRO_SURFACE_TYPE_SKIA) ==
|
||||
uint32_t(gfxSurfaceTypeSkia));
|
||||
uint32_t(gfxSurfaceType::Skia));
|
||||
|
||||
/* Surface size memory reporting */
|
||||
|
||||
static int64_t gSurfaceMemoryUsed[gfxSurfaceTypeMax] = { 0 };
|
||||
static int64_t gSurfaceMemoryUsed[size_t(gfxSurfaceType::Max)] = { 0 };
|
||||
|
||||
class SurfaceMemoryReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
{
|
||||
@ -668,7 +668,7 @@ void
|
||||
gfxASurface::RecordMemoryUsedForSurfaceType(gfxSurfaceType aType,
|
||||
int32_t aBytes)
|
||||
{
|
||||
if (aType < 0 || aType >= gfxSurfaceTypeMax) {
|
||||
if (int(aType) < 0 || aType >= gfxSurfaceType::Max) {
|
||||
NS_WARNING("Invalid type to RecordMemoryUsedForSurfaceType!");
|
||||
return;
|
||||
}
|
||||
@ -679,7 +679,7 @@ gfxASurface::RecordMemoryUsedForSurfaceType(gfxSurfaceType aType,
|
||||
registered = true;
|
||||
}
|
||||
|
||||
gSurfaceMemoryUsed[aType] += aBytes;
|
||||
gSurfaceMemoryUsed[size_t(aType)] += aBytes;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
static bool IsSharedImage(gfxASurface *aSurface)
|
||||
{
|
||||
return (aSurface
|
||||
&& aSurface->GetType() == gfxSurfaceTypeImage
|
||||
&& aSurface->GetType() == gfxSurfaceType::Image
|
||||
&& aSurface->GetData(&SHM_KEY));
|
||||
}
|
||||
|
||||
|
@ -1611,14 +1611,14 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content)
|
||||
if (content == GFX_CONTENT_COLOR_ALPHA &&
|
||||
!(GetFlags() & FLAG_DISABLE_COPY_BACKGROUND)) {
|
||||
nsRefPtr<gfxASurface> s = CurrentSurface();
|
||||
if ((s->GetAllowUseAsSource() || s->GetType() == gfxSurfaceTypeTee) &&
|
||||
if ((s->GetAllowUseAsSource() || s->GetType() == gfxSurfaceType::Tee) &&
|
||||
(s->GetContentType() == GFX_CONTENT_COLOR ||
|
||||
s->GetOpaqueRect().Contains(GetRoundOutDeviceClipExtents(this)))) {
|
||||
cairo_push_group_with_content(mCairo, CAIRO_CONTENT_COLOR);
|
||||
nsRefPtr<gfxASurface> d = CurrentSurface();
|
||||
|
||||
if (d->GetType() == gfxSurfaceTypeTee) {
|
||||
NS_ASSERTION(s->GetType() == gfxSurfaceTypeTee, "Mismatched types");
|
||||
if (d->GetType() == gfxSurfaceType::Tee) {
|
||||
NS_ASSERTION(s->GetType() == gfxSurfaceType::Tee, "Mismatched types");
|
||||
nsAutoTArray<nsRefPtr<gfxASurface>,2> ss;
|
||||
nsAutoTArray<nsRefPtr<gfxASurface>,2> ds;
|
||||
static_cast<gfxTeeSurface*>(s.get())->GetSurfaces(&ss);
|
||||
|
@ -75,7 +75,7 @@ PreparePatternForUntiledDrawing(gfxPattern* aPattern,
|
||||
switch (currentTarget->GetType()) {
|
||||
|
||||
#ifdef MOZ_X11
|
||||
case gfxSurfaceTypeXlib:
|
||||
case gfxSurfaceType::Xlib:
|
||||
{
|
||||
// See bugs 324698, 422179, and 468496. This is a workaround for
|
||||
// XRender's RepeatPad not being implemented correctly on old X
|
||||
|
@ -668,7 +668,7 @@ gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSi
|
||||
#ifdef XP_MACOSX
|
||||
// this is a bit of a hack that assumes that the buffer associated with the CGContext
|
||||
// will live around long enough that nothing bad will happen.
|
||||
if (aSurface->GetType() == gfxSurfaceTypeQuartz) {
|
||||
if (aSurface->GetType() == gfxSurfaceType::Quartz) {
|
||||
return Factory::CreateDrawTargetForCairoCGContext(static_cast<gfxQuartzSurface*>(aSurface)->GetCGContext(), aSize);
|
||||
}
|
||||
#endif
|
||||
@ -758,7 +758,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
RefPtr<SourceSurface> srcBuffer;
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (aSurface->GetType() == gfxSurfaceTypeD2D &&
|
||||
if (aSurface->GetType() == gfxSurfaceType::D2D &&
|
||||
format != SurfaceFormat::A8) {
|
||||
NativeSurface surf;
|
||||
surf.mFormat = format;
|
||||
@ -791,7 +791,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
nsRefPtr<gfxImageSurface> imgSurface = aSurface->GetAsImageSurface();
|
||||
|
||||
bool isWin32ImageSurf = imgSurface &&
|
||||
aSurface->GetType() == gfxSurfaceTypeWin32;
|
||||
aSurface->GetType() == gfxSurfaceType::Win32;
|
||||
|
||||
if (!imgSurface) {
|
||||
imgSurface = new gfxImageSurface(aSurface->GetSize(), OptimalFormatForContent(aSurface->GetContentType()));
|
||||
|
@ -74,7 +74,7 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
|
||||
// rendering to our own CGContextRef; in most cases, we are able to
|
||||
// use the CGContextRef from the surface directly. we can extend
|
||||
// this to support offscreen drawing fairly easily in the future.
|
||||
if (surf->GetType() == gfxSurfaceTypeQuartz &&
|
||||
if (surf->GetType() == gfxSurfaceType::Quartz &&
|
||||
(surf->GetContentType() == GFX_CONTENT_COLOR ||
|
||||
(surf->GetContentType() == GFX_CONTENT_COLOR_ALPHA))) {
|
||||
mQuartzSurface = static_cast<gfxQuartzSurface*>(surf.get());
|
||||
|
@ -58,34 +58,34 @@ MOZ_BEGIN_ENUM_CLASS(gfxImageFormat)
|
||||
Unknown
|
||||
MOZ_END_ENUM_CLASS(gfxImageFormat)
|
||||
|
||||
enum gfxSurfaceType {
|
||||
gfxSurfaceTypeImage,
|
||||
gfxSurfaceTypePDF,
|
||||
gfxSurfaceTypePS,
|
||||
gfxSurfaceTypeXlib,
|
||||
gfxSurfaceTypeXcb,
|
||||
gfxSurfaceTypeGlitz, // unused, but needed for cairo parity
|
||||
gfxSurfaceTypeQuartz,
|
||||
gfxSurfaceTypeWin32,
|
||||
gfxSurfaceTypeBeOS,
|
||||
gfxSurfaceTypeDirectFB, // unused, but needed for cairo parity
|
||||
gfxSurfaceTypeSVG,
|
||||
gfxSurfaceTypeOS2,
|
||||
gfxSurfaceTypeWin32Printing,
|
||||
gfxSurfaceTypeQuartzImage,
|
||||
gfxSurfaceTypeScript,
|
||||
gfxSurfaceTypeQPainter,
|
||||
gfxSurfaceTypeRecording,
|
||||
gfxSurfaceTypeVG,
|
||||
gfxSurfaceTypeGL,
|
||||
gfxSurfaceTypeDRM,
|
||||
gfxSurfaceTypeTee,
|
||||
gfxSurfaceTypeXML,
|
||||
gfxSurfaceTypeSkia,
|
||||
gfxSurfaceTypeSubsurface,
|
||||
gfxSurfaceTypeD2D,
|
||||
gfxSurfaceTypeMax
|
||||
};
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxSurfaceType)
|
||||
Image,
|
||||
PDF,
|
||||
PS,
|
||||
Xlib,
|
||||
Xcb,
|
||||
Glitz, // unused, but needed for cairo parity
|
||||
Quartz,
|
||||
Win32,
|
||||
BeOS,
|
||||
DirectFB, // unused, but needed for cairo parity
|
||||
SVG,
|
||||
OS2,
|
||||
Win32Printing,
|
||||
QuartzImage,
|
||||
Script,
|
||||
QPainter,
|
||||
Recording,
|
||||
VG,
|
||||
GL,
|
||||
DRM,
|
||||
Tee,
|
||||
XML,
|
||||
Skia,
|
||||
Subsurface,
|
||||
D2D,
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(gfxSurfaceType)
|
||||
|
||||
enum gfxContentType {
|
||||
GFX_CONTENT_COLOR = 0x1000,
|
||||
|
@ -283,7 +283,7 @@ struct MOZ_STACK_CLASS AutoCairoPixmanBugWorkaround
|
||||
: mContext(aContext), mSucceeded(true), mPushedGroup(false)
|
||||
{
|
||||
// Quartz's limits for matrix are much larger than pixman
|
||||
if (!aSurface || aSurface->GetType() == gfxSurfaceTypeQuartz)
|
||||
if (!aSurface || aSurface->GetType() == gfxSurfaceType::Quartz)
|
||||
return;
|
||||
|
||||
if (!IsSafeImageTransformComponent(aDeviceSpaceToImageSpace.xx) ||
|
||||
|
@ -59,8 +59,8 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
||||
// redirect rendering to our own HDC; in some cases,
|
||||
// we may be able to use the HDC from the surface directly.
|
||||
if (surf &&
|
||||
((surf->GetType() == gfxSurfaceTypeWin32 ||
|
||||
surf->GetType() == gfxSurfaceTypeWin32Printing) &&
|
||||
((surf->GetType() == gfxSurfaceType::Win32 ||
|
||||
surf->GetType() == gfxSurfaceType::Win32Printing) &&
|
||||
(surf->GetContentType() == GFX_CONTENT_COLOR ||
|
||||
(surf->GetContentType() == GFX_CONTENT_COLOR_ALPHA &&
|
||||
(mNativeDrawFlags & CAN_DRAW_TO_COLOR_ALPHA)))))
|
||||
@ -192,8 +192,8 @@ gfxWindowsNativeDrawing::IsDoublePass()
|
||||
nsRefPtr<gfxASurface> surf = mContext->CurrentSurface(&mDeviceOffset.x, &mDeviceOffset.y);
|
||||
if (!surf || surf->CairoStatus())
|
||||
return false;
|
||||
if (surf->GetType() != gfxSurfaceTypeWin32 &&
|
||||
surf->GetType() != gfxSurfaceTypeWin32Printing) {
|
||||
if (surf->GetType() != gfxSurfaceType::Win32 &&
|
||||
surf->GetType() != gfxSurfaceType::Win32Printing) {
|
||||
return true;
|
||||
}
|
||||
if ((surf->GetContentType() != GFX_CONTENT_COLOR ||
|
||||
|
@ -62,8 +62,8 @@ struct DCFromContext {
|
||||
nsRefPtr<gfxASurface> aSurface = aContext->CurrentSurface();
|
||||
NS_ASSERTION(aSurface || !aContext->IsCairo(), "DCFromContext: null surface");
|
||||
if (aSurface &&
|
||||
(aSurface->GetType() == gfxSurfaceTypeWin32 ||
|
||||
aSurface->GetType() == gfxSurfaceTypeWin32Printing))
|
||||
(aSurface->GetType() == gfxSurfaceType::Win32 ||
|
||||
aSurface->GetType() == gfxSurfaceType::Win32Printing))
|
||||
{
|
||||
dc = static_cast<gfxWindowsSurface*>(aSurface.get())->GetDC();
|
||||
needsRelease = false;
|
||||
|
@ -1073,8 +1073,8 @@ nsCSSBorderRenderer::CreateCornerGradient(mozilla::css::Corner aCorner,
|
||||
float gradientOffset;
|
||||
|
||||
if (mContext->IsCairo() &&
|
||||
(mContext->OriginalSurface()->GetType() == gfxSurfaceTypeD2D ||
|
||||
mContext->OriginalSurface()->GetType() == gfxSurfaceTypeQuartz))
|
||||
(mContext->OriginalSurface()->GetType() == gfxSurfaceType::D2D ||
|
||||
mContext->OriginalSurface()->GetType() == gfxSurfaceType::Quartz))
|
||||
{
|
||||
// On quarz this doesn't do exactly the right thing, but it does do what
|
||||
// most other browsers do and doing the 'right' thing seems to be
|
||||
|
@ -138,7 +138,7 @@ nsImageToPixbuf::SurfaceToPixbuf(gfxASurface* aSurface, int32_t aWidth, int32_t
|
||||
}
|
||||
|
||||
nsRefPtr<gfxImageSurface> imgSurface;
|
||||
if (aSurface->GetType() == gfxSurfaceTypeImage) {
|
||||
if (aSurface->GetType() == gfxSurfaceType::Image) {
|
||||
imgSurface = static_cast<gfxImageSurface*>
|
||||
(static_cast<gfxASurface*>(aSurface));
|
||||
} else {
|
||||
|
@ -2160,7 +2160,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
CreateDrawTargetForSurface(surf, intSize));
|
||||
} else if (gfxPlatform::GetPlatform()->
|
||||
SupportsAzureContentForType(BackendType::SKIA) &&
|
||||
surf->GetType() != gfxSurfaceTypeImage) {
|
||||
surf->GetType() != gfxSurfaceType::Image) {
|
||||
gfxImageSurface* imgSurf = static_cast<gfxImageSurface*>(surf);
|
||||
SurfaceFormat format = ImageFormatToSurfaceFormat(imgSurf->Format());
|
||||
IntSize intSize(surf->GetSize().width, surf->GetSize().height);
|
||||
|
@ -93,7 +93,7 @@ nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||
nsRefPtr<gfxASurface> surface = context->CurrentSurface();
|
||||
|
||||
#ifdef CAIRO_HAS_QT_SURFACE
|
||||
if (surface->GetType() == gfxSurfaceTypeQPainter) {
|
||||
if (surface->GetType() == gfxSurfaceType::QPainter) {
|
||||
gfxQPainterSurface* qSurface = (gfxQPainterSurface*) (surface.get());
|
||||
QPainter *painter = qSurface->GetQPainter();
|
||||
NS_ASSERTION(painter, "Where'd my QPainter go?");
|
||||
@ -104,7 +104,7 @@ nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||
aRect, aClipRect);
|
||||
} else
|
||||
#endif
|
||||
if (surface->GetType() == gfxSurfaceTypeImage) {
|
||||
if (surface->GetType() == gfxSurfaceType::Image) {
|
||||
gfxImageSurface* qSurface = (gfxImageSurface*) (surface.get());
|
||||
QImage tempQImage(qSurface->Data(),
|
||||
qSurface->Width(),
|
||||
@ -117,7 +117,7 @@ nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||
aRect, aClipRect);
|
||||
}
|
||||
#if defined(MOZ_X11) && defined(Q_WS_X11)
|
||||
else if (surface->GetType() == gfxSurfaceTypeXlib) {
|
||||
else if (surface->GetType() == gfxSurfaceType::Xlib) {
|
||||
gfxXlibSurface* qSurface = (gfxXlibSurface*) (surface.get());
|
||||
QPixmap pixmap(QPixmap::fromX11Pixmap(qSurface->XDrawable()));
|
||||
QPainter painter(&pixmap);
|
||||
|
@ -289,7 +289,7 @@ UpdateOffScreenBuffers(int aDepth, QSize aSize, QWidget* aWidget = nullptr)
|
||||
#ifdef MOZ_HAVE_SHMIMAGE
|
||||
if (aWidget) {
|
||||
if (gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType() ==
|
||||
gfxSurfaceTypeImage) {
|
||||
gfxSurfaceType::Image) {
|
||||
gShmImage = nsShmImage::Create(gBufferMaxSize,
|
||||
DefaultVisualOfScreen(gfxQtPlatform::GetXScreen(aWidget)),
|
||||
aDepth);
|
||||
@ -1097,7 +1097,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
// Handle buffered painting mode
|
||||
if (renderMode == gfxQtPlatform::RENDER_BUFFERED) {
|
||||
#if defined(MOZ_X11) && defined(Q_WS_X11)
|
||||
if (gBufferSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (gBufferSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
// Paint offscreen pixmap to QPainter
|
||||
static QPixmap gBufferPixmap;
|
||||
Drawable draw = static_cast<gfxXlibSurface*>(gBufferSurface.get())->XDrawable();
|
||||
@ -1109,7 +1109,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
|
||||
} else
|
||||
#endif
|
||||
if (gBufferSurface->GetType() == gfxSurfaceTypeImage) {
|
||||
if (gBufferSurface->GetType() == gfxSurfaceType::Image) {
|
||||
// in raster mode we can just wrap gBufferImage as QImage and paint directly
|
||||
gfxImageSurface *imgs = static_cast<gfxImageSurface*>(gBufferSurface.get());
|
||||
QImage img(imgs->Data(),
|
||||
@ -1123,7 +1123,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
} else if (renderMode == gfxQtPlatform::RENDER_DIRECT) {
|
||||
QRect trans = aPainter->transform().mapRect(r).toRect();
|
||||
#ifdef MOZ_X11
|
||||
if (gBufferSurface->GetType() == gfxSurfaceTypeXlib) {
|
||||
if (gBufferSurface->GetType() == gfxSurfaceType::Xlib) {
|
||||
nsRefPtr<gfxASurface> widgetSurface = GetSurfaceForQWidget(aWidget);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(widgetSurface);
|
||||
ctx->SetSource(gBufferSurface);
|
||||
@ -1132,7 +1132,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
ctx->Fill();
|
||||
} else
|
||||
#endif
|
||||
if (gBufferSurface->GetType() == gfxSurfaceTypeImage) {
|
||||
if (gBufferSurface->GetType() == gfxSurfaceType::Image) {
|
||||
#ifdef MOZ_HAVE_SHMIMAGE
|
||||
if (gShmImage) {
|
||||
gShmImage->Put(aWidget, trans);
|
||||
|
@ -25,7 +25,7 @@ static bool gShmAvailable = true;
|
||||
bool nsShmImage::UseShm()
|
||||
{
|
||||
return gfxPlatform::GetPlatform()->
|
||||
ScreenReferenceSurface()->GetType() == gfxSurfaceTypeImage
|
||||
ScreenReferenceSurface()->GetType() == gfxSurfaceType::Image
|
||||
&& gShmAvailable;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user