Bug 740560 - [Azure] Add Factory::CreateDrawTargetForData. r=Bas,gw280

This commit is contained in:
Matt Woodrow 2012-04-02 15:15:08 -04:00
parent 00bbd5f1fe
commit 7e20c213c5
3 changed files with 41 additions and 0 deletions

View File

@ -132,6 +132,33 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor
return NULL;
}
TemporaryRef<DrawTarget>
Factory::CreateDrawTargetForData(BackendType aBackend,
unsigned char *aData,
const IntSize &aSize,
int32_t aStride,
SurfaceFormat aFormat)
{
switch (aBackend) {
#ifdef USE_SKIA
case BACKEND_SKIA:
{
RefPtr<DrawTargetSkia> newTarget;
newTarget = new DrawTargetSkia();
newTarget->Init(aData, aSize, aStride, aFormat);
return newTarget;
}
#endif
default:
gfxDebug() << "Invalid draw target type specified.";
return NULL;
}
gfxDebug() << "Failed to create DrawTarget, Type: " << aBackend << " Size: " << aSize;
// Failed
return NULL;
}
TemporaryRef<ScaledFont>
Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSize)
{

View File

@ -647,6 +647,16 @@ gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aForm
}
}
RefPtr<DrawTarget>
gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat)
{
BackendType backend;
if (!SupportsAzure(backend)) {
return NULL;
}
return Factory::CreateDrawTargetForData(backend, aData, aSize, aStride, aFormat);
}
nsresult
gfxPlatform::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,

View File

@ -208,6 +208,10 @@ public:
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize,
int32_t aStride, mozilla::gfx::SurfaceFormat aFormat);
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend) { return false; }
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {