Bug 702517 - Expose skia backend as a GfxInfo property and use it to mark tests as passing. r=jrmuizel

This commit is contained in:
Matt Woodrow 2011-11-18 17:00:38 +13:00
parent 1b8d86494f
commit 8c5da2ed3d
3 changed files with 60 additions and 7 deletions

View File

@ -29,6 +29,18 @@ function IsAzureEnabled() {
return enabled;
}
function IsAzureSkia() {
var enabled = false;
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureBackend;
enabled = (backend == "skia");
} catch (e) { }
return enabled;
}
</script>
<!-- Includes all the tests in the content/canvas/tests except for test_bug397524.html -->
@ -14339,8 +14351,11 @@ ctx.lineTo(50, 25);
ctx.closePath();
ctx.stroke();
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
if (IsAzureEnabled() && IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
}
</script>
@ -14412,7 +14427,11 @@ ctx.moveTo(50, 25);
ctx.bezierCurveTo(50, 25, 50, 25, 50, 25);
ctx.stroke();
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
if (IsAzureEnabled() && IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
}
@ -14445,8 +14464,11 @@ ctx.moveTo(50, 25);
ctx.lineTo(50, 25);
ctx.stroke();
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
if (IsAzureEnabled() && IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
}
</script>
@ -14479,8 +14501,11 @@ ctx.stroke();
ctx.strokeRect(50, 25, 0, 0);
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
if (IsAzureEnabled() && IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
}
</script>

View File

@ -220,6 +220,7 @@ static const char *gPrefLangNames[] = {
};
gfxPlatform::gfxPlatform()
: mAzureBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
{
mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
mAllowDownloadableFonts = UNINITIALIZED_VALUE;

View File

@ -53,6 +53,7 @@
#include "gfx2DGlue.h"
#include "mozilla/RefPtr.h"
#include "GfxInfoCollector.h"
#ifdef XP_OS2
#undef OS2EMX_PLAIN_CHAR
@ -142,6 +143,24 @@ const PRUint32 kMaxLenPrefLangList = 32;
typedef gfxASurface::gfxImageFormat gfxImageFormat;
inline const char*
GetBackendName(mozilla::gfx::BackendType aBackend)
{
switch (aBackend) {
case mozilla::gfx::BACKEND_DIRECT2D:
return "direct2d";
case mozilla::gfx::BACKEND_COREGRAPHICS:
return "quartz";
case mozilla::gfx::BACKEND_CAIRO:
return "cairo";
case mozilla::gfx::BACKEND_SKIA:
return "skia";
default:
NS_ERROR("Invalid backend type!");
return "";
}
}
class THEBES_API gfxPlatform {
public:
/**
@ -190,6 +209,13 @@ public:
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend) { return false; }
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
mozilla::gfx::BackendType backend;
if (SupportsAzure(backend)) {
aObj.DefineProperty("AzureBackend", GetBackendName(backend));
}
}
/*
* Font bits
*/
@ -408,6 +434,7 @@ private:
nsTArray<PRUint32> mCJKPrefLangs;
nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
nsCOMPtr<nsIObserver> mFontPrefsObserver;
mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureBackendCollector;
};
#endif /* GFX_PLATFORM_H */