| 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/fxcrt/fx_basic.h" | 7 #include "../../../include/fxcrt/fx_basic.h" |
| 8 #include "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
| 9 CFX_ClipRgn::CFX_ClipRgn(int width, int height) | 9 CFX_ClipRgn::CFX_ClipRgn(int width, int height) { |
| 10 { | 10 m_Type = RectI; |
| 11 m_Box.left = m_Box.top = 0; |
| 12 m_Box.right = width; |
| 13 m_Box.bottom = height; |
| 14 } |
| 15 CFX_ClipRgn::CFX_ClipRgn(const FX_RECT& rect) { |
| 16 m_Type = RectI; |
| 17 m_Box = rect; |
| 18 } |
| 19 CFX_ClipRgn::CFX_ClipRgn(const CFX_ClipRgn& src) { |
| 20 m_Type = src.m_Type; |
| 21 m_Box = src.m_Box; |
| 22 m_Mask = src.m_Mask; |
| 23 } |
| 24 CFX_ClipRgn::~CFX_ClipRgn() { |
| 25 } |
| 26 void CFX_ClipRgn::Reset(const FX_RECT& rect) { |
| 27 m_Type = RectI; |
| 28 m_Box = rect; |
| 29 m_Mask.SetNull(); |
| 30 } |
| 31 void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { |
| 32 if (m_Type == RectI) { |
| 33 m_Box.Intersect(rect); |
| 34 return; |
| 35 } |
| 36 if (m_Type == MaskF) { |
| 37 IntersectMaskRect(rect, m_Box, m_Mask); |
| 38 return; |
| 39 } |
| 40 } |
| 41 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, |
| 42 FX_RECT mask_rect, |
| 43 CFX_DIBitmapRef Mask) { |
| 44 const CFX_DIBitmap* mask_dib = Mask; |
| 45 m_Type = MaskF; |
| 46 m_Box = rect; |
| 47 m_Box.Intersect(mask_rect); |
| 48 if (m_Box.IsEmpty()) { |
| 11 m_Type = RectI; | 49 m_Type = RectI; |
| 12 m_Box.left = m_Box.top = 0; | 50 return; |
| 13 m_Box.right = width; | 51 } else if (m_Box == mask_rect) { |
| 14 m_Box.bottom = height; | 52 m_Mask = Mask; |
| 15 } | 53 return; |
| 16 CFX_ClipRgn::CFX_ClipRgn(const FX_RECT& rect) | 54 } |
| 17 { | 55 CFX_DIBitmap* new_dib = m_Mask.New(); |
| 18 m_Type = RectI; | 56 if (!new_dib) { |
| 19 m_Box = rect; | 57 return; |
| 20 } | 58 } |
| 21 CFX_ClipRgn::CFX_ClipRgn(const CFX_ClipRgn& src) | 59 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); |
| 22 { | 60 for (int row = m_Box.top; row < m_Box.bottom; row++) { |
| 23 m_Type = src.m_Type; | 61 FX_LPBYTE dest_scan = |
| 24 m_Box = src.m_Box; | 62 new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); |
| 25 m_Mask = src.m_Mask; | 63 FX_LPBYTE src_scan = |
| 26 } | 64 mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); |
| 27 CFX_ClipRgn::~CFX_ClipRgn() | 65 for (int col = m_Box.left; col < m_Box.right; col++) { |
| 28 { | 66 dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; |
| 29 } | 67 } |
| 30 void CFX_ClipRgn::Reset(const FX_RECT& rect) | 68 } |
| 31 { | 69 } |
| 32 m_Type = RectI; | 70 void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { |
| 33 m_Box = rect; | 71 const CFX_DIBitmap* mask_dib = Mask; |
| 34 m_Mask.SetNull(); | 72 ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask); |
| 35 } | 73 FX_RECT mask_box( |
| 36 void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) | 74 left, top, left + mask_dib->GetWidth(), top + mask_dib->GetHeight()); |
| 37 { | 75 if (m_Type == RectI) { |
| 38 if (m_Type == RectI) { | 76 IntersectMaskRect(m_Box, mask_box, Mask); |
| 39 m_Box.Intersect(rect); | 77 return; |
| 40 return; | 78 } |
| 41 } | 79 if (m_Type == MaskF) { |
| 42 if (m_Type == MaskF) { | 80 FX_RECT new_box = m_Box; |
| 43 IntersectMaskRect(rect, m_Box, m_Mask); | 81 new_box.Intersect(mask_box); |
| 44 return; | 82 if (new_box.IsEmpty()) { |
| 45 } | 83 m_Type = RectI; |
| 46 } | 84 m_Mask.SetNull(); |
| 47 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma
pRef Mask) | 85 m_Box = new_box; |
| 48 { | 86 return; |
| 49 const CFX_DIBitmap* mask_dib = Mask; | 87 } |
| 50 m_Type = MaskF; | 88 CFX_DIBitmapRef new_mask; |
| 51 m_Box = rect; | 89 CFX_DIBitmap* new_dib = new_mask.New(); |
| 52 m_Box.Intersect(mask_rect); | |
| 53 if (m_Box.IsEmpty()) { | |
| 54 m_Type = RectI; | |
| 55 return; | |
| 56 } else if (m_Box == mask_rect) { | |
| 57 m_Mask = Mask; | |
| 58 return; | |
| 59 } | |
| 60 CFX_DIBitmap* new_dib = m_Mask.New(); | |
| 61 if (!new_dib) { | 90 if (!new_dib) { |
| 62 return; | 91 return; |
| 63 } | 92 } |
| 64 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); | 93 new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); |
| 65 for (int row = m_Box.top; row < m_Box.bottom; row ++) { | 94 const CFX_DIBitmap* old_dib = m_Mask; |
| 66 FX_LPBYTE dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row
- m_Box.top); | 95 for (int row = new_box.top; row < new_box.bottom; row++) { |
| 67 FX_LPBYTE src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row
- mask_rect.top); | 96 FX_LPBYTE old_scan = |
| 68 for (int col = m_Box.left; col < m_Box.right; col ++) { | 97 old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); |
| 69 dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; | 98 FX_LPBYTE mask_scan = |
| 99 mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); |
| 100 FX_LPBYTE new_scan = |
| 101 new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); |
| 102 for (int col = new_box.left; col < new_box.right; col++) { |
| 103 new_scan[col - new_box.left] = |
| 104 old_scan[col - m_Box.left] * mask_scan[col - left] / 255; |
| 105 } |
| 106 } |
| 107 m_Box = new_box; |
| 108 m_Mask = new_mask; |
| 109 return; |
| 110 } |
| 111 ASSERT(FALSE); |
| 112 } |
| 113 CFX_PathData::CFX_PathData() { |
| 114 m_PointCount = m_AllocCount = 0; |
| 115 m_pPoints = NULL; |
| 116 } |
| 117 CFX_PathData::~CFX_PathData() { |
| 118 if (m_pPoints) { |
| 119 FX_Free(m_pPoints); |
| 120 } |
| 121 } |
| 122 FX_BOOL CFX_PathData::SetPointCount(int nPoints) { |
| 123 m_PointCount = nPoints; |
| 124 if (m_AllocCount < nPoints) { |
| 125 if (m_pPoints) { |
| 126 FX_Free(m_pPoints); |
| 127 m_pPoints = NULL; |
| 128 } |
| 129 m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints); |
| 130 if (!m_pPoints) { |
| 131 return FALSE; |
| 132 } |
| 133 m_AllocCount = nPoints; |
| 134 } |
| 135 return TRUE; |
| 136 } |
| 137 FX_BOOL CFX_PathData::AllocPointCount(int nPoints) { |
| 138 if (m_AllocCount < nPoints) { |
| 139 FX_PATHPOINT* pNewBuf = FX_Alloc(FX_PATHPOINT, nPoints); |
| 140 if (!pNewBuf) { |
| 141 return FALSE; |
| 142 } |
| 143 if (m_PointCount) { |
| 144 FXSYS_memcpy32(pNewBuf, m_pPoints, m_PointCount * sizeof(FX_PATHPOINT)); |
| 145 } |
| 146 if (m_pPoints) { |
| 147 FX_Free(m_pPoints); |
| 148 } |
| 149 m_pPoints = pNewBuf; |
| 150 m_AllocCount = nPoints; |
| 151 } |
| 152 return TRUE; |
| 153 } |
| 154 CFX_PathData::CFX_PathData(const CFX_PathData& src) { |
| 155 m_pPoints = NULL; |
| 156 m_PointCount = m_AllocCount = src.m_PointCount; |
| 157 m_pPoints = FX_Alloc(FX_PATHPOINT, src.m_PointCount); |
| 158 if (!m_pPoints) { |
| 159 return; |
| 160 } |
| 161 FXSYS_memcpy32(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount); |
| 162 } |
| 163 void CFX_PathData::TrimPoints(int nPoints) { |
| 164 if (m_PointCount <= nPoints) { |
| 165 return; |
| 166 } |
| 167 SetPointCount(nPoints); |
| 168 } |
| 169 FX_BOOL CFX_PathData::AddPointCount(int addPoints) { |
| 170 int new_count = m_PointCount + addPoints; |
| 171 if (!AllocPointCount(new_count)) { |
| 172 return FALSE; |
| 173 } |
| 174 m_PointCount = new_count; |
| 175 return TRUE; |
| 176 } |
| 177 FX_BOOL CFX_PathData::Append(const CFX_PathData* pSrc, |
| 178 const CFX_AffineMatrix* pMatrix) { |
| 179 int old_count = m_PointCount; |
| 180 if (!AddPointCount(pSrc->m_PointCount)) { |
| 181 return FALSE; |
| 182 } |
| 183 FXSYS_memcpy32(m_pPoints + old_count, |
| 184 pSrc->m_pPoints, |
| 185 pSrc->m_PointCount * sizeof(FX_PATHPOINT)); |
| 186 if (pMatrix == NULL) { |
| 187 return TRUE; |
| 188 } |
| 189 for (int i = 0; i < pSrc->m_PointCount; i++) { |
| 190 pMatrix->Transform(m_pPoints[old_count + i].m_PointX, |
| 191 m_pPoints[old_count + i].m_PointY); |
| 192 } |
| 193 return TRUE; |
| 194 } |
| 195 void CFX_PathData::SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag) { |
| 196 ASSERT(index < m_PointCount); |
| 197 m_pPoints[index].m_PointX = x; |
| 198 m_pPoints[index].m_PointY = y; |
| 199 m_pPoints[index].m_Flag = flag; |
| 200 } |
| 201 FX_BOOL CFX_PathData::AppendRect(FX_FLOAT left, |
| 202 FX_FLOAT bottom, |
| 203 FX_FLOAT right, |
| 204 FX_FLOAT top) { |
| 205 int old_count = m_PointCount; |
| 206 if (!AddPointCount(5)) { |
| 207 return FALSE; |
| 208 } |
| 209 FX_PATHPOINT* pPoints = m_pPoints + old_count; |
| 210 pPoints[0].m_PointX = pPoints[1].m_PointX = pPoints[4].m_PointX = left; |
| 211 pPoints[2].m_PointX = pPoints[3].m_PointX = right; |
| 212 pPoints[0].m_PointY = pPoints[3].m_PointY = pPoints[4].m_PointY = bottom; |
| 213 pPoints[1].m_PointY = pPoints[2].m_PointY = top; |
| 214 pPoints[0].m_Flag = FXPT_MOVETO; |
| 215 pPoints[1].m_Flag = pPoints[2].m_Flag = pPoints[3].m_Flag = FXPT_LINETO; |
| 216 pPoints[4].m_Flag = FXPT_LINETO | FXPT_CLOSEFIGURE; |
| 217 return TRUE; |
| 218 } |
| 219 CFX_FloatRect CFX_PathData::GetBoundingBox() const { |
| 220 CFX_FloatRect rect; |
| 221 if (m_PointCount) { |
| 222 rect.InitRect(m_pPoints[0].m_PointX, m_pPoints[0].m_PointY); |
| 223 for (int i = 1; i < m_PointCount; i++) { |
| 224 rect.UpdateRect(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); |
| 225 } |
| 226 } |
| 227 return rect; |
| 228 } |
| 229 static void _UpdateLineEndPoints(CFX_FloatRect& rect, |
| 230 FX_FLOAT start_x, |
| 231 FX_FLOAT start_y, |
| 232 FX_FLOAT end_x, |
| 233 FX_FLOAT end_y, |
| 234 FX_FLOAT hw) { |
| 235 if (start_x == end_x) { |
| 236 if (start_y == end_y) { |
| 237 rect.UpdateRect(end_x + hw, end_y + hw); |
| 238 rect.UpdateRect(end_x - hw, end_y - hw); |
| 239 return; |
| 240 } |
| 241 FX_FLOAT point_y; |
| 242 if (end_y < start_y) { |
| 243 point_y = end_y - hw; |
| 244 } else { |
| 245 point_y = end_y + hw; |
| 246 } |
| 247 rect.UpdateRect(end_x + hw, point_y); |
| 248 rect.UpdateRect(end_x - hw, point_y); |
| 249 return; |
| 250 } else if (start_y == end_y) { |
| 251 FX_FLOAT point_x; |
| 252 if (end_x < start_x) { |
| 253 point_x = end_x - hw; |
| 254 } else { |
| 255 point_x = end_x + hw; |
| 256 } |
| 257 rect.UpdateRect(point_x, end_y + hw); |
| 258 rect.UpdateRect(point_x, end_y - hw); |
| 259 return; |
| 260 } |
| 261 FX_FLOAT dx = end_x - start_x; |
| 262 FX_FLOAT dy = end_y - start_y; |
| 263 FX_FLOAT ll = FXSYS_sqrt2(dx, dy); |
| 264 FX_FLOAT mx = end_x + hw * dx / ll; |
| 265 FX_FLOAT my = end_y + hw * dy / ll; |
| 266 FX_FLOAT dx1 = hw * dy / ll; |
| 267 FX_FLOAT dy1 = hw * dx / ll; |
| 268 rect.UpdateRect(mx - dx1, my + dy1); |
| 269 rect.UpdateRect(mx + dx1, my - dy1); |
| 270 } |
| 271 static void _UpdateLineJoinPoints(CFX_FloatRect& rect, |
| 272 FX_FLOAT start_x, |
| 273 FX_FLOAT start_y, |
| 274 FX_FLOAT middle_x, |
| 275 FX_FLOAT middle_y, |
| 276 FX_FLOAT end_x, |
| 277 FX_FLOAT end_y, |
| 278 FX_FLOAT half_width, |
| 279 FX_FLOAT miter_limit) { |
| 280 FX_FLOAT start_k = 0, start_c = 0, end_k = 0, end_c = 0, start_len = 0, |
| 281 start_dc = 0, end_len = 0, end_dc = 0; |
| 282 FX_BOOL bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20; |
| 283 FX_BOOL bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20; |
| 284 if (bStartVert && bEndVert) { |
| 285 int start_dir = middle_y > start_y ? 1 : -1; |
| 286 FX_FLOAT point_y = middle_y + half_width * start_dir; |
| 287 rect.UpdateRect(middle_x + half_width, point_y); |
| 288 rect.UpdateRect(middle_x - half_width, point_y); |
| 289 return; |
| 290 } |
| 291 if (!bStartVert) { |
| 292 start_k = FXSYS_Div(middle_y - start_y, middle_x - start_x); |
| 293 start_c = middle_y - FXSYS_Mul(start_k, middle_x); |
| 294 start_len = FXSYS_sqrt2(start_x - middle_x, start_y - middle_y); |
| 295 start_dc = (FX_FLOAT)FXSYS_fabs( |
| 296 FXSYS_MulDiv(half_width, start_len, start_x - middle_x)); |
| 297 } |
| 298 if (!bEndVert) { |
| 299 end_k = FXSYS_Div(end_y - middle_y, end_x - middle_x); |
| 300 end_c = middle_y - FXSYS_Mul(end_k, middle_x); |
| 301 end_len = FXSYS_sqrt2(end_x - middle_x, end_y - middle_y); |
| 302 end_dc = (FX_FLOAT)FXSYS_fabs( |
| 303 FXSYS_MulDiv(half_width, end_len, end_x - middle_x)); |
| 304 } |
| 305 if (bStartVert) { |
| 306 FX_FLOAT outside_x = start_x; |
| 307 if (end_x < start_x) { |
| 308 outside_x += half_width; |
| 309 } else { |
| 310 outside_x -= half_width; |
| 311 } |
| 312 FX_FLOAT outside_y; |
| 313 if (start_y < FXSYS_Mul(end_k, start_x) + end_c) { |
| 314 outside_y = FXSYS_Mul(end_k, outside_x) + end_c + end_dc; |
| 315 } else { |
| 316 outside_y = FXSYS_Mul(end_k, outside_x) + end_c - end_dc; |
| 317 } |
| 318 rect.UpdateRect(outside_x, outside_y); |
| 319 return; |
| 320 } |
| 321 if (bEndVert) { |
| 322 FX_FLOAT outside_x = end_x; |
| 323 if (start_x < end_x) { |
| 324 outside_x += half_width; |
| 325 } else { |
| 326 outside_x -= half_width; |
| 327 } |
| 328 FX_FLOAT outside_y; |
| 329 if (end_y < FXSYS_Mul(start_k, end_x) + start_c) { |
| 330 outside_y = FXSYS_Mul(start_k, outside_x) + start_c + start_dc; |
| 331 } else { |
| 332 outside_y = FXSYS_Mul(start_k, outside_x) + start_c - start_dc; |
| 333 } |
| 334 rect.UpdateRect(outside_x, outside_y); |
| 335 return; |
| 336 } |
| 337 if (FXSYS_fabs(start_k - end_k) < 1.0f / 20) { |
| 338 int start_dir = middle_x > start_x ? 1 : -1; |
| 339 int end_dir = end_x > middle_x ? 1 : -1; |
| 340 if (start_dir == end_dir) { |
| 341 _UpdateLineEndPoints(rect, middle_x, middle_y, end_x, end_y, half_width); |
| 342 } else { |
| 343 _UpdateLineEndPoints( |
| 344 rect, start_x, start_y, middle_x, middle_y, half_width); |
| 345 } |
| 346 return; |
| 347 } |
| 348 FX_FLOAT start_outside_c = start_c; |
| 349 if (end_y < FXSYS_Mul(start_k, end_x) + start_c) { |
| 350 start_outside_c += start_dc; |
| 351 } else { |
| 352 start_outside_c -= start_dc; |
| 353 } |
| 354 FX_FLOAT end_outside_c = end_c; |
| 355 if (start_y < FXSYS_Mul(end_k, start_x) + end_c) { |
| 356 end_outside_c += end_dc; |
| 357 } else { |
| 358 end_outside_c -= end_dc; |
| 359 } |
| 360 FX_FLOAT join_x = FXSYS_Div(end_outside_c - start_outside_c, start_k - end_k); |
| 361 FX_FLOAT join_y = FXSYS_Mul(start_k, join_x) + start_outside_c; |
| 362 rect.UpdateRect(join_x, join_y); |
| 363 } |
| 364 CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, |
| 365 FX_FLOAT miter_limit) const { |
| 366 CFX_FloatRect rect( |
| 367 100000 * 1.0f, 100000 * 1.0f, -100000 * 1.0f, -100000 * 1.0f); |
| 368 int iPoint = 0; |
| 369 FX_FLOAT half_width = line_width; |
| 370 int iStartPoint, iEndPoint, iMiddlePoint; |
| 371 FX_BOOL bJoin; |
| 372 while (iPoint < m_PointCount) { |
| 373 if (m_pPoints[iPoint].m_Flag == FXPT_MOVETO) { |
| 374 iStartPoint = iPoint + 1; |
| 375 iEndPoint = iPoint; |
| 376 bJoin = FALSE; |
| 377 } else { |
| 378 if (m_pPoints[iPoint].m_Flag == FXPT_BEZIERTO) { |
| 379 rect.UpdateRect(m_pPoints[iPoint].m_PointX, m_pPoints[iPoint].m_PointY); |
| 380 rect.UpdateRect(m_pPoints[iPoint + 1].m_PointX, |
| 381 m_pPoints[iPoint + 1].m_PointY); |
| 382 iPoint += 2; |
| 383 } |
| 384 if (iPoint == m_PointCount - 1 || |
| 385 m_pPoints[iPoint + 1].m_Flag == FXPT_MOVETO) { |
| 386 iStartPoint = iPoint - 1; |
| 387 iEndPoint = iPoint; |
| 388 bJoin = FALSE; |
| 389 } else { |
| 390 iStartPoint = iPoint - 1; |
| 391 iMiddlePoint = iPoint; |
| 392 iEndPoint = iPoint + 1; |
| 393 bJoin = TRUE; |
| 394 } |
| 395 } |
| 396 FX_FLOAT start_x = m_pPoints[iStartPoint].m_PointX; |
| 397 FX_FLOAT start_y = m_pPoints[iStartPoint].m_PointY; |
| 398 FX_FLOAT end_x = m_pPoints[iEndPoint].m_PointX; |
| 399 FX_FLOAT end_y = m_pPoints[iEndPoint].m_PointY; |
| 400 if (bJoin) { |
| 401 FX_FLOAT middle_x = m_pPoints[iMiddlePoint].m_PointX; |
| 402 FX_FLOAT middle_y = m_pPoints[iMiddlePoint].m_PointY; |
| 403 _UpdateLineJoinPoints(rect, |
| 404 start_x, |
| 405 start_y, |
| 406 middle_x, |
| 407 middle_y, |
| 408 end_x, |
| 409 end_y, |
| 410 half_width, |
| 411 miter_limit); |
| 412 } else { |
| 413 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); |
| 414 } |
| 415 iPoint++; |
| 416 } |
| 417 return rect; |
| 418 } |
| 419 void CFX_PathData::Transform(const CFX_AffineMatrix* pMatrix) { |
| 420 if (pMatrix == NULL) { |
| 421 return; |
| 422 } |
| 423 for (int i = 0; i < m_PointCount; i++) { |
| 424 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); |
| 425 } |
| 426 } |
| 427 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, |
| 428 CFX_AffineMatrix* pMatrix, |
| 429 FX_BOOL& bThin, |
| 430 FX_BOOL bAdjust) const { |
| 431 if (m_PointCount < 3) { |
| 432 return FALSE; |
| 433 } |
| 434 if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO && |
| 435 (m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 436 (m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 437 m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && |
| 438 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) { |
| 439 NewPath.AddPointCount(2); |
| 440 if (bAdjust) { |
| 441 if (pMatrix) { |
| 442 FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY; |
| 443 pMatrix->TransformPoint(x, y); |
| 444 x = (int)x + 0.5f; |
| 445 y = (int)y + 0.5f; |
| 446 NewPath.SetPoint(0, x, y, FXPT_MOVETO); |
| 447 x = m_pPoints[1].m_PointX, y = m_pPoints[1].m_PointY; |
| 448 pMatrix->TransformPoint(x, y); |
| 449 x = (int)x + 0.5f; |
| 450 y = (int)y + 0.5f; |
| 451 NewPath.SetPoint(1, x, y, FXPT_LINETO); |
| 452 pMatrix->SetIdentity(); |
| 453 } else { |
| 454 FX_FLOAT x = (int)m_pPoints[0].m_PointX + 0.5f, |
| 455 y = (int)m_pPoints[0].m_PointY + 0.5f; |
| 456 NewPath.SetPoint(0, x, y, FXPT_MOVETO); |
| 457 x = (int)m_pPoints[1].m_PointX + 0.5f, |
| 458 y = (int)m_pPoints[1].m_PointY + 0.5f; |
| 459 NewPath.SetPoint(1, x, y, FXPT_LINETO); |
| 460 } |
| 461 } else { |
| 462 NewPath.SetPoint( |
| 463 0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY, FXPT_MOVETO); |
| 464 NewPath.SetPoint( |
| 465 1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, FXPT_LINETO); |
| 466 } |
| 467 if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX && |
| 468 m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) { |
| 469 bThin = TRUE; |
| 470 } |
| 471 return TRUE; |
| 472 } |
| 473 if (((m_PointCount > 3) && (m_PointCount % 2))) { |
| 474 int mid = m_PointCount / 2; |
| 475 FX_BOOL bZeroArea = FALSE; |
| 476 CFX_PathData t_path; |
| 477 for (int i = 0; i < mid; i++) { |
| 478 if (!(m_pPoints[mid - i - 1].m_PointX == |
| 479 m_pPoints[mid + i + 1].m_PointX && |
| 480 m_pPoints[mid - i - 1].m_PointY == |
| 481 m_pPoints[mid + i + 1].m_PointY && |
| 482 ((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && |
| 483 (m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) { |
| 484 bZeroArea = TRUE; |
| 485 break; |
| 486 } |
| 487 int new_count = t_path.GetPointCount(); |
| 488 t_path.AddPointCount(2); |
| 489 t_path.SetPoint(new_count, |
| 490 m_pPoints[mid - i].m_PointX, |
| 491 m_pPoints[mid - i].m_PointY, |
| 492 FXPT_MOVETO); |
| 493 t_path.SetPoint(new_count + 1, |
| 494 m_pPoints[mid - i - 1].m_PointX, |
| 495 m_pPoints[mid - i - 1].m_PointY, |
| 496 FXPT_LINETO); |
| 497 } |
| 498 if (!bZeroArea) { |
| 499 NewPath.Append(&t_path, NULL); |
| 500 bThin = TRUE; |
| 501 return TRUE; |
| 502 } |
| 503 } |
| 504 int stratPoint = 0; |
| 505 int next = 0, i; |
| 506 for (i = 0; i < m_PointCount; i++) { |
| 507 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; |
| 508 if (point_type == FXPT_MOVETO) { |
| 509 stratPoint = i; |
| 510 } else if (point_type == FXPT_LINETO) { |
| 511 next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoint; |
| 512 if ((m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && |
| 513 (m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_MOVETO) { |
| 514 if ((m_pPoints[i - 1].m_PointX == m_pPoints[i].m_PointX && |
| 515 m_pPoints[i].m_PointX == m_pPoints[next].m_PointX) && |
| 516 ((m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) * |
| 517 (m_pPoints[i].m_PointY - m_pPoints[next].m_PointY) > |
| 518 0)) { |
| 519 int pre = i; |
| 520 if (FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY) < |
| 521 FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[next].m_PointY)) { |
| 522 pre--; |
| 523 next--; |
| 524 } |
| 525 int new_count = NewPath.GetPointCount(); |
| 526 NewPath.AddPointCount(2); |
| 527 NewPath.SetPoint(new_count, |
| 528 m_pPoints[pre].m_PointX, |
| 529 m_pPoints[pre].m_PointY, |
| 530 FXPT_MOVETO); |
| 531 NewPath.SetPoint(new_count + 1, |
| 532 m_pPoints[next].m_PointX, |
| 533 m_pPoints[next].m_PointY, |
| 534 FXPT_LINETO); |
| 535 } else if ((m_pPoints[i - 1].m_PointY == m_pPoints[i].m_PointY && |
| 536 m_pPoints[i].m_PointY == m_pPoints[next].m_PointY) && |
| 537 ((m_pPoints[i].m_PointX - m_pPoints[i - 1].m_PointX) * |
| 538 (m_pPoints[i].m_PointX - m_pPoints[next].m_PointX) > |
| 539 0)) { |
| 540 int pre = i; |
| 541 if (FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[i - 1].m_PointX) < |
| 542 FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[next].m_PointX)) { |
| 543 pre--; |
| 544 next--; |
| 545 } |
| 546 int new_count = NewPath.GetPointCount(); |
| 547 NewPath.AddPointCount(2); |
| 548 NewPath.SetPoint(new_count, |
| 549 m_pPoints[pre].m_PointX, |
| 550 m_pPoints[pre].m_PointY, |
| 551 FXPT_MOVETO); |
| 552 NewPath.SetPoint(new_count + 1, |
| 553 m_pPoints[next].m_PointX, |
| 554 m_pPoints[next].m_PointY, |
| 555 FXPT_LINETO); |
| 556 } else if ((m_pPoints[i - 1].m_Flag & FXPT_TYPE) == FXPT_MOVETO && |
| 557 (m_pPoints[next].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 558 m_pPoints[i - 1].m_PointX == m_pPoints[next].m_PointX && |
| 559 m_pPoints[i - 1].m_PointY == m_pPoints[next].m_PointY && |
| 560 m_pPoints[next].m_Flag & FXPT_CLOSEFIGURE) { |
| 561 int new_count = NewPath.GetPointCount(); |
| 562 NewPath.AddPointCount(2); |
| 563 NewPath.SetPoint(new_count, |
| 564 m_pPoints[i - 1].m_PointX, |
| 565 m_pPoints[i - 1].m_PointY, |
| 566 FXPT_MOVETO); |
| 567 NewPath.SetPoint(new_count + 1, |
| 568 m_pPoints[i].m_PointX, |
| 569 m_pPoints[i].m_PointY, |
| 570 FXPT_LINETO); |
| 571 bThin = TRUE; |
| 70 } | 572 } |
| 71 } | 573 } |
| 72 } | 574 } else if (point_type == FXPT_BEZIERTO) { |
| 73 void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) | 575 i += 2; |
| 74 { | 576 continue; |
| 75 const CFX_DIBitmap* mask_dib = Mask; | 577 } |
| 76 ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask); | 578 } |
| 77 FX_RECT mask_box(left, top, left + mask_dib->GetWidth(), top + mask_dib->Get
Height()); | 579 if (m_PointCount > 3 && NewPath.GetPointCount()) { |
| 78 if (m_Type == RectI) { | 580 bThin = TRUE; |
| 79 IntersectMaskRect(m_Box, mask_box, Mask); | 581 } |
| 80 return; | 582 if (NewPath.GetPointCount() == 0) { |
| 81 } | 583 return FALSE; |
| 82 if (m_Type == MaskF) { | 584 } |
| 83 FX_RECT new_box = m_Box; | 585 return TRUE; |
| 84 new_box.Intersect(mask_box); | 586 } |
| 85 if (new_box.IsEmpty()) { | 587 FX_BOOL CFX_PathData::IsRect() const { |
| 86 m_Type = RectI; | 588 if (m_PointCount != 5 && m_PointCount != 4) { |
| 87 m_Mask.SetNull(); | 589 return FALSE; |
| 88 m_Box = new_box; | 590 } |
| 89 return; | 591 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || |
| 90 } | 592 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || |
| 91 CFX_DIBitmapRef new_mask; | 593 (m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && |
| 92 CFX_DIBitmap* new_dib = new_mask.New(); | 594 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) || |
| 93 if (!new_dib) { | 595 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && |
| 94 return; | 596 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { |
| 95 } | 597 return FALSE; |
| 96 new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); | 598 } |
| 97 const CFX_DIBitmap* old_dib = m_Mask; | 599 if (m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && |
| 98 for (int row = new_box.top; row < new_box.bottom; row ++) { | 600 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { |
| 99 FX_LPBYTE old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_
dib->GetPitch(); | 601 return FALSE; |
| 100 FX_LPBYTE mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib
->GetPitch(); | 602 } |
| 101 FX_LPBYTE new_scan = new_dib->GetBuffer() + (row - new_box.top) * ne
w_dib->GetPitch(); | 603 for (int i = 1; i < 4; i++) { |
| 102 for (int col = new_box.left; col < new_box.right; col ++) { | 604 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { |
| 103 new_scan[col - new_box.left] = old_scan[col - m_Box.left] * mask
_scan[col - left] / 255; | 605 return FALSE; |
| 104 } | 606 } |
| 105 } | 607 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && |
| 106 m_Box = new_box; | 608 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { |
| 107 m_Mask = new_mask; | 609 return FALSE; |
| 108 return; | 610 } |
| 109 } | 611 } |
| 110 ASSERT(FALSE); | 612 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); |
| 111 } | 613 } |
| 112 CFX_PathData::CFX_PathData() | 614 FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, |
| 113 { | 615 CFX_FloatRect* pRect) const { |
| 114 m_PointCount = m_AllocCount = 0; | 616 if (pMatrix == NULL) { |
| 115 m_pPoints = NULL; | 617 if (!IsRect()) { |
| 116 } | 618 return FALSE; |
| 117 CFX_PathData::~CFX_PathData() | 619 } |
| 118 { | 620 if (pRect) { |
| 119 if (m_pPoints) { | 621 pRect->left = m_pPoints[0].m_PointX; |
| 120 FX_Free(m_pPoints); | 622 pRect->right = m_pPoints[2].m_PointX; |
| 121 } | 623 pRect->bottom = m_pPoints[0].m_PointY; |
| 122 } | 624 pRect->top = m_pPoints[2].m_PointY; |
| 123 FX_BOOL CFX_PathData::SetPointCount(int nPoints) | 625 pRect->Normalize(); |
| 124 { | |
| 125 m_PointCount = nPoints; | |
| 126 if (m_AllocCount < nPoints) { | |
| 127 if (m_pPoints) { | |
| 128 FX_Free(m_pPoints); | |
| 129 m_pPoints = NULL; | |
| 130 } | |
| 131 m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints); | |
| 132 if (!m_pPoints) { | |
| 133 return FALSE; | |
| 134 } | |
| 135 m_AllocCount = nPoints; | |
| 136 } | 626 } |
| 137 return TRUE; | 627 return TRUE; |
| 138 } | 628 } |
| 139 FX_BOOL CFX_PathData::AllocPointCount(int nPoints) | 629 if (m_PointCount != 5 && m_PointCount != 4) { |
| 140 { | 630 return FALSE; |
| 141 if (m_AllocCount < nPoints) { | 631 } |
| 142 FX_PATHPOINT* pNewBuf = FX_Alloc(FX_PATHPOINT, nPoints); | 632 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || |
| 143 if (!pNewBuf) { | 633 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || |
| 144 return FALSE; | 634 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && |
| 145 } | 635 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { |
| 146 if (m_PointCount) { | 636 return FALSE; |
| 147 FXSYS_memcpy32(pNewBuf, m_pPoints, m_PointCount * sizeof(FX_PATHPOIN
T)); | 637 } |
| 148 } | 638 if (m_PointCount == 4 && m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && |
| 149 if (m_pPoints) { | 639 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { |
| 150 FX_Free(m_pPoints); | 640 return FALSE; |
| 151 } | 641 } |
| 152 m_pPoints = pNewBuf; | 642 FX_FLOAT x[5], y[5]; |
| 153 m_AllocCount = nPoints; | 643 for (int i = 0; i < m_PointCount; i++) { |
| 154 } | 644 pMatrix->Transform( |
| 155 return TRUE; | 645 m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i], y[i]); |
| 156 } | 646 if (i) { |
| 157 CFX_PathData::CFX_PathData(const CFX_PathData& src) | 647 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { |
| 158 { | |
| 159 m_pPoints = NULL; | |
| 160 m_PointCount = m_AllocCount = src.m_PointCount; | |
| 161 m_pPoints = FX_Alloc(FX_PATHPOINT, src.m_PointCount); | |
| 162 if (!m_pPoints) { | |
| 163 return; | |
| 164 } | |
| 165 FXSYS_memcpy32(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount
); | |
| 166 } | |
| 167 void CFX_PathData::TrimPoints(int nPoints) | |
| 168 { | |
| 169 if (m_PointCount <= nPoints) { | |
| 170 return; | |
| 171 } | |
| 172 SetPointCount(nPoints); | |
| 173 } | |
| 174 FX_BOOL CFX_PathData::AddPointCount(int addPoints) | |
| 175 { | |
| 176 int new_count = m_PointCount + addPoints; | |
| 177 if (!AllocPointCount(new_count)) { | |
| 178 return FALSE; | 648 return FALSE; |
| 179 } | 649 } |
| 180 m_PointCount = new_count; | 650 if (x[i] != x[i - 1] && y[i] != y[i - 1]) { |
| 181 return TRUE; | |
| 182 } | |
| 183 FX_BOOL CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_AffineMatrix* p
Matrix) | |
| 184 { | |
| 185 int old_count = m_PointCount; | |
| 186 if (!AddPointCount(pSrc->m_PointCount)) { | |
| 187 return FALSE; | 651 return FALSE; |
| 188 } | 652 } |
| 189 FXSYS_memcpy32(m_pPoints + old_count, pSrc->m_pPoints, pSrc->m_PointCount *
sizeof(FX_PATHPOINT)); | 653 } |
| 190 if (pMatrix == NULL) { | 654 } |
| 191 return TRUE; | 655 if (pRect) { |
| 192 } | 656 pRect->left = x[0]; |
| 193 for (int i = 0; i < pSrc->m_PointCount; i ++) { | 657 pRect->right = x[2]; |
| 194 pMatrix->Transform(m_pPoints[old_count + i].m_PointX, m_pPoints[old_coun
t + i].m_PointY); | 658 pRect->bottom = y[0]; |
| 195 } | 659 pRect->top = y[2]; |
| 196 return TRUE; | 660 pRect->Normalize(); |
| 197 } | 661 } |
| 198 void CFX_PathData::SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag) | 662 return TRUE; |
| 199 { | 663 } |
| 200 ASSERT(index < m_PointCount); | 664 FX_BOOL CFX_PathData::Copy(const CFX_PathData& src) { |
| 201 m_pPoints[index].m_PointX = x; | 665 if (!SetPointCount(src.m_PointCount)) { |
| 202 m_pPoints[index].m_PointY = y; | 666 return FALSE; |
| 203 m_pPoints[index].m_Flag = flag; | 667 } |
| 204 } | 668 FXSYS_memcpy32(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount); |
| 205 FX_BOOL CFX_PathData::AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right,
FX_FLOAT top) | 669 return TRUE; |
| 206 { | 670 } |
| 207 int old_count = m_PointCount; | 671 CFX_GraphStateData::CFX_GraphStateData() { |
| 208 if (!AddPointCount(5)) { | 672 m_LineCap = LineCapButt; |
| 209 return FALSE; | 673 m_DashCount = 0; |
| 210 } | 674 m_DashArray = NULL; |
| 211 FX_PATHPOINT* pPoints = m_pPoints + old_count; | 675 m_DashPhase = 0; |
| 212 pPoints[0].m_PointX = pPoints[1].m_PointX = pPoints[4].m_PointX = left; | 676 m_LineJoin = LineJoinMiter; |
| 213 pPoints[2].m_PointX = pPoints[3].m_PointX = right; | 677 m_MiterLimit = 10 * 1.0f; |
| 214 pPoints[0].m_PointY = pPoints[3].m_PointY = pPoints[4].m_PointY = bottom; | 678 m_LineWidth = 1.0f; |
| 215 pPoints[1].m_PointY = pPoints[2].m_PointY = top; | 679 } |
| 216 pPoints[0].m_Flag = FXPT_MOVETO; | 680 CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) { |
| 217 pPoints[1].m_Flag = pPoints[2].m_Flag = pPoints[3].m_Flag = FXPT_LINETO; | 681 m_DashArray = NULL; |
| 218 pPoints[4].m_Flag = FXPT_LINETO | FXPT_CLOSEFIGURE; | 682 Copy(src); |
| 219 return TRUE; | 683 } |
| 220 } | 684 void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { |
| 221 CFX_FloatRect CFX_PathData::GetBoundingBox() const | 685 m_LineCap = src.m_LineCap; |
| 222 { | 686 m_DashCount = src.m_DashCount; |
| 223 CFX_FloatRect rect; | 687 if (m_DashArray) { |
| 224 if (m_PointCount) { | 688 FX_Free(m_DashArray); |
| 225 rect.InitRect(m_pPoints[0].m_PointX, m_pPoints[0].m_PointY); | 689 } |
| 226 for (int i = 1; i < m_PointCount; i ++) { | 690 m_DashArray = NULL; |
| 227 rect.UpdateRect(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); | 691 m_DashPhase = src.m_DashPhase; |
| 228 } | 692 m_LineJoin = src.m_LineJoin; |
| 229 } | 693 m_MiterLimit = src.m_MiterLimit; |
| 230 return rect; | 694 m_LineWidth = src.m_LineWidth; |
| 231 } | 695 if (m_DashCount) { |
| 232 static void _UpdateLineEndPoints(CFX_FloatRect& rect, FX_FLOAT start_x, FX_FLOAT
start_y, FX_FLOAT end_x, FX_FLOAT end_y, | 696 m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); |
| 233 FX_FLOAT hw) | 697 if (!m_DashArray) { |
| 234 { | 698 return; |
| 235 if (start_x == end_x) { | 699 } |
| 236 if (start_y == end_y) { | 700 FXSYS_memcpy32( |
| 237 rect.UpdateRect(end_x + hw, end_y + hw); | 701 m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT)); |
| 238 rect.UpdateRect(end_x - hw, end_y - hw); | 702 } |
| 239 return; | 703 } |
| 240 } | 704 CFX_GraphStateData::~CFX_GraphStateData() { |
| 241 FX_FLOAT point_y; | 705 if (m_DashArray) { |
| 242 if (end_y < start_y) { | 706 FX_Free(m_DashArray); |
| 243 point_y = end_y - hw; | 707 } |
| 244 } else { | 708 } |
| 245 point_y = end_y + hw; | 709 void CFX_GraphStateData::SetDashCount(int count) { |
| 246 } | 710 if (m_DashArray) { |
| 247 rect.UpdateRect(end_x + hw, point_y); | 711 FX_Free(m_DashArray); |
| 248 rect.UpdateRect(end_x - hw, point_y); | 712 } |
| 249 return; | 713 m_DashArray = NULL; |
| 250 } else if (start_y == end_y) { | 714 m_DashCount = count; |
| 251 FX_FLOAT point_x; | 715 if (count == 0) { |
| 252 if (end_x < start_x) { | 716 return; |
| 253 point_x = end_x - hw; | 717 } |
| 254 } else { | 718 m_DashArray = FX_Alloc(FX_FLOAT, count); |
| 255 point_x = end_x + hw; | 719 } |
| 256 } | |
| 257 rect.UpdateRect(point_x, end_y + hw); | |
| 258 rect.UpdateRect(point_x, end_y - hw); | |
| 259 return; | |
| 260 } | |
| 261 FX_FLOAT dx = end_x - start_x; | |
| 262 FX_FLOAT dy = end_y - start_y; | |
| 263 FX_FLOAT ll = FXSYS_sqrt2(dx, dy); | |
| 264 FX_FLOAT mx = end_x + hw * dx / ll; | |
| 265 FX_FLOAT my = end_y + hw * dy / ll; | |
| 266 FX_FLOAT dx1 = hw * dy / ll; | |
| 267 FX_FLOAT dy1 = hw * dx / ll; | |
| 268 rect.UpdateRect(mx - dx1, my + dy1); | |
| 269 rect.UpdateRect(mx + dx1, my - dy1); | |
| 270 } | |
| 271 static void _UpdateLineJoinPoints(CFX_FloatRect& rect, FX_FLOAT start_x, FX_FLOA
T start_y, | |
| 272 FX_FLOAT middle_x, FX_FLOAT middle_y, FX_FLOAT
end_x, FX_FLOAT end_y, | |
| 273 FX_FLOAT half_width, FX_FLOAT miter_limit) | |
| 274 { | |
| 275 FX_FLOAT start_k = 0, start_c = 0, end_k = 0, end_c = 0, start_len = 0, star
t_dc = 0, end_len = 0, end_dc = 0; | |
| 276 FX_BOOL bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20; | |
| 277 FX_BOOL bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20; | |
| 278 if (bStartVert && bEndVert) { | |
| 279 int start_dir = middle_y > start_y ? 1 : -1; | |
| 280 FX_FLOAT point_y = middle_y + half_width * start_dir; | |
| 281 rect.UpdateRect(middle_x + half_width, point_y); | |
| 282 rect.UpdateRect(middle_x - half_width, point_y); | |
| 283 return; | |
| 284 } | |
| 285 if (!bStartVert) { | |
| 286 start_k = FXSYS_Div(middle_y - start_y, middle_x - start_x); | |
| 287 start_c = middle_y - FXSYS_Mul(start_k, middle_x); | |
| 288 start_len = FXSYS_sqrt2(start_x - middle_x, start_y - middle_y); | |
| 289 start_dc = (FX_FLOAT)FXSYS_fabs(FXSYS_MulDiv(half_width, start_len, star
t_x - middle_x)); | |
| 290 } | |
| 291 if (!bEndVert) { | |
| 292 end_k = FXSYS_Div(end_y - middle_y, end_x - middle_x); | |
| 293 end_c = middle_y - FXSYS_Mul(end_k, middle_x); | |
| 294 end_len = FXSYS_sqrt2(end_x - middle_x, end_y - middle_y); | |
| 295 end_dc = (FX_FLOAT)FXSYS_fabs(FXSYS_MulDiv(half_width, end_len, end_x -
middle_x)); | |
| 296 } | |
| 297 if (bStartVert) { | |
| 298 FX_FLOAT outside_x = start_x; | |
| 299 if (end_x < start_x) { | |
| 300 outside_x += half_width; | |
| 301 } else { | |
| 302 outside_x -= half_width; | |
| 303 } | |
| 304 FX_FLOAT outside_y; | |
| 305 if (start_y < FXSYS_Mul(end_k, start_x) + end_c) { | |
| 306 outside_y = FXSYS_Mul(end_k, outside_x) + end_c + end_dc; | |
| 307 } else { | |
| 308 outside_y = FXSYS_Mul(end_k, outside_x) + end_c - end_dc; | |
| 309 } | |
| 310 rect.UpdateRect(outside_x, outside_y); | |
| 311 return; | |
| 312 } | |
| 313 if (bEndVert) { | |
| 314 FX_FLOAT outside_x = end_x; | |
| 315 if (start_x < end_x) { | |
| 316 outside_x += half_width; | |
| 317 } else { | |
| 318 outside_x -= half_width; | |
| 319 } | |
| 320 FX_FLOAT outside_y; | |
| 321 if (end_y < FXSYS_Mul(start_k, end_x) + start_c) { | |
| 322 outside_y = FXSYS_Mul(start_k, outside_x) + start_c + start_dc; | |
| 323 } else { | |
| 324 outside_y = FXSYS_Mul(start_k, outside_x) + start_c - start_dc; | |
| 325 } | |
| 326 rect.UpdateRect(outside_x, outside_y); | |
| 327 return; | |
| 328 } | |
| 329 if (FXSYS_fabs(start_k - end_k) < 1.0f / 20) { | |
| 330 int start_dir = middle_x > start_x ? 1 : -1; | |
| 331 int end_dir = end_x > middle_x ? 1 : -1; | |
| 332 if (start_dir == end_dir) { | |
| 333 _UpdateLineEndPoints(rect, middle_x, middle_y, end_x, end_y, half_wi
dth); | |
| 334 } else { | |
| 335 _UpdateLineEndPoints(rect, start_x, start_y, middle_x, middle_y, hal
f_width); | |
| 336 } | |
| 337 return; | |
| 338 } | |
| 339 FX_FLOAT start_outside_c = start_c; | |
| 340 if (end_y < FXSYS_Mul(start_k, end_x) + start_c) { | |
| 341 start_outside_c += start_dc; | |
| 342 } else { | |
| 343 start_outside_c -= start_dc; | |
| 344 } | |
| 345 FX_FLOAT end_outside_c = end_c; | |
| 346 if (start_y < FXSYS_Mul(end_k, start_x) + end_c) { | |
| 347 end_outside_c += end_dc; | |
| 348 } else { | |
| 349 end_outside_c -= end_dc; | |
| 350 } | |
| 351 FX_FLOAT join_x = FXSYS_Div(end_outside_c - start_outside_c, start_k - end_k
); | |
| 352 FX_FLOAT join_y = FXSYS_Mul(start_k, join_x) + start_outside_c; | |
| 353 rect.UpdateRect(join_x, join_y); | |
| 354 } | |
| 355 CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_l
imit) const | |
| 356 { | |
| 357 CFX_FloatRect rect(100000 * 1.0f, 100000 * 1.0f, -100000 * 1.0f, -100000 * 1
.0f); | |
| 358 int iPoint = 0; | |
| 359 FX_FLOAT half_width = line_width; | |
| 360 int iStartPoint, iEndPoint, iMiddlePoint; | |
| 361 FX_BOOL bJoin; | |
| 362 while (iPoint < m_PointCount) { | |
| 363 if (m_pPoints[iPoint].m_Flag == FXPT_MOVETO) { | |
| 364 iStartPoint = iPoint + 1; | |
| 365 iEndPoint = iPoint; | |
| 366 bJoin = FALSE; | |
| 367 } else { | |
| 368 if (m_pPoints[iPoint].m_Flag == FXPT_BEZIERTO) { | |
| 369 rect.UpdateRect(m_pPoints[iPoint].m_PointX, m_pPoints[iPoint].m_
PointY); | |
| 370 rect.UpdateRect(m_pPoints[iPoint + 1].m_PointX, m_pPoints[iPoint
+ 1].m_PointY); | |
| 371 iPoint += 2; | |
| 372 } | |
| 373 if (iPoint == m_PointCount - 1 || m_pPoints[iPoint + 1].m_Flag == FX
PT_MOVETO) { | |
| 374 iStartPoint = iPoint - 1; | |
| 375 iEndPoint = iPoint; | |
| 376 bJoin = FALSE; | |
| 377 } else { | |
| 378 iStartPoint = iPoint - 1; | |
| 379 iMiddlePoint = iPoint; | |
| 380 iEndPoint = iPoint + 1; | |
| 381 bJoin = TRUE; | |
| 382 } | |
| 383 } | |
| 384 FX_FLOAT start_x = m_pPoints[iStartPoint].m_PointX; | |
| 385 FX_FLOAT start_y = m_pPoints[iStartPoint].m_PointY; | |
| 386 FX_FLOAT end_x = m_pPoints[iEndPoint].m_PointX; | |
| 387 FX_FLOAT end_y = m_pPoints[iEndPoint].m_PointY; | |
| 388 if (bJoin) { | |
| 389 FX_FLOAT middle_x = m_pPoints[iMiddlePoint].m_PointX; | |
| 390 FX_FLOAT middle_y = m_pPoints[iMiddlePoint].m_PointY; | |
| 391 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, en
d_x, end_y, half_width, miter_limit); | |
| 392 } else { | |
| 393 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_widt
h); | |
| 394 } | |
| 395 iPoint ++; | |
| 396 } | |
| 397 return rect; | |
| 398 } | |
| 399 void CFX_PathData::Transform(const CFX_AffineMatrix* pMatrix) | |
| 400 { | |
| 401 if (pMatrix == NULL) { | |
| 402 return; | |
| 403 } | |
| 404 for (int i = 0; i < m_PointCount; i ++) { | |
| 405 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); | |
| 406 } | |
| 407 } | |
| 408 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* p
Matrix, FX_BOOL&bThin, FX_BOOL bAdjust) const | |
| 409 { | |
| 410 if (m_PointCount < 3) { | |
| 411 return FALSE; | |
| 412 } | |
| 413 if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO && | |
| 414 (m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO && (m_pPoints[2].m_
Flag & FXPT_TYPE) == FXPT_LINETO | |
| 415 && m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && m_pPoints[0].m_
PointY == m_pPoints[2].m_PointY) { | |
| 416 NewPath.AddPointCount(2); | |
| 417 if (bAdjust) { | |
| 418 if (pMatrix) { | |
| 419 FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY; | |
| 420 pMatrix->TransformPoint(x, y); | |
| 421 x = (int)x + 0.5f; | |
| 422 y = (int)y + 0.5f; | |
| 423 NewPath.SetPoint(0, x, y, FXPT_MOVETO); | |
| 424 x = m_pPoints[1].m_PointX, y = m_pPoints[1].m_PointY; | |
| 425 pMatrix->TransformPoint(x, y); | |
| 426 x = (int)x + 0.5f; | |
| 427 y = (int)y + 0.5f; | |
| 428 NewPath.SetPoint(1, x, y, FXPT_LINETO); | |
| 429 pMatrix->SetIdentity(); | |
| 430 } else { | |
| 431 FX_FLOAT x = (int)m_pPoints[0].m_PointX + 0.5f, y = (int)m_pPoin
ts[0].m_PointY + 0.5f; | |
| 432 NewPath.SetPoint(0, x, y, FXPT_MOVETO); | |
| 433 x = (int)m_pPoints[1].m_PointX + 0.5f, y = (int)m_pPoints[1].m_P
ointY + 0.5f; | |
| 434 NewPath.SetPoint(1, x, y, FXPT_LINETO); | |
| 435 } | |
| 436 } else { | |
| 437 NewPath.SetPoint(0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY, FX
PT_MOVETO); | |
| 438 NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, FX
PT_LINETO); | |
| 439 } | |
| 440 if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX && m_pPoints[0].m_Poi
ntY != m_pPoints[1].m_PointY) { | |
| 441 bThin = TRUE; | |
| 442 } | |
| 443 return TRUE; | |
| 444 } | |
| 445 if (((m_PointCount > 3) && (m_PointCount % 2))) { | |
| 446 int mid = m_PointCount / 2; | |
| 447 FX_BOOL bZeroArea = FALSE; | |
| 448 CFX_PathData t_path; | |
| 449 for (int i = 0; i < mid; i++) { | |
| 450 if (!(m_pPoints[mid - i - 1].m_PointX == m_pPoints[mid + i + 1].m_Po
intX | |
| 451 && m_pPoints[mid - i - 1].m_PointY == m_pPoints[mid + i + 1]
.m_PointY && | |
| 452 ((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERT
O && (m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) { | |
| 453 bZeroArea = TRUE; | |
| 454 break; | |
| 455 } | |
| 456 int new_count = t_path.GetPointCount(); | |
| 457 t_path.AddPointCount(2); | |
| 458 t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX, m_pPoints[mi
d - i].m_PointY, FXPT_MOVETO); | |
| 459 t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX, m_pP
oints[mid - i - 1].m_PointY, FXPT_LINETO); | |
| 460 } | |
| 461 if (!bZeroArea) { | |
| 462 NewPath.Append(&t_path, NULL); | |
| 463 bThin = TRUE; | |
| 464 return TRUE; | |
| 465 } | |
| 466 } | |
| 467 int stratPoint = 0; | |
| 468 int next = 0, i; | |
| 469 for (i = 0; i < m_PointCount; i++) { | |
| 470 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; | |
| 471 if (point_type == FXPT_MOVETO) { | |
| 472 stratPoint = i; | |
| 473 } else if (point_type == FXPT_LINETO) { | |
| 474 next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoi
nt; | |
| 475 if ((m_pPoints[next].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && (m_pPoi
nts[next].m_Flag & FXPT_TYPE) != FXPT_MOVETO) { | |
| 476 if((m_pPoints[i - 1].m_PointX == m_pPoints[i].m_PointX && m_pPoi
nts[i].m_PointX == m_pPoints[next].m_PointX) | |
| 477 && ((m_pPoints[i].m_PointY - m_pPoints[i - 1].m_PointY)
* (m_pPoints[i].m_PointY - m_pPoints[next].m_PointY) > 0)) { | |
| 478 int pre = i; | |
| 479 if (FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[i - 1].m_Po
intY) | |
| 480 < FXSYS_fabs(m_pPoints[i].m_PointY - m_pPoints[next]
.m_PointY)) { | |
| 481 pre --; | |
| 482 next--; | |
| 483 } | |
| 484 int new_count = NewPath.GetPointCount(); | |
| 485 NewPath.AddPointCount(2); | |
| 486 NewPath.SetPoint(new_count, m_pPoints[pre].m_PointX, m_pPoin
ts[pre].m_PointY, FXPT_MOVETO); | |
| 487 NewPath.SetPoint(new_count + 1, m_pPoints[next].m_PointX, m_
pPoints[next].m_PointY, FXPT_LINETO); | |
| 488 } else if((m_pPoints[i - 1].m_PointY == m_pPoints[i].m_PointY &&
m_pPoints[i].m_PointY == m_pPoints[next].m_PointY) | |
| 489 && ((m_pPoints[i].m_PointX - m_pPoints[i - 1].m_PointX
) * (m_pPoints[i].m_PointX - m_pPoints[next].m_PointX) > 0)) { | |
| 490 int pre = i; | |
| 491 if (FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[i - 1].m_Po
intX) | |
| 492 < FXSYS_fabs(m_pPoints[i].m_PointX - m_pPoints[next]
.m_PointX)) { | |
| 493 pre --; | |
| 494 next--; | |
| 495 } | |
| 496 int new_count = NewPath.GetPointCount(); | |
| 497 NewPath.AddPointCount(2); | |
| 498 NewPath.SetPoint(new_count, m_pPoints[pre].m_PointX, m_pPoin
ts[pre].m_PointY, FXPT_MOVETO); | |
| 499 NewPath.SetPoint(new_count + 1, m_pPoints[next].m_PointX, m_
pPoints[next].m_PointY, FXPT_LINETO); | |
| 500 } else if ((m_pPoints[i - 1].m_Flag & FXPT_TYPE) == FXPT_MOVETO
&& (m_pPoints[next].m_Flag & FXPT_TYPE) == FXPT_LINETO && | |
| 501 m_pPoints[i - 1].m_PointX == m_pPoints[next].m_PointX
&& m_pPoints[i - 1].m_PointY == m_pPoints[next].m_PointY | |
| 502 && m_pPoints[next].m_Flag & FXPT_CLOSEFIGURE) { | |
| 503 int new_count = NewPath.GetPointCount(); | |
| 504 NewPath.AddPointCount(2); | |
| 505 NewPath.SetPoint(new_count, m_pPoints[i - 1].m_PointX, m_pPo
ints[i - 1].m_PointY, FXPT_MOVETO); | |
| 506 NewPath.SetPoint(new_count + 1, m_pPoints[i].m_PointX, m_pPo
ints[i].m_PointY, FXPT_LINETO); | |
| 507 bThin = TRUE; | |
| 508 } | |
| 509 } | |
| 510 } else if (point_type == FXPT_BEZIERTO) { | |
| 511 i += 2; | |
| 512 continue; | |
| 513 } | |
| 514 } | |
| 515 if (m_PointCount > 3 && NewPath.GetPointCount()) { | |
| 516 bThin = TRUE; | |
| 517 } | |
| 518 if (NewPath.GetPointCount() == 0) { | |
| 519 return FALSE; | |
| 520 } | |
| 521 return TRUE; | |
| 522 } | |
| 523 FX_BOOL CFX_PathData::IsRect() const | |
| 524 { | |
| 525 if (m_PointCount != 5 && m_PointCount != 4) { | |
| 526 return FALSE; | |
| 527 } | |
| 528 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || | |
| 529 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY))
|| | |
| 530 (m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && m_pPoints[0].m_Po
intY == m_pPoints[2].m_PointY) || | |
| 531 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && m_pPoints[1].m_Po
intY == m_pPoints[3].m_PointY)) { | |
| 532 return FALSE; | |
| 533 } | |
| 534 if (m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && m_pPoints[0].m_PointY
!= m_pPoints[3].m_PointY) { | |
| 535 return FALSE; | |
| 536 } | |
| 537 for (int i = 1; i < 4; i ++) { | |
| 538 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { | |
| 539 return FALSE; | |
| 540 } | |
| 541 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && m_pPoints[i].m
_PointY != m_pPoints[i - 1].m_PointY) { | |
| 542 return FALSE; | |
| 543 } | |
| 544 } | |
| 545 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); | |
| 546 } | |
| 547 FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, CFX_FloatRect* pRe
ct) const | |
| 548 { | |
| 549 if (pMatrix == NULL) { | |
| 550 if (!IsRect()) { | |
| 551 return FALSE; | |
| 552 } | |
| 553 if (pRect) { | |
| 554 pRect->left = m_pPoints[0].m_PointX; | |
| 555 pRect->right = m_pPoints[2].m_PointX; | |
| 556 pRect->bottom = m_pPoints[0].m_PointY; | |
| 557 pRect->top = m_pPoints[2].m_PointY; | |
| 558 pRect->Normalize(); | |
| 559 } | |
| 560 return TRUE; | |
| 561 } | |
| 562 if (m_PointCount != 5 && m_PointCount != 4) { | |
| 563 return FALSE; | |
| 564 } | |
| 565 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX ||
m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || | |
| 566 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && m_pPoints[1].m_Po
intY == m_pPoints[3].m_PointY)) { | |
| 567 return FALSE; | |
| 568 } | |
| 569 if (m_PointCount == 4 && m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && m
_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { | |
| 570 return FALSE; | |
| 571 } | |
| 572 FX_FLOAT x[5], y[5]; | |
| 573 for (int i = 0; i < m_PointCount; i ++) { | |
| 574 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i], y
[i]); | |
| 575 if (i) { | |
| 576 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { | |
| 577 return FALSE; | |
| 578 } | |
| 579 if (x[i] != x[i - 1] && y[i] != y[i - 1]) { | |
| 580 return FALSE; | |
| 581 } | |
| 582 } | |
| 583 } | |
| 584 if (pRect) { | |
| 585 pRect->left = x[0]; | |
| 586 pRect->right = x[2]; | |
| 587 pRect->bottom = y[0]; | |
| 588 pRect->top = y[2]; | |
| 589 pRect->Normalize(); | |
| 590 } | |
| 591 return TRUE; | |
| 592 } | |
| 593 FX_BOOL CFX_PathData::Copy(const CFX_PathData &src) | |
| 594 { | |
| 595 if (!SetPointCount(src.m_PointCount)) { | |
| 596 return FALSE; | |
| 597 } | |
| 598 FXSYS_memcpy32(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount
); | |
| 599 return TRUE; | |
| 600 } | |
| 601 CFX_GraphStateData::CFX_GraphStateData() | |
| 602 { | |
| 603 m_LineCap = LineCapButt; | |
| 604 m_DashCount = 0; | |
| 605 m_DashArray = NULL; | |
| 606 m_DashPhase = 0; | |
| 607 m_LineJoin = LineJoinMiter; | |
| 608 m_MiterLimit = 10 * 1.0f; | |
| 609 m_LineWidth = 1.0f; | |
| 610 } | |
| 611 CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) | |
| 612 { | |
| 613 m_DashArray = NULL; | |
| 614 Copy(src); | |
| 615 } | |
| 616 void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) | |
| 617 { | |
| 618 m_LineCap = src.m_LineCap; | |
| 619 m_DashCount = src.m_DashCount; | |
| 620 if (m_DashArray) { | |
| 621 FX_Free(m_DashArray); | |
| 622 } | |
| 623 m_DashArray = NULL; | |
| 624 m_DashPhase = src.m_DashPhase; | |
| 625 m_LineJoin = src.m_LineJoin; | |
| 626 m_MiterLimit = src.m_MiterLimit; | |
| 627 m_LineWidth = src.m_LineWidth; | |
| 628 if (m_DashCount) { | |
| 629 m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); | |
| 630 if (!m_DashArray) { | |
| 631 return; | |
| 632 } | |
| 633 FXSYS_memcpy32(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLO
AT)); | |
| 634 } | |
| 635 } | |
| 636 CFX_GraphStateData::~CFX_GraphStateData() | |
| 637 { | |
| 638 if (m_DashArray) { | |
| 639 FX_Free(m_DashArray); | |
| 640 } | |
| 641 } | |
| 642 void CFX_GraphStateData::SetDashCount(int count) | |
| 643 { | |
| 644 if (m_DashArray) { | |
| 645 FX_Free(m_DashArray); | |
| 646 } | |
| 647 m_DashArray = NULL; | |
| 648 m_DashCount = count; | |
| 649 if (count == 0) { | |
| 650 return; | |
| 651 } | |
| 652 m_DashArray = FX_Alloc(FX_FLOAT, count); | |
| 653 } | |
| OLD | NEW |