shithub: pdffs

Download patch

ref: 613828fbd75a8753e03e088c7d1804fdca097942
parent: 1e529dae29361055228348a4864c403b7914da0f
author: Noam Preil <noam@pixelhero.dev>
date: Thu Apr 7 20:21:08 EDT 2022

gs: remove pointers from state

--- a/pdf.h
+++ b/pdf.h
@@ -15,7 +15,6 @@
 typedef struct Filter Filter;
 typedef struct TS TS;
 typedef struct GS GS;
-typedef struct GSD GSD;
 typedef struct GSFont GSFont;
 typedef struct KeyValue KeyValue;
 typedef struct Object Object;
@@ -92,12 +91,6 @@
 	Object *value;
 };
 
-struct GSD {
-	int *d;
-	int nd;
-	int phase;
-};
-
 struct GSFont {
 	Object *font;
 	double size;
@@ -121,9 +114,9 @@
 	Pattern, Indexed, Separation, DeviceN, /* Special family */
 } ColorSpace;
 
+/* Since the GS gets duplicated onto a stack, avoid holding pointers, which would become messy to clean up properly */
 struct GS {
 	double CTM[6]; /* current transformation matrix ; 8.3 */
-	Object *BG, *UCR, *UCR2, *TR, *TR2, *HT, *BM, *SMask, *UseBlackPTComp, *HTO;
 	int LW, LC, LJ, ML, RI, OP, op, OPM, SA, AIS, TK;
 	double SM, CA, ca, FL;
 	struct{ /* coloring info */
@@ -131,10 +124,6 @@
 		u32int SC, NSC;
 	};
 	GSFont Font;
-	struct {
-		GSD *d;
-		int nd;
-	};
 };
 
 struct TS {