Fix warnings in android build, fix font rendering issue, fix issue 357588: wrong...
authorBo Xu <bo_xu@foxitsoftware.com>
Sat, 24 May 2014 19:20:17 +0000 (12:20 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Sat, 24 May 2014 19:20:17 +0000 (12:20 -0700)
BUG=
R=jam@chromium.org

Review URL: https://codereview.chromium.org/294353002

20 files changed:
core/include/fxcrt/fx_system.h
core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
core/src/fpdfapi/fpdf_render/fpdf_render.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
core/src/fpdfapi/fpdf_render/render_int.h
core/src/fpdftext/fpdf_text_int.cpp
core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/mct.c
core/src/fxcrt/fx_basic_coords.cpp
core/src/fxge/android/fpf_skiafontmgr.cpp
core/src/fxge/dib/fx_dib_composite.cpp
core/src/fxge/dib/fx_dib_convert.cpp
core/src/fxge/dib/fx_dib_main.cpp
core/src/fxge/dib/fx_dib_transform.cpp
core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c
core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c
core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c
core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c
core/src/fxge/win32/fx_win32_device.cpp

index 0021c14..9f43360 100644 (file)
@@ -39,7 +39,7 @@
 #define _FX_W32_               1
 #define _FX_W64_               2
 #ifndef _FX_WORDSIZE_
-#if defined(_WIN64) || defined(__arm64) || defined(__arm64__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IA64) || defined(__powerpc64__) || defined(__x86_64__) || __WORDSIZE == 64
+#if defined(_WIN64) || defined(__arm64) || defined(__arm64__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IA64) || defined(__powerpc64__) || defined(__x86_64__) || __WORDSIZE == 64 || defined(__LP64__)
 #define _FX_WORDSIZE_  _FX_W64_
 #else
 #define _FX_WORDSIZE_  _FX_W32_
index cafca26..8cd9f2b 100644 (file)
@@ -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;
                     }
index 35b9726..c705ea7 100644 (file)
@@ -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;
index 1962432..611804b 100644 (file)
@@ -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);
index e67b46c..91a3725 100644 (file)
@@ -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);
index 9bde4be..e8e8ea4 100644 (file)
@@ -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;
index 0e0d52e..6baf6ad 100644 (file)
@@ -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;
index 32cb100..8e77cda 100644 (file)
@@ -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) {
index 0a64938..c4341ec 100644 (file)
@@ -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];
index f55c267..6206170 100644 (file)
@@ -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)
 {
index cf93e5b..4380732 100644 (file)
@@ -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();
index 1bbe077..da555de 100644 (file)
@@ -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) {
index 0120721..2a74452 100644 (file)
@@ -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;
 }
index 9b27a13..7644e39 100644 (file)
@@ -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)
index 80475cb..16d791b 100644 (file)
@@ -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--;
index c1eeec2..479d912 100644 (file)
     FT_Error  lastError = FT_Err_Ok;
 
     FT_Vector  translation;
-       int refCount = 0;
 
 #if 0
     FT_Vector  advancePoint;
     /* winding order only affects darkening */
     needWinding = font->darkened;
 
-    while ( refCount++ < 1024)
+    while ( 1 )
     {
       /* reset output buffer */
       cf2_outline_reset( &font->outline );
index 4311d10..7f82b24 100644 (file)
     /* downcast the object pointer */
     CF2_Outline   outline = (CF2_Outline)callbacks;
     CFF_Builder*  builder;
+       FT_Error          error;
 
 
     FT_ASSERT( outline && outline->decoder );
     {
       /* 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;
   }
 
 
     /* downcast the object pointer */
     CF2_Outline   outline = (CF2_Outline)callbacks;
     CFF_Builder*  builder;
+       FT_Error          error;
 
 
     FT_ASSERT( outline && outline->decoder );
     {
       /* 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,
index e0755b4..7092629 100644 (file)
     {
       /* 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;
                                   &P0,
                                   P1,
                                   FALSE );
+         if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return;
     }
 
     /* queue the current element with offset points */
     {
       /* 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;
                                   &P0,
                                   P1,
                                   FALSE );
+         if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return;
     }
 
     /* queue the current element with offset points */
       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 */
index 12f5dd7..fc11100 100644 (file)
     CF2_HintMaskRec   hintMask;
     CF2_GlyphPathRec  glyphPath;
 
-       int refCount = 0;
-
-
     /* initialize the remaining objects */
     cf2_arrstack_init( &subrStack,
                        memory,
       goto exit;
 
     /* main interpreter loop */
-    while ( refCount++ < 10240 )
+    while ( 1 )
     {
       if ( cf2_buf_isEnd( charstring ) )
       {
         curY += cf2_stack_popFixed( opStack );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+               if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit;
 
         break;
 
             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 );
             isX = !isX;
 
             cf2_glyphpath_lineTo( &glyphPath, curX, curY );
+                       if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit;
           }
 
           cf2_stack_clear( opStack );
 
 
             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;
             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 );
         curX += cf2_stack_popFixed( opStack );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+               if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit;
 
         break;
 
         curX += cf2_stack_popFixed( opStack );
 
         cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+               if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit;
 
         break;
 
             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;
           }
 
 
 
             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;
             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;
             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;
             }
 
             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;
index 5928862..2e2ea9a 100644 (file)
@@ -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)