diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-05-24 12:20:17 -0700 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-05-24 12:20:17 -0700 |
commit | 5dc4f24637d353d4d777c251f6d8c5746e062e7e (patch) | |
tree | 3b456ac537c2ff58afa268bd4a543a482dbdc1f1 /core/src/fxge | |
parent | 4201b2a5f38a6335d012aa4dc4cd19f6989d05f1 (diff) | |
download | pdfium-5dc4f24637d353d4d777c251f6d8c5746e062e7e.tar.xz |
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
Diffstat (limited to 'core/src/fxge')
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.cpp | 4 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_composite.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_convert.cpp | 3 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 3 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_transform.cpp | 8 | ||||
-rw-r--r-- | core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c | 3 | ||||
-rw-r--r-- | core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c | 17 | ||||
-rw-r--r-- | core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c | 5 | ||||
-rw-r--r-- | core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c | 17 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 5 |
10 files changed, 48 insertions, 19 deletions
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) |