Skip to content

Commit 55d6cf1

Browse files
author
Benoit Jacob
committed
Bug 913872 - Take nested enums out of gfxASurface - 1/3 : automatic changes - r=jrmuizel
Generated by these regexes: find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(ImageFormat\|SurfaceType\|ContentType\|MemoryLocation\)[0-9A-Za-z_]*\)/gfx\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(CONTENT_\|MEMORY_\)[0-9A-Za-z_]*\)/GFX_\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(CONTENT_COLOR\|CONTENT_ALPHA\|CONTENT_COLOR_ALPHA\|CONTENT_SENTINEL\|MEMORY_IN_PROCESS_HEAP\|MEMORY_IN_PROCESS_NONHEAP\|MEMORY_OUT_OF_PROCESS\)\($\|[^A-Za-z0-9_]\)/\1GFX_\2\3/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(ImageFormatARGB32\|ImageFormatRGB24\|ImageFormatA8\|ImageFormatA1\|ImageFormatRGB16_565\|ImageFormatUnknown\|SurfaceTypeImage\|SurfaceTypePDF\|SurfaceTypePS\|SurfaceTypeXlib\|SurfaceTypeXcb\|SurfaceTypeGlitz\|SurfaceTypeQuartz\|SurfaceTypeWin32\|SurfaceTypeBeOS\|SurfaceTypeDirectFB\|SurfaceTypeSVG\|SurfaceTypeOS2\|SurfaceTypeWin32Printing\|SurfaceTypeQuartzImage\|SurfaceTypeScript\|SurfaceTypeQPainter\|SurfaceTypeRecording\|SurfaceTypeVG\|SurfaceTypeGL\|SurfaceTypeDRM\|SurfaceTypeTee\|SurfaceTypeXML\|SurfaceTypeSkia\|SurfaceTypeSubsurface\|SurfaceTypeD2D\|SurfaceTypeMax\)\($\|[^A-Za-z0-9_]\)/\1gfx\2\3/g'
1 parent 0bda204 commit 55d6cf1

File tree

207 files changed

+922
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+922
-922
lines changed

content/canvas/src/CanvasRenderingContext2D.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
10781078
new gfxImageSurface(imageBuffer.get(),
10791079
gfxIntSize(mWidth, mHeight),
10801080
mWidth * 4,
1081-
gfxASurface::ImageFormatARGB32);
1081+
gfxImageFormatARGB32);
10821082

10831083
if (!imgsurf || imgsurf->CairoStatus()) {
10841084
return NS_ERROR_FAILURE;
@@ -3258,7 +3258,7 @@ CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* window, double x,
32583258
} else {
32593259
drawSurf =
32603260
gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(ceil(sw), ceil(sh)),
3261-
gfxASurface::CONTENT_COLOR_ALPHA);
3261+
GFX_CONTENT_COLOR_ALPHA);
32623262
if (!drawSurf) {
32633263
error.Throw(NS_ERROR_FAILURE);
32643264
return;
@@ -3678,7 +3678,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w
36783678
}
36793679

36803680
nsRefPtr<gfxImageSurface> imgsurf = new gfxImageSurface(gfxIntSize(w, h),
3681-
gfxASurface::ImageFormatARGB32,
3681+
gfxImageFormatARGB32,
36823682
false);
36833683
if (!imgsurf || imgsurf->CairoStatus()) {
36843684
return NS_ERROR_FAILURE;

content/canvas/src/DocumentRendererChild.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
7171
new gfxImageSurface(reinterpret_cast<uint8_t*>(data.BeginWriting()),
7272
gfxIntSize(renderSize.width, renderSize.height),
7373
4 * renderSize.width,
74-
gfxASurface::ImageFormatARGB32);
74+
gfxImageFormatARGB32);
7575
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
7676
ctx->SetMatrix(transform);
7777

content/canvas/src/DocumentRendererParent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
3232
new gfxImageSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
3333
gfxIntSize(aSize.width, aSize.height),
3434
aSize.width * 4,
35-
gfxASurface::ImageFormatARGB32);
35+
gfxImageFormatARGB32);
3636
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
3737

3838
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));

content/canvas/src/WebGLContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ WebGLContext::Render(gfxContext *ctx, gfxPattern::GraphicsFilter f, uint32_t aFl
601601
return NS_OK;
602602

603603
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
604-
gfxASurface::ImageFormatARGB32);
604+
gfxImageFormatARGB32);
605605
if (surf->CairoStatus() != 0)
606606
return NS_ERROR_FAILURE;
607607

@@ -731,7 +731,7 @@ WebGLContext::GetInputStream(const char* aMimeType,
731731
return NS_ERROR_FAILURE;
732732

733733
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
734-
gfxASurface::ImageFormatARGB32);
734+
gfxImageFormatARGB32);
735735
if (surf->CairoStatus() != 0)
736736
return NS_ERROR_FAILURE;
737737

content/canvas/src/WebGLContextGL.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
25322532
{
25332533
if (!res.mSurface)
25342534
return NS_ERROR_FAILURE;
2535-
if (res.mSurface->GetType() != gfxASurface::SurfaceTypeImage) {
2535+
if (res.mSurface->GetType() != gfxSurfaceTypeImage) {
25362536
// SurfaceFromElement lied!
25372537
return NS_ERROR_FAILURE;
25382538
}
@@ -2578,16 +2578,16 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
25782578
*imageOut = surf;
25792579

25802580
switch (surf->Format()) {
2581-
case gfxASurface::ImageFormatARGB32:
2581+
case gfxImageFormatARGB32:
25822582
*format = WebGLTexelConversions::BGRA8; // careful, our ARGB means BGRA
25832583
break;
2584-
case gfxASurface::ImageFormatRGB24:
2584+
case gfxImageFormatRGB24:
25852585
*format = WebGLTexelConversions::BGRX8; // careful, our RGB24 is not tightly packed. Whence BGRX8.
25862586
break;
2587-
case gfxASurface::ImageFormatA8:
2587+
case gfxImageFormatA8:
25882588
*format = WebGLTexelConversions::A8;
25892589
break;
2590-
case gfxASurface::ImageFormatRGB16_565:
2590+
case gfxImageFormatRGB16_565:
25912591
*format = WebGLTexelConversions::RGB565;
25922592
break;
25932593
default:

content/html/content/src/HTMLCanvasElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ HTMLCanvasElement::ExtractData(const nsAString& aType,
398398
nsRefPtr<gfxImageSurface> emptyCanvas;
399399
nsIntSize size = GetWidthHeight();
400400
if (!mCurrentContext) {
401-
emptyCanvas = new gfxImageSurface(gfxIntSize(size.width, size.height), gfxASurface::ImageFormatARGB32);
401+
emptyCanvas = new gfxImageSurface(gfxIntSize(size.width, size.height), gfxImageFormatARGB32);
402402
if (emptyCanvas->CairoStatus()) {
403403
return NS_ERROR_INVALID_ARG;
404404
}

content/media/plugins/MediaPluginReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ MediaPluginReader::ImageBufferCallback::operator()(size_t aWidth, size_t aHeight
363363
case MPAPI::RGB565:
364364
rgbImage = mozilla::layers::CreateSharedRGBImage(mImageContainer,
365365
nsIntSize(aWidth, aHeight),
366-
gfxASurface::ImageFormatRGB16_565);
366+
gfxImageFormatRGB16_565);
367367
if (!rgbImage) {
368368
NS_WARNING("Could not create rgb image");
369369
return nullptr;

content/svg/content/src/nsSVGFilters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ nsSVGFE::SetupScalingFilter(nsSVGFilterInstance *aInstance,
155155
nsIntRect(nsIntPoint(), scaledSize));
156156

157157
result.mSource = new gfxImageSurface(scaledSize,
158-
gfxASurface::ImageFormatARGB32);
158+
gfxImageFormatARGB32);
159159
result.mTarget = new gfxImageSurface(scaledSize,
160-
gfxASurface::ImageFormatARGB32);
160+
gfxImageFormatARGB32);
161161
if (!result.mSource || result.mSource->CairoStatus() ||
162162
!result.mTarget || result.mTarget->CairoStatus()) {
163163
result.mSource = nullptr;

dom/plugins/base/nsPluginInstanceOwner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2682,7 +2682,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
26822682
aFrameRect.height != pluginSurface->Height()) {
26832683

26842684
pluginSurface = new gfxImageSurface(gfxIntSize(aFrameRect.width, aFrameRect.height),
2685-
gfxImageSurface::ImageFormatARGB32);
2685+
gfxImageFormatARGB32);
26862686
if (!pluginSurface)
26872687
return;
26882688
}

dom/plugins/ipc/PluginInstanceChild.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
135135
#endif
136136
, mAccumulatedInvalidRect(0,0,0,0)
137137
, mIsTransparent(false)
138-
, mSurfaceType(gfxASurface::SurfaceTypeMax)
138+
, mSurfaceType(gfxSurfaceTypeMax)
139139
, mCurrentInvalidateTask(nullptr)
140140
, mCurrentAsyncSetWindowTask(nullptr)
141141
, mPendingPluginCall(false)
@@ -2770,26 +2770,26 @@ GfxFromNsRect(const nsIntRect& aRect)
27702770
bool
27712771
PluginInstanceChild::CreateOptSurface(void)
27722772
{
2773-
NS_ABORT_IF_FALSE(mSurfaceType != gfxASurface::SurfaceTypeMax,
2773+
NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceTypeMax,
27742774
"Need a valid surface type here");
27752775
NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync.");
27762776

27772777
nsRefPtr<gfxASurface> retsurf;
27782778
// Use an opaque surface unless we're transparent and *don't* have
27792779
// a background to source from.
2780-
gfxASurface::gfxImageFormat format =
2781-
(mIsTransparent && !mBackground) ? gfxASurface::ImageFormatARGB32 :
2782-
gfxASurface::ImageFormatRGB24;
2780+
gfxImageFormat format =
2781+
(mIsTransparent && !mBackground) ? gfxImageFormatARGB32 :
2782+
gfxImageFormatRGB24;
27832783

27842784
#ifdef MOZ_X11
27852785
Display* dpy = mWsInfo.display;
27862786
Screen* screen = DefaultScreenOfDisplay(dpy);
2787-
if (format == gfxASurface::ImageFormatRGB24 &&
2787+
if (format == gfxImageFormatRGB24 &&
27882788
DefaultDepth(dpy, DefaultScreen(dpy)) == 16) {
2789-
format = gfxASurface::ImageFormatRGB16_565;
2789+
format = gfxImageFormatRGB16_565;
27902790
}
27912791

2792-
if (mSurfaceType == gfxASurface::SurfaceTypeXlib) {
2792+
if (mSurfaceType == gfxSurfaceTypeXlib) {
27932793
if (!mIsTransparent || mBackground) {
27942794
Visual* defaultVisual = DefaultVisualOfScreen(screen);
27952795
mCurrentSurface =
@@ -2813,8 +2813,8 @@ PluginInstanceChild::CreateOptSurface(void)
28132813
#endif
28142814

28152815
#ifdef XP_WIN
2816-
if (mSurfaceType == gfxASurface::SurfaceTypeWin32 ||
2817-
mSurfaceType == gfxASurface::SurfaceTypeD2D) {
2816+
if (mSurfaceType == gfxSurfaceTypeWin32 ||
2817+
mSurfaceType == gfxSurfaceTypeD2D) {
28182818
bool willHaveTransparentPixels = mIsTransparent && !mBackground;
28192819

28202820
SharedDIBSurface* s = new SharedDIBSurface();
@@ -2853,7 +2853,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
28532853
mDoAlphaExtraction = false;
28542854
bool createHelperSurface = false;
28552855

2856-
if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
2856+
if (mCurrentSurface->GetType() == gfxSurfaceTypeXlib) {
28572857
static_cast<gfxXlibSurface*>(mCurrentSurface.get())->
28582858
GetColormapAndVisual(&colormap, &visual);
28592859
// Create helper surface if layer surface visual not same as default
@@ -2863,7 +2863,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
28632863
visual = defaultVisual;
28642864
mDoAlphaExtraction = mIsTransparent;
28652865
}
2866-
} else if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeImage) {
2866+
} else if (mCurrentSurface->GetType() == gfxSurfaceTypeImage) {
28672867
// For image layer surface we should always create helper surface
28682868
createHelperSurface = true;
28692869
// Check if we can create helper surface with non-default visual
@@ -2916,9 +2916,9 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
29162916
if (winSize != surfSize ||
29172917
(mBackground && !CanPaintOnBackground()) ||
29182918
(mBackground &&
2919-
gfxASurface::CONTENT_COLOR != mCurrentSurface->GetContentType()) ||
2919+
GFX_CONTENT_COLOR != mCurrentSurface->GetContentType()) ||
29202920
(!mBackground && mIsTransparent &&
2921-
gfxASurface::CONTENT_COLOR == mCurrentSurface->GetContentType())) {
2921+
GFX_CONTENT_COLOR == mCurrentSurface->GetContentType())) {
29222922
// Don't try to use an old, invalid DC.
29232923
mWindow.window = nullptr;
29242924
ClearCurrentSurface();
@@ -3011,7 +3011,7 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
30113011
#ifdef MOZ_X11
30123012
Visual* visual = nullptr;
30133013
Colormap colormap = 0;
3014-
if (curSurface && curSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
3014+
if (curSurface && curSurface->GetType() == gfxSurfaceTypeXlib) {
30153015
static_cast<gfxXlibSurface*>(curSurface.get())->
30163016
GetColormapAndVisual(&colormap, &visual);
30173017
if (visual != mWsInfo.visual || colormap != mWsInfo.colormap) {
@@ -3103,7 +3103,7 @@ PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
31033103

31043104
#ifdef MOZ_X11
31053105
{
3106-
NS_ASSERTION(aSurface->GetType() == gfxASurface::SurfaceTypeXlib,
3106+
NS_ASSERTION(aSurface->GetType() == gfxSurfaceTypeXlib,
31073107
"Non supported platform surface type");
31083108

31093109
NPEvent pluginEvent;
@@ -3197,19 +3197,19 @@ void
31973197
PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
31983198
gfxASurface* aSurface)
31993199
{
3200-
NS_ABORT_IF_FALSE(aSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA,
3200+
NS_ABORT_IF_FALSE(aSurface->GetContentType() == GFX_CONTENT_COLOR_ALPHA,
32013201
"Refusing to pointlessly recover alpha");
32023202

32033203
nsIntRect rect(aRect);
32043204
// If |aSurface| can be used to paint and can have alpha values
32053205
// recovered directly to it, do that to save a tmp surface and
32063206
// copy.
32073207
bool useSurfaceSubimageForBlack = false;
3208-
if (gfxASurface::SurfaceTypeImage == aSurface->GetType()) {
3208+
if (gfxSurfaceTypeImage == aSurface->GetType()) {
32093209
gfxImageSurface* surfaceAsImage =
32103210
static_cast<gfxImageSurface*>(aSurface);
32113211
useSurfaceSubimageForBlack =
3212-
(surfaceAsImage->Format() == gfxASurface::ImageFormatARGB32);
3212+
(surfaceAsImage->Format() == gfxImageFormatARGB32);
32133213
// If we're going to use a subimage, nudge the rect so that we
32143214
// can use optimal alpha recovery. If we're not using a
32153215
// subimage, the temporaries should automatically get
@@ -3228,7 +3228,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
32283228
gfxPoint deviceOffset = -targetRect.TopLeft();
32293229

32303230
// We always use a temporary "white image"
3231-
whiteImage = new gfxImageSurface(targetSize, gfxASurface::ImageFormatRGB24);
3231+
whiteImage = new gfxImageSurface(targetSize, gfxImageFormatRGB24);
32323232
if (whiteImage->CairoStatus()) {
32333233
return;
32343234
}
@@ -3271,7 +3271,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
32713271
blackImage = surface->GetSubimage(targetRect);
32723272
} else {
32733273
blackImage = new gfxImageSurface(targetSize,
3274-
gfxASurface::ImageFormatARGB32);
3274+
gfxImageFormatARGB32);
32753275
}
32763276

32773277
// Paint onto black background
@@ -3415,7 +3415,7 @@ PluginInstanceChild::ShowPluginFrame()
34153415
}
34163416

34173417
bool haveTransparentPixels =
3418-
gfxASurface::CONTENT_COLOR_ALPHA == mCurrentSurface->GetContentType();
3418+
GFX_CONTENT_COLOR_ALPHA == mCurrentSurface->GetContentType();
34193419
PLUGIN_LOG_DEBUG(
34203420
("[InstanceChild][%p] Painting%s <x=%d,y=%d, w=%d,h=%d> on surface <w=%d,h=%d>",
34213421
this, haveTransparentPixels ? " with alpha" : "",
@@ -3481,7 +3481,7 @@ PluginInstanceChild::ShowPluginFrame()
34813481
(uint16_t)rect.YMost(), (uint16_t)rect.XMost() };
34823482
SurfaceDescriptor currSurf;
34833483
#ifdef MOZ_X11
3484-
if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
3484+
if (mCurrentSurface->GetType() == gfxSurfaceTypeXlib) {
34853485
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mCurrentSurface.get());
34863486
currSurf = SurfaceDescriptorX11(xsurf);
34873487
// Need to sync all pending x-paint requests
@@ -3533,7 +3533,7 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
35333533
// We can read safely from XSurface,SharedDIBSurface and Unsafe SharedMemory,
35343534
// because PluginHost is not able to modify that surface
35353535
#if defined(MOZ_X11)
3536-
if (mBackSurface->GetType() != gfxASurface::SurfaceTypeXlib &&
3536+
if (mBackSurface->GetType() != gfxSurfaceTypeXlib &&
35373537
!gfxSharedImageSurface::IsSharedImage(mBackSurface))
35383538
return false;
35393539
#elif defined(XP_WIN)

0 commit comments

Comments
 (0)