From 5dc4f24637d353d4d777c251f6d8c5746e062e7e Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Sat, 24 May 2014 12:20:17 -0700 Subject: Fix warnings in android build, fix font rendering issue, fix issue 357588: wrong characters representation, and addjust some code indent BUG= R=jam@chromium.org Review URL: https://codereview.chromium.org/294353002 --- .../src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 4 +- .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 2 +- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 2 +- .../fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 48 +++++++++------------- core/src/fpdfapi/fpdf_render/render_int.h | 3 +- core/src/fpdftext/fpdf_text_int.cpp | 33 +++++++-------- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 4 +- .../src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c | 3 +- core/src/fxcrt/fx_basic_coords.cpp | 7 +++- core/src/fxge/android/fpf_skiafontmgr.cpp | 4 +- core/src/fxge/dib/fx_dib_composite.cpp | 2 +- core/src/fxge/dib/fx_dib_convert.cpp | 3 +- core/src/fxge/dib/fx_dib_main.cpp | 3 +- core/src/fxge/dib/fx_dib_transform.cpp | 8 ++-- .../fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c | 3 +- .../fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c | 17 ++++++-- .../fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c | 5 +++ .../fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c | 17 ++++++-- core/src/fxge/win32/fx_win32_device.cpp | 5 +++ 19 files changed, 98 insertions(+), 75 deletions(-) (limited to 'core/src') diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index cafca2623c..8cd9f2bdb5 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -1036,8 +1036,8 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) for (i = 0; i < m_nStreams; i ++) { FX_DWORD size = m_pStreamArray[i]->GetSize(); if (m_Size + size + 1 <= m_Size) { - m_Status = Done; - return; + m_Status = Done; + return; } m_Size += size + 1; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 35b9726b4a..c705ea7357 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2401,7 +2401,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT { CPDF_Object* pLenObj = pDict->GetElement(FX_BSTRC("Length")); FX_DWORD len = 0; - if (pLenObj && (pLenObj->GetType() != PDFOBJ_REFERENCE || + if (pLenObj && ((pLenObj->GetType() != PDFOBJ_REFERENCE) || ((((CPDF_Reference*)pLenObj)->GetObjList() != NULL) && ((CPDF_Reference*)pLenObj)->GetRefObjNum() != objnum))) { FX_FILESIZE pos = m_Pos; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 19624329fb..611804bc06 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -508,7 +508,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Affi } CPDF_RenderStatus status; status.Initialize(m_Level + 1, m_pContext, m_pDevice, NULL, m_pStopObj, - this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, TRUE); + this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, FALSE); status.m_curBlend = m_curBlend; m_pDevice->SaveState(); status.RenderObjectList(pFormObj->m_pForm, &matrix); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index e67b46c931..91a3725ad7 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -911,37 +911,33 @@ void CPDF_DIBSource::LoadPalette() } } } - FX_DWORD CPDF_DIBSource::GetValidBpp() const { FX_DWORD bpc = m_bpc; CPDF_Object * pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); - if(pFilter) - { - if(pFilter->GetType() == PDFOBJ_NAME) - { + if (pFilter) { + if (pFilter->GetType() == PDFOBJ_NAME) { CFX_ByteString filter = pFilter->GetString(); - if(filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG2Decode") ) + if (filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG2Decode")) { bpc = 1; - if(filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCTDecode") ) + } + if (filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCTDecode")) { bpc = 8; + } + } else if (pFilter->GetType() == PDFOBJ_ARRAY) { + CPDF_Array *pArray = (CPDF_Array *)pFilter; + if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("CCITTFacDecode") || + pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("JBIG2Decode")) { + bpc = 1; + } + if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("RunLengthDecode") || + pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode")) { + bpc = 8; + } } - else if (pFilter->GetType() == PDFOBJ_ARRAY) - { - CPDF_Array *pArray = (CPDF_Array *) pFilter; - if( pArray->GetString(pArray->GetCount() -1) == FX_BSTRC("CCITTFacDecode") || - pArray->GetString(pArray->GetCount() -1) == FX_BSTRC("JBIG2Decode") ) - bpc = 1; - - if( pArray->GetString(pArray->GetCount() -1) == FX_BSTRC("RunLengthDecode") || - pArray->GetString(pArray->GetCount() -1) == FX_BSTRC("DCTDecode") ) - bpc = 8; - } - } - + } return bpc; } - #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 : (color); void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const { @@ -969,9 +965,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } else { int src_bit_pos = 0; int dest_byte_pos = 0; - FX_DWORD bpc = GetValidBpp(); - for (int column = 0; column < m_Width; column ++) { int R = _GetBits8(src_scan, src_bit_pos, bpc); src_bit_pos += bpc; @@ -990,9 +984,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } return; } else if (m_bpc == 8) { - if (m_nComponents == m_pColorSpace->CountComponents()) - m_pColorSpace->TranslateImageLine(dest_scan, src_scan, m_Width, m_Width, m_Height, - m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK); + if (m_nComponents == m_pColorSpace->CountComponents()) + m_pColorSpace->TranslateImageLine(dest_scan, src_scan, m_Width, m_Width, m_Height, + m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK); return; } } @@ -1027,9 +1021,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } else { int src_bit_pos = 0; int dest_byte_pos = 0; - FX_DWORD bpc = GetValidBpp(); - for (int column = 0; column < m_Width; column ++) { for (FX_DWORD color = 0; color < m_nComponents; color ++) { int data = _GetBits8(src_scan, src_bit_pos, bpc); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 9bde4be877..e8e8ea4651 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -419,8 +419,7 @@ protected: void LoadPalette(); FX_BOOL CreateDecoder(); void TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const; - FX_DWORD GetValidBpp() const; - + FX_DWORD GetValidBpp() const; CPDF_Document* m_pDocument; const CPDF_Stream* m_pStream; CPDF_StreamAcc* m_pStreamAcc; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 0e0d52ec1a..6baf6ad339 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -939,12 +939,12 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() if (!nHorizontalMask.SetSize(nPageWidth)) { return -1; } - FX_BYTE* pDataH = nHorizontalMask.GetData(); + FX_BYTE* pDataH = nHorizontalMask.GetData(); CFX_ByteArray nVerticalMask; if (!nVerticalMask.SetSize(nPageHeight)) { return -1; } - FX_BYTE* pDataV = nVerticalMask.GetData(); + FX_BYTE* pDataV = nVerticalMask.GetData(); FX_INT32 index = 0; FX_FLOAT fLineHeight = 0.0f; CPDF_PageObject* pPageObj = NULL; @@ -961,22 +961,19 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() if(PDFPAGE_TEXT != pPageObj->m_Type) { continue; } - FX_INT32 minH = (FX_INT32)pPageObj->m_Left < 0 ? 0 : (FX_INT32)pPageObj->m_Left; - FX_INT32 maxH = (FX_INT32)pPageObj->m_Right > nPageWidth ? nPageWidth : (FX_INT32)pPageObj->m_Right; - FX_INT32 minV = (FX_INT32)pPageObj->m_Bottom < 0 ? 0 : (FX_INT32)pPageObj->m_Bottom; - FX_INT32 maxV = (FX_INT32)pPageObj->m_Top > nPageHeight ? nPageHeight : (FX_INT32)pPageObj->m_Top; - if (minH >= maxH || minV >= maxV){ - continue; - } - - FXSYS_memset8(pDataH + minH, 1, maxH - minH); - FXSYS_memset8(pDataV + minV, 1, maxV - minV); - - if (fLineHeight <= 0.0f) { - fLineHeight = pPageObj->m_Top - pPageObj->m_Bottom; - } - - pPageObj = NULL; + FX_INT32 minH = (FX_INT32)pPageObj->m_Left < 0 ? 0 : (FX_INT32)pPageObj->m_Left; + FX_INT32 maxH = (FX_INT32)pPageObj->m_Right > nPageWidth ? nPageWidth : (FX_INT32)pPageObj->m_Right; + FX_INT32 minV = (FX_INT32)pPageObj->m_Bottom < 0 ? 0 : (FX_INT32)pPageObj->m_Bottom; + FX_INT32 maxV = (FX_INT32)pPageObj->m_Top > nPageHeight ? nPageHeight : (FX_INT32)pPageObj->m_Top; + if (minH >= maxH || minV >= maxV) { + continue; + } + FXSYS_memset8(pDataH + minH, 1, maxH - minH); + FXSYS_memset8(pDataV + minV, 1, maxV - minV); + if (fLineHeight <= 0.0f) { + fLineHeight = pPageObj->m_Top - pPageObj->m_Bottom; + } + pPageObj = NULL; } FX_INT32 nStartH = 0; FX_INT32 nEndH = 0; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 32cb10076d..8e77cdaece 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -729,7 +729,9 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo pScanline = pChannel + row * pitch; for (col = 0; col < wid; col++) { pPixel = pScanline + col * image->numcomps; - if (!image->comps[channel].data) continue; + if (!image->comps[channel].data) { + continue; + } src = image->comps[channel].data[row * wid + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) : 0; if (adjust_comps[channel] - 1 < 0) { diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c index 0a64938b5c..c4341ec1bb 100644 --- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c +++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c @@ -190,7 +190,7 @@ void opj_mct_decode_real( } n &= 7; } else { - for(i = 0; i < n; ++i) { + for (i = 0; i < n; ++i) { OPJ_FLOAT32 y = c0[i]; OPJ_FLOAT32 u = c1[i]; OPJ_FLOAT32 v = c2[i]; @@ -202,7 +202,6 @@ void opj_mct_decode_real( c2[i] = b; } } - #endif for(i = 0; i < n; ++i) { OPJ_FLOAT32 y = c0[i]; diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index f55c267da5..62061704c7 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -260,7 +260,12 @@ void CFX_Matrix::Set(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, } void CFX_Matrix::Set(const FX_FLOAT n[6]) { - FXSYS_memcpy32((void*)this, &n, sizeof(CFX_Matrix)); + this->a = n[0]; + this->b = n[1]; + this->c = n[2]; + this->d = n[3]; + this->e = n[4]; + this->f = n[5]; } void CFX_Matrix::SetReverse(const CFX_Matrix &m) { diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index cf93e5beaf..4380732eb1 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -283,7 +283,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, { FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); IFPF_Font *pFont = NULL; - if (m_FamilyFonts.Lookup((void*)dwHash, (void*&)pFont)) { + if (m_FamilyFonts.Lookup((void*)(FX_UINTPTR)dwHash, (void*&)pFont)) { if (pFont) { return pFont->Retain(); } @@ -355,7 +355,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; if (pFont) { if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { - m_FamilyFonts.SetAt((void*)dwHash, (void*)pFont); + m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); return pFont->Retain(); } pFont->Release(); diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index 1bbe07725b..da555de9d5 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -3805,7 +3805,6 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB { int src_Bpp = (m_SrcFormat & 0xff) >> 3; int dest_Bpp = (m_DestFormat & 0xff) >> 3; - int dest_Size = width * dest_Bpp + 4; if (m_bRgbByteOrder) { switch (m_Transparency) { case 0: @@ -3886,6 +3885,7 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } } } else { + int dest_Size = width * dest_Bpp + 4; if (dest_Size > m_CacheSize) { m_pCacheScanline = FX_Realloc(FX_BYTE, m_pCacheScanline, dest_Size); if (!m_pCacheScanline) { diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 0120721e35..2a74452626 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -452,7 +452,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi src_scan += 4; } } - } else + } else { for (int row = 0; row < height; row ++) { FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; @@ -461,6 +461,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi src_scan += Bpp; } } + } } return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 9b27a13daf..7644e39f02 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -1326,7 +1326,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) *scanline ++ = bk + (fk - bk) * gray / 255; } } - } else + } else { for (int row = 0; row < m_Height; row ++) { FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; int gap = m_bpp / 8 - 2; @@ -1338,6 +1338,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) scanline += gap; } } + } return TRUE; } FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect) diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 80475cbb1f..16d791b4ee 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -420,13 +420,13 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); - int pos_pixel[8]; for (int row = 0; row < m_ResultHeight; row ++) { FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) { + int pos_pixel[8]; int u_w[4], v_w[4]; if (src_col_l == stretch_width) { src_col_l--; @@ -493,13 +493,13 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); - int pos_pixel[8]; for (int row = 0; row < m_ResultHeight; row ++) { FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) { + int pos_pixel[8]; int u_w[4], v_w[4]; if (src_col_l == stretch_width) { src_col_l--; @@ -593,13 +593,13 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); - int pos_pixel[8]; for (int row = 0; row < m_ResultHeight; row ++) { FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) { + int pos_pixel[8]; int u_w[4], v_w[4]; if (src_col_l == stretch_width) { src_col_l--; @@ -706,13 +706,13 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); - int pos_pixel[8]; for (int row = 0; row < m_ResultHeight; row ++) { FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) { + int pos_pixel[8]; int u_w[4], v_w[4]; if (src_col_l == stretch_width) { src_col_l--; diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c index c1eeec289a..479d9125d1 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c @@ -328,7 +328,6 @@ FT_Error lastError = FT_Err_Ok; FT_Vector translation; - int refCount = 0; #if 0 FT_Vector advancePoint; @@ -355,7 +354,7 @@ /* winding order only affects darkening */ needWinding = font->darkened; - while ( refCount++ < 1024) + while ( 1 ) { /* reset output buffer */ cf2_outline_reset( &font->outline ); diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c index 4311d10756..7f82b247af 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c @@ -143,6 +143,7 @@ /* downcast the object pointer */ CF2_Outline outline = (CF2_Outline)callbacks; CFF_Builder* builder; + FT_Error error; FT_ASSERT( outline && outline->decoder ); @@ -154,15 +155,18 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - cff_builder_start_point( builder, + error = cff_builder_start_point(builder, params->pt0.x, params->pt0.y ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; } /* `cff_builder_add_point1' includes a check_points call for one point */ - cff_builder_add_point1( builder, + error = cff_builder_add_point1(builder, params->pt1.x, params->pt1.y ); + if (callbacks && callbacks->error) *callbacks->error = error; } @@ -173,6 +177,7 @@ /* downcast the object pointer */ CF2_Outline outline = (CF2_Outline)callbacks; CFF_Builder* builder; + FT_Error error; FT_ASSERT( outline && outline->decoder ); @@ -184,13 +189,17 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - cff_builder_start_point( builder, + error = cff_builder_start_point( builder, params->pt0.x, params->pt0.y ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; } /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - cff_check_points( builder, 3 ); + error = cff_check_points( builder, 3 ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; cff_builder_add_point( builder, params->pt1.x, diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c index e0755b4c3c..70926299f3 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c @@ -1585,6 +1585,7 @@ { /* emit offset 1st point as MoveTo */ cf2_glyphpath_pushMove( glyphpath, P0 ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; glyphpath->moveIsPending = FALSE; /* adjust state machine */ glyphpath->pathIsOpen = TRUE; @@ -1601,6 +1602,7 @@ &P0, P1, FALSE ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; } /* queue the current element with offset points */ @@ -1671,6 +1673,7 @@ { /* emit offset 1st point as MoveTo */ cf2_glyphpath_pushMove( glyphpath, P0 ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; glyphpath->moveIsPending = FALSE; glyphpath->pathIsOpen = TRUE; @@ -1687,6 +1690,7 @@ &P0, P1, FALSE ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; } /* queue the current element with offset points */ @@ -1723,6 +1727,7 @@ cf2_glyphpath_lineTo( glyphpath, glyphpath->start.x, glyphpath->start.y ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; /* Draw previous element (the explicit LineTo we just created, */ /* above) and connect it to the start point, but with the offset we */ diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c index 12f5dd79e7..fc11100012 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c @@ -464,9 +464,6 @@ CF2_HintMaskRec hintMask; CF2_GlyphPathRec glyphPath; - int refCount = 0; - - /* initialize the remaining objects */ cf2_arrstack_init( &subrStack, memory, @@ -551,7 +548,7 @@ goto exit; /* main interpreter loop */ - while ( refCount++ < 10240 ) + while ( 1 ) { if ( cf2_buf_isEnd( charstring ) ) { @@ -646,6 +643,7 @@ curY += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -663,6 +661,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -693,6 +692,7 @@ isX = !isX; cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -720,6 +720,7 @@ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -732,6 +733,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -1225,6 +1227,7 @@ curX += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -1243,6 +1246,7 @@ curX += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -1260,6 +1264,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; index += 2; } @@ -1274,6 +1279,7 @@ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1313,6 +1319,7 @@ y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1352,6 +1359,7 @@ y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1418,6 +1426,7 @@ } cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 592886249b..2e2ea9a92b 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -1156,6 +1156,11 @@ IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu } else { device_class = FXDC_DISPLAY; } +#ifndef _FPDFAPI_MINI_ + if (device_class == FXDC_PRINTER) { + return FX_NEW CGdiPrinterDriver(hDC); + } +#endif return FX_NEW CGdiDisplayDriver(hDC); } CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format format) -- cgit v1.2.3