| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include "core/include/fpdfapi/fpdf_pageobj.h" | 9 #include "core/include/fpdfapi/fpdf_pageobj.h" |
| 10 #include "core/include/fpdfapi/fpdf_render.h" | 10 #include "core/include/fpdfapi/fpdf_render.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 blues[count++] = new_pos; | 67 blues[count++] = new_pos; |
| 68 return new_pos; | 68 return new_pos; |
| 69 } | 69 } |
| 70 void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, | 70 void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, |
| 71 FX_FLOAT bottom, | 71 FX_FLOAT bottom, |
| 72 int& top_line, | 72 int& top_line, |
| 73 int& bottom_line) { | 73 int& bottom_line) { |
| 74 top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); | 74 top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); |
| 75 bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); | 75 bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); |
| 76 } | 76 } |
| 77 |
| 77 static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { | 78 static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { |
| 78 int size = width / 8; | 79 int size = width / 8; |
| 79 for (int i = 0; i < size; i++) | 80 for (int i = 0; i < size; i++) { |
| 80 if (pBuf[i]) { | 81 if (pBuf[i]) |
| 81 return TRUE; | 82 return TRUE; |
| 82 } | 83 } |
| 83 if (width % 8) | 84 return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8))); |
| 84 if (pBuf[width / 8] & (0xff << (8 - width % 8))) { | 85 } |
| 86 |
| 87 static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { |
| 88 for (int i = 0; i < width; i++) { |
| 89 if (pBuf[i] > 0x40) |
| 85 return TRUE; | 90 return TRUE; |
| 86 } | 91 } |
| 87 return FALSE; | 92 return FALSE; |
| 88 } | 93 } |
| 89 static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { | 94 |
| 90 for (int i = 0; i < width; i++) | |
| 91 if (pBuf[i] > 0x40) { | |
| 92 return TRUE; | |
| 93 } | |
| 94 return FALSE; | |
| 95 } | |
| 96 static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { | 95 static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { |
| 97 int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(), | 96 int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(), |
| 98 width = pBitmap->GetWidth(); | 97 width = pBitmap->GetWidth(); |
| 99 int bpp = pBitmap->GetBPP(); | 98 int bpp = pBitmap->GetBPP(); |
| 100 if (bpp > 8) { | 99 if (bpp > 8) { |
| 101 width *= bpp / 8; | 100 width *= bpp / 8; |
| 102 } | 101 } |
| 103 uint8_t* pBuf = pBitmap->GetBuffer(); | 102 uint8_t* pBuf = pBitmap->GetBuffer(); |
| 104 int line = bFirst ? 0 : height - 1; | 103 int line = bFirst ? 0 : height - 1; |
| 105 int line_step = bFirst ? 1 : -1; | 104 int line_step = bFirst ? 1 : -1; |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 charpos.m_OriginY); | 776 charpos.m_OriginY); |
| 778 path.m_Path.New()->Append(pPath, &matrix); | 777 path.m_Path.New()->Append(pPath, &matrix); |
| 779 path.m_Matrix = *pTextMatrix; | 778 path.m_Matrix = *pTextMatrix; |
| 780 path.m_bStroke = bStroke; | 779 path.m_bStroke = bStroke; |
| 781 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 780 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
| 782 path.CalcBoundingBox(); | 781 path.CalcBoundingBox(); |
| 783 ProcessPath(&path, pObj2Device); | 782 ProcessPath(&path, pObj2Device); |
| 784 } | 783 } |
| 785 } | 784 } |
| 786 | 785 |
| OLD | NEW |