gecko-dev/gfx/thebes/gfx2DGlue.h

41 lines
738 B
C++

#include "gfxRect.h"
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace gfx {
class DrawTarget;
class SourceSurface;
class ScaledFont;
}
}
namespace mozilla {
namespace gfx {
inline Rect ToRect(const gfxRect &aRect)
{
return Rect(Float(aRect.x), Float(aRect.y),
Float(aRect.width), Float(aRect.height));
}
inline gfxRect GFXRect(const Rect &aRect)
{
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline gfxASurface::gfxContentType ContentForFormat(const SurfaceFormat &aFormat)
{
switch (aFormat) {
case FORMAT_B8G8R8X8:
return gfxASurface::CONTENT_COLOR;
case FORMAT_A8:
return gfxASurface::CONTENT_ALPHA;
default:
return gfxASurface::CONTENT_COLOR_ALPHA;
}
}
}
}