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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 start_index = 1; | 350 start_index = 1; |
351 end_index = 0; | 351 end_index = 0; |
352 } | 352 } |
353 int start_x = min_x, end_x = max_x; | 353 int start_x = min_x, end_x = max_x; |
354 if (start_x < 0) { | 354 if (start_x < 0) { |
355 start_x = 0; | 355 start_x = 0; |
356 } | 356 } |
357 if (end_x > pBitmap->GetWidth()) { | 357 if (end_x > pBitmap->GetWidth()) { |
358 end_x = pBitmap->GetWidth(); | 358 end_x = pBitmap->GetWidth(); |
359 } | 359 } |
360 FX_LPBYTE dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + sta
rt_x * 4; | 360 uint8_t* dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + star
t_x * 4; |
361 FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); | 361 FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); |
362 FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); | 362 FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); |
363 FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); | 363 FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); |
364 FX_FLOAT R = r[start_index] + (start_x - min_x) * r_unit; | 364 FX_FLOAT R = r[start_index] + (start_x - min_x) * r_unit; |
365 FX_FLOAT G = g[start_index] + (start_x - min_x) * g_unit; | 365 FX_FLOAT G = g[start_index] + (start_x - min_x) * g_unit; |
366 FX_FLOAT B = b[start_index] + (start_x - min_x) * b_unit; | 366 FX_FLOAT B = b[start_index] + (start_x - min_x) * b_unit; |
367 for (int x = start_x; x < end_x; x ++) { | 367 for (int x = start_x; x < end_x; x ++) { |
368 R += r_unit; | 368 R += r_unit; |
369 G += g_unit; | 369 G += g_unit; |
370 B += b_unit; | 370 B += b_unit; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 start_y = FXSYS_round(orig_y + top_offset) - clip_box.top; | 1059 start_y = FXSYS_round(orig_y + top_offset) - clip_box.top; |
1060 } | 1060 } |
1061 if (width == 1 && height == 1) { | 1061 if (width == 1 && height == 1) { |
1062 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 ||
start_y >= clip_box.Height()) { | 1062 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 ||
start_y >= clip_box.Height()) { |
1063 continue; | 1063 continue; |
1064 } | 1064 } |
1065 FX_DWORD* dest_buf = (FX_DWORD*)(screen.GetBuffer() + screen.Get
Pitch() * start_y + start_x * 4); | 1065 FX_DWORD* dest_buf = (FX_DWORD*)(screen.GetBuffer() + screen.Get
Pitch() * start_y + start_x * 4); |
1066 if (pPattern->m_bColored) { | 1066 if (pPattern->m_bColored) { |
1067 *dest_buf = *src_buf; | 1067 *dest_buf = *src_buf; |
1068 } else { | 1068 } else { |
1069 *dest_buf = (*(FX_LPBYTE)src_buf << 24) | (fill_argb & 0xfff
fff); | 1069 *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffff
ff); |
1070 } | 1070 } |
1071 } else { | 1071 } else { |
1072 if (pPattern->m_bColored) { | 1072 if (pPattern->m_bColored) { |
1073 screen.CompositeBitmap(start_x, start_y, width, height, pPat
ternBitmap, 0, 0); | 1073 screen.CompositeBitmap(start_x, start_y, width, height, pPat
ternBitmap, 0, 0); |
1074 } else { | 1074 } else { |
1075 screen.CompositeMask(start_x, start_y, width, height, pPatte
rnBitmap, fill_argb, 0, 0); | 1075 screen.CompositeMask(start_x, start_y, width, height, pPatte
rnBitmap, fill_argb, 0, 0); |
1076 } | 1076 } |
1077 } | 1077 } |
1078 } | 1078 } |
1079 } | 1079 } |
(...skipping 23 matching lines...) Expand all Loading... |
1103 } | 1103 } |
1104 } | 1104 } |
1105 if(bStroke) { | 1105 if(bStroke) { |
1106 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); | 1106 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); |
1107 if(StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN)
{ | 1107 if(StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN)
{ |
1108 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); | 1108 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); |
1109 bStroke = FALSE; | 1109 bStroke = FALSE; |
1110 } | 1110 } |
1111 } | 1111 } |
1112 } | 1112 } |
OLD | NEW |