Coverage Report

Created: 2026-04-12 06:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/xpdf-4.06/xpdf/OutputDev.cc
Line
Count
Source
1
//========================================================================
2
//
3
// OutputDev.cc
4
//
5
// Copyright 1996-2003 Glyph & Cog, LLC
6
//
7
//========================================================================
8
9
#include <aconf.h>
10
11
#include <stddef.h>
12
#include "gmempp.h"
13
#include "Object.h"
14
#include "Stream.h"
15
#include "GfxState.h"
16
#include "OutputDev.h"
17
18
//------------------------------------------------------------------------
19
// OutputDev
20
//------------------------------------------------------------------------
21
22
401k
void OutputDev::setDefaultCTM(double *ctm) {
23
401k
  int i;
24
401k
  double det;
25
26
2.81M
  for (i = 0; i < 6; ++i) {
27
2.40M
    defCTM[i] = ctm[i];
28
2.40M
  }
29
401k
  det = 1 / (defCTM[0] * defCTM[3] - defCTM[1] * defCTM[2]);
30
401k
  defICTM[0] = defCTM[3] * det;
31
401k
  defICTM[1] = -defCTM[1] * det;
32
401k
  defICTM[2] = -defCTM[2] * det;
33
401k
  defICTM[3] = defCTM[0] * det;
34
401k
  defICTM[4] = (defCTM[2] * defCTM[5] - defCTM[3] * defCTM[4]) * det;
35
401k
  defICTM[5] = (defCTM[1] * defCTM[4] - defCTM[0] * defCTM[5]) * det;
36
401k
}
37
38
0
void OutputDev::cvtDevToUser(double dx, double dy, double *ux, double *uy) {
39
0
  *ux = defICTM[0] * dx + defICTM[2] * dy + defICTM[4];
40
0
  *uy = defICTM[1] * dx + defICTM[3] * dy + defICTM[5];
41
0
}
42
43
0
void OutputDev::cvtUserToDev(double ux, double uy, double *dx, double *dy) {
44
0
  *dx = defCTM[0] * ux + defCTM[2] * uy + defCTM[4];
45
0
  *dy = defCTM[1] * ux + defCTM[3] * uy + defCTM[5];
46
0
}
47
48
0
void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) {
49
0
  *dx = (int)(defCTM[0] * ux + defCTM[2] * uy + defCTM[4] + 0.5);
50
0
  *dy = (int)(defCTM[1] * ux + defCTM[3] * uy + defCTM[5] + 0.5);
51
0
}
52
53
0
void OutputDev::updateAll(GfxState *state) {
54
0
  updateLineDash(state);
55
0
  updateFlatness(state);
56
0
  updateLineJoin(state);
57
0
  updateLineCap(state);
58
0
  updateMiterLimit(state);
59
0
  updateLineWidth(state);
60
0
  updateStrokeAdjust(state);
61
0
  updateFillColorSpace(state);
62
0
  updateFillColor(state);
63
0
  updateStrokeColorSpace(state);
64
0
  updateStrokeColor(state);
65
0
  updateBlendMode(state);
66
0
  updateFillOpacity(state);
67
0
  updateStrokeOpacity(state);
68
0
  updateFillOverprint(state);
69
0
  updateStrokeOverprint(state);
70
0
  updateOverprintMode(state);
71
0
  updateTransfer(state);
72
0
  updateFont(state);
73
0
}
74
75
21.0k
void OutputDev::fillStroke(GfxState *state, GBool eo) {
76
21.0k
  if (eo) {
77
148
    eoFill(state);
78
20.8k
  } else {
79
20.8k
    fill(state);
80
20.8k
  }
81
21.0k
  stroke(state);
82
21.0k
}
83
84
GBool OutputDev::beginType3Char(GfxState *state, double x, double y,
85
        double dx, double dy,
86
0
        CharCode code, Unicode *u, int uLen) {
87
0
  return gFalse;
88
0
}
89
90
void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
91
            int width, int height, GBool invert,
92
0
            GBool inlineImg, GBool interpolate) {
93
0
  if (inlineImg) {
94
0
    str->reset();
95
0
    str->discardChars(height * ((width + 7) / 8));
96
0
    str->close();
97
0
  }
98
0
}
99
100
void OutputDev::setSoftMaskFromImageMask(GfxState *state,
101
           Object *ref, Stream *str,
102
           int width, int height, GBool invert,
103
0
           GBool inlineImg, GBool interpolate) {
104
0
  drawImageMask(state, ref, str, width, height, invert, inlineImg, interpolate);
105
0
}
106
107
void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
108
        int width, int height, GfxImageColorMap *colorMap,
109
0
        int *maskColors, GBool inlineImg, GBool interpolate) {
110
0
  if (inlineImg) {
111
0
    str->reset();
112
0
    str->discardChars(height * ((width * colorMap->getNumPixelComps() *
113
0
         colorMap->getBits() + 7) / 8));
114
0
    str->close();
115
0
  }
116
0
}
117
118
void OutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str,
119
        int width, int height,
120
        GfxImageColorMap *colorMap,
121
        Object *maskRef, Stream *maskStr,
122
        int maskWidth, int maskHeight,
123
0
        GBool maskInvert, GBool interpolate) {
124
0
  drawImage(state, ref, str, width, height, colorMap, NULL, gFalse,
125
0
      interpolate);
126
0
}
127
128
void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
129
            int width, int height,
130
            GfxImageColorMap *colorMap,
131
            Object *maskRef, Stream *maskStr,
132
            int maskWidth, int maskHeight,
133
            GfxImageColorMap *maskColorMap,
134
0
            double *matte, GBool interpolate) {
135
0
  drawImage(state, ref, str, width, height, colorMap, NULL, gFalse,
136
0
      interpolate);
137
0
}
138
139
#if OPI_SUPPORT
140
0
void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
141
0
}
142
143
0
void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
144
0
}
145
#endif