| 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 "../../../include/fpdfapi/fpdf_render.h" | 7 #include "../../../include/fpdfapi/fpdf_render.h" |
| 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
| 10 #include "../fpdf_page/pageint.h" | 10 #include "../fpdf_page/pageint.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (pFuncs[j]->Call(&input, 1, pResults + offset, nresults)) { | 64 if (pFuncs[j]->Call(&input, 1, pResults + offset, nresults)) { |
| 65 offset += nresults; | 65 offset += nresults; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; | 69 FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; |
| 70 pCS->GetRGB(pResults, R, G, B); | 70 pCS->GetRGB(pResults, R, G, B); |
| 71 rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXS
YS_round(G * 255), FXSYS_round(B * 255))); | 71 rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXS
YS_round(G * 255), FXSYS_round(B * 255))); |
| 72 } | 72 } |
| 73 int pitch = pBitmap->GetPitch(); | 73 int pitch = pBitmap->GetPitch(); |
| 74 int Bpp = pBitmap->GetBPP() / 8; | |
| 75 for (int row = 0; row < height; row ++) { | 74 for (int row = 0; row < height; row ++) { |
| 76 FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); | 75 FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); |
| 77 for (int column = 0; column < width; column ++) { | 76 for (int column = 0; column < width; column ++) { |
| 78 FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; | 77 FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; |
| 79 matrix.Transform(x, y); | 78 matrix.Transform(x, y); |
| 80 FX_FLOAT scale = FXSYS_Div(FXSYS_Mul(x - start_x, x_span) + FXSYS_Mu
l(y - start_y, y_span), axis_len_square); | 79 FX_FLOAT scale = FXSYS_Div(FXSYS_Mul(x - start_x, x_span) + FXSYS_Mu
l(y - start_y, y_span), axis_len_square); |
| 81 int index = (FX_INT32)(scale * (SHADING_STEPS - 1)); | 80 int index = (FX_INT32)(scale * (SHADING_STEPS - 1)); |
| 82 if (index < 0) { | 81 if (index < 0) { |
| 83 if (!bStartExtend) { | 82 if (!bStartExtend) { |
| 84 continue; | 83 continue; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 148 } |
| 150 FX_FLOAT R, G, B; | 149 FX_FLOAT R, G, B; |
| 151 pCS->GetRGB(pResults, R, G, B); | 150 pCS->GetRGB(pResults, R, G, B); |
| 152 rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXS
YS_round(G * 255), FXSYS_round(B * 255))); | 151 rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXS
YS_round(G * 255), FXSYS_round(B * 255))); |
| 153 } | 152 } |
| 154 FX_FLOAT a = FXSYS_Mul(start_x - end_x, start_x - end_x) + | 153 FX_FLOAT a = FXSYS_Mul(start_x - end_x, start_x - end_x) + |
| 155 FXSYS_Mul(start_y - end_y, start_y - end_y) - FXSYS_Mul(start_r
- end_r, start_r - end_r); | 154 FXSYS_Mul(start_y - end_y, start_y - end_y) - FXSYS_Mul(start_r
- end_r, start_r - end_r); |
| 156 int width = pBitmap->GetWidth(); | 155 int width = pBitmap->GetWidth(); |
| 157 int height = pBitmap->GetHeight(); | 156 int height = pBitmap->GetHeight(); |
| 158 int pitch = pBitmap->GetPitch(); | 157 int pitch = pBitmap->GetPitch(); |
| 159 int Bpp = pBitmap->GetBPP() / 8; | |
| 160 FX_BOOL bDecreasing = FALSE; | 158 FX_BOOL bDecreasing = FALSE; |
| 161 if (start_r > end_r) { | 159 if (start_r > end_r) { |
| 162 int length = (int)FXSYS_sqrt((FXSYS_Mul(start_x - end_x, start_x - end_x
) + FXSYS_Mul(start_y - end_y, start_y - end_y))); | 160 int length = (int)FXSYS_sqrt((FXSYS_Mul(start_x - end_x, start_x - end_x
) + FXSYS_Mul(start_y - end_y, start_y - end_y))); |
| 163 if (length < start_r - end_r) { | 161 if (length < start_r - end_r) { |
| 164 bDecreasing = TRUE; | 162 bDecreasing = TRUE; |
| 165 } | 163 } |
| 166 } | 164 } |
| 167 for (int row = 0; row < height; row ++) { | 165 for (int row = 0; row < height; row ++) { |
| 168 FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); | 166 FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); |
| 169 for (int column = 0; column < width; column ++) { | 167 for (int column = 0; column < width; column ++) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 ymax = pDomain->GetNumber(3); | 236 ymax = pDomain->GetNumber(3); |
| 239 } | 237 } |
| 240 CFX_AffineMatrix mtDomain2Target = pDict->GetMatrix(FX_BSTRC("Matrix")); | 238 CFX_AffineMatrix mtDomain2Target = pDict->GetMatrix(FX_BSTRC("Matrix")); |
| 241 CFX_AffineMatrix matrix, reverse_matrix; | 239 CFX_AffineMatrix matrix, reverse_matrix; |
| 242 matrix.SetReverse(*pObject2Bitmap); | 240 matrix.SetReverse(*pObject2Bitmap); |
| 243 reverse_matrix.SetReverse(mtDomain2Target); | 241 reverse_matrix.SetReverse(mtDomain2Target); |
| 244 matrix.Concat(reverse_matrix); | 242 matrix.Concat(reverse_matrix); |
| 245 int width = pBitmap->GetWidth(); | 243 int width = pBitmap->GetWidth(); |
| 246 int height = pBitmap->GetHeight(); | 244 int height = pBitmap->GetHeight(); |
| 247 int pitch = pBitmap->GetPitch(); | 245 int pitch = pBitmap->GetPitch(); |
| 248 int Bpp = pBitmap->GetBPP() / 8; | |
| 249 int total_results = 0; | 246 int total_results = 0; |
| 250 for (int j = 0; j < nFuncs; j ++) { | 247 for (int j = 0; j < nFuncs; j ++) { |
| 251 if (pFuncs[j]) { | 248 if (pFuncs[j]) { |
| 252 total_results += pFuncs[j]->CountOutputs(); | 249 total_results += pFuncs[j]->CountOutputs(); |
| 253 } | 250 } |
| 254 } | 251 } |
| 255 if (pCS->CountComponents() > total_results) { | 252 if (pCS->CountComponents() > total_results) { |
| 256 total_results = pCS->CountComponents(); | 253 total_results = pCS->CountComponents(); |
| 257 } | 254 } |
| 258 CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); | 255 CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 D1.FromPoints(coords[0].x, coords[0].y, coords[1].x, coords[1].y, coords
[2].x, coords[2].y, | 733 D1.FromPoints(coords[0].x, coords[0].y, coords[1].x, coords[1].y, coords
[2].x, coords[2].y, |
| 737 coords[3].x, coords[3].y); | 734 coords[3].x, coords[3].y); |
| 738 D2.FromPoints(coords[9].x, coords[9].y, coords[8].x, coords[8].y, coords
[7].x, coords[7].y, | 735 D2.FromPoints(coords[9].x, coords[9].y, coords[8].x, coords[8].y, coords
[7].x, coords[7].y, |
| 739 coords[6].x, coords[6].y); | 736 coords[6].x, coords[6].y); |
| 740 patch.Draw(1, 1, 0, 0, C1, C2, D1, D2); | 737 patch.Draw(1, 1, 0, 0, C1, C2, D1, D2); |
| 741 } | 738 } |
| 742 } | 739 } |
| 743 void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat
rix* pMatrix, | 740 void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat
rix* pMatrix, |
| 744 FX_RECT& clip_rect, int alpha, FX_BOOL bAlph
aMode) | 741 FX_RECT& clip_rect, int alpha, FX_BOOL bAlph
aMode) |
| 745 { | 742 { |
| 746 int width = clip_rect.Width(); | |
| 747 int height = clip_rect.Height(); | |
| 748 CPDF_Function** pFuncs = pPattern->m_pFunctions; | 743 CPDF_Function** pFuncs = pPattern->m_pFunctions; |
| 749 int nFuncs = pPattern->m_nFuncs; | 744 int nFuncs = pPattern->m_nFuncs; |
| 750 CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict(); | 745 CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict(); |
| 751 CPDF_ColorSpace* pColorSpace = pPattern->m_pCS; | 746 CPDF_ColorSpace* pColorSpace = pPattern->m_pCS; |
| 752 if (pColorSpace == NULL) { | 747 if (pColorSpace == NULL) { |
| 753 return; | 748 return; |
| 754 } | 749 } |
| 755 FX_ARGB background = 0; | 750 FX_ARGB background = 0; |
| 756 if (!pPattern->m_bShadingObj && pPattern->m_pShadingObj->GetDict()->KeyExist
(FX_BSTRC("Background"))) { | 751 if (!pPattern->m_bShadingObj && pPattern->m_pShadingObj->GetDict()->KeyExist
(FX_BSTRC("Background"))) { |
| 757 CPDF_Array* pBackColor = pPattern->m_pShadingObj->GetDict()->GetArray(FX
_BSTRC("Background")); | 752 CPDF_Array* pBackColor = pPattern->m_pShadingObj->GetDict()->GetArray(FX
_BSTRC("Background")); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 bStroke = FALSE; | 1086 bStroke = FALSE; |
| 1092 bPattern = TRUE; | 1087 bPattern = TRUE; |
| 1093 } | 1088 } |
| 1094 } | 1089 } |
| 1095 #ifdef _FPDFAPI_MINI_ | 1090 #ifdef _FPDFAPI_MINI_ |
| 1096 if (bPattern && m_DitherBits) { | 1091 if (bPattern && m_DitherBits) { |
| 1097 DitherObjectArea(pPathObj, pObj2Device); | 1092 DitherObjectArea(pPathObj, pObj2Device); |
| 1098 } | 1093 } |
| 1099 #endif | 1094 #endif |
| 1100 } | 1095 } |
| OLD | NEW |