summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge/fx_ge_ps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/ge/fx_ge_ps.cpp')
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp158
1 files changed, 70 insertions, 88 deletions
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index bf0c8c1a16..6ce8f4635b 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -101,16 +101,16 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
if (pObject2Device) {
pObject2Device->Transform(x, y);
}
- buf << x << FX_BSTRC(" ") << y;
+ buf << x << " " << y;
switch (flag & FXPT_TYPE) {
case FXPT_MOVETO:
- buf << FX_BSTRC(" m ");
+ buf << " m ";
break;
case FXPT_LINETO:
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" l h ");
+ buf << " l h ";
} else {
- buf << FX_BSTRC(" l ");
+ buf << " l ";
}
break;
case FXPT_BEZIERTO: {
@@ -122,12 +122,11 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
pObject2Device->Transform(x1, y1);
pObject2Device->Transform(x2, y2);
}
- buf << FX_BSTRC(" ") << x1 << FX_BSTRC(" ") << y1 << FX_BSTRC(" ") << x2
- << FX_BSTRC(" ") << y2;
+ buf << " " << x1 << " " << y1 << " " << x2 << " " << y2;
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" c h\n");
+ buf << " c h\n";
} else {
- buf << FX_BSTRC(" c\n");
+ buf << " c\n";
}
i += 2;
break;
@@ -159,11 +158,9 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
OutputPath(pPathData, NULL);
@@ -205,11 +202,9 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
}
@@ -245,29 +240,29 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
CFX_ByteTextBuf buf;
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineCap != pGraphState->m_LineCap) {
- buf << pGraphState->m_LineCap << FX_BSTRC(" J\n");
+ buf << pGraphState->m_LineCap << " J\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) {
- buf << FX_BSTRC("[");
+ buf << "[";
for (int i = 0; i < pGraphState->m_DashCount; i++) {
- buf << pGraphState->m_DashArray[i] << FX_BSTRC(" ");
+ buf << pGraphState->m_DashArray[i] << " ";
}
- buf << FX_BSTRC("]") << pGraphState->m_DashPhase << FX_BSTRC(" d\n");
+ buf << "]" << pGraphState->m_DashPhase << " d\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) {
- buf << pGraphState->m_LineJoin << FX_BSTRC(" j\n");
+ buf << pGraphState->m_LineJoin << " j\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) {
- buf << pGraphState->m_LineWidth << FX_BSTRC(" w\n");
+ buf << pGraphState->m_LineWidth << " w\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) {
- buf << pGraphState->m_MiterLimit << FX_BSTRC(" M\n");
+ buf << pGraphState->m_MiterLimit << " M\n";
}
m_CurGraphState.Copy(*pGraphState);
m_bGraphStateSet = TRUE;
@@ -374,13 +369,11 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
}
OUTPUT_PS("q\n");
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("[") << pMatrix->a << FX_BSTRC(" ") << pMatrix->b
- << FX_BSTRC(" ") << pMatrix->c << FX_BSTRC(" ") << pMatrix->d
- << FX_BSTRC(" ") << pMatrix->e << FX_BSTRC(" ") << pMatrix->f
- << FX_BSTRC("]cm ");
+ buf << "[" << pMatrix->a << " " << pMatrix->b << " " << pMatrix->c << " "
+ << pMatrix->d << " " << pMatrix->e << " " << pMatrix->f << "]cm ";
int width = pSource->GetWidth();
int height = pSource->GetHeight();
- buf << width << FX_BSTRC(" ") << height;
+ buf << width << " " << height;
if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) {
int pitch = (width + 7) / 8;
FX_DWORD src_size = height * pitch;
@@ -395,20 +388,19 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
if (pSource->IsAlphaMask()) {
SetColor(color, alpha_flag, pIccTransform);
m_bColorSet = FALSE;
- buf << FX_BSTRC(" true[");
+ buf << " true[";
} else {
- buf << FX_BSTRC(" 1[");
+ buf << " 1[";
}
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]currentfile/ASCII85Decode filter ");
+ buf << width << " 0 0 -" << height << " 0 " << height
+ << "]currentfile/ASCII85Decode filter ";
if (output_buf != src_buf)
- buf << FX_BSTRC("<</K -1/EndOfBlock false/Columns ") << width
- << FX_BSTRC("/Rows ") << height
- << FX_BSTRC(">>/CCITTFaxDecode filter ");
+ buf << "<</K -1/EndOfBlock false/Columns " << width << "/Rows " << height
+ << ">>/CCITTFaxDecode filter ";
if (pSource->IsAlphaMask()) {
- buf << FX_BSTRC("iM\n");
+ buf << "iM\n";
} else {
- buf << FX_BSTRC("false 1 colorimage\n");
+ buf << "false 1 colorimage\n";
}
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
@@ -489,15 +481,14 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
delete pConverted;
pConverted = NULL;
}
- buf << FX_BSTRC(" 8[");
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]");
- buf << FX_BSTRC("currentfile/ASCII85Decode filter ");
+ buf << " 8[";
+ buf << width << " 0 0 -" << height << " 0 " << height << "]";
+ buf << "currentfile/ASCII85Decode filter ";
if (filter) {
buf << filter;
}
- buf << FX_BSTRC("false ") << Bpp;
- buf << FX_BSTRC(" colorimage\n");
+ buf << "false " << Bpp;
+ buf << " colorimage\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
FX_Free(output_buf);
@@ -528,13 +519,13 @@ void CFX_PSRenderer::SetColor(FX_DWORD color,
if (bCMYK != m_bCmykOutput || !m_bColorSet || m_LastColor != color) {
CFX_ByteTextBuf buf;
if (bCMYK) {
- buf << FXSYS_GetCValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetMValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetYValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetKValue(color) / 255.0 << FX_BSTRC(" k\n");
+ buf << FXSYS_GetCValue(color) / 255.0 << " "
+ << FXSYS_GetMValue(color) / 255.0 << " "
+ << FXSYS_GetYValue(color) / 255.0 << " "
+ << FXSYS_GetKValue(color) / 255.0 << " k\n";
} else {
- buf << FXARGB_R(color) / 255.0 << FX_BSTRC(" ") << FXARGB_G(color) / 255.0
- << FX_BSTRC(" ") << FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n");
+ buf << FXARGB_R(color) / 255.0 << " " << FXARGB_G(color) / 255.0 << " "
+ << FXARGB_B(color) / 255.0 << " rg\n";
}
if (bCMYK == m_bCmykOutput) {
m_bColorSet = TRUE;
@@ -575,18 +566,16 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
pPSFont->m_nGlyphs = 0;
m_PSFontList.Add(pPSFont);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC(
- "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
- "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
- "exch/.notdef put}for\n"
- "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
- "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get exch "
- "2 copy known not{pop/.notdef}if get exec}bind def\n"
- "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
- "exec}bind def\n"
- "currentdict end\n");
- buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1
- << FX_BSTRC(" exch definefont pop\n");
+ buf << "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
+ "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
+ "exch/.notdef put}for\n"
+ "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
+ "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get "
+ "exch 2 copy known not{pop/.notdef}if get exec}bind def\n"
+ "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
+ "exec}bind def\n"
+ "currentdict end\n";
+ buf << "/X" << m_PSFontList.GetSize() - 1 << " exch definefont pop\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
buf.Clear();
}
@@ -622,35 +611,32 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
TransformedPath.Transform(&matrix);
}
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/CharProcs get begin/")
- << ps_glyphindex << FX_BSTRC("{");
- buf << FX_BSTRC("n ");
+ buf << "/X" << ps_fontnum << " Ff/CharProcs get begin/" << ps_glyphindex
+ << "{n ";
for (int p = 0; p < TransformedPath.GetPointCount(); p++) {
FX_FLOAT x = TransformedPath.GetPointX(p), y = TransformedPath.GetPointY(p);
switch (TransformedPath.GetFlag(p) & FXPT_TYPE) {
case FXPT_MOVETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" m\n");
+ buf << x << " " << y << " m\n";
break;
}
case FXPT_LINETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" l\n");
+ buf << x << " " << y << " l\n";
break;
}
case FXPT_BEZIERTO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 2) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 2) << FX_BSTRC(" c\n");
+ buf << x << " " << y << " " << TransformedPath.GetPointX(p + 1) << " "
+ << TransformedPath.GetPointY(p + 1) << " "
+ << TransformedPath.GetPointX(p + 2) << " "
+ << TransformedPath.GetPointY(p + 2) << " c\n";
p += 2;
break;
}
}
}
- buf << FX_BSTRC("f");
- buf << FX_BSTRC("}bind def end\n");
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ")
- << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n");
+ buf << "f}bind def end\n";
+ buf << "/X" << ps_fontnum << " Ff/Encoding get " << ps_glyphindex << "/"
+ << ps_glyphindex << " put\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
FX_BOOL CFX_PSRenderer::DrawText(int nChars,
@@ -674,11 +660,9 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
}
SetColor(color, alpha_flag, pIccTransform);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("q[") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d;
- buf << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ")
- << pObject2Device->f << "]cm\n";
+ buf << "q[" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm\n";
if (pCache == NULL) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
@@ -689,17 +673,15 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
int ps_fontnum, ps_glyphindex;
FindPSFontGlyph(pFaceCache, pFont, pCharPos[i], ps_fontnum, ps_glyphindex);
if (last_fontnum != ps_fontnum) {
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff ") << font_size
- << FX_BSTRC(" Fs Sf ");
+ buf << "/X" << ps_fontnum << " Ff " << font_size << " Fs Sf ";
last_fontnum = ps_fontnum;
}
- buf << pCharPos[i].m_OriginX << FX_BSTRC(" ") << pCharPos[i].m_OriginY
- << FX_BSTRC(" m");
+ buf << pCharPos[i].m_OriginX << " " << pCharPos[i].m_OriginY << " m";
CFX_ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex << FX_BSTRC("Tj\n");
+ buf << hex << "Tj\n";
}
- buf << FX_BSTRC("Q\n");
+ buf << "Q\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
return TRUE;
}