1 //========================================================================
2 //
3 // CoreOutputDev.cc
4 //
5 // Copyright 2004 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
9 #include <aconf.h>
10 
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
13 #endif
14 
15 #include "Object.h"
16 #include "TextOutputDev.h"
17 #include "CoreOutputDev.h"
18 
19 //------------------------------------------------------------------------
20 // CoreOutputDev
21 //------------------------------------------------------------------------
22 
CoreOutputDev(SplashColorMode colorModeA,int bitmapRowPadA,GBool reverseVideoA,SplashColorPtr paperColorA,GBool incrementalUpdateA,CoreOutRedrawCbk redrawCbkA,void * redrawCbkDataA)23 CoreOutputDev::CoreOutputDev(SplashColorMode colorModeA, int bitmapRowPadA,
24 			     GBool reverseVideoA, SplashColorPtr paperColorA,
25 			     GBool incrementalUpdateA,
26 			     CoreOutRedrawCbk redrawCbkA,
27 			     void *redrawCbkDataA):
28   SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA, paperColorA)
29 {
30   incrementalUpdate = incrementalUpdateA;
31   redrawCbk = redrawCbkA;
32   redrawCbkData = redrawCbkDataA;
33 }
34 
~CoreOutputDev()35 CoreOutputDev::~CoreOutputDev() {
36 }
37 
endPage()38 void CoreOutputDev::endPage() {
39   SplashOutputDev::endPage();
40   if (!incrementalUpdate) {
41     (*redrawCbk)(redrawCbkData, 0, 0, getBitmapWidth(), getBitmapHeight(),
42 		 gTrue);
43   }
44 }
45 
dump()46 void CoreOutputDev::dump() {
47   int x0, y0, x1, y1;
48 
49   if (incrementalUpdate) {
50     getModRegion(&x0, &y0, &x1, &y1);
51     clearModRegion();
52     if (x1 >= x0 && y1 >= y0) {
53       (*redrawCbk)(redrawCbkData, x0, y0, x1, y1, gFalse);
54     }
55   }
56 }
57 
clear()58 void CoreOutputDev::clear() {
59   startDoc(NULL);
60   startPage(0, NULL);
61 }
62