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 "../../../../third_party/base/numerics/safe_math.h" | 7 #include "../../../../third_party/base/numerics/safe_math.h" |
8 #include "../../../include/fxcrt/fx_system.h" | 8 #include "../../../include/fxcrt/fx_system.h" |
9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma
pRef Mask) | 49 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma
pRef Mask) |
50 { | 50 { |
51 const CFX_DIBitmap* mask_dib = Mask; | 51 const CFX_DIBitmap* mask_dib = Mask; |
52 m_Type = MaskF; | 52 m_Type = MaskF; |
53 m_Box = rect; | 53 m_Box = rect; |
54 m_Box.Intersect(mask_rect); | 54 m_Box.Intersect(mask_rect); |
55 if (m_Box.IsEmpty()) { | 55 if (m_Box.IsEmpty()) { |
56 m_Type = RectI; | 56 m_Type = RectI; |
57 return; | 57 return; |
58 } else if (m_Box == mask_rect) { | 58 } |
| 59 if (m_Box == mask_rect) { |
59 m_Mask = Mask; | 60 m_Mask = Mask; |
60 return; | 61 return; |
61 } | 62 } |
62 CFX_DIBitmap* new_dib = m_Mask.New(); | 63 CFX_DIBitmap* new_dib = m_Mask.New(); |
63 if (!new_dib) { | 64 if (!new_dib) { |
64 return; | 65 return; |
65 } | 66 } |
66 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); | 67 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); |
67 for (int row = m_Box.top; row < m_Box.bottom; row ++) { | 68 for (int row = m_Box.top; row < m_Box.bottom; row ++) { |
68 uint8_t* dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row -
m_Box.top); | 69 uint8_t* dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row -
m_Box.top); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 223 } |
223 FX_FLOAT point_y; | 224 FX_FLOAT point_y; |
224 if (end_y < start_y) { | 225 if (end_y < start_y) { |
225 point_y = end_y - hw; | 226 point_y = end_y - hw; |
226 } else { | 227 } else { |
227 point_y = end_y + hw; | 228 point_y = end_y + hw; |
228 } | 229 } |
229 rect.UpdateRect(end_x + hw, point_y); | 230 rect.UpdateRect(end_x + hw, point_y); |
230 rect.UpdateRect(end_x - hw, point_y); | 231 rect.UpdateRect(end_x - hw, point_y); |
231 return; | 232 return; |
232 } else if (start_y == end_y) { | 233 } |
| 234 if (start_y == end_y) { |
233 FX_FLOAT point_x; | 235 FX_FLOAT point_x; |
234 if (end_x < start_x) { | 236 if (end_x < start_x) { |
235 point_x = end_x - hw; | 237 point_x = end_x - hw; |
236 } else { | 238 } else { |
237 point_x = end_x + hw; | 239 point_x = end_x + hw; |
238 } | 240 } |
239 rect.UpdateRect(point_x, end_y + hw); | 241 rect.UpdateRect(point_x, end_y + hw); |
240 rect.UpdateRect(point_x, end_y - hw); | 242 rect.UpdateRect(point_x, end_y - hw); |
241 return; | 243 return; |
242 } | 244 } |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 if (m_DashArray) { | 622 if (m_DashArray) { |
621 FX_Free(m_DashArray); | 623 FX_Free(m_DashArray); |
622 } | 624 } |
623 m_DashArray = NULL; | 625 m_DashArray = NULL; |
624 m_DashCount = count; | 626 m_DashCount = count; |
625 if (count == 0) { | 627 if (count == 0) { |
626 return; | 628 return; |
627 } | 629 } |
628 m_DashArray = FX_Alloc(FX_FLOAT, count); | 630 m_DashArray = FX_Alloc(FX_FLOAT, count); |
629 } | 631 } |
OLD | NEW |