Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Edit.cpp

Issue 1143663008: Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | third_party/base/numerics/safe_conversions_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_EditCtrl.h" 9 #include "../../include/pdfwindow/PWL_EditCtrl.h"
10 #include "../../include/pdfwindow/PWL_Edit.h" 10 #include "../../include/pdfwindow/PWL_Edit.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (nCharArray > 0 && nCharArraySafe.IsValid()) 419 if (nCharArray > 0 && nCharArraySafe.IsValid())
420 { 420 {
421 switch (GetBorderStyle()) 421 switch (GetBorderStyle())
422 { 422 {
423 case PBS_SOLID: 423 case PBS_SOLID:
424 { 424 {
425 CFX_GraphStateData gsd; 425 CFX_GraphStateData gsd;
426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); 426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
427 427
428 CFX_PathData path; 428 CFX_PathData path;
429 » » » » if (!path.SetPointCount(nCharArraySafe.ValueOrDi e())) { 429 » » » » path.SetPointCount(nCharArraySafe.ValueOrDie());
430 » » » » » return; 430
431 » » » » }
432 » » » »
433 for (FX_INT32 i=0; i<nCharArray-1; i++) 431 for (FX_INT32 i=0; i<nCharArray-1; i++)
434 » » » » {» » » » » 432 » » » » {
435 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1), 433 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1),
436 rcClient.bottom, FXPT_MOVETO); 434 rcClient.bottom, FXPT_MOVETO);
437 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1), 435 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1),
438 » » » » » » rcClient.top, FXPT_LINETO);» » » » » » » » » » » 436 » » » » » » rcClient.top, FXPT_LINETO);
439 » » » » }» » » 437 » » » » }
440 if (path.GetPointCount() > 0) 438 if (path.GetPointCount() > 0)
441 pDevice->DrawPath(&path, pUser2Device, & gsd,0, 439 pDevice->DrawPath(&path, pUser2Device, & gsd,0,
442 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE); 440 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE);
443 } 441 }
444 break; 442 break;
445 case PBS_DASH: 443 case PBS_DASH:
446 { 444 {
447 CFX_GraphStateData gsd; 445 CFX_GraphStateData gsd;
448 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); 446 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
449 447
450 gsd.SetDashCount(2); 448 gsd.SetDashCount(2);
451 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n Dash; 449 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n Dash;
452 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n Gap; 450 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n Gap;
453 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha se; 451 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha se;
454 452
455 CFX_PathData path; 453 CFX_PathData path;
456 » » » » if (!path.SetPointCount(nCharArraySafe.ValueOrDi e())) { 454 » » » » path.SetPointCount(nCharArraySafe.ValueOrDie());
457 » » » » » return; 455
458 » » » » }
459 » » » »
460 for (FX_INT32 i=0; i<nCharArray-1; i++) 456 for (FX_INT32 i=0; i<nCharArray-1; i++)
461 » » » » {» » » » » 457 » » » » {
462 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1), 458 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1),
463 rcClient.bottom, FXPT_MOVETO); 459 rcClient.bottom, FXPT_MOVETO);
464 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1), 460 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1),
465 » » » » » » rcClient.top, FXPT_LINETO);» » » » » » » » » » » 461 » » » » » » rcClient.top, FXPT_LINETO);
466 » » » » }» » 462 » » » » }
467 if (path.GetPointCount() > 0) 463 if (path.GetPointCount() > 0)
468 » » » » » pDevice->DrawPath(&path, pUser2Device, & gsd,0, 464 » » » » » pDevice->DrawPath(&path, pUser2Device, & gsd,0,
469 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE); 465 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE);
470 } 466 }
471 break; 467 break;
472 } 468 }
473 } 469 }
474 470
475 CPDF_Rect rcClip; 471 CPDF_Rect rcClip;
476 CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); 472 CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
477 CPVT_WordRange* pRange = NULL; 473 CPVT_WordRange* pRange = NULL;
478 474
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1311 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1316 } 1312 }
1317 1313
1318 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, 1314 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
1319 const CP DF_Point& ptOffset) 1315 const CP DF_Point& ptOffset)
1320 { 1316 {
1321 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; 1317 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
1322 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1318 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1323 } 1319 }
1324 1320
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | third_party/base/numerics/safe_conversions_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698