cleaning up thebes PDF and PS surfaces

This commit is contained in:
pavlov%pavlov.net 2006-02-13 22:37:13 +00:00
Родитель d2035a097a
Коммит 4c74730634
7 изменённых файлов: 31 добавлений и 18 удалений

Просмотреть файл

@ -43,7 +43,7 @@ endif
ifeq ($(MOZ_GFX_TOOLKIT),gtk2)
EXPORTS += gfxXlibSurface.h gfxPlatformGtk.h
EXPORTS += gfxPangoFonts.h
EXPORTS += gfxPDFSurface.h
EXPORTS += gfxPDFSurface.h gfxPSSurface.h
ifdef MOZ_ENABLE_GLITZ
REQUIRES += glitzglx

Просмотреть файл

@ -44,17 +44,21 @@ class NS_EXPORT gfxPDFSurface : public gfxASurface {
THEBES_DECL_ISUPPORTS_INHERITED
public:
gfxPDFSurface(const char *filename,
double width_in_points,
double height_in_points);
/* size is in points */
gfxPDFSurface(const char *filename, gfxSize aSizeInPonits);
virtual ~gfxPDFSurface();
void SetDPI(double x, double y);
void GetDPI(double *xDPI, double *yDPI);
gfxSize GetSize() {
gfxSize size = mSize;
return size;
}
private:
double mXDPI;
double mYDPI;
gfxSize mSize;
};
#endif /* GFX_WINDOWSSURFACE_H */
#endif /* GFX_PDFSURFACE_H */

Просмотреть файл

@ -44,17 +44,20 @@ class NS_EXPORT gfxPSSurface : public gfxASurface {
THEBES_DECL_ISUPPORTS_INHERITED
public:
gfxPSSurface(const char *filename,
double width_in_points,
double height_in_points);
gfxPSSurface(const char *filename, gfxSize aSizeInPonits);
virtual ~gfxPSSurface();
void SetDPI(double x, double y);
void GetDPI(double *xDPI, double *yDPI);
gfxSize GetSize() {
gfxSize size = mSize;
return size;
}
private:
double mXDPI;
double mYDPI;
gfxSize mSize;
};
#endif /* GFX_WINDOWSSURFACE_H */
#endif /* GFX_PSSURFACE_H */

Просмотреть файл

@ -52,7 +52,7 @@ endif
ifeq ($(MOZ_GFX_TOOLKIT),gtk2)
CPPSRCS += gfxXlibSurface.cpp gfxPlatformGtk.cpp
CPPSRCS += gfxPangoFonts.cpp
CPPSRCS += gfxPDFSurface.cpp
CPPSRCS += gfxPDFSurface.cpp gfxPSSurface.cpp
EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(ZLIB_LIBS)
endif

Просмотреть файл

@ -41,10 +41,10 @@
THEBES_IMPL_REFCOUNTING(gfxPDFSurface)
gfxPDFSurface::gfxPDFSurface(const char *filename, double width, double height)
: mXDPI(-1), mYDPI(-1)
gfxPDFSurface::gfxPDFSurface(const char *filename, gfxSize aSizeInPoints)
: mXDPI(-1), mYDPI(-1), mSize(aSizeInPoints)
{
Init(cairo_pdf_surface_create(filename, width, height));
Init(cairo_pdf_surface_create(filename, mSize.width, mSize.height));
}
gfxPDFSurface::~gfxPDFSurface()

Просмотреть файл

@ -35,16 +35,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "gfxPDFSurface.h"
#include "gfxPSSurface.h"
#include <cairo-ps.h>
THEBES_IMPL_REFCOUNTING(gfxPSSurface)
gfxPSSurface::gfxPSSurface(const char *filename, double width, double height)
: mXDPI(-1), mYDPI(-1)
gfxPSSurface::gfxPSSurface(const char *filename, gfxSize aSizeInPoints)
: mXDPI(-1), mYDPI(-1), mSize(aSizeInPoints)
{
Init(cairo_ps_surface_create(filename, width, height));
Init(cairo_ps_surface_create(filename, mSize.width, mSize.height));
}
gfxPSSurface::~gfxPSSurface()

Просмотреть файл

@ -410,7 +410,9 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
#endif
#ifdef MOZ_CAIRO_GFX
//#define USE_PDF 1
#include "gfxPDFSurface.h"
#include "gfxPSSurface.h"
#include "nsUnitConversion.h"
NS_IMETHODIMP nsDeviceContextSpecGTK::GetSurfaceForPrinter(gfxASurface **aSurface)
{
@ -426,7 +428,11 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::GetSurfaceForPrinter(gfxASurface **aSurfac
printf("%s, %d, %d\n", path, width, height);
gfxPDFSurface *surface = new gfxPDFSurface(path, w, h);
#ifdef USE_PDF
gfxPDFSurface *surface = new gfxPDFSurface(path, gfxSize(w, h));
#else
gfxPSSurface *surface = new gfxPSSurface(path, gfxSize(w, h));
#endif
surface->SetDPI(600, 600);
*aSurface = surface;