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 "fpdfsdk/pdfwindow/PWL_Utils.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return rcRet; | 81 return rcRet; |
82 } | 82 } |
83 | 83 |
84 CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, | 84 CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, |
85 FX_FLOAT x, | 85 FX_FLOAT x, |
86 FX_FLOAT y) { | 86 FX_FLOAT y) { |
87 return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x, | 87 return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x, |
88 rect.top + y); | 88 rect.top + y); |
89 } | 89 } |
90 | 90 |
91 FX_BOOL CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, | 91 bool CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, |
92 const CFX_FloatRect& rcChild) { | 92 const CFX_FloatRect& rcChild) { |
93 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && | 93 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && |
94 rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; | 94 rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; |
95 } | 95 } |
96 | 96 |
97 FX_BOOL CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, | 97 bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, |
98 const CFX_FloatRect& rect2) { | 98 const CFX_FloatRect& rect2) { |
99 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; | 99 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; |
100 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; | 100 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; |
101 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; | 101 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; |
102 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; | 102 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; |
103 | 103 |
104 return left < right && bottom < top; | 104 return left < right && bottom < top; |
105 } | 105 } |
106 | 106 |
107 CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, | 107 CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, |
108 FX_FLOAT x, | 108 FX_FLOAT x, |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 (rcRect.top + rcRect.bottom) / 2); | 368 (rcRect.top + rcRect.bottom) / 2); |
369 | 369 |
370 return CFX_FloatRect( | 370 return CFX_FloatRect( |
371 ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, | 371 ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, |
372 ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale); | 372 ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale); |
373 } | 373 } |
374 | 374 |
375 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, | 375 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, |
376 const CPWL_Color& color) { | 376 const CPWL_Color& color) { |
377 CFX_ByteTextBuf sAppStream; | 377 CFX_ByteTextBuf sAppStream; |
378 CFX_ByteString sColor = GetColorAppStream(color, TRUE); | 378 CFX_ByteString sColor = GetColorAppStream(color, true); |
379 if (sColor.GetLength() > 0) { | 379 if (sColor.GetLength() > 0) { |
380 sAppStream << "q\n" << sColor; | 380 sAppStream << "q\n" << sColor; |
381 sAppStream << rect.left << " " << rect.bottom << " " | 381 sAppStream << rect.left << " " << rect.bottom << " " |
382 << rect.right - rect.left << " " << rect.top - rect.bottom | 382 << rect.right - rect.left << " " << rect.top - rect.bottom |
383 << " re f\nQ\n"; | 383 << " re f\nQ\n"; |
384 } | 384 } |
385 | 385 |
386 return sAppStream.MakeString(); | 386 return sAppStream.MakeString(); |
387 } | 387 } |
388 | 388 |
389 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, | 389 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, |
390 const CPWL_Color& color) { | 390 const CPWL_Color& color) { |
391 CFX_ByteTextBuf sAppStream; | 391 CFX_ByteTextBuf sAppStream; |
392 CFX_ByteString sColor = GetColorAppStream(color, TRUE); | 392 CFX_ByteString sColor = GetColorAppStream(color, true); |
393 if (sColor.GetLength() > 0) { | 393 if (sColor.GetLength() > 0) { |
394 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; | 394 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; |
395 } | 395 } |
396 return sAppStream.MakeString(); | 396 return sAppStream.MakeString(); |
397 } | 397 } |
398 | 398 |
399 CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { | 399 CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { |
400 FX_FLOAT fWidth = rect.right - rect.left; | 400 FX_FLOAT fWidth = rect.right - rect.left; |
401 FX_FLOAT fHeight = rect.top - rect.bottom; | 401 FX_FLOAT fHeight = rect.top - rect.bottom; |
402 | 402 |
403 FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f; | 403 FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f; |
404 FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f; | 404 FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f; |
405 | 405 |
406 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; | 406 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; |
407 | 407 |
408 return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius, | 408 return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius, |
409 fCenterX + fRadius, fCenterY + fRadius); | 409 fCenterX + fRadius, fCenterY + fRadius); |
410 } | 410 } |
411 | 411 |
412 CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, | 412 CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, |
413 const CFX_FloatPoint& ptOffset, | 413 const CFX_FloatPoint& ptOffset, |
414 const CPVT_WordRange* pRange, | 414 const CPVT_WordRange* pRange, |
415 FX_BOOL bContinuous, | 415 bool bContinuous, |
416 uint16_t SubWord) { | 416 uint16_t SubWord) { |
417 return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, | 417 return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, |
418 SubWord); | 418 SubWord); |
419 } | 419 } |
420 | 420 |
421 CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, | 421 CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, |
422 const CFX_FloatPoint& ptOffset, | 422 const CFX_FloatPoint& ptOffset, |
423 const CPVT_WordRange* pRange) { | 423 const CPVT_WordRange* pRange) { |
424 return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); | 424 return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); |
425 } | 425 } |
426 | 426 |
427 CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, | 427 CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, |
428 IPVT_FontMap* pFontMap, | 428 IPVT_FontMap* pFontMap, |
429 const CFX_WideString& sText, | 429 const CFX_WideString& sText, |
430 int32_t nAlignmentH, | 430 int32_t nAlignmentH, |
431 int32_t nAlignmentV, | 431 int32_t nAlignmentV, |
432 FX_FLOAT fFontSize, | 432 FX_FLOAT fFontSize, |
433 FX_BOOL bMultiLine, | 433 bool bMultiLine, |
434 FX_BOOL bAutoReturn, | 434 bool bAutoReturn, |
435 const CPWL_Color& crText) { | 435 const CPWL_Color& crText) { |
436 CFX_ByteTextBuf sRet; | 436 CFX_ByteTextBuf sRet; |
437 | 437 |
438 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); | 438 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); |
439 pEdit->SetFontMap(pFontMap); | 439 pEdit->SetFontMap(pFontMap); |
440 pEdit->SetPlateRect(rcBBox); | 440 pEdit->SetPlateRect(rcBBox); |
441 pEdit->SetAlignmentH(nAlignmentH, TRUE); | 441 pEdit->SetAlignmentH(nAlignmentH, true); |
442 pEdit->SetAlignmentV(nAlignmentV, TRUE); | 442 pEdit->SetAlignmentV(nAlignmentV, true); |
443 pEdit->SetMultiLine(bMultiLine, TRUE); | 443 pEdit->SetMultiLine(bMultiLine, true); |
444 pEdit->SetAutoReturn(bAutoReturn, TRUE); | 444 pEdit->SetAutoReturn(bAutoReturn, true); |
445 if (IsFloatZero(fFontSize)) | 445 if (IsFloatZero(fFontSize)) |
446 pEdit->SetAutoFontSize(TRUE, TRUE); | 446 pEdit->SetAutoFontSize(true, true); |
447 else | 447 else |
448 pEdit->SetFontSize(fFontSize); | 448 pEdit->SetFontSize(fFontSize); |
449 | 449 |
450 pEdit->Initialize(); | 450 pEdit->Initialize(); |
451 pEdit->SetText(sText); | 451 pEdit->SetText(sText); |
452 | 452 |
453 CFX_ByteString sEdit = | 453 CFX_ByteString sEdit = |
454 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); | 454 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); |
455 if (sEdit.GetLength() > 0) | 455 if (sEdit.GetLength() > 0) |
456 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; | 456 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; |
457 | 457 |
458 return sRet.MakeString(); | 458 return sRet.MakeString(); |
459 } | 459 } |
460 | 460 |
461 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, | 461 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, |
462 IPVT_FontMap* pFontMap, | 462 IPVT_FontMap* pFontMap, |
463 CPDF_Stream* pIconStream, | 463 CPDF_Stream* pIconStream, |
464 CPDF_IconFit& IconFit, | 464 CPDF_IconFit& IconFit, |
465 const CFX_WideString& sLabel, | 465 const CFX_WideString& sLabel, |
466 const CPWL_Color& crText, | 466 const CPWL_Color& crText, |
467 FX_FLOAT fFontSize, | 467 FX_FLOAT fFontSize, |
468 int32_t nLayOut) { | 468 int32_t nLayOut) { |
469 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; | 469 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; |
470 | 470 |
471 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); | 471 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); |
472 pEdit->SetFontMap(pFontMap); | 472 pEdit->SetFontMap(pFontMap); |
473 pEdit->SetAlignmentH(1, TRUE); | 473 pEdit->SetAlignmentH(1, true); |
474 pEdit->SetAlignmentV(1, TRUE); | 474 pEdit->SetAlignmentV(1, true); |
475 pEdit->SetMultiLine(FALSE, TRUE); | 475 pEdit->SetMultiLine(false, true); |
476 pEdit->SetAutoReturn(FALSE, TRUE); | 476 pEdit->SetAutoReturn(false, true); |
477 if (IsFloatZero(fFontSize)) | 477 if (IsFloatZero(fFontSize)) |
478 pEdit->SetAutoFontSize(TRUE, TRUE); | 478 pEdit->SetAutoFontSize(true, true); |
479 else | 479 else |
480 pEdit->SetFontSize(fFontSize); | 480 pEdit->SetFontSize(fFontSize); |
481 | 481 |
482 pEdit->Initialize(); | 482 pEdit->Initialize(); |
483 pEdit->SetText(sLabel); | 483 pEdit->SetText(sLabel); |
484 | 484 |
485 CFX_FloatRect rcLabelContent = pEdit->GetContentRect(); | 485 CFX_FloatRect rcLabelContent = pEdit->GetContentRect(); |
486 CPWL_Icon Icon; | 486 CPWL_Icon Icon; |
487 PWL_CREATEPARAM cp; | 487 PWL_CREATEPARAM cp; |
488 cp.dwFlags = PWS_VISIBLE; | 488 cp.dwFlags = PWS_VISIBLE; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 break; | 647 break; |
648 case PPBL_LABELOVERICON: | 648 case PPBL_LABELOVERICON: |
649 rcLabel = rcBBox; | 649 rcLabel = rcBBox; |
650 rcIcon = rcBBox; | 650 rcIcon = rcBBox; |
651 break; | 651 break; |
652 } | 652 } |
653 | 653 |
654 CFX_ByteTextBuf sAppStream, sTemp; | 654 CFX_ByteTextBuf sAppStream, sTemp; |
655 | 655 |
656 if (!rcIcon.IsEmpty()) { | 656 if (!rcIcon.IsEmpty()) { |
657 Icon.Move(rcIcon, FALSE, FALSE); | 657 Icon.Move(rcIcon, false, false); |
658 sTemp << Icon.GetImageAppStream(); | 658 sTemp << Icon.GetImageAppStream(); |
659 } | 659 } |
660 | 660 |
661 Icon.Destroy(); | 661 Icon.Destroy(); |
662 | 662 |
663 if (!rcLabel.IsEmpty()) { | 663 if (!rcLabel.IsEmpty()) { |
664 pEdit->SetPlateRect(rcLabel); | 664 pEdit->SetPlateRect(rcLabel); |
665 CFX_ByteString sEdit = | 665 CFX_ByteString sEdit = |
666 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); | 666 CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); |
667 if (sEdit.GetLength() > 0) { | 667 if (sEdit.GetLength() > 0) { |
668 sTemp << "BT\n" | 668 sTemp << "BT\n" |
669 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; | 669 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 if (sTemp.GetSize() > 0) { | 673 if (sTemp.GetSize() > 0) { |
674 sAppStream << "q\n" | 674 sAppStream << "q\n" |
675 << rcBBox.left << " " << rcBBox.bottom << " " | 675 << rcBBox.left << " " << rcBBox.bottom << " " |
676 << rcBBox.right - rcBBox.left << " " | 676 << rcBBox.right - rcBBox.left << " " |
677 << rcBBox.top - rcBBox.bottom << " re W n\n"; | 677 << rcBBox.top - rcBBox.bottom << " re W n\n"; |
678 sAppStream << sTemp << "Q\n"; | 678 sAppStream << sTemp << "Q\n"; |
679 } | 679 } |
680 return sAppStream.MakeString(); | 680 return sAppStream.MakeString(); |
681 } | 681 } |
682 | 682 |
683 CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, | 683 CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, |
684 const FX_BOOL& bFillOrStroke) { | 684 const bool& bFillOrStroke) { |
685 CFX_ByteTextBuf sColorStream; | 685 CFX_ByteTextBuf sColorStream; |
686 | 686 |
687 switch (color.nColorType) { | 687 switch (color.nColorType) { |
688 case COLORTYPE_RGB: | 688 case COLORTYPE_RGB: |
689 sColorStream << color.fColor1 << " " << color.fColor2 << " " | 689 sColorStream << color.fColor1 << " " << color.fColor2 << " " |
690 << color.fColor3 << " " << (bFillOrStroke ? "rg" : "RG") | 690 << color.fColor3 << " " << (bFillOrStroke ? "rg" : "RG") |
691 << "\n"; | 691 << "\n"; |
692 break; | 692 break; |
693 case COLORTYPE_GRAY: | 693 case COLORTYPE_GRAY: |
694 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") | 694 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") |
(...skipping 25 matching lines...) Expand all Loading... |
720 FX_FLOAT fBottom = rect.bottom; | 720 FX_FLOAT fBottom = rect.bottom; |
721 | 721 |
722 if (fWidth > 0.0f) { | 722 if (fWidth > 0.0f) { |
723 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 723 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
724 | 724 |
725 sAppStream << "q\n"; | 725 sAppStream << "q\n"; |
726 | 726 |
727 switch (nStyle) { | 727 switch (nStyle) { |
728 default: | 728 default: |
729 case BorderStyle::SOLID: | 729 case BorderStyle::SOLID: |
730 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); | 730 sColor = CPWL_Utils::GetColorAppStream(color, true); |
731 if (sColor.GetLength() > 0) { | 731 if (sColor.GetLength() > 0) { |
732 sAppStream << sColor; | 732 sAppStream << sColor; |
733 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " | 733 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " |
734 << fTop - fBottom << " re\n"; | 734 << fTop - fBottom << " re\n"; |
735 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " | 735 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " |
736 << fRight - fLeft - fWidth * 2 << " " | 736 << fRight - fLeft - fWidth * 2 << " " |
737 << fTop - fBottom - fWidth * 2 << " re\n"; | 737 << fTop - fBottom - fWidth * 2 << " re\n"; |
738 sAppStream << "f*\n"; | 738 sAppStream << "f*\n"; |
739 } | 739 } |
740 break; | 740 break; |
741 case BorderStyle::DASH: | 741 case BorderStyle::DASH: |
742 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 742 sColor = CPWL_Utils::GetColorAppStream(color, false); |
743 if (sColor.GetLength() > 0) { | 743 if (sColor.GetLength() > 0) { |
744 sAppStream << sColor; | 744 sAppStream << sColor; |
745 sAppStream << fWidth << " w" | 745 sAppStream << fWidth << " w" |
746 << " [" << dash.nDash << " " << dash.nGap << "] " | 746 << " [" << dash.nDash << " " << dash.nGap << "] " |
747 << dash.nPhase << " d\n"; | 747 << dash.nPhase << " d\n"; |
748 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 | 748 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 |
749 << " m\n"; | 749 << " m\n"; |
750 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 | 750 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 |
751 << " l\n"; | 751 << " l\n"; |
752 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 | 752 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 |
753 << " l\n"; | 753 << " l\n"; |
754 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 | 754 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 |
755 << " l\n"; | 755 << " l\n"; |
756 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 | 756 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 |
757 << " l S\n"; | 757 << " l S\n"; |
758 } | 758 } |
759 break; | 759 break; |
760 case BorderStyle::BEVELED: | 760 case BorderStyle::BEVELED: |
761 case BorderStyle::INSET: | 761 case BorderStyle::INSET: |
762 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, TRUE); | 762 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, true); |
763 if (sColor.GetLength() > 0) { | 763 if (sColor.GetLength() > 0) { |
764 sAppStream << sColor; | 764 sAppStream << sColor; |
765 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth | 765 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth |
766 << " m\n"; | 766 << " m\n"; |
767 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth | 767 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth |
768 << " l\n"; | 768 << " l\n"; |
769 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth | 769 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth |
770 << " l\n"; | 770 << " l\n"; |
771 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 | 771 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 |
772 << " l\n"; | 772 << " l\n"; |
773 sAppStream << fLeft + fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 | 773 sAppStream << fLeft + fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 |
774 << " l\n"; | 774 << " l\n"; |
775 sAppStream << fLeft + fHalfWidth * 2 << " " | 775 sAppStream << fLeft + fHalfWidth * 2 << " " |
776 << fBottom + fHalfWidth * 2 << " l f\n"; | 776 << fBottom + fHalfWidth * 2 << " l f\n"; |
777 } | 777 } |
778 | 778 |
779 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, TRUE); | 779 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, true); |
780 if (sColor.GetLength() > 0) { | 780 if (sColor.GetLength() > 0) { |
781 sAppStream << sColor; | 781 sAppStream << sColor; |
782 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth | 782 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth |
783 << " m\n"; | 783 << " m\n"; |
784 sAppStream << fRight - fHalfWidth << " " << fBottom + fHalfWidth | 784 sAppStream << fRight - fHalfWidth << " " << fBottom + fHalfWidth |
785 << " l\n"; | 785 << " l\n"; |
786 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth | 786 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth |
787 << " l\n"; | 787 << " l\n"; |
788 sAppStream << fLeft + fHalfWidth * 2 << " " | 788 sAppStream << fLeft + fHalfWidth * 2 << " " |
789 << fBottom + fHalfWidth * 2 << " l\n"; | 789 << fBottom + fHalfWidth * 2 << " l\n"; |
790 sAppStream << fRight - fHalfWidth * 2 << " " | 790 sAppStream << fRight - fHalfWidth * 2 << " " |
791 << fBottom + fHalfWidth * 2 << " l\n"; | 791 << fBottom + fHalfWidth * 2 << " l\n"; |
792 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 | 792 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 |
793 << " l f\n"; | 793 << " l f\n"; |
794 } | 794 } |
795 | 795 |
796 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); | 796 sColor = CPWL_Utils::GetColorAppStream(color, true); |
797 if (sColor.GetLength() > 0) { | 797 if (sColor.GetLength() > 0) { |
798 sAppStream << sColor; | 798 sAppStream << sColor; |
799 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " | 799 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " |
800 << fTop - fBottom << " re\n"; | 800 << fTop - fBottom << " re\n"; |
801 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " | 801 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " |
802 << fRight - fLeft - fHalfWidth * 2 << " " | 802 << fRight - fLeft - fHalfWidth * 2 << " " |
803 << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; | 803 << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; |
804 } | 804 } |
805 break; | 805 break; |
806 case BorderStyle::UNDERLINE: | 806 case BorderStyle::UNDERLINE: |
807 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 807 sColor = CPWL_Utils::GetColorAppStream(color, false); |
808 if (sColor.GetLength() > 0) { | 808 if (sColor.GetLength() > 0) { |
809 sAppStream << sColor; | 809 sAppStream << sColor; |
810 sAppStream << fWidth << " w\n"; | 810 sAppStream << fWidth << " w\n"; |
811 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n"; | 811 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n"; |
812 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n"; | 812 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n"; |
813 } | 813 } |
814 break; | 814 break; |
815 } | 815 } |
816 | 816 |
817 sAppStream << "Q\n"; | 817 sAppStream << "Q\n"; |
(...skipping 13 matching lines...) Expand all Loading... |
831 CFX_ByteTextBuf sAppStream; | 831 CFX_ByteTextBuf sAppStream; |
832 CFX_ByteString sColor; | 832 CFX_ByteString sColor; |
833 | 833 |
834 if (fWidth > 0.0f) { | 834 if (fWidth > 0.0f) { |
835 sAppStream << "q\n"; | 835 sAppStream << "q\n"; |
836 | 836 |
837 switch (nStyle) { | 837 switch (nStyle) { |
838 default: | 838 default: |
839 case BorderStyle::SOLID: | 839 case BorderStyle::SOLID: |
840 case BorderStyle::UNDERLINE: { | 840 case BorderStyle::UNDERLINE: { |
841 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 841 sColor = CPWL_Utils::GetColorAppStream(color, false); |
842 if (sColor.GetLength() > 0) { | 842 if (sColor.GetLength() > 0) { |
843 sAppStream << "q\n" << fWidth << " w\n" << sColor | 843 sAppStream << "q\n" << fWidth << " w\n" << sColor |
844 << CPWL_Utils::GetAP_Circle( | 844 << CPWL_Utils::GetAP_Circle( |
845 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) | 845 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) |
846 << " S\nQ\n"; | 846 << " S\nQ\n"; |
847 } | 847 } |
848 } break; | 848 } break; |
849 case BorderStyle::DASH: { | 849 case BorderStyle::DASH: { |
850 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 850 sColor = CPWL_Utils::GetColorAppStream(color, false); |
851 if (sColor.GetLength() > 0) { | 851 if (sColor.GetLength() > 0) { |
852 sAppStream << "q\n" << fWidth << " w\n" | 852 sAppStream << "q\n" << fWidth << " w\n" |
853 << "[" << dash.nDash << " " << dash.nGap << "] " | 853 << "[" << dash.nDash << " " << dash.nGap << "] " |
854 << dash.nPhase << " d\n" << sColor | 854 << dash.nPhase << " d\n" << sColor |
855 << CPWL_Utils::GetAP_Circle( | 855 << CPWL_Utils::GetAP_Circle( |
856 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) | 856 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) |
857 << " S\nQ\n"; | 857 << " S\nQ\n"; |
858 } | 858 } |
859 } break; | 859 } break; |
860 case BorderStyle::BEVELED: { | 860 case BorderStyle::BEVELED: { |
861 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 861 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
862 | 862 |
863 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 863 sColor = CPWL_Utils::GetColorAppStream(color, false); |
864 if (sColor.GetLength() > 0) { | 864 if (sColor.GetLength() > 0) { |
865 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 865 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
866 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; | 866 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; |
867 } | 867 } |
868 | 868 |
869 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); | 869 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); |
870 if (sColor.GetLength() > 0) { | 870 if (sColor.GetLength() > 0) { |
871 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 871 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
872 << CPWL_Utils::GetAP_HalfCircle( | 872 << CPWL_Utils::GetAP_HalfCircle( |
873 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 873 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
874 FX_PI / 4.0f) | 874 FX_PI / 4.0f) |
875 << " S\nQ\n"; | 875 << " S\nQ\n"; |
876 } | 876 } |
877 | 877 |
878 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); | 878 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); |
879 if (sColor.GetLength() > 0) { | 879 if (sColor.GetLength() > 0) { |
880 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 880 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
881 << CPWL_Utils::GetAP_HalfCircle( | 881 << CPWL_Utils::GetAP_HalfCircle( |
882 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 882 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
883 FX_PI * 5 / 4.0f) | 883 FX_PI * 5 / 4.0f) |
884 << " S\nQ\n"; | 884 << " S\nQ\n"; |
885 } | 885 } |
886 } break; | 886 } break; |
887 case BorderStyle::INSET: { | 887 case BorderStyle::INSET: { |
888 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 888 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
889 | 889 |
890 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 890 sColor = CPWL_Utils::GetColorAppStream(color, false); |
891 if (sColor.GetLength() > 0) { | 891 if (sColor.GetLength() > 0) { |
892 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 892 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
893 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; | 893 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; |
894 } | 894 } |
895 | 895 |
896 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); | 896 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); |
897 if (sColor.GetLength() > 0) { | 897 if (sColor.GetLength() > 0) { |
898 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 898 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
899 << CPWL_Utils::GetAP_HalfCircle( | 899 << CPWL_Utils::GetAP_HalfCircle( |
900 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 900 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
901 FX_PI / 4.0f) | 901 FX_PI / 4.0f) |
902 << " S\nQ\n"; | 902 << " S\nQ\n"; |
903 } | 903 } |
904 | 904 |
905 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); | 905 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); |
906 if (sColor.GetLength() > 0) { | 906 if (sColor.GetLength() > 0) { |
907 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 907 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
908 << CPWL_Utils::GetAP_HalfCircle( | 908 << CPWL_Utils::GetAP_HalfCircle( |
909 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 909 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
910 FX_PI * 5 / 4.0f) | 910 FX_PI * 5 / 4.0f) |
911 << " S\nQ\n"; | 911 << " S\nQ\n"; |
912 } | 912 } |
913 } break; | 913 } break; |
914 } | 914 } |
915 | 915 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 sRet.fColor4 /= fColorDevide; | 966 sRet.fColor4 /= fColorDevide; |
967 break; | 967 break; |
968 } | 968 } |
969 | 969 |
970 return sRet; | 970 return sRet; |
971 } | 971 } |
972 | 972 |
973 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, | 973 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, |
974 const CPWL_Color& crText) { | 974 const CPWL_Color& crText) { |
975 CFX_ByteTextBuf sAP; | 975 CFX_ByteTextBuf sAP; |
976 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) | 976 sAP << "q\n" |
| 977 << CPWL_Utils::GetColorAppStream(crText, true) |
977 << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; | 978 << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; |
978 return sAP.MakeString(); | 979 return sAP.MakeString(); |
979 } | 980 } |
980 | 981 |
981 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, | 982 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, |
982 const CPWL_Color& crText) { | 983 const CPWL_Color& crText) { |
983 CFX_ByteTextBuf sAP; | 984 CFX_ByteTextBuf sAP; |
984 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) | 985 sAP << "q\n" |
| 986 << CPWL_Utils::GetColorAppStream(crText, true) |
985 << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; | 987 << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; |
986 return sAP.MakeString(); | 988 return sAP.MakeString(); |
987 } | 989 } |
988 | 990 |
989 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, | 991 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, |
990 const CPWL_Color& crText) { | 992 const CPWL_Color& crText) { |
991 CFX_ByteTextBuf sAP; | 993 CFX_ByteTextBuf sAP; |
992 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE) | 994 sAP << "q\n" |
| 995 << CPWL_Utils::GetColorAppStream(crText, false) |
993 << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; | 996 << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; |
994 return sAP.MakeString(); | 997 return sAP.MakeString(); |
995 } | 998 } |
996 | 999 |
997 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, | 1000 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, |
998 const CPWL_Color& crText) { | 1001 const CPWL_Color& crText) { |
999 CFX_ByteTextBuf sAP; | 1002 CFX_ByteTextBuf sAP; |
1000 sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) | 1003 sAP << "q\n1 w\n" |
| 1004 << CPWL_Utils::GetColorAppStream(crText, true) |
1001 << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; | 1005 << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; |
1002 return sAP.MakeString(); | 1006 return sAP.MakeString(); |
1003 } | 1007 } |
1004 | 1008 |
1005 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, | 1009 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, |
1006 const CPWL_Color& crText) { | 1010 const CPWL_Color& crText) { |
1007 CFX_ByteTextBuf sAP; | 1011 CFX_ByteTextBuf sAP; |
1008 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) | 1012 sAP << "q\n" |
| 1013 << CPWL_Utils::GetColorAppStream(crText, true) |
1009 << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; | 1014 << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; |
1010 return sAP.MakeString(); | 1015 return sAP.MakeString(); |
1011 } | 1016 } |
1012 | 1017 |
1013 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, | 1018 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, |
1014 const CPWL_Color& crText) { | 1019 const CPWL_Color& crText) { |
1015 CFX_ByteTextBuf sAP; | 1020 CFX_ByteTextBuf sAP; |
1016 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) | 1021 sAP << "q\n" |
| 1022 << CPWL_Utils::GetColorAppStream(crText, true) |
1017 << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; | 1023 << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; |
1018 return sAP.MakeString(); | 1024 return sAP.MakeString(); |
1019 } | 1025 } |
1020 | 1026 |
1021 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, | 1027 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, |
1022 int32_t nStyle, | 1028 int32_t nStyle, |
1023 const CPWL_Color& crText) { | 1029 const CPWL_Color& crText) { |
1024 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox); | 1030 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox); |
1025 switch (nStyle) { | 1031 switch (nStyle) { |
1026 default: | 1032 default: |
(...skipping 30 matching lines...) Expand all Loading... |
1057 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); | 1063 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); |
1058 case PCS_STAR: | 1064 case PCS_STAR: |
1059 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); | 1065 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); |
1060 } | 1066 } |
1061 } | 1067 } |
1062 | 1068 |
1063 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { | 1069 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { |
1064 CFX_ByteTextBuf sAppStream; | 1070 CFX_ByteTextBuf sAppStream; |
1065 | 1071 |
1066 if (!rcBBox.IsEmpty()) { | 1072 if (!rcBBox.IsEmpty()) { |
1067 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( | 1073 sAppStream << "q\n" |
1068 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, | 1074 << CPWL_Utils::GetColorAppStream( |
1069 220.0f / 255.0f, 220.0f / 255.0f), | 1075 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, |
1070 TRUE); | 1076 220.0f / 255.0f, 220.0f / 255.0f), |
| 1077 true); |
1071 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " | 1078 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " |
1072 << rcBBox.right - rcBBox.left << " " | 1079 << rcBBox.right - rcBBox.left << " " |
1073 << rcBBox.top - rcBBox.bottom << " re f\n"; | 1080 << rcBBox.top - rcBBox.bottom << " re f\n"; |
1074 sAppStream << "Q\n"; | 1081 sAppStream << "Q\n"; |
1075 | 1082 |
1076 sAppStream << "q\n" | 1083 sAppStream << "q\n" |
1077 << CPWL_Utils::GetBorderAppStream( | 1084 << CPWL_Utils::GetBorderAppStream( |
1078 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), | 1085 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), |
1079 CPWL_Color(COLORTYPE_GRAY, 1), | 1086 CPWL_Color(COLORTYPE_GRAY, 1), |
1080 CPWL_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED, | 1087 CPWL_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 CFX_Matrix* pUser2Device, | 1278 CFX_Matrix* pUser2Device, |
1272 const CFX_FloatRect& rect, | 1279 const CFX_FloatRect& rect, |
1273 const CPWL_Color& color, | 1280 const CPWL_Color& color, |
1274 int32_t nTransparancy) { | 1281 int32_t nTransparancy) { |
1275 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect, | 1282 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect, |
1276 PWLColorToFXColor(color, nTransparancy)); | 1283 PWLColorToFXColor(color, nTransparancy)); |
1277 } | 1284 } |
1278 | 1285 |
1279 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, | 1286 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, |
1280 CFX_Matrix* pUser2Device, | 1287 CFX_Matrix* pUser2Device, |
1281 FX_BOOL bVertical, | 1288 bool bVertical, |
1282 FX_BOOL bHorizontal, | 1289 bool bHorizontal, |
1283 CFX_FloatRect rect, | 1290 CFX_FloatRect rect, |
1284 int32_t nTransparancy, | 1291 int32_t nTransparancy, |
1285 int32_t nStartGray, | 1292 int32_t nStartGray, |
1286 int32_t nEndGray) { | 1293 int32_t nEndGray) { |
1287 FX_FLOAT fStepGray = 1.0f; | 1294 FX_FLOAT fStepGray = 1.0f; |
1288 | 1295 |
1289 if (bVertical) { | 1296 if (bVertical) { |
1290 fStepGray = (nEndGray - nStartGray) / rect.Height(); | 1297 fStepGray = (nEndGray - nStartGray) / rect.Height(); |
1291 | 1298 |
1292 for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { | 1299 for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 | 1442 |
1436 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, | 1443 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, |
1437 PWLColorToFXColor(color, nTransparancy), | 1444 PWLColorToFXColor(color, nTransparancy), |
1438 FXFILL_ALTERNATE); | 1445 FXFILL_ALTERNATE); |
1439 break; | 1446 break; |
1440 } | 1447 } |
1441 } | 1448 } |
1442 } | 1449 } |
1443 } | 1450 } |
1444 | 1451 |
1445 FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { | 1452 bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { |
1446 switch (color.nColorType) { | 1453 switch (color.nColorType) { |
1447 case COLORTYPE_TRANSPARENT: | 1454 case COLORTYPE_TRANSPARENT: |
1448 return FALSE; | 1455 return false; |
1449 case COLORTYPE_GRAY: | 1456 case COLORTYPE_GRAY: |
1450 return color.fColor1 < 0.5f; | 1457 return color.fColor1 < 0.5f; |
1451 case COLORTYPE_RGB: | 1458 case COLORTYPE_RGB: |
1452 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f; | 1459 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f; |
1453 case COLORTYPE_CMYK: | 1460 case COLORTYPE_CMYK: |
1454 return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 > | 1461 return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 > |
1455 2.0f; | 1462 2.0f; |
1456 } | 1463 } |
1457 | 1464 |
1458 return TRUE; | 1465 return true; |
1459 } | 1466 } |
1460 | 1467 |
1461 CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) { | 1468 CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) { |
1462 CPWL_Color crRet = color; | 1469 CPWL_Color crRet = color; |
1463 | 1470 |
1464 switch (color.nColorType) { | 1471 switch (color.nColorType) { |
1465 case COLORTYPE_GRAY: | 1472 case COLORTYPE_GRAY: |
1466 crRet.fColor1 = 1.0f - crRet.fColor1; | 1473 crRet.fColor1 = 1.0f - crRet.fColor1; |
1467 break; | 1474 break; |
1468 case COLORTYPE_RGB: | 1475 case COLORTYPE_RGB: |
1469 crRet.fColor1 = 1.0f - crRet.fColor1; | 1476 crRet.fColor1 = 1.0f - crRet.fColor1; |
1470 crRet.fColor2 = 1.0f - crRet.fColor2; | 1477 crRet.fColor2 = 1.0f - crRet.fColor2; |
1471 crRet.fColor3 = 1.0f - crRet.fColor3; | 1478 crRet.fColor3 = 1.0f - crRet.fColor3; |
1472 break; | 1479 break; |
1473 case COLORTYPE_CMYK: | 1480 case COLORTYPE_CMYK: |
1474 crRet.fColor1 = 1.0f - crRet.fColor1; | 1481 crRet.fColor1 = 1.0f - crRet.fColor1; |
1475 crRet.fColor2 = 1.0f - crRet.fColor2; | 1482 crRet.fColor2 = 1.0f - crRet.fColor2; |
1476 crRet.fColor3 = 1.0f - crRet.fColor3; | 1483 crRet.fColor3 = 1.0f - crRet.fColor3; |
1477 crRet.fColor4 = 1.0f - crRet.fColor4; | 1484 crRet.fColor4 = 1.0f - crRet.fColor4; |
1478 break; | 1485 break; |
1479 } | 1486 } |
1480 | 1487 |
1481 return crRet; | 1488 return crRet; |
1482 } | 1489 } |
1483 | 1490 |
1484 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, | 1491 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, |
1485 const CFX_FloatRect& rect, | 1492 const CFX_FloatRect& rect, |
1486 const CPWL_Color& crFill, | 1493 const CPWL_Color& crFill, |
1487 const CPWL_Color& crStroke) { | 1494 const CPWL_Color& crStroke) { |
1488 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); | 1495 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false); |
1489 sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); | 1496 sAppStream += CPWL_Utils::GetColorAppStream(crFill, true); |
1490 | 1497 |
1491 CFX_ByteString sPath; | 1498 CFX_ByteString sPath; |
1492 CFX_PathData path; | 1499 CFX_PathData path; |
1493 | 1500 |
1494 switch (nType) { | 1501 switch (nType) { |
1495 case PWL_ICONTYPE_CHECKMARK: | 1502 case PWL_ICONTYPE_CHECKMARK: |
1496 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); | 1503 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); |
1497 break; | 1504 break; |
1498 case PWL_ICONTYPE_CIRCLE: | 1505 case PWL_ICONTYPE_CIRCLE: |
1499 GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM); | 1506 GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM); |
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3345 break; | 3352 break; |
3346 case COLORTYPE_RGB: | 3353 case COLORTYPE_RGB: |
3347 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, | 3354 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, |
3348 fColor1, fColor2, fColor3); | 3355 fColor1, fColor2, fColor3); |
3349 break; | 3356 break; |
3350 } | 3357 } |
3351 break; | 3358 break; |
3352 } | 3359 } |
3353 nColorType = nConvertColorType; | 3360 nColorType = nConvertColorType; |
3354 } | 3361 } |
OLD | NEW |