Author: adamblokus
Date: Fri Jun 6 08:36:34 2008
New Revision: 4267
URL:
http://source.netsurf-browser.org?rev=4267&view=rev
Log:
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
Modified:
branches/adamblokus/netsurf/pdf/TODO
branches/adamblokus/netsurf/pdf/pdf_plotters.c
Modified: branches/adamblokus/netsurf/pdf/TODO
URL:
http://source.netsurf-browser.org/branches/adamblokus/netsurf/pdf/TODO?re...
==============================================================================
--- branches/adamblokus/netsurf/pdf/TODO (original)
+++ branches/adamblokus/netsurf/pdf/TODO Fri Jun 6 08:36:34 2008
@@ -1,10 +1,13 @@
+- bitmap_tile at page-border
- finish all graphic primitives
- allow adding raw bitmaps
+- make image-aware (embed the image in its native/original type if possible)
+
- adjust content width to page width
- add text-scaling (if not yet using the original font - make the default one
have the same width)
-- make image-aware (embed the image in its native/original type if possible)
- add a save file.. dialogue
- divide output into multiple pages (not just the first one)
- rearrange file structure
- add utf support to Haru ( doable? )
+- wait for browser to end fetching?
Modified: branches/adamblokus/netsurf/pdf/pdf_plotters.c
URL:
http://source.netsurf-browser.org/branches/adamblokus/netsurf/pdf/pdf_plo...
==============================================================================
--- branches/adamblokus/netsurf/pdf/pdf_plotters.c (original)
+++ branches/adamblokus/netsurf/pdf/pdf_plotters.c Fri Jun 6 08:36:34 2008
@@ -59,6 +59,8 @@
static void pdf_set_dashed();
static void pdf_set_dotted();
+static HPDF_Image pdf_extract_image(struct bitmap *bitmap, struct content *content);
+
bool pdf_begin(const char *);
void pdf_next_page();
void pdf_end(const char *);
@@ -72,8 +74,11 @@
static HPDF_Doc pdf_doc;
static HPDF_Page pdf_page;
static HPDF_Font pdf_font;
+
/*PDF Page size*/
static HPDF_REAL page_height, page_width;
+
+/*Remeber if pdf_plot_clip was invoked for current page*/
static bool page_clipped;
extern struct plotter_table plot;
@@ -105,14 +110,14 @@
#ifdef PDF_DEBUG
LOG(("."));
#endif
- HPDF_Page_SetLineWidth(pdf_page,line_width);
+ HPDF_Page_SetLineWidth(pdf_page, line_width);
if(dotted)
pdf_set_dotted();
else if(dashed)
pdf_set_dashed();
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y0 + height, width, height);
HPDF_Page_Stroke(pdf_page);
@@ -122,20 +127,20 @@
return true;
}
-bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
+bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed){
#ifdef PDF_DEBUG
LOG(("."));
#endif
- HPDF_Page_SetLineWidth(pdf_page,width);
+ HPDF_Page_SetLineWidth(pdf_page, width);
if(dotted)
pdf_set_dotted();
else if(dashed)
pdf_set_dashed();
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
- HPDF_Page_SetLineWidth(pdf_page,width);
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+ HPDF_Page_SetLineWidth(pdf_page, width);
HPDF_Page_MoveTo(pdf_page, x0, page_height - y0);
HPDF_Page_LineTo(pdf_page, x1, page_height - y1);
HPDF_Page_Stroke(pdf_page);
@@ -148,29 +153,29 @@
bool pdf_plot_polygon(int *p, unsigned int n, colour fill){
int i;
- int pmaxx=p[0],pmaxy=p[1];
- int pminx=p[0],pminy=p[1];
+ int pmaxx = p[0], pmaxy = p[1];
+ int pminx = p[0], pminy = p[1];
#ifdef PDF_DEBUG
LOG(("."));
#endif
- if(n==0)
+ if(n == 0)
return true;
- HPDF_Page_SetRGBFill(pdf_page,R(fill),G(fill),B(fill));
+ HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
HPDF_Page_MoveTo(pdf_page, p[0], page_height - p[1]);
- for(i=1;i<n;i++){
+ for(i = 1 ; i<n ; i++){
HPDF_Page_LineTo(pdf_page, p[i*2], page_height - p[i*2+1]);
#ifdef PDF_DEBUG
- pmaxx=max(pmaxx,p[i*2]);
- pmaxy=max(pmaxy,p[i*2+1]);
- pminx=min(pminx,p[i*2]);
- pminy=min(pminy,p[i*2+1]);
-#endif
- }
-
-#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f",pminx,pminy, pmaxx, pmaxy, page_height-pminy));
+ pmaxx = max(pmaxx, p[i*2]);
+ pmaxy = max(pmaxy, p[i*2+1]);
+ pminx = min(pminx, p[i*2]);
+ pminy = min(pminy, p[i*2+1]);
+#endif
+ }
+
+#ifdef PDF_DEBUG
+ LOG(("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height-pminy));
#endif
HPDF_Page_LineTo(pdf_page, p[0], page_height - p[1]);
@@ -182,50 +187,50 @@
bool pdf_plot_fill(int x0, int y0, int x1, int y1, colour c){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f %X",x0,y0,x1,y1,page_height-y0,c));
+ LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height-y0, c));
#endif
/*Normalize boundaries of the area - to prevent overflows*/
- x0=min(max(x0,0),page_width);
- y0=min(max(y0,0),page_height);
- x1=min(max(x1,0),page_width);
- y1=min(max(y1,0),page_height);
-
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ x0 = min(max(x0, 0), page_width);
+ y0 = min(max(y0, 0), page_height);
+ x1 = min(max(x1, 0), page_width);
+ y1 = min(max(y1, 0), page_height);
+
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1-x0, y1-y0);
HPDF_Page_Fill(pdf_page);
return true;
}
-bool pdf_plot_clip(int clip_x0, int clip_y0,
+bool pdf_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d",clip_x0, clip_y0, clip_x1, clip_y1));
+ LOG(("%d %d %d %d", clip_x0, clip_y0, clip_x1, clip_y1));
#endif
if(page_clipped)
HPDF_Page_GRestore(pdf_page);
/*Normalize cllipping area - to prevent overflows*/
- clip_x0=min(max(clip_x0,0),page_width);
- clip_y0=min(max(clip_y0,0),page_height);
- clip_x1=min(max(clip_x1,0),page_width);
- clip_y1=min(max(clip_y1,0),page_height);
+ clip_x0 = min(max(clip_x0, 0), page_width);
+ clip_y0 = min(max(clip_y0, 0), page_height);
+ clip_x1 = min(max(clip_x1, 0), page_width);
+ clip_y1 = min(max(clip_y1, 0), page_height);
HPDF_Page_GSave(pdf_page);
- HPDF_Page_Rectangle(pdf_page, clip_x0, page_height-clip_y1,
- clip_x1-clip_x0, clip_y1-clip_y0);
+ HPDF_Page_Rectangle(pdf_page, clip_x0, page_height-clip_y1,
+ clip_x1-clip_x0, clip_y1-clip_y0);
HPDF_Page_Clip(pdf_page);
HPDF_Page_EndPath(pdf_page);
- page_clipped=true;
-
- return true;
-}
-
-bool pdf_plot_text(int x, int y, const struct css_style *style,
+ page_clipped = true;
+
+ return true;
+}
+
+bool pdf_plot_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c){
#ifdef PDF_DEBUG
LOG(("."));
@@ -233,17 +238,19 @@
char *word;
HPDF_REAL size;
- word=(char*)malloc(sizeof(char)*(length+1));
-
- strncpy(word,text,length);
- word[length]='\0';
-
- if (style->font_size.value.length.unit == CSS_UNIT_PX)
+ word = (char*)malloc(sizeof(char)*(length+1));
+ if(word == NULL)
+ return false;
+
+ strncpy(word, text, length);
+ word[length] = '\0';
+
+ if (style->font_size.value.length.unit == CSS_UNIT_PX)
size = style->font_size.value.length.value;
else
size = css_len2pt(&style->font_size.value.length, style);
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
HPDF_Page_BeginText(pdf_page);
HPDF_Page_SetFontAndSize (pdf_page, pdf_font, size*1.5);
@@ -260,11 +267,11 @@
LOG(("."));
#endif
if(filled)
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
else
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- HPDF_Page_Circle(pdf_page,x,page_height-y,radius);
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ HPDF_Page_Circle(pdf_page, x, page_height-y, radius);
if(filled)
HPDF_Page_Fill(pdf_page);
@@ -274,21 +281,21 @@
return true;
}
-bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2,
+bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2,
colour c){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %d %X",x,y,radius,angle1,angle2,c));
+ LOG(("%d %d %d %d %d %X", x, y, radius, angle1, angle2, c));
#endif
/*Normalize angles*/
- angle1%=360;
- angle2%=360;
- if(angle1>angle2)
- angle1-=360;
-
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- HPDF_Page_Arc(pdf_page,x,page_height-y,radius,angle1,angle2);
+ angle1 %= 360;
+ angle2 %= 360;
+ if(angle1 > angle2)
+ angle1 -= 360;
+
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ HPDF_Page_Arc(pdf_page, x, page_height-y, radius, angle1, angle2);
HPDF_Page_Stroke(pdf_page);
return true;
@@ -296,31 +303,90 @@
bool pdf_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg, struct content *content){
-
- HPDF_Image image=NULL,smask;
- char *img_buffer,*rgb_buffer,*alpha_buffer;
- int img_width,img_height,img_rowstride;
- int i,j;
-
+
+ HPDF_Image image;
+
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %X %X %X", x, y, width, height,
bitmap, bg, content));
#endif
+ image = pdf_extract_image(bitmap, content);
+
+ if(image){
+ HPDF_Page_DrawImage(pdf_page, image,
+ x, page_height-y-height,
+ width, height);
+ return true;
+ }
+ else
+ return false;
+}
+
+bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
+ struct bitmap *bitmap, colour bg,
+ bool repeat_x, bool repeat_y, struct content *content){
+
+ HPDF_Image image;
+
+#ifdef PDF_DEBUG
+ LOG(("%d %d %d %d %X %X %X", x, y, width, height,
+ bitmap, bg, content));
+#endif
+
+ image = pdf_extract_image(bitmap, content);
+
+ if(image){
+ //The position of the next tile
+ HPDF_REAL current_x, current_y ;
+ HPDF_REAL max_width, max_height;
+
+ max_width = (repeat_x ? page_width : width);
+ max_height = (repeat_y ? page_height: height);
+
+ current_y=0;
+ while(current_y < max_height){
+ current_x=0;
+ while(current_x < max_width){
+ HPDF_Page_DrawImage(pdf_page, image,
+ current_x,
+ page_height-current_y-height,
+ width, height);
+ current_x += width;
+ }
+ current_y += height;
+ }
+
+ return true;
+ }
+ else
+ return false;
+
+ return true;
+}
+
+HPDF_Image pdf_extract_image(struct bitmap *bitmap, struct content *content){
+ HPDF_Image image = NULL,smask;
+ char *img_buffer, *rgb_buffer, *alpha_buffer;
+ int img_width, img_height, img_rowstride;
+ int i, j;
+
if(content){
/*Not sure if I don't have to check if downloading has been
- finished.
- Other way - lock pdf plotting while fetching a website
+ finished.
+ Other way - lock pdf plotting while fetching a website
*/
switch(content->type){
/*Handle "embeddable" types of images*/
case CONTENT_JPEG:
- image=HPDF_LoadJpegImageFromMem(pdf_doc,content->source_data,
+ image = HPDF_LoadJpegImageFromMem(pdf_doc,
+ content->source_data,
content->total_size);
break;
case CONTENT_PNG:
- image=HPDF_LoadPngImageFromMem(pdf_doc,content->source_data,
+ image = HPDF_LoadPngImageFromMem(pdf_doc,
+ content->source_data,
content->total_size);
break;
}
@@ -334,49 +400,52 @@
img_height = bitmap_get_height(bitmap);
img_rowstride = bitmap_get_rowstride(bitmap);
- rgb_buffer = (char*)malloc(3*img_width*img_height);
- alpha_buffer = (char*)malloc(img_width*img_height);
- if(!(rgb_buffer&&alpha_buffer)){
- LOG(("Not enough memory?"));
- return false;
+ rgb_buffer = (char*)malloc(3 * img_width * img_height);
+ if(rgb_buffer == NULL){
+ LOG(("Not enough memory to create RGB buffer"));
+ return NULL;
}
+
+ alpha_buffer = (char*)malloc(img_width * img_height);
+ if(alpha_buffer == NULL){
+ LOG(("Not enough memory to create alpha buffer"));
+ free(rgb_buffer);
+ return NULL;
+ }
+
- for(i=0;i<img_height;i++)
- for(j=0;j<img_width;j++){
- rgb_buffer[(i*img_width+j)*3] = img_buffer[i*img_rowstride+j*4];
- rgb_buffer[(i*img_width+j)*3+1] = img_buffer[i*img_rowstride+j*4+1];
- rgb_buffer[(i*img_width+j)*3+2] = img_buffer[i*img_rowstride+j*4+2];
- alpha_buffer[i*img_width+j] = img_buffer[i*img_rowstride+j*4+3];
+ for (i = 0; i<img_height; i++)
+ for(j = 0 ; j<img_width ; j++){
+ rgb_buffer[((i * img_width) + j) * 3] =
+ img_buffer[(i * img_rowstride) + (j * 4)];
+
+ rgb_buffer[(((i * img_width) + j) * 3) + 1] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 1];
+
+ rgb_buffer[(((i * img_width) + j) * 3) + 2] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 2];
+
+ alpha_buffer[(i * img_width)+j] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 3];
}
- smask=HPDF_LoadRawImageFromMem(pdf_doc,alpha_buffer,
- img_width,img_height,
- HPDF_CS_DEVICE_GRAY,8);
-
- image=HPDF_LoadRawImageFromMem(pdf_doc,rgb_buffer,
- img_width,img_height,
- HPDF_CS_DEVICE_RGB,8);
-
- HPDF_Image_AddSMask(pdf_doc,image,smask);
-
- free(rgb_buffer);
- free(alpha_buffer);
- }
-
- if(image)
- HPDF_Page_DrawImage(pdf_page,image,
- x, page_height-y-height,
- width, height);
-
- return true;
-}
-
-bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bool repeat_x, bool repeat_y, struct content *content){
-
- return true;
-}
+ smask = HPDF_LoadRawImageFromMem(pdf_doc, alpha_buffer,
+ img_width, img_height,
+ HPDF_CS_DEVICE_GRAY, 8);
+
+ image = HPDF_LoadRawImageFromMem(pdf_doc, rgb_buffer,
+ img_width, img_height,
+ HPDF_CS_DEVICE_RGB, 8);
+
+ HPDF_Image_AddSMask(pdf_doc, image,smask);
+
+ free(rgb_buffer);
+ free(alpha_buffer);
+ }
+
+ return image;
+}
+
bool pdf_plot_flush(){
return true;
@@ -384,11 +453,12 @@
static inline float transform_x(float *transform,float x,float y){
- return (transform[0] * (x) + transform[2] * -(y) + transform[4]) * 2;
+ return ((transform[0] * x) + (transform[2] * (-y) ) + transform[4]) * 2;
}
static inline float transform_y(float *transform,float x,float y){
- return page_height-(transform[1] * (x) + transform[3] * -(y) - transform[5]) * 2;
+ return page_height -
+ (((transform[1] * x) + (transform[3] * (-y)) - transform[5]) * 2);
}
bool pdf_plot_path(float *p, unsigned int n, colour fill, float width,
@@ -397,52 +467,52 @@
LOG(("."));
#endif
unsigned int i;
- bool empty_path=true;
+ bool empty_path = true;
- if(n==0)
+ if(n == 0)
return true;
- if(c==TRANSPARENT && fill==TRANSPARENT)
+ if((c == TRANSPARENT) && (fill == TRANSPARENT))
return true;
if (p[0] != PLOTTER_PATH_MOVE) {
return false;
}
- HPDF_Page_SetRGBFill(pdf_page,R(fill),G(fill),B(fill));
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- transform[0]=0.1;
- transform[1]=0;
- transform[2]=0;
- transform[3]=-0.1;
- transform[4]=0;
- transform[5]=0;
-
- for(i=0;i<n;){
- if(p[i]==PLOTTER_PATH_MOVE){
- HPDF_Page_MoveTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]));
- i+=3;
+ HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ transform[0] = 0.1;
+ transform[1] = 0;
+ transform[2] = 0;
+ transform[3] = -0.1;
+ transform[4] = 0;
+ transform[5] = 0;
+
+ for(i = 0 ; i<n ; ){
+ if(p[i] == PLOTTER_PATH_MOVE){
+ HPDF_Page_MoveTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]));
+ i+= 3;
}else if (p[i] == PLOTTER_PATH_CLOSE) {
if(!empty_path)
HPDF_Page_ClosePath(pdf_page);
i++;
} else if (p[i] == PLOTTER_PATH_LINE) {
- HPDF_Page_LineTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]));
+ HPDF_Page_LineTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]));
i+=3;
empty_path = false;
} else if (p[i] == PLOTTER_PATH_BEZIER) {
- HPDF_Page_CurveTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]),
- transform_x(transform,p[i+3],p[i+4]),
- transform_y(transform,p[i+3],p[i+4]),
- transform_x(transform,p[i+5],p[i+6]),
- transform_y(transform,p[i+5],p[i+6]));
+ HPDF_Page_CurveTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]),
+ transform_x(transform, p[i+3], p[i+4]),
+ transform_y(transform, p[i+3], p[i+4]),
+ transform_x(transform, p[i+5], p[i+6]),
+ transform_y(transform, p[i+5], p[i+6]));
i += 7;
empty_path = false;
} else {
@@ -469,32 +539,32 @@
}
void pdf_set_solid(){
- HPDF_Page_SetDash(pdf_page,NULL,0,0);
+ HPDF_Page_SetDash(pdf_page, NULL, 0, 0);
}
void pdf_set_dashed(){
- HPDF_UINT16 dash_ptn[]={3};
- HPDF_Page_SetDash(pdf_page,dash_ptn,1,1);
+ HPDF_UINT16 dash_ptn[] = {3};
+ HPDF_Page_SetDash(pdf_page, dash_ptn, 1, 1);
}
void pdf_set_dotted(){
- HPDF_UINT16 dash_ptn[]={1};
- HPDF_Page_SetDash(pdf_page,dash_ptn,1,1);
+ HPDF_UINT16 dash_ptn[] = {1};
+ HPDF_Page_SetDash(pdf_page, dash_ptn, 1, 1);
}
bool pdf_begin(const char *path){
#ifdef PDF_DEBUG
- pdf_doc = HPDF_New(error_handler,NULL);
+ pdf_doc = HPDF_New(error_handler, NULL);
#else
- pdf_doc = HPDF_New(NULL,NULL);
+ pdf_doc = HPDF_New(NULL, NULL);
#endif
if(!pdf_doc){
LOG(("Error creating pdf_doc"));
return false;
}
- HPDF_SetCompressionMode(pdf_doc,HPDF_COMP_ALL); /*Compression on*/
+ HPDF_SetCompressionMode(pdf_doc, HPDF_COMP_ALL); /*Compression on*/
pdf_font = HPDF_GetFont (pdf_doc, "Times-Roman",
"StandardEncoding");
#ifdef PDF_DEBUG
LOG(("pdf_begin finishes"));
@@ -509,7 +579,7 @@
page_width = HPDF_Page_GetWidth(pdf_page);
page_clipped = false;
#ifdef PDF_DEBUG
- LOG(("%f %f",page_width,page_height));
+ LOG(("%f %f", page_width, page_height));
#endif
}
@@ -517,8 +587,8 @@
#ifdef PDF_DEBUG
LOG(("pdf_end begins"));
- pdf_plot_grid(10,10,0xCCCCCC);
- pdf_plot_grid(100,100,0xCCCCFF);
+ pdf_plot_grid(10, 10, 0xCCCCCC);
+ pdf_plot_grid(100, 100, 0xCCCCFF);
#endif
HPDF_SaveToFile(pdf_doc, path);
@@ -529,26 +599,26 @@
#endif
}
-void error_handler (HPDF_STATUS error_no,
- HPDF_STATUS detail_no,
+void error_handler (HPDF_STATUS error_no,
+ HPDF_STATUS detail_no,
void *user_data)
{
- printf ("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n",
- (HPDF_UINT)error_no,
+ printf ("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n",
+ (HPDF_UINT)error_no,
(HPDF_UINT)detail_no);
exit(1);
}
-void pdf_plot_grid(int x_dist,int y_dist,unsigned int colour){
+void pdf_plot_grid(int x_dist, int y_dist, unsigned int colour){
int i;
- for(int i=x_dist;i<page_width;i+=x_dist)
- pdf_plot_line(i,0,i,page_height,1,colour,false,false);
-
- for(int i=y_dist;i<page_height;i+=x_dist)
- pdf_plot_line(0,i,page_width,i,1,colour,false,false);
-
-}
-
-
+ for(int i = x_dist ; i<page_width ; i+=x_dist)
+ pdf_plot_line(i, 0, i, page_height, 1, colour, false, false);
+
+ for(int i = y_dist ; i<page_height ; i+=x_dist)
+ pdf_plot_line(0, i, page_width, i, 1, colour, false, false);
+
+}
+
+