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 #include <algorithm> | 5 #include <algorithm> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "core/fpdfapi/page/cpdf_meshstream.h" | 9 #include "core/fpdfapi/page/cpdf_meshstream.h" |
10 #include "core/fpdfapi/page/cpdf_shadingpattern.h" | 10 #include "core/fpdfapi/page/cpdf_shadingpattern.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 } | 148 } |
149 | 149 |
150 ASSERT(false); | 150 ASSERT(false); |
151 } | 151 } |
152 | 152 |
153 #endif // _SKIA_SUPPORT_PATHS_ | 153 #endif // _SKIA_SUPPORT_PATHS_ |
154 | 154 |
155 #define SHOW_SKIA_PATH 0 // set to 1 to print the path contents | 155 #define SHOW_SKIA_PATH 0 // set to 1 to print the path contents |
156 #define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip | 156 #define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip |
157 | 157 |
158 #if SHOW_SKIA_PATH | |
159 void DebugShowSkiaPaint(const SkPaint& paint) { | |
160 if (SkPaint::kFill_Style == paint.getStyle()) { | |
161 printf("fill 0x%08x\n", paint.getColor()); | |
162 } else { | |
163 printf("stroke 0x%08x width %g\n", paint.getColor(), | |
164 paint.getStrokeWidth()); | |
165 } | |
166 } | |
167 #endif // SHOW_SKIA_PATH | |
168 | |
158 void DebugShowSkiaPath(const SkPath& path) { | 169 void DebugShowSkiaPath(const SkPath& path) { |
159 #if SHOW_SKIA_PATH | 170 #if SHOW_SKIA_PATH |
160 char buffer[4096]; | 171 char buffer[4096]; |
161 sk_bzero(buffer, sizeof(buffer)); | 172 sk_bzero(buffer, sizeof(buffer)); |
162 SkMemoryWStream stream(buffer, sizeof(buffer)); | 173 SkMemoryWStream stream(buffer, sizeof(buffer)); |
163 path.dump(&stream, false, false); | 174 path.dump(&stream, false, false); |
164 printf("%s", buffer); | 175 printf("%s", buffer); |
165 #endif // SHOW_SKIA_PATH | 176 #endif // SHOW_SKIA_PATH |
166 } | 177 } |
167 | 178 |
168 void DebugShowCanvasMatrix(const SkCanvas* canvas) { | 179 void DebugShowCanvasMatrix(const SkCanvas* canvas) { |
169 #if SHOW_SKIA_PATH | 180 #if SHOW_SKIA_PATH |
170 SkMatrix matrix = canvas->getTotalMatrix(); | 181 SkMatrix matrix = canvas->getTotalMatrix(); |
171 SkScalar m[9]; | 182 SkScalar m[9]; |
172 matrix.get9(m); | 183 matrix.get9(m); |
173 printf("matrix (%g,%g,%g) (%g,%g,%g) (%g,%g,%g)\n", m[0], m[1], m[2], m[3], | 184 printf("matrix (%g,%g,%g) (%g,%g,%g) (%g,%g,%g)\n", m[0], m[1], m[2], m[3], |
174 m[4], m[5], m[6], m[7], m[8]); | 185 m[4], m[5], m[6], m[7], m[8]); |
175 #endif // SHOW_SKIA_PATH | 186 #endif // SHOW_SKIA_PATH |
176 } | 187 } |
177 | 188 |
189 void DebugShowCanvasClip(const SkCanvas* canvas) { | |
178 #if SHOW_SKIA_PATH | 190 #if SHOW_SKIA_PATH |
179 void DebugShowCanvasClip(const SkCanvas* canvas) { | |
180 SkRect local; | 191 SkRect local; |
181 SkIRect device; | 192 SkIRect device; |
182 canvas->getClipBounds(&local); | 193 canvas->getClipBounds(&local); |
183 printf("local bounds %g %g %g %g\n", local.fLeft, local.fTop, local.fRight, | 194 printf("local bounds %g %g %g %g\n", local.fLeft, local.fTop, local.fRight, |
184 local.fBottom); | 195 local.fBottom); |
185 canvas->getClipDeviceBounds(&device); | 196 canvas->getClipDeviceBounds(&device); |
186 printf("device bounds %d %d %d %d\n", device.fLeft, device.fTop, | 197 printf("device bounds %d %d %d %d\n", device.fLeft, device.fTop, |
187 device.fRight, device.fBottom); | 198 device.fRight, device.fBottom); |
188 const SkClipStack* clipStack = canvas->getClipStack(); | 199 const SkClipStack* clipStack = canvas->getClipStack(); |
189 clipStack->dump(); | 200 clipStack->dump(); |
201 #endif // SHOW_SKIA_PATH | |
190 } | 202 } |
191 | 203 |
204 #if SHOW_SKIA_PATH | |
192 void DebugShowSkiaPaint(const SkPaint& paint) { | 205 void DebugShowSkiaPaint(const SkPaint& paint) { |
193 if (SkPaint::kFill_Style == paint.getStyle()) { | 206 if (SkPaint::kFill_Style == paint.getStyle()) { |
194 printf("fill 0x%08x\n", paint.getColor()); | 207 printf("fill 0x%08x\n", paint.getColor()); |
195 } else { | 208 } else { |
196 printf("stroke 0x%08x width %g\n", paint.getColor(), | 209 printf("stroke 0x%08x width %g\n", paint.getColor(), |
197 paint.getStrokeWidth()); | 210 paint.getStrokeWidth()); |
198 } | 211 } |
199 } | 212 } |
200 #endif // SHOW_SKIA_PATH | 213 #endif // SHOW_SKIA_PATH |
201 | 214 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 skBitmap->installPixels(imageInfo, buffer, rowBytes, *ctPtr, nullptr, | 640 skBitmap->installPixels(imageInfo, buffer, rowBytes, *ctPtr, nullptr, |
628 nullptr); | 641 nullptr); |
629 *widthPtr = width; | 642 *widthPtr = width; |
630 *heightPtr = height; | 643 *heightPtr = height; |
631 return true; | 644 return true; |
632 } | 645 } |
633 #endif // _SKIA_SUPPORT_ | 646 #endif // _SKIA_SUPPORT_ |
634 | 647 |
635 } // namespace | 648 } // namespace |
636 | 649 |
637 #ifdef _SKIA_SUPPORT_ | |
638 // Encapsulate the state used for successive text and path draws so that | 650 // Encapsulate the state used for successive text and path draws so that |
639 // they can be combined. | 651 // they can be combined. |
640 class SkiaState { | 652 class SkiaState { |
641 public: | 653 public: |
642 enum class Clip { | 654 enum class Clip { |
643 kSave, | 655 kSave, |
644 kPath, | 656 kPath, |
645 }; | 657 }; |
646 | 658 |
659 enum class Accumulator { | |
660 kNone, | |
661 kPath, | |
662 kText, | |
663 kOther, | |
664 }; | |
665 | |
647 // mark all cached state as uninitialized | 666 // mark all cached state as uninitialized |
648 SkiaState() | 667 explicit SkiaState(CFX_SkiaDeviceDriver* pDriver) |
dsinclair
2016/12/06 18:48:26
I think the explicit is only needed in the .h file
caryclark
2016/12/06 19:00:37
The upload lint complained.
| |
649 : m_pFont(nullptr), | 668 : m_pDriver(pDriver), |
669 m_pFont(nullptr), | |
650 m_fontSize(0), | 670 m_fontSize(0), |
651 m_fillColor(0), | 671 m_fillColor(0), |
652 m_strokeColor(0), | 672 m_strokeColor(0), |
653 m_blendType(0), | 673 m_blendType(0), |
654 m_commandIndex(0), | 674 m_commandIndex(0), |
655 m_drawText(false), | 675 m_drawIndex(INT_MAX), |
656 m_drawPath(false), | 676 m_clipIndex(0), |
677 m_type(Accumulator::kNone), | |
678 m_fillFullCover(false), | |
657 m_fillPath(false), | 679 m_fillPath(false), |
658 m_groupKnockout(false), | 680 m_groupKnockout(false), |
659 m_debugDisable(false) {} | 681 m_debugDisable(false) |
682 #if SHOW_SKIA_PATH | |
683 , | |
684 m_debugSaveCounter(0) | |
685 #endif | |
686 { | |
687 } | |
660 | 688 |
661 bool DrawPath(const CFX_PathData* pPathData, | 689 bool DrawPath(const CFX_PathData* pPathData, |
662 const CFX_Matrix* pMatrix, | 690 const CFX_Matrix* pMatrix, |
663 const CFX_GraphStateData* pDrawState, | 691 const CFX_GraphStateData* pDrawState, |
664 uint32_t fill_color, | 692 uint32_t fill_color, |
665 uint32_t stroke_color, | 693 uint32_t stroke_color, |
666 int fill_mode, | 694 int fill_mode, |
667 int blend_type, | 695 int blend_type) { |
668 CFX_SkiaDeviceDriver* pDriver) { | |
669 if (m_debugDisable) | 696 if (m_debugDisable) |
670 return false; | 697 return false; |
671 if (m_commandIndex < m_commands.count()) | 698 Dump(__func__); |
672 FlushCommands(pDriver); | 699 int drawIndex = SkTMin(m_drawIndex, m_commands.count()); |
673 if (m_drawText) | 700 if (Accumulator::kText == m_type || drawIndex != m_commandIndex || |
674 FlushText(pDriver); | 701 (Accumulator::kPath == m_type && |
675 if (m_drawPath && | 702 DrawChanged(pMatrix, pDrawState, fill_color, stroke_color, fill_mode, |
676 DrawChanged(pMatrix, pDrawState, fill_color, stroke_color, fill_mode, | 703 blend_type, m_pDriver->m_bGroupKnockout))) { |
677 blend_type, pDriver->m_bGroupKnockout)) { | 704 Flush(); |
678 FlushPath(pDriver); | |
679 } | 705 } |
680 if (!m_drawPath) { | 706 if (Accumulator::kPath != m_type) { |
681 m_skPath.reset(); | 707 m_skPath.reset(); |
708 m_fillFullCover = !!(fill_mode & FXFILL_FULLCOVER); | |
682 m_fillPath = (fill_mode & 3) && fill_color; | 709 m_fillPath = (fill_mode & 3) && fill_color; |
683 m_skPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE | 710 m_skPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE |
684 ? SkPath::kEvenOdd_FillType | 711 ? SkPath::kEvenOdd_FillType |
685 : SkPath::kWinding_FillType); | 712 : SkPath::kWinding_FillType); |
686 if (pDrawState) | 713 if (pDrawState) |
687 m_drawState.Copy(*pDrawState); | 714 m_drawState.Copy(*pDrawState); |
688 m_fillColor = fill_color; | 715 m_fillColor = fill_color; |
689 m_strokeColor = stroke_color; | 716 m_strokeColor = stroke_color; |
690 m_blendType = blend_type; | 717 m_blendType = blend_type; |
691 m_groupKnockout = pDriver->m_bGroupKnockout; | 718 m_groupKnockout = m_pDriver->m_bGroupKnockout; |
692 if (pMatrix) | 719 if (pMatrix) |
693 m_drawMatrix = *pMatrix; | 720 m_drawMatrix = *pMatrix; |
721 m_drawIndex = m_commandIndex; | |
722 m_type = Accumulator::kPath; | |
694 } | 723 } |
695 SkPath skPath = BuildPath(pPathData); | 724 SkPath skPath = BuildPath(pPathData); |
696 SkPoint delta; | 725 SkPoint delta; |
697 if (MatrixOffset(pMatrix, &delta)) | 726 if (MatrixOffset(pMatrix, &delta)) |
698 skPath.offset(delta.fX, delta.fY); | 727 skPath.offset(delta.fX, delta.fY); |
699 m_skPath.addPath(skPath); | 728 m_skPath.addPath(skPath); |
700 m_drawPath = true; | |
701 return true; | 729 return true; |
702 } | 730 } |
703 | 731 |
704 void FlushPath(CFX_SkiaDeviceDriver* pDriver) { | 732 void FlushPath() { |
733 Dump(__func__); | |
705 SkMatrix skMatrix = ToSkMatrix(m_drawMatrix); | 734 SkMatrix skMatrix = ToSkMatrix(m_drawMatrix); |
706 SkPaint skPaint; | 735 SkPaint skPaint; |
707 skPaint.setAntiAlias(true); | 736 skPaint.setAntiAlias(true); |
737 if (m_fillFullCover) | |
738 skPaint.setBlendMode(SkBlendMode::kPlus); | |
708 int stroke_alpha = FXARGB_A(m_strokeColor); | 739 int stroke_alpha = FXARGB_A(m_strokeColor); |
709 if (stroke_alpha) | 740 if (stroke_alpha) |
710 pDriver->PaintStroke(&skPaint, &m_drawState, skMatrix); | 741 m_pDriver->PaintStroke(&skPaint, &m_drawState, skMatrix); |
711 SkCanvas* skCanvas = pDriver->SkiaCanvas(); | 742 SkCanvas* skCanvas = m_pDriver->SkiaCanvas(); |
712 skCanvas->save(); | 743 skCanvas->save(); |
713 skCanvas->concat(skMatrix); | 744 skCanvas->concat(skMatrix); |
714 if (m_fillPath) { | 745 if (m_fillPath) { |
715 SkPath strokePath; | 746 SkPath strokePath; |
716 const SkPath* fillPath = &m_skPath; | 747 const SkPath* fillPath = &m_skPath; |
717 if (stroke_alpha) { | 748 if (stroke_alpha) { |
718 if (m_groupKnockout) { | 749 if (m_groupKnockout) { |
719 skPaint.getFillPath(m_skPath, &strokePath); | 750 skPaint.getFillPath(m_skPath, &strokePath); |
720 if (Op(m_skPath, strokePath, SkPathOp::kDifference_SkPathOp, | 751 if (Op(m_skPath, strokePath, SkPathOp::kDifference_SkPathOp, |
721 &strokePath)) { | 752 &strokePath)) { |
722 fillPath = &strokePath; | 753 fillPath = &strokePath; |
723 } | 754 } |
724 } | 755 } |
725 } | 756 } |
726 skPaint.setStyle(SkPaint::kFill_Style); | 757 skPaint.setStyle(SkPaint::kFill_Style); |
727 skPaint.setColor(m_fillColor); | 758 skPaint.setColor(m_fillColor); |
759 #ifdef _SKIA_SUPPORT_PATHS_ | |
760 m_pDriver->PreMultiply(); | |
761 #endif // _SKIA_SUPPORT_PATHS_ | |
762 DebugShowSkiaDrawPath(skCanvas, skPaint, *fillPath); | |
728 skCanvas->drawPath(*fillPath, skPaint); | 763 skCanvas->drawPath(*fillPath, skPaint); |
729 } | 764 } |
730 if (stroke_alpha) { | 765 if (stroke_alpha) { |
731 DebugShowSkiaPath(m_skPath); | |
732 DebugShowCanvasMatrix(skCanvas); | |
733 skPaint.setStyle(SkPaint::kStroke_Style); | 766 skPaint.setStyle(SkPaint::kStroke_Style); |
734 skPaint.setColor(m_strokeColor); | 767 skPaint.setColor(m_strokeColor); |
768 #ifdef _SKIA_SUPPORT_PATHS_ | |
769 m_pDriver->PreMultiply(); | |
770 #endif // _SKIA_SUPPORT_PATHS_ | |
771 DebugShowSkiaDrawPath(skCanvas, skPaint, m_skPath); | |
735 skCanvas->drawPath(m_skPath, skPaint); | 772 skCanvas->drawPath(m_skPath, skPaint); |
736 } | 773 } |
737 skCanvas->restore(); | 774 skCanvas->restore(); |
738 m_drawPath = false; | 775 m_drawIndex = INT_MAX; |
776 m_type = Accumulator::kNone; | |
739 } | 777 } |
740 | 778 |
741 bool DrawText(int nChars, | 779 bool DrawText(int nChars, |
742 const FXTEXT_CHARPOS* pCharPos, | 780 const FXTEXT_CHARPOS* pCharPos, |
743 CFX_Font* pFont, | 781 CFX_Font* pFont, |
744 const CFX_Matrix* pMatrix, | 782 const CFX_Matrix* pMatrix, |
745 FX_FLOAT font_size, | 783 FX_FLOAT font_size, |
746 uint32_t color, | 784 uint32_t color) { |
747 CFX_SkiaDeviceDriver* pDriver) { | |
748 if (m_debugDisable) | 785 if (m_debugDisable) |
749 return false; | 786 return false; |
750 if (m_commandIndex < m_commands.count()) | 787 Dump(__func__); |
751 FlushCommands(pDriver); | 788 int drawIndex = SkTMin(m_drawIndex, m_commands.count()); |
752 if (m_drawPath) | 789 if (Accumulator::kPath == m_type || drawIndex != m_commandIndex || |
753 FlushPath(pDriver); | 790 (Accumulator::kText == m_type && |
754 if (m_drawText && FontChanged(pFont, pMatrix, font_size, color)) | 791 FontChanged(pFont, pMatrix, font_size, color))) { |
755 FlushText(pDriver); | 792 Flush(); |
756 if (!m_drawText) { | 793 } |
794 if (Accumulator::kText != m_type) { | |
757 m_positions.setCount(0); | 795 m_positions.setCount(0); |
758 m_glyphs.setCount(0); | 796 m_glyphs.setCount(0); |
759 m_pFont = pFont; | 797 m_pFont = pFont; |
760 m_fontSize = font_size; | 798 m_fontSize = font_size; |
761 m_fillColor = color; | 799 m_fillColor = color; |
762 m_drawMatrix = *pMatrix; | 800 m_drawMatrix = *pMatrix; |
801 m_drawIndex = m_commandIndex; | |
802 m_type = Accumulator::kText; | |
763 } | 803 } |
764 int count = m_positions.count(); | 804 int count = m_positions.count(); |
765 m_positions.setCount(nChars + count); | 805 m_positions.setCount(nChars + count); |
766 m_glyphs.setCount(nChars + count); | 806 m_glyphs.setCount(nChars + count); |
767 SkScalar flip = m_fontSize < 0 ? -1 : 1; | 807 SkScalar flip = m_fontSize < 0 ? -1 : 1; |
808 SkScalar vFlip = flip; | |
809 if (pFont->IsVertical()) | |
810 vFlip *= -1; | |
768 for (int index = 0; index < nChars; ++index) { | 811 for (int index = 0; index < nChars; ++index) { |
769 const FXTEXT_CHARPOS& cp = pCharPos[index]; | 812 const FXTEXT_CHARPOS& cp = pCharPos[index]; |
770 m_positions[index + count] = {cp.m_OriginX * flip, cp.m_OriginY * flip}; | 813 m_positions[index + count] = {cp.m_OriginX * flip, cp.m_OriginY * vFlip}; |
771 m_glyphs[index + count] = (uint16_t)cp.m_GlyphIndex; | 814 m_glyphs[index + count] = (uint16_t)cp.m_GlyphIndex; |
772 } | 815 } |
773 SkPoint delta; | 816 SkPoint delta; |
774 if (MatrixOffset(pMatrix, &delta)) { | 817 if (MatrixOffset(pMatrix, &delta)) { |
775 for (int index = 0; index < nChars; ++index) | 818 for (int index = 0; index < nChars; ++index) |
776 m_positions[index + count].offset(delta.fX * flip, -delta.fY * flip); | 819 m_positions[index + count].offset(delta.fX * flip, -delta.fY * flip); |
777 } | 820 } |
778 m_drawText = true; | |
779 return true; | 821 return true; |
780 } | 822 } |
781 | 823 |
782 void FlushText(CFX_SkiaDeviceDriver* pDriver) { | 824 void FlushText() { |
783 SkScalar flip = m_fontSize < 0 ? -1 : 1; | 825 Dump(__func__); |
784 SkMatrix skMatrix = ToFlippedSkMatrix(m_drawMatrix, flip); | |
785 SkPaint skPaint; | 826 SkPaint skPaint; |
786 skPaint.setAntiAlias(true); | 827 skPaint.setAntiAlias(true); |
787 skPaint.setColor(m_fillColor); | 828 skPaint.setColor(m_fillColor); |
788 if (m_pFont->GetFace()) { // exclude placeholder test fonts | 829 if (m_pFont->GetFace()) { // exclude placeholder test fonts |
789 sk_sp<SkTypeface> typeface(SkSafeRef(m_pFont->GetDeviceCache())); | 830 sk_sp<SkTypeface> typeface(SkSafeRef(m_pFont->GetDeviceCache())); |
790 skPaint.setTypeface(typeface); | 831 skPaint.setTypeface(typeface); |
791 } | 832 } |
792 skPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 833 skPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
793 skPaint.setHinting(SkPaint::kNo_Hinting); | 834 skPaint.setHinting(SkPaint::kNo_Hinting); |
794 skPaint.setTextSize(SkTAbs(m_fontSize)); | 835 skPaint.setTextSize(SkTAbs(m_fontSize)); |
795 skPaint.setSubpixelText(true); | 836 skPaint.setSubpixelText(true); |
796 SkCanvas* skCanvas = pDriver->SkiaCanvas(); | 837 SkCanvas* skCanvas = m_pDriver->SkiaCanvas(); |
797 skCanvas->save(); | 838 skCanvas->save(); |
839 SkScalar flip = m_fontSize < 0 ? -1 : 1; | |
840 SkMatrix skMatrix = ToFlippedSkMatrix(m_drawMatrix, flip); | |
798 skCanvas->concat(skMatrix); | 841 skCanvas->concat(skMatrix); |
842 #ifdef _SKIA_SUPPORT_PATHS_ | |
843 m_pDriver->PreMultiply(); | |
844 #endif // _SKIA_SUPPORT_PATHS_ | |
799 skCanvas->drawPosText(m_glyphs.begin(), m_glyphs.count() * 2, | 845 skCanvas->drawPosText(m_glyphs.begin(), m_glyphs.count() * 2, |
800 m_positions.begin(), skPaint); | 846 m_positions.begin(), skPaint); |
801 skCanvas->restore(); | 847 skCanvas->restore(); |
802 m_drawText = false; | 848 m_drawIndex = INT_MAX; |
849 m_type = Accumulator::kNone; | |
803 } | 850 } |
804 | 851 |
805 bool SetClipFill(const CFX_PathData* pPathData, | 852 bool SetClipFill(const CFX_PathData* pPathData, |
806 const CFX_Matrix* pMatrix, | 853 const CFX_Matrix* pMatrix, |
807 int fill_mode, | 854 int fill_mode) { |
808 CFX_SkiaDeviceDriver* pDriver) { | |
809 if (m_debugDisable) | 855 if (m_debugDisable) |
810 return false; | 856 return false; |
857 Dump(__func__); | |
811 SkPath skClipPath = BuildPath(pPathData); | 858 SkPath skClipPath = BuildPath(pPathData); |
812 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE | 859 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE |
813 ? SkPath::kEvenOdd_FillType | 860 ? SkPath::kEvenOdd_FillType |
814 : SkPath::kWinding_FillType); | 861 : SkPath::kWinding_FillType); |
815 SkMatrix skMatrix = ToSkMatrix(*pMatrix); | 862 SkMatrix skMatrix = ToSkMatrix(*pMatrix); |
816 skClipPath.transform(skMatrix); | 863 skClipPath.transform(skMatrix); |
817 return SetClip(skClipPath, pDriver); | 864 return SetClip(skClipPath); |
818 } | 865 } |
819 | 866 |
820 bool SetClip(const SkPath& skClipPath, CFX_SkiaDeviceDriver* pDriver) { | 867 bool SetClip(const SkPath& skClipPath) { |
868 // if a pending draw depends on clip state that is cached, flush it and draw | |
821 if (m_commandIndex < m_commands.count()) { | 869 if (m_commandIndex < m_commands.count()) { |
822 if (m_commands[m_commandIndex] == Clip::kPath && | 870 if (m_commands[m_commandIndex] == Clip::kPath && |
823 m_clips[m_commandIndex] == skClipPath) { | 871 m_clips[m_commandIndex] == skClipPath) { |
824 ++m_commandIndex; | 872 ++m_commandIndex; |
825 return true; | 873 return true; |
826 } | 874 } |
827 FlushCommands(pDriver); | 875 Flush(); |
828 } | 876 } |
829 Flush(pDriver); | 877 while (m_clipIndex > m_commandIndex) { |
830 m_commands.push(Clip::kPath); | 878 do { |
879 --m_clipIndex; | |
880 SkASSERT(m_clipIndex >= 0); | |
881 } while (m_commands[m_clipIndex] != Clip::kSave); | |
882 m_pDriver->SkiaCanvas()->restore(); | |
883 } | |
884 if (m_commandIndex < m_commands.count()) { | |
885 m_commands[m_commandIndex] = Clip::kPath; | |
886 m_clips[m_commandIndex] = skClipPath; | |
887 } else { | |
888 m_commands.push(Clip::kPath); | |
889 m_clips.push_back(skClipPath); | |
890 } | |
831 ++m_commandIndex; | 891 ++m_commandIndex; |
832 m_clips.push_back(skClipPath); | 892 return true; |
833 return false; | |
834 } | 893 } |
835 | 894 |
836 bool SetClipStroke(const CFX_PathData* pPathData, | 895 bool SetClipStroke(const CFX_PathData* pPathData, |
837 const CFX_Matrix* pMatrix, | 896 const CFX_Matrix* pMatrix, |
838 const CFX_GraphStateData* pGraphState, | 897 const CFX_GraphStateData* pGraphState) { |
839 CFX_SkiaDeviceDriver* pDriver) { | |
840 if (m_debugDisable) | 898 if (m_debugDisable) |
841 return false; | 899 return false; |
900 Dump(__func__); | |
842 SkPath skPath = BuildPath(pPathData); | 901 SkPath skPath = BuildPath(pPathData); |
843 SkMatrix skMatrix = ToSkMatrix(*pMatrix); | 902 SkMatrix skMatrix = ToSkMatrix(*pMatrix); |
844 SkPaint skPaint; | 903 SkPaint skPaint; |
845 pDriver->PaintStroke(&skPaint, pGraphState, skMatrix); | 904 m_pDriver->PaintStroke(&skPaint, pGraphState, skMatrix); |
846 SkPath dst_path; | 905 SkPath dst_path; |
847 skPaint.getFillPath(skPath, &dst_path); | 906 skPaint.getFillPath(skPath, &dst_path); |
848 dst_path.transform(skMatrix); | 907 dst_path.transform(skMatrix); |
849 return SetClip(dst_path, pDriver); | 908 return SetClip(dst_path); |
850 } | 909 } |
851 | 910 |
852 bool MatrixOffset(const CFX_Matrix* pMatrix, SkPoint* delta) { | 911 bool MatrixOffset(const CFX_Matrix* pMatrix, SkPoint* delta) { |
853 CFX_Matrix identityMatrix; | 912 CFX_Matrix identityMatrix; |
854 if (!pMatrix) | 913 if (!pMatrix) |
855 pMatrix = &identityMatrix; | 914 pMatrix = &identityMatrix; |
856 delta->set(pMatrix->e - m_drawMatrix.e, pMatrix->f - m_drawMatrix.f); | 915 delta->set(pMatrix->e - m_drawMatrix.e, pMatrix->f - m_drawMatrix.f); |
857 if (!delta->fX && !delta->fY) | 916 if (!delta->fX && !delta->fY) |
858 return true; | 917 return true; |
859 SkMatrix drawMatrix = ToSkMatrix(m_drawMatrix); | 918 SkMatrix drawMatrix = ToSkMatrix(m_drawMatrix); |
860 if (!(drawMatrix.getType() & ~SkMatrix::kTranslate_Mask)) | 919 if (!(drawMatrix.getType() & ~SkMatrix::kTranslate_Mask)) |
861 return true; | 920 return true; |
862 SkMatrix invDrawMatrix; | 921 SkMatrix invDrawMatrix; |
863 if (!drawMatrix.invert(&invDrawMatrix)) | 922 if (!drawMatrix.invert(&invDrawMatrix)) |
864 return false; | 923 return false; |
865 SkMatrix invNewMatrix; | 924 SkMatrix invNewMatrix; |
866 SkMatrix newMatrix = ToSkMatrix(*pMatrix); | 925 SkMatrix newMatrix = ToSkMatrix(*pMatrix); |
867 if (!newMatrix.invert(&invNewMatrix)) | 926 if (!newMatrix.invert(&invNewMatrix)) |
868 return false; | 927 return false; |
869 delta->set(invDrawMatrix.getTranslateX() - invNewMatrix.getTranslateX(), | 928 delta->set(invDrawMatrix.getTranslateX() - invNewMatrix.getTranslateX(), |
870 invDrawMatrix.getTranslateY() - invNewMatrix.getTranslateY()); | 929 invDrawMatrix.getTranslateY() - invNewMatrix.getTranslateY()); |
871 return true; | 930 return true; |
872 } | 931 } |
873 | 932 |
874 void FlushCommands(CFX_SkiaDeviceDriver* pDriver) { | |
875 if (m_commandIndex == m_commands.count()) | |
876 return; | |
877 if (m_commandIndex < m_commands.count()) | |
878 pDriver->SkiaCanvas()->restore(); | |
879 int index = m_commands.count() - 1; | |
880 if (m_commandIndex == index && m_commands[index] == Clip::kSave) | |
881 return; | |
882 for (; index > m_commandIndex; --index) { | |
883 if (m_commands[index] == Clip::kSave) | |
884 pDriver->SkiaCanvas()->restore(); | |
885 } | |
886 | |
887 if (m_commandIndex > 0) | |
888 pDriver->SkiaCanvas()->save(); | |
889 while (index > 0 && m_commands[index] != Clip::kSave) | |
890 --index; | |
891 while (++index < m_commandIndex) { | |
892 SkASSERT(m_commands[index] == Clip::kPath); | |
893 pDriver->SkiaCanvas()->clipPath(m_clips[index], SkCanvas::kIntersect_Op, | |
894 true); | |
895 } | |
896 m_commands.setCount(m_commandIndex); | |
897 m_clips.resize_back(m_commandIndex); | |
898 } | |
899 | |
900 // returns true if caller should apply command to skia canvas | 933 // returns true if caller should apply command to skia canvas |
901 bool ClipSave(CFX_SkiaDeviceDriver* pDriver) { | 934 bool ClipSave() { |
902 if (m_debugDisable) | 935 if (m_debugDisable) |
903 return false; | 936 return false; |
937 Dump(__func__); | |
904 int count = m_commands.count(); | 938 int count = m_commands.count(); |
905 if (m_commandIndex < count) { | 939 if (m_commandIndex < count - 1) { |
906 if (m_commands[m_commandIndex] == Clip::kSave) { | 940 if (Clip::kSave == m_commands[m_commandIndex + 1]) { |
907 ++m_commandIndex; | 941 ++m_commandIndex; |
908 return true; | 942 return true; |
909 } | 943 } |
910 FlushCommands(pDriver); | 944 Flush(); |
945 AdjustClip(m_commandIndex); | |
946 m_commands[++m_commandIndex] = Clip::kSave; | |
947 m_clips[m_commandIndex] = m_skEmptyPath; | |
948 } else { | |
949 AdjustClip(m_commandIndex); | |
950 m_commands.push(Clip::kSave); | |
951 m_clips.push_back(m_skEmptyPath); | |
952 ++m_commandIndex; | |
911 } | 953 } |
912 Flush(pDriver); | 954 return true; |
913 m_commands.push(Clip::kSave); | |
914 ++m_commandIndex; | |
915 m_clips.push_back(m_skEmptyPath); | |
916 return false; | |
917 } | 955 } |
918 | 956 |
919 bool ClipRestore(CFX_SkiaDeviceDriver* pDriver) { | 957 bool ClipRestore() { |
920 if (m_debugDisable) | 958 if (m_debugDisable) |
921 return false; | 959 return false; |
922 while (m_commandIndex > 0) { | 960 Dump(__func__); |
923 if (m_commands[--m_commandIndex] == Clip::kSave) | 961 while (Clip::kSave != m_commands[--m_commandIndex]) { |
924 return true; | 962 SkASSERT(m_commandIndex > 0); |
925 } | 963 } |
926 Flush(pDriver); | 964 return true; |
927 return false; | |
928 } | 965 } |
929 | 966 |
930 bool DrawChanged(const CFX_Matrix* pMatrix, | 967 bool DrawChanged(const CFX_Matrix* pMatrix, |
931 const CFX_GraphStateData* pState, | 968 const CFX_GraphStateData* pState, |
932 uint32_t fill_color, | 969 uint32_t fill_color, |
933 uint32_t stroke_color, | 970 uint32_t stroke_color, |
934 int fill_mode, | 971 int fill_mode, |
935 int blend_type, | 972 int blend_type, |
936 bool group_knockout) { | 973 bool group_knockout) const { |
937 return MatrixChanged(pMatrix, m_drawMatrix) || | 974 return MatrixChanged(pMatrix, m_drawMatrix) || |
938 StateChanged(pState, m_drawState) || fill_color != m_fillColor || | 975 StateChanged(pState, m_drawState) || fill_color != m_fillColor || |
939 stroke_color != m_strokeColor || | 976 stroke_color != m_strokeColor || |
940 ((fill_mode & 3) == FXFILL_ALTERNATE) != | 977 ((fill_mode & 3) == FXFILL_ALTERNATE) != |
941 (m_skPath.getFillType() == SkPath::kEvenOdd_FillType) || | 978 (m_skPath.getFillType() == SkPath::kEvenOdd_FillType) || |
942 blend_type != m_blendType || group_knockout != m_groupKnockout; | 979 blend_type != m_blendType || group_knockout != m_groupKnockout; |
943 } | 980 } |
944 | 981 |
945 bool FontChanged(CFX_Font* pFont, | 982 bool FontChanged(CFX_Font* pFont, |
946 const CFX_Matrix* pMatrix, | 983 const CFX_Matrix* pMatrix, |
947 FX_FLOAT font_size, | 984 FX_FLOAT font_size, |
948 uint32_t color) { | 985 uint32_t color) const { |
949 return pFont != m_pFont || MatrixChanged(pMatrix, m_drawMatrix) || | 986 return pFont != m_pFont || MatrixChanged(pMatrix, m_drawMatrix) || |
950 font_size != m_fontSize || color != m_fillColor; | 987 font_size != m_fontSize || color != m_fillColor; |
951 } | 988 } |
952 | 989 |
953 bool MatrixChanged(const CFX_Matrix* pMatrix, const CFX_Matrix& refMatrix) { | 990 bool MatrixChanged(const CFX_Matrix* pMatrix, |
991 const CFX_Matrix& refMatrix) const { | |
954 CFX_Matrix identityMatrix; | 992 CFX_Matrix identityMatrix; |
955 if (!pMatrix) | 993 if (!pMatrix) |
956 pMatrix = &identityMatrix; | 994 pMatrix = &identityMatrix; |
957 return pMatrix->a != refMatrix.a || pMatrix->b != refMatrix.b || | 995 return pMatrix->a != refMatrix.a || pMatrix->b != refMatrix.b || |
958 pMatrix->c != refMatrix.c || pMatrix->d != refMatrix.d; | 996 pMatrix->c != refMatrix.c || pMatrix->d != refMatrix.d; |
959 } | 997 } |
960 | 998 |
961 bool StateChanged(const CFX_GraphStateData* pState, | 999 bool StateChanged(const CFX_GraphStateData* pState, |
962 const CFX_GraphStateData& refState) { | 1000 const CFX_GraphStateData& refState) const { |
963 CFX_GraphStateData identityState; | 1001 CFX_GraphStateData identityState; |
964 if (!pState) | 1002 if (!pState) |
965 pState = &identityState; | 1003 pState = &identityState; |
966 return pState->m_LineWidth != refState.m_LineWidth || | 1004 return pState->m_LineWidth != refState.m_LineWidth || |
967 pState->m_LineCap != refState.m_LineCap || | 1005 pState->m_LineCap != refState.m_LineCap || |
968 pState->m_LineJoin != refState.m_LineJoin || | 1006 pState->m_LineJoin != refState.m_LineJoin || |
969 pState->m_MiterLimit != refState.m_MiterLimit || | 1007 pState->m_MiterLimit != refState.m_MiterLimit || |
970 DashChanged(pState, refState); | 1008 DashChanged(pState, refState); |
971 } | 1009 } |
972 | 1010 |
973 bool DashChanged(const CFX_GraphStateData* pState, | 1011 bool DashChanged(const CFX_GraphStateData* pState, |
974 const CFX_GraphStateData& refState) { | 1012 const CFX_GraphStateData& refState) const { |
975 bool dashArray = pState && pState->m_DashArray; | 1013 bool dashArray = pState && pState->m_DashArray; |
976 if (!dashArray && !refState.m_DashArray) | 1014 if (!dashArray && !refState.m_DashArray) |
977 return false; | 1015 return false; |
978 if (!dashArray || !refState.m_DashArray) | 1016 if (!dashArray || !refState.m_DashArray) |
979 return true; | 1017 return true; |
980 if (pState->m_DashPhase != refState.m_DashPhase || | 1018 if (pState->m_DashPhase != refState.m_DashPhase || |
981 pState->m_DashCount != refState.m_DashCount) { | 1019 pState->m_DashCount != refState.m_DashCount) { |
982 return true; | 1020 return true; |
983 } | 1021 } |
984 for (int index = 0; index < pState->m_DashCount; ++index) { | 1022 for (int index = 0; index < pState->m_DashCount; ++index) { |
985 if (pState->m_DashArray[index] != refState.m_DashArray[index]) | 1023 if (pState->m_DashArray[index] != refState.m_DashArray[index]) |
986 return false; | 1024 return true; |
987 } | 1025 } |
988 return true; | 1026 return true; |
989 } | 1027 } |
990 | 1028 |
991 void Flush(CFX_SkiaDeviceDriver* pDriver) { | 1029 void AdjustClip(int limit) { |
992 if (m_drawPath) | 1030 while (m_clipIndex > limit) { |
993 FlushPath(pDriver); | 1031 do { |
994 if (m_drawText) | 1032 --m_clipIndex; |
995 FlushText(pDriver); | 1033 SkASSERT(m_clipIndex >= 0); |
1034 } while (m_commands[m_clipIndex] != Clip::kSave); | |
1035 m_pDriver->SkiaCanvas()->restore(); | |
1036 } | |
1037 while (m_clipIndex < limit) { | |
1038 if (Clip::kSave == m_commands[m_clipIndex]) { | |
1039 m_pDriver->SkiaCanvas()->save(); | |
1040 } else { | |
1041 SkASSERT(Clip::kPath == m_commands[m_clipIndex]); | |
1042 m_pDriver->SkiaCanvas()->clipPath(m_clips[m_clipIndex], | |
1043 SkCanvas::kIntersect_Op, true); | |
1044 } | |
1045 ++m_clipIndex; | |
1046 } | |
996 } | 1047 } |
997 | 1048 |
998 void Dump(const CFX_SkiaDeviceDriver* pDriver) const { | 1049 void Flush() { |
1050 if (m_debugDisable) | |
1051 return; | |
1052 Dump(__func__); | |
1053 if (Accumulator::kPath == m_type || Accumulator::kText == m_type) { | |
1054 AdjustClip(SkTMin(m_drawIndex, m_commands.count())); | |
1055 Accumulator::kPath == m_type ? FlushPath() : FlushText(); | |
1056 } | |
1057 } | |
1058 | |
1059 void FlushForDraw() { | |
1060 if (m_debugDisable) | |
1061 return; | |
1062 Flush(); // draw any pending text or path | |
1063 AdjustClip(m_commandIndex); // set up clip stack with any pending state | |
1064 } | |
1065 | |
999 #if SHOW_SKIA_PATH | 1066 #if SHOW_SKIA_PATH |
1000 SkDebugf("\n\nSkia Save Count %d:\n", pDriver->m_pCanvas->getSaveCount()); | 1067 void DumpPrefix(int index) const { |
1001 pDriver->m_pCanvas->getClipStack()->dump(); | 1068 if (index != m_commandIndex && index != m_drawIndex && |
1002 SkDebugf("Cache:\n"); | 1069 index != m_clipIndex) { |
1070 printf(" "); | |
1071 return; | |
1072 } | |
1073 printf("%c%c%c> ", index == m_commandIndex ? 'x' : '-', | |
1074 index == m_drawIndex ? 'd' : '-', index == m_clipIndex ? 'c' : '-'); | |
1075 } | |
1076 | |
1077 void DumpEndPrefix() const { | |
1078 int index = m_commands.count(); | |
1079 if (index != m_commandIndex && index > m_drawIndex && index != m_clipIndex) | |
1080 return; | |
1081 printf("%c%c%c>\n", index == m_commandIndex ? 'x' : '-', | |
1082 index <= m_drawIndex ? 'd' : '-', index == m_clipIndex ? 'c' : '-'); | |
1083 } | |
1084 #endif // SHOW_SKIA_PATH | |
1085 | |
1086 void Dump(const char* where) const { | |
1087 #if SHOW_SKIA_PATH | |
1088 printf("\n%s\nSkia Save Count %d:\n", where, | |
1089 m_pDriver->m_pCanvas->getSaveCount()); | |
1090 m_pDriver->m_pCanvas->getClipStack()->dump(); | |
1091 printf("Cache:\n"); | |
1003 for (int index = 0; index < m_commands.count(); ++index) { | 1092 for (int index = 0; index < m_commands.count(); ++index) { |
1004 SkDebugf("%s ", m_commandIndex == index ? "-->" : " "); | 1093 DumpPrefix(index); |
1005 switch (m_commands[index]) { | 1094 switch (m_commands[index]) { |
1006 case Clip::kSave: | 1095 case Clip::kSave: |
1007 SkDebugf("Save\n"); | 1096 printf("Save %d\n", ++m_debugSaveCounter); |
1008 break; | 1097 break; |
1009 case Clip::kPath: | 1098 case Clip::kPath: |
1010 m_clips[index].dump(); | 1099 m_clips[index].dump(); |
1011 break; | 1100 break; |
1012 default: | 1101 default: |
1013 SkDebugf("unknown\n"); | 1102 printf("unknown\n"); |
1014 } | 1103 } |
1015 } | 1104 } |
1016 if (m_commandIndex == m_commands.count()) | 1105 DumpEndPrefix(); |
1017 SkDebugf("-->\n"); | |
1018 #endif // SHOW_SKIA_PATH | 1106 #endif // SHOW_SKIA_PATH |
1107 #ifdef SK_DEBUG | |
1108 int skCanvasSaveCount = m_pDriver->m_pCanvas->getSaveCount(); | |
1109 int cacheSaveCount = 1; | |
1110 SkASSERT(m_clipIndex <= m_commands.count()); | |
1111 for (int index = 0; index < m_clipIndex; ++index) | |
1112 cacheSaveCount += Clip::kSave == m_commands[index]; | |
1113 SkASSERT(skCanvasSaveCount == cacheSaveCount); | |
1114 #endif | |
1019 } | 1115 } |
1020 | 1116 |
1021 private: | 1117 private: |
1022 SkTArray<SkPath> m_clips; // stack of clips that may be reused | 1118 SkTArray<SkPath> m_clips; // stack of clips that may be reused |
1023 SkTDArray<Clip> m_commands; // stack of clip-related commands | 1119 SkTDArray<Clip> m_commands; // stack of clip-related commands |
1024 SkTDArray<SkPoint> m_positions; // accumulator for text positions | 1120 SkTDArray<SkPoint> m_positions; // accumulator for text positions |
1025 SkTDArray<uint16_t> m_glyphs; // accumulator for text glyphs | 1121 SkTDArray<uint16_t> m_glyphs; // accumulator for text glyphs |
1026 SkPath m_skPath; // accumulator for path contours | 1122 SkPath m_skPath; // accumulator for path contours |
1027 SkPath m_skEmptyPath; // used as placehold in the clips array | 1123 SkPath m_skEmptyPath; // used as placehold in the clips array |
1028 CFX_Matrix m_drawMatrix; | 1124 CFX_Matrix m_drawMatrix; |
1029 CFX_GraphStateData m_clipState; | 1125 CFX_GraphStateData m_clipState; |
1030 CFX_GraphStateData m_drawState; | 1126 CFX_GraphStateData m_drawState; |
1031 CFX_Matrix m_clipMatrix; | 1127 CFX_Matrix m_clipMatrix; |
1128 CFX_SkiaDeviceDriver* m_pDriver; | |
1032 CFX_Font* m_pFont; | 1129 CFX_Font* m_pFont; |
1033 FX_FLOAT m_fontSize; | 1130 FX_FLOAT m_fontSize; |
1034 uint32_t m_fillColor; | 1131 uint32_t m_fillColor; |
1035 uint32_t m_strokeColor; | 1132 uint32_t m_strokeColor; |
1036 int m_blendType; | 1133 int m_blendType; |
1037 int m_commandIndex; // active position in clip command stack | 1134 int m_commandIndex; // active position in clip command stack |
1038 bool m_drawText; | 1135 int m_drawIndex; // position of the pending path or text draw |
1039 bool m_drawPath; | 1136 int m_clipIndex; // position reflecting depth of canvas clip stacck |
1137 Accumulator m_type; // type of pending draw | |
1138 bool m_fillFullCover; | |
1040 bool m_fillPath; | 1139 bool m_fillPath; |
1041 bool m_groupKnockout; | 1140 bool m_groupKnockout; |
1042 bool m_debugDisable; // turn off cache for debugging | 1141 bool m_debugDisable; // turn off cache for debugging |
1142 #if SHOW_SKIA_PATH | |
1143 mutable int m_debugSaveCounter; | |
1144 #endif | |
1043 }; | 1145 }; |
1044 #endif // _SKIA_SUPPORT_ | |
1045 | 1146 |
1046 // convert a stroking path to scanlines | 1147 // convert a stroking path to scanlines |
1047 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, | 1148 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, |
1048 const CFX_GraphStateData* pGraphState, | 1149 const CFX_GraphStateData* pGraphState, |
1049 const SkMatrix& matrix) { | 1150 const SkMatrix& matrix) { |
1050 SkPaint::Cap cap; | 1151 SkPaint::Cap cap; |
1051 switch (pGraphState->m_LineCap) { | 1152 switch (pGraphState->m_LineCap) { |
1052 case CFX_GraphStateData::LineCapRound: | 1153 case CFX_GraphStateData::LineCapRound: |
1053 cap = SkPaint::kRound_Cap; | 1154 cap = SkPaint::kRound_Cap; |
1054 break; | 1155 break; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 spaint->setStrokeJoin(join); | 1209 spaint->setStrokeJoin(join); |
1109 } | 1210 } |
1110 | 1211 |
1111 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | 1212 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
1112 bool bRgbByteOrder, | 1213 bool bRgbByteOrder, |
1113 CFX_DIBitmap* pOriDevice, | 1214 CFX_DIBitmap* pOriDevice, |
1114 bool bGroupKnockout) | 1215 bool bGroupKnockout) |
1115 : m_pBitmap(pBitmap), | 1216 : m_pBitmap(pBitmap), |
1116 m_pOriDevice(pOriDevice), | 1217 m_pOriDevice(pOriDevice), |
1117 m_pRecorder(nullptr), | 1218 m_pRecorder(nullptr), |
1118 #ifdef _SKIA_SUPPORT_ | 1219 m_pCache(new SkiaState(this)), |
1119 m_pCache(new SkiaState), | |
1120 #endif | |
1121 #ifdef _SKIA_SUPPORT_PATHS_ | 1220 #ifdef _SKIA_SUPPORT_PATHS_ |
1122 m_pClipRgn(nullptr), | 1221 m_pClipRgn(nullptr), |
1123 m_FillFlags(0), | 1222 m_FillFlags(0), |
1124 m_bRgbByteOrder(bRgbByteOrder), | 1223 m_bRgbByteOrder(bRgbByteOrder), |
1125 #endif // _SKIA_SUPPORT_PATHS_ | 1224 #endif // _SKIA_SUPPORT_PATHS_ |
1126 m_bGroupKnockout(bGroupKnockout) { | 1225 m_bGroupKnockout(bGroupKnockout) { |
1127 SkBitmap skBitmap; | 1226 SkBitmap skBitmap; |
1128 SkASSERT(pBitmap->GetBPP() == 8 || pBitmap->GetBPP() == 32); | 1227 SkASSERT(pBitmap->GetBPP() == 8 || pBitmap->GetBPP() == 32); |
1129 SkImageInfo imageInfo = SkImageInfo::Make( | 1228 SkImageInfo imageInfo = SkImageInfo::Make( |
1130 pBitmap->GetWidth(), pBitmap->GetHeight(), | 1229 pBitmap->GetWidth(), pBitmap->GetHeight(), |
1131 pBitmap->GetBPP() == 8 ? kAlpha_8_SkColorType : kN32_SkColorType, | 1230 pBitmap->GetBPP() == 8 ? kAlpha_8_SkColorType : kN32_SkColorType, |
1132 kOpaque_SkAlphaType); | 1231 kOpaque_SkAlphaType); |
1133 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), | 1232 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), |
1134 nullptr, // FIXME(caryclark) set color table | 1233 nullptr, // FIXME(caryclark) set color table |
1135 nullptr, nullptr); | 1234 nullptr, nullptr); |
1136 m_pCanvas = new SkCanvas(skBitmap); | 1235 m_pCanvas = new SkCanvas(skBitmap); |
1137 } | 1236 } |
1138 | 1237 |
1139 #ifdef _SKIA_SUPPORT_ | 1238 #ifdef _SKIA_SUPPORT_ |
1140 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) | 1239 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) |
1141 : m_pBitmap(nullptr), | 1240 : m_pBitmap(nullptr), |
1142 m_pOriDevice(nullptr), | 1241 m_pOriDevice(nullptr), |
1143 m_pRecorder(new SkPictureRecorder), | 1242 m_pRecorder(new SkPictureRecorder), |
1144 m_pCache(new SkiaState), | 1243 m_pCache(new SkiaState(this)), |
1145 m_bGroupKnockout(false) { | 1244 m_bGroupKnockout(false) { |
1146 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); | 1245 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); |
1147 m_pCanvas = m_pRecorder->getRecordingCanvas(); | 1246 m_pCanvas = m_pRecorder->getRecordingCanvas(); |
1148 } | 1247 } |
1149 | 1248 |
1150 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) | 1249 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) |
1151 : m_pBitmap(nullptr), | 1250 : m_pBitmap(nullptr), |
1152 m_pOriDevice(nullptr), | 1251 m_pOriDevice(nullptr), |
1153 m_pRecorder(recorder), | 1252 m_pRecorder(recorder), |
1154 m_pCache(new SkiaState), | 1253 m_pCache(new SkiaState(this)), |
1155 m_bGroupKnockout(false) { | 1254 m_bGroupKnockout(false) { |
1156 m_pCanvas = m_pRecorder->getRecordingCanvas(); | 1255 m_pCanvas = m_pRecorder->getRecordingCanvas(); |
1157 } | 1256 } |
1158 #endif // _SKIA_SUPPORT_ | 1257 #endif // _SKIA_SUPPORT_ |
1159 | 1258 |
1160 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { | 1259 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { |
1161 Flush(); | 1260 Flush(); |
1162 if (!m_pRecorder) | 1261 if (!m_pRecorder) |
1163 delete m_pCanvas; | 1262 delete m_pCanvas; |
1164 } | 1263 } |
1165 | 1264 |
1166 void CFX_SkiaDeviceDriver::Flush() { | 1265 void CFX_SkiaDeviceDriver::Flush() { |
1167 #ifdef _SKIA_SUPPORT_ | 1266 m_pCache->Flush(); |
1168 m_pCache->Flush(this); | |
1169 m_pCache->FlushCommands(this); | |
1170 #endif | |
1171 } | 1267 } |
1172 | 1268 |
1173 bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, | 1269 bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, |
1174 const FXTEXT_CHARPOS* pCharPos, | 1270 const FXTEXT_CHARPOS* pCharPos, |
1175 CFX_Font* pFont, | 1271 CFX_Font* pFont, |
1176 const CFX_Matrix* pObject2Device, | 1272 const CFX_Matrix* pObject2Device, |
1177 FX_FLOAT font_size, | 1273 FX_FLOAT font_size, |
1178 uint32_t color) { | 1274 uint32_t color) { |
1179 #ifdef _SKIA_SUPPORT_ | |
1180 if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size, | 1275 if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size, |
1181 color, this)) { | 1276 color)) { |
1182 return true; | 1277 return true; |
1183 } | 1278 } |
1184 #endif | |
1185 sk_sp<SkTypeface> typeface(SkSafeRef(pFont->GetDeviceCache())); | 1279 sk_sp<SkTypeface> typeface(SkSafeRef(pFont->GetDeviceCache())); |
1186 SkPaint paint; | 1280 SkPaint paint; |
1187 paint.setAntiAlias(true); | 1281 paint.setAntiAlias(true); |
1188 paint.setColor(color); | 1282 paint.setColor(color); |
1189 paint.setTypeface(typeface); | 1283 paint.setTypeface(typeface); |
1190 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 1284 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
1191 paint.setHinting(SkPaint::kNo_Hinting); | 1285 paint.setHinting(SkPaint::kNo_Hinting); |
1192 paint.setTextSize(SkTAbs(font_size)); | 1286 paint.setTextSize(SkTAbs(font_size)); |
1193 paint.setSubpixelText(true); | 1287 paint.setSubpixelText(true); |
1194 m_pCanvas->save(); | 1288 m_pCanvas->save(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 flags |= FXRC_CMYK_OUTPUT; | 1356 flags |= FXRC_CMYK_OUTPUT; |
1263 } | 1357 } |
1264 return flags; | 1358 return flags; |
1265 } | 1359 } |
1266 #endif // _SKIA_SUPPORT_PATHS_ | 1360 #endif // _SKIA_SUPPORT_PATHS_ |
1267 } | 1361 } |
1268 return 0; | 1362 return 0; |
1269 } | 1363 } |
1270 | 1364 |
1271 void CFX_SkiaDeviceDriver::SaveState() { | 1365 void CFX_SkiaDeviceDriver::SaveState() { |
1272 #ifdef _SKIA_SUPPORT_ | 1366 if (!m_pCache->ClipSave()) |
1273 if (!m_pCache->ClipSave(this)) | |
1274 #endif | |
1275 m_pCanvas->save(); | 1367 m_pCanvas->save(); |
1276 | 1368 |
1277 #ifdef _SKIA_SUPPORT_PATHS_ | 1369 #ifdef _SKIA_SUPPORT_PATHS_ |
1278 std::unique_ptr<CFX_ClipRgn> pClip; | 1370 std::unique_ptr<CFX_ClipRgn> pClip; |
1279 if (m_pClipRgn) | 1371 if (m_pClipRgn) |
1280 pClip = pdfium::MakeUnique<CFX_ClipRgn>(*m_pClipRgn); | 1372 pClip = pdfium::MakeUnique<CFX_ClipRgn>(*m_pClipRgn); |
1281 m_StateStack.push_back(std::move(pClip)); | 1373 m_StateStack.push_back(std::move(pClip)); |
1282 #endif // _SKIA_SUPPORT_PATHS_ | 1374 #endif // _SKIA_SUPPORT_PATHS_ |
1283 } | 1375 } |
1284 | 1376 |
1285 void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) { | 1377 void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) { |
1286 #ifdef _SKIA_SUPPORT_ | 1378 if (!m_pCache->ClipRestore()) |
1287 if (!m_pCache->ClipRestore(this)) | |
1288 #endif | |
1289 m_pCanvas->restore(); | 1379 m_pCanvas->restore(); |
1290 if (bKeepSaved | 1380 if (bKeepSaved && !m_pCache->ClipSave()) |
1291 #ifdef _SKIA_SUPPORT_ | |
1292 && !m_pCache->ClipSave(this) | |
1293 #endif | |
1294 ) { | |
1295 m_pCanvas->save(); | 1381 m_pCanvas->save(); |
1296 } | |
1297 #ifdef _SKIA_SUPPORT_PATHS_ | 1382 #ifdef _SKIA_SUPPORT_PATHS_ |
1298 m_pClipRgn.reset(); | 1383 m_pClipRgn.reset(); |
1299 | 1384 |
1300 if (m_StateStack.empty()) | 1385 if (m_StateStack.empty()) |
1301 return; | 1386 return; |
1302 | 1387 |
1303 if (bKeepSaved) { | 1388 if (bKeepSaved) { |
1304 if (m_StateStack.back()) | 1389 if (m_StateStack.back()) |
1305 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(*m_StateStack.back()); | 1390 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(*m_StateStack.back()); |
1306 } else { | 1391 } else { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1339 } | 1424 } |
1340 #endif // _SKIA_SUPPORT_PATHS_ | 1425 #endif // _SKIA_SUPPORT_PATHS_ |
1341 | 1426 |
1342 bool CFX_SkiaDeviceDriver::SetClip_PathFill( | 1427 bool CFX_SkiaDeviceDriver::SetClip_PathFill( |
1343 const CFX_PathData* pPathData, // path info | 1428 const CFX_PathData* pPathData, // path info |
1344 const CFX_Matrix* pObject2Device, // flips object's y-axis | 1429 const CFX_Matrix* pObject2Device, // flips object's y-axis |
1345 int fill_mode // fill mode, WINDING or ALTERNATE | 1430 int fill_mode // fill mode, WINDING or ALTERNATE |
1346 ) { | 1431 ) { |
1347 CFX_Matrix identity; | 1432 CFX_Matrix identity; |
1348 const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity; | 1433 const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity; |
1349 #ifdef _SKIA_SUPPORT_ | 1434 bool cached = m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode); |
1350 if (m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode, this)) | |
1351 return true; | |
1352 #endif // _SKIA_SUPPORT_ | |
1353 | 1435 |
1354 #ifdef _SKIA_SUPPORT_PATHS_ | 1436 #ifdef _SKIA_SUPPORT_PATHS_ |
1355 m_FillFlags = fill_mode; | 1437 m_FillFlags = fill_mode; |
1356 if (!m_pClipRgn) { | 1438 if (!m_pClipRgn) { |
1357 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( | 1439 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( |
1358 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 1440 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
1359 } | 1441 } |
1360 #endif // _SKIA_SUPPORT_PATHS_ | 1442 #endif // _SKIA_SUPPORT_PATHS_ |
1361 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { | 1443 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { |
1362 CFX_FloatRect rectf; | 1444 CFX_FloatRect rectf; |
1363 if (pPathData->IsRect(deviceMatrix, &rectf)) { | 1445 if (pPathData->IsRect(deviceMatrix, &rectf)) { |
1364 rectf.Intersect( | 1446 rectf.Intersect( |
1365 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), | 1447 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), |
1366 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); | 1448 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
1367 // note that PDF's y-axis goes up; Skia's y-axis goes down | 1449 // note that PDF's y-axis goes up; Skia's y-axis goes down |
1368 SkRect skClipRect = | 1450 if (!cached) { |
1369 SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top); | 1451 SkRect skClipRect = |
1370 DebugDrawSkiaClipRect(m_pCanvas, skClipRect); | 1452 SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top); |
1371 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); | 1453 DebugDrawSkiaClipRect(m_pCanvas, skClipRect); |
1454 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); | |
1455 } | |
1372 | 1456 |
1373 #ifdef _SKIA_SUPPORT_PATHS_ | 1457 #ifdef _SKIA_SUPPORT_PATHS_ |
1374 FX_RECT rect = rectf.GetOuterRect(); | 1458 FX_RECT rect = rectf.GetOuterRect(); |
1375 m_pClipRgn->IntersectRect(rect); | 1459 m_pClipRgn->IntersectRect(rect); |
1376 #endif // _SKIA_SUPPORT_PATHS_ | 1460 #endif // _SKIA_SUPPORT_PATHS_ |
1461 DebugShowCanvasClip(m_pCanvas); | |
1377 return true; | 1462 return true; |
1378 } | 1463 } |
1379 } | 1464 } |
1380 SkPath skClipPath = BuildPath(pPathData); | 1465 SkPath skClipPath = BuildPath(pPathData); |
1381 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE | 1466 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE |
1382 ? SkPath::kEvenOdd_FillType | 1467 ? SkPath::kEvenOdd_FillType |
1383 : SkPath::kWinding_FillType); | 1468 : SkPath::kWinding_FillType); |
1384 SkMatrix skMatrix = ToSkMatrix(*deviceMatrix); | 1469 SkMatrix skMatrix = ToSkMatrix(*deviceMatrix); |
1385 skClipPath.transform(skMatrix); | 1470 skClipPath.transform(skMatrix); |
1386 DebugShowSkiaPath(skClipPath); | 1471 DebugShowSkiaPath(skClipPath); |
1387 DebugDrawSkiaClipPath(m_pCanvas, skClipPath); | 1472 if (!cached) { |
1388 m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true); | 1473 DebugDrawSkiaClipPath(m_pCanvas, skClipPath); |
1474 m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true); | |
1475 } | |
1389 #ifdef _SKIA_SUPPORT_PATHS_ | 1476 #ifdef _SKIA_SUPPORT_PATHS_ |
1390 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), | 1477 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), |
1391 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 1478 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
1392 SetClipMask(clipBox, skClipPath); | 1479 SetClipMask(clipBox, skClipPath); |
1393 #endif // _SKIA_SUPPORT_PATHS_ | 1480 #endif // _SKIA_SUPPORT_PATHS_ |
1481 DebugShowCanvasClip(m_pCanvas); | |
1394 return true; | 1482 return true; |
1395 } | 1483 } |
1396 | 1484 |
1397 bool CFX_SkiaDeviceDriver::SetClip_PathStroke( | 1485 bool CFX_SkiaDeviceDriver::SetClip_PathStroke( |
1398 const CFX_PathData* pPathData, // path info | 1486 const CFX_PathData* pPathData, // path info |
1399 const CFX_Matrix* pObject2Device, // optional transformation | 1487 const CFX_Matrix* pObject2Device, // optional transformation |
1400 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes | 1488 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes |
1401 ) { | 1489 ) { |
1402 #ifdef _SKIA_SUPPORT_ | 1490 bool cached = m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState); |
1403 if (m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState, this)) | |
1404 return true; | |
1405 #endif // _SKIA_SUPPORT_ | |
1406 | 1491 |
1407 #ifdef _SKIA_SUPPORT_PATHS_ | 1492 #ifdef _SKIA_SUPPORT_PATHS_ |
1408 if (!m_pClipRgn) { | 1493 if (!m_pClipRgn) { |
1409 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( | 1494 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( |
1410 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 1495 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
1411 } | 1496 } |
1412 #endif // _SKIA_SUPPORT_PATHS_ | 1497 #endif // _SKIA_SUPPORT_PATHS_ |
1413 // build path data | 1498 // build path data |
1414 SkPath skPath = BuildPath(pPathData); | 1499 SkPath skPath = BuildPath(pPathData); |
1415 SkMatrix skMatrix = ToSkMatrix(*pObject2Device); | 1500 SkMatrix skMatrix = ToSkMatrix(*pObject2Device); |
1416 SkPaint skPaint; | 1501 SkPaint skPaint; |
1417 PaintStroke(&skPaint, pGraphState, skMatrix); | 1502 PaintStroke(&skPaint, pGraphState, skMatrix); |
1418 SkPath dst_path; | 1503 SkPath dst_path; |
1419 skPaint.getFillPath(skPath, &dst_path); | 1504 skPaint.getFillPath(skPath, &dst_path); |
1420 dst_path.transform(skMatrix); | 1505 dst_path.transform(skMatrix); |
1421 DebugDrawSkiaClipPath(m_pCanvas, dst_path); | 1506 if (!cached) { |
1422 #ifdef _SKIA_SUPPORT_ | 1507 DebugDrawSkiaClipPath(m_pCanvas, dst_path); |
1423 m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true); | 1508 m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true); |
1424 #endif // _SKIA_SUPPORT_ | 1509 } |
1425 | |
1426 #ifdef _SKIA_SUPPORT_PATHS_ | 1510 #ifdef _SKIA_SUPPORT_PATHS_ |
1427 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), | 1511 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), |
1428 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 1512 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
1429 SetClipMask(clipBox, dst_path); | 1513 SetClipMask(clipBox, dst_path); |
1430 #endif // _SKIA_SUPPORT_PATHS_ | 1514 #endif // _SKIA_SUPPORT_PATHS_ |
1515 DebugShowCanvasClip(m_pCanvas); | |
1431 return true; | 1516 return true; |
1432 } | 1517 } |
1433 | 1518 |
1434 bool CFX_SkiaDeviceDriver::DrawPath( | 1519 bool CFX_SkiaDeviceDriver::DrawPath( |
1435 const CFX_PathData* pPathData, // path info | 1520 const CFX_PathData* pPathData, // path info |
1436 const CFX_Matrix* pObject2Device, // optional transformation | 1521 const CFX_Matrix* pObject2Device, // optional transformation |
1437 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes | 1522 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes |
1438 uint32_t fill_color, // fill color | 1523 uint32_t fill_color, // fill color |
1439 uint32_t stroke_color, // stroke color | 1524 uint32_t stroke_color, // stroke color |
1440 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled | 1525 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled |
1441 int blend_type) { | 1526 int blend_type) { |
1442 if (fill_mode & FX_ZEROAREA_FILL) | 1527 if (fill_mode & FX_ZEROAREA_FILL) |
1443 return true; | 1528 return true; |
1444 #ifdef _SKIA_SUPPORT_ | |
1445 if (m_pCache->DrawPath(pPathData, pObject2Device, pGraphState, fill_color, | 1529 if (m_pCache->DrawPath(pPathData, pObject2Device, pGraphState, fill_color, |
1446 stroke_color, fill_mode, blend_type, this)) { | 1530 stroke_color, fill_mode, blend_type)) { |
1447 return true; | 1531 return true; |
1448 } | 1532 } |
1449 #endif | |
1450 SkIRect rect; | |
1451 rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), | |
1452 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | |
1453 SkMatrix skMatrix; | 1533 SkMatrix skMatrix; |
1454 if (pObject2Device) | 1534 if (pObject2Device) |
1455 skMatrix = ToSkMatrix(*pObject2Device); | 1535 skMatrix = ToSkMatrix(*pObject2Device); |
1456 else | 1536 else |
1457 skMatrix.setIdentity(); | 1537 skMatrix.setIdentity(); |
1458 SkPaint skPaint; | 1538 SkPaint skPaint; |
1459 skPaint.setAntiAlias(true); | 1539 skPaint.setAntiAlias(true); |
1460 if (fill_mode & FXFILL_FULLCOVER) | 1540 if (fill_mode & FXFILL_FULLCOVER) |
1461 skPaint.setBlendMode(SkBlendMode::kPlus); | 1541 skPaint.setBlendMode(SkBlendMode::kPlus); |
1462 int stroke_alpha = FXARGB_A(stroke_color); | 1542 int stroke_alpha = FXARGB_A(stroke_color); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 FX_FLOAT x2, | 1586 FX_FLOAT x2, |
1507 FX_FLOAT y2, | 1587 FX_FLOAT y2, |
1508 uint32_t color, | 1588 uint32_t color, |
1509 int blend_type) { | 1589 int blend_type) { |
1510 return false; | 1590 return false; |
1511 } | 1591 } |
1512 | 1592 |
1513 bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, | 1593 bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, |
1514 uint32_t fill_color, | 1594 uint32_t fill_color, |
1515 int blend_type) { | 1595 int blend_type) { |
1596 m_pCache->FlushForDraw(); | |
1516 SkPaint spaint; | 1597 SkPaint spaint; |
1517 spaint.setAntiAlias(true); | 1598 spaint.setAntiAlias(true); |
1518 spaint.setColor(fill_color); | 1599 spaint.setColor(fill_color); |
1519 spaint.setBlendMode(GetSkiaBlendMode(blend_type)); | 1600 spaint.setBlendMode(GetSkiaBlendMode(blend_type)); |
1520 SkRect rect = | 1601 SkRect rect = |
1521 SkRect::MakeLTRB(pRect->left, SkTMin(pRect->top, pRect->bottom), | 1602 SkRect::MakeLTRB(pRect->left, SkTMin(pRect->top, pRect->bottom), |
1522 pRect->right, SkTMax(pRect->bottom, pRect->top)); | 1603 pRect->right, SkTMax(pRect->bottom, pRect->top)); |
1523 DebugShowSkiaDrawRect(m_pCanvas, spaint, rect); | 1604 DebugShowSkiaDrawRect(m_pCanvas, spaint, rect); |
1524 m_pCanvas->drawRect(rect, spaint); | 1605 m_pCanvas->drawRect(rect, spaint); |
1525 return true; | 1606 return true; |
1526 } | 1607 } |
1527 | 1608 |
1528 bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, | 1609 bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, |
1529 const CFX_Matrix* pMatrix, | 1610 const CFX_Matrix* pMatrix, |
1530 const FX_RECT& clip_rect, | 1611 const FX_RECT& clip_rect, |
1531 int alpha, | 1612 int alpha, |
1532 bool bAlphaMode) { | 1613 bool bAlphaMode) { |
1614 m_pCache->FlushForDraw(); | |
1533 ShadingType shadingType = pPattern->GetShadingType(); | 1615 ShadingType shadingType = pPattern->GetShadingType(); |
1534 if (kAxialShading != shadingType && kRadialShading != shadingType && | 1616 if (kAxialShading != shadingType && kRadialShading != shadingType && |
1535 kCoonsPatchMeshShading != shadingType) { | 1617 kCoonsPatchMeshShading != shadingType) { |
1536 // TODO(caryclark) more types | 1618 // TODO(caryclark) more types |
1537 return false; | 1619 return false; |
1538 } | 1620 } |
1539 int csFamily = pPattern->GetCS()->GetFamily(); | 1621 int csFamily = pPattern->GetCS()->GetFamily(); |
1540 if (PDFCS_DEVICERGB != csFamily && PDFCS_DEVICEGRAY != csFamily) | 1622 if (PDFCS_DEVICERGB != csFamily && PDFCS_DEVICEGRAY != csFamily) |
1541 return false; | 1623 return false; |
1542 const std::vector<std::unique_ptr<CPDF_Function>>& pFuncs = | 1624 const std::vector<std::unique_ptr<CPDF_Function>>& pFuncs = |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 return true; | 1799 return true; |
1718 } | 1800 } |
1719 | 1801 |
1720 bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { | 1802 bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { |
1721 if (!m_pBitmap) | 1803 if (!m_pBitmap) |
1722 return true; | 1804 return true; |
1723 uint8_t* srcBuffer = m_pBitmap->GetBuffer(); | 1805 uint8_t* srcBuffer = m_pBitmap->GetBuffer(); |
1724 if (!srcBuffer) | 1806 if (!srcBuffer) |
1725 return true; | 1807 return true; |
1726 #ifdef _SKIA_SUPPORT_ | 1808 #ifdef _SKIA_SUPPORT_ |
1809 m_pCache->FlushForDraw(); | |
1727 int srcWidth = m_pBitmap->GetWidth(); | 1810 int srcWidth = m_pBitmap->GetWidth(); |
1728 int srcHeight = m_pBitmap->GetHeight(); | 1811 int srcHeight = m_pBitmap->GetHeight(); |
1729 int srcRowBytes = srcWidth * sizeof(uint32_t); | 1812 int srcRowBytes = srcWidth * sizeof(uint32_t); |
1730 SkImageInfo srcImageInfo = SkImageInfo::Make( | 1813 SkImageInfo srcImageInfo = SkImageInfo::Make( |
1731 srcWidth, srcHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType); | 1814 srcWidth, srcHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType); |
1732 SkBitmap skSrcBitmap; | 1815 SkBitmap skSrcBitmap; |
1733 skSrcBitmap.installPixels(srcImageInfo, srcBuffer, srcRowBytes, nullptr, | 1816 skSrcBitmap.installPixels(srcImageInfo, srcBuffer, srcRowBytes, nullptr, |
1734 nullptr, nullptr); | 1817 nullptr, nullptr); |
1735 SkASSERT(pBitmap); | 1818 SkASSERT(pBitmap); |
1736 uint8_t* dstBuffer = pBitmap->GetBuffer(); | 1819 uint8_t* dstBuffer = pBitmap->GetBuffer(); |
1737 SkASSERT(dstBuffer); | 1820 SkASSERT(dstBuffer); |
1738 int dstWidth = pBitmap->GetWidth(); | 1821 int dstWidth = pBitmap->GetWidth(); |
1739 int dstHeight = pBitmap->GetHeight(); | 1822 int dstHeight = pBitmap->GetHeight(); |
1740 int dstRowBytes = dstWidth * sizeof(uint32_t); | 1823 int dstRowBytes = dstWidth * sizeof(uint32_t); |
1741 SkImageInfo dstImageInfo = SkImageInfo::Make( | 1824 SkImageInfo dstImageInfo = SkImageInfo::Make( |
1742 dstWidth, dstHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType); | 1825 dstWidth, dstHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType); |
1743 SkBitmap skDstBitmap; | 1826 SkBitmap skDstBitmap; |
1744 skDstBitmap.installPixels(dstImageInfo, dstBuffer, dstRowBytes, nullptr, | 1827 skDstBitmap.installPixels(dstImageInfo, dstBuffer, dstRowBytes, nullptr, |
1745 nullptr, nullptr); | 1828 nullptr, nullptr); |
1746 SkCanvas canvas(skDstBitmap); | 1829 SkCanvas canvas(skDstBitmap); |
1747 canvas.drawBitmap(skSrcBitmap, left, top, nullptr); | 1830 canvas.drawBitmap(skSrcBitmap, left, top, nullptr); |
1748 return true; | 1831 return true; |
1749 #endif // _SKIA_SUPPORT_ | 1832 #endif // _SKIA_SUPPORT_ |
1750 | 1833 |
1751 #ifdef _SKIA_SUPPORT_PATHS_ | 1834 #ifdef _SKIA_SUPPORT_PATHS_ |
1835 Flush(); | |
1752 m_pBitmap->UnPreMultiply(); | 1836 m_pBitmap->UnPreMultiply(); |
1753 FX_RECT rect(left, top, left + pBitmap->GetWidth(), | 1837 FX_RECT rect(left, top, left + pBitmap->GetWidth(), |
1754 top + pBitmap->GetHeight()); | 1838 top + pBitmap->GetHeight()); |
1755 CFX_DIBitmap* pBack = nullptr; | 1839 std::unique_ptr<CFX_DIBitmap> pBack = nullptr; |
dsinclair
2016/12/06 18:48:26
I dont' think you need the = nullptr here.
caryclark
2016/12/06 19:00:37
Done.
| |
1756 if (m_pOriDevice) { | 1840 if (m_pOriDevice) { |
1757 pBack = m_pOriDevice->Clone(&rect); | 1841 pBack = m_pOriDevice->Clone(&rect); |
1758 if (!pBack) | 1842 if (!pBack) |
1759 return true; | 1843 return true; |
1760 | 1844 |
1761 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), | 1845 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), |
1762 m_pBitmap, 0, 0); | 1846 m_pBitmap, 0, 0); |
1763 } else { | 1847 } else { |
1764 pBack = m_pBitmap->Clone(&rect); | 1848 pBack = m_pBitmap->Clone(&rect); |
1765 if (!pBack) | 1849 if (!pBack) |
1766 return true; | 1850 return true; |
1767 } | 1851 } |
1768 | 1852 |
1769 bool bRet = true; | 1853 bool bRet = true; |
1770 left = std::min(left, 0); | 1854 left = std::min(left, 0); |
1771 top = std::min(top, 0); | 1855 top = std::min(top, 0); |
1772 if (m_bRgbByteOrder) { | 1856 if (m_bRgbByteOrder) { |
1773 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), | 1857 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), |
1774 pBack, left, top); | 1858 pBack.get(), left, top); |
1775 } else { | 1859 } else { |
1776 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, | 1860 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), |
1777 left, top); | 1861 pBack.get(), left, top); |
1778 } | 1862 } |
1779 delete pBack; | |
1780 return bRet; | 1863 return bRet; |
1781 #endif // _SKIA_SUPPORT_PATHS_ | 1864 #endif // _SKIA_SUPPORT_PATHS_ |
1782 } | 1865 } |
1783 | 1866 |
1784 CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { | 1867 CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { |
1785 return m_pOriDevice; | 1868 return m_pOriDevice; |
1786 } | 1869 } |
1787 | 1870 |
1788 bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 1871 bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
1789 uint32_t argb, | 1872 uint32_t argb, |
1790 const FX_RECT* pSrcRect, | 1873 const FX_RECT* pSrcRect, |
1791 int left, | 1874 int left, |
1792 int top, | 1875 int top, |
1793 int blend_type) { | 1876 int blend_type) { |
1794 if (!m_pBitmap || !m_pBitmap->GetBuffer()) | 1877 if (!m_pBitmap || !m_pBitmap->GetBuffer()) |
1795 return true; | 1878 return true; |
1796 | 1879 |
1797 #ifdef _SKIA_SUPPORT_ | 1880 #ifdef _SKIA_SUPPORT_ |
1798 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, | 1881 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, |
1799 top + pBitmap->GetHeight()); | 1882 top + pBitmap->GetHeight()); |
1800 void* dummy; | 1883 void* dummy; |
1801 return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type); | 1884 return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type); |
1802 #endif // _SKIA_SUPPORT_ | 1885 #endif // _SKIA_SUPPORT_ |
1803 | 1886 |
1804 #ifdef _SKIA_SUPPORT_PATHS_ | 1887 #ifdef _SKIA_SUPPORT_PATHS_ |
1888 Flush(); | |
1805 if (pBitmap->IsAlphaMask()) { | 1889 if (pBitmap->IsAlphaMask()) { |
1806 return m_pBitmap->CompositeMask( | 1890 return m_pBitmap->CompositeMask( |
1807 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, | 1891 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, |
1808 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(), | 1892 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(), |
1809 m_bRgbByteOrder, 0, nullptr); | 1893 m_bRgbByteOrder, 0, nullptr); |
1810 } | 1894 } |
1811 return m_pBitmap->CompositeBitmap( | 1895 return m_pBitmap->CompositeBitmap( |
1812 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, | 1896 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, |
1813 pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr); | 1897 pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr); |
1814 #endif // _SKIA_SUPPORT_PATHS_ | 1898 #endif // _SKIA_SUPPORT_PATHS_ |
1815 } | 1899 } |
1816 | 1900 |
1817 bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, | 1901 bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
1818 uint32_t argb, | 1902 uint32_t argb, |
1819 int dest_left, | 1903 int dest_left, |
1820 int dest_top, | 1904 int dest_top, |
1821 int dest_width, | 1905 int dest_width, |
1822 int dest_height, | 1906 int dest_height, |
1823 const FX_RECT* pClipRect, | 1907 const FX_RECT* pClipRect, |
1824 uint32_t flags, | 1908 uint32_t flags, |
1825 int blend_type) { | 1909 int blend_type) { |
1826 #ifdef _SKIA_SUPPORT_ | 1910 #ifdef _SKIA_SUPPORT_ |
1911 m_pCache->FlushForDraw(); | |
1827 if (!m_pBitmap->GetBuffer()) | 1912 if (!m_pBitmap->GetBuffer()) |
1828 return true; | 1913 return true; |
1829 CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left, | 1914 CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left, |
1830 dest_top + dest_height); | 1915 dest_top + dest_height); |
1831 | 1916 |
1832 m_pCanvas->save(); | 1917 m_pCanvas->save(); |
1833 SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom, | 1918 SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom, |
1834 pClipRect->right, pClipRect->top); | 1919 pClipRect->right, pClipRect->top); |
1835 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); | 1920 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); |
1836 void* dummy; | 1921 void* dummy; |
1837 bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type); | 1922 bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type); |
1838 m_pCanvas->restore(); | 1923 m_pCanvas->restore(); |
1839 | 1924 |
1840 return result; | 1925 return result; |
1841 #endif // _SKIA_SUPPORT_ | 1926 #endif // _SKIA_SUPPORT_ |
1842 | 1927 |
1843 #ifdef _SKIA_SUPPORT_PATHS_ | 1928 #ifdef _SKIA_SUPPORT_PATHS_ |
1844 if (dest_width == pSource->GetWidth() && | 1929 if (dest_width == pSource->GetWidth() && |
1845 dest_height == pSource->GetHeight()) { | 1930 dest_height == pSource->GetHeight()) { |
1846 FX_RECT rect(0, 0, dest_width, dest_height); | 1931 FX_RECT rect(0, 0, dest_width, dest_height); |
1847 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type); | 1932 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type); |
1848 } | 1933 } |
1934 Flush(); | |
1849 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, | 1935 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, |
1850 dest_top + dest_height); | 1936 dest_top + dest_height); |
1851 dest_rect.Normalize(); | 1937 dest_rect.Normalize(); |
1852 FX_RECT dest_clip = dest_rect; | 1938 FX_RECT dest_clip = dest_rect; |
1853 dest_clip.Intersect(*pClipRect); | 1939 dest_clip.Intersect(*pClipRect); |
1854 CFX_BitmapComposer composer; | 1940 CFX_BitmapComposer composer; |
1855 composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false, | 1941 composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false, |
1856 false, false, m_bRgbByteOrder, 0, nullptr, blend_type); | 1942 false, false, m_bRgbByteOrder, 0, nullptr, blend_type); |
1857 dest_clip.Offset(-dest_rect.left, -dest_rect.top); | 1943 dest_clip.Offset(-dest_rect.left, -dest_rect.top); |
1858 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, | 1944 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, |
1859 dest_clip, flags); | 1945 dest_clip, flags); |
1860 if (stretcher.Start()) | 1946 if (stretcher.Start()) |
1861 stretcher.Continue(nullptr); | 1947 stretcher.Continue(nullptr); |
1862 return true; | 1948 return true; |
1863 #endif // _SKIA_SUPPORT_PATHS_ | 1949 #endif // _SKIA_SUPPORT_PATHS_ |
1864 } | 1950 } |
1865 | 1951 |
1866 bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, | 1952 bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
1867 int bitmap_alpha, | 1953 int bitmap_alpha, |
1868 uint32_t argb, | 1954 uint32_t argb, |
1869 const CFX_Matrix* pMatrix, | 1955 const CFX_Matrix* pMatrix, |
1870 uint32_t render_flags, | 1956 uint32_t render_flags, |
1871 void*& handle, | 1957 void*& handle, |
1872 int blend_type) { | 1958 int blend_type) { |
1873 #ifdef _SKIA_SUPPORT_ | 1959 #ifdef _SKIA_SUPPORT_ |
1960 m_pCache->FlushForDraw(); | |
1874 DebugValidate(m_pBitmap, m_pOriDevice); | 1961 DebugValidate(m_pBitmap, m_pOriDevice); |
1875 SkColorTable* ct = nullptr; | 1962 SkColorTable* ct = nullptr; |
1876 std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage; | 1963 std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage; |
1877 std::unique_ptr<uint32_t, FxFreeDeleter> dst32Storage; | 1964 std::unique_ptr<uint32_t, FxFreeDeleter> dst32Storage; |
1878 SkBitmap skBitmap; | 1965 SkBitmap skBitmap; |
1879 int width, height; | 1966 int width, height; |
1880 if (!Upsample(pSource, dst8Storage, dst32Storage, &ct, &skBitmap, &width, | 1967 if (!Upsample(pSource, dst8Storage, dst32Storage, &ct, &skBitmap, &width, |
1881 &height, false)) { | 1968 &height, false)) { |
1882 return false; | 1969 return false; |
1883 } | 1970 } |
(...skipping 21 matching lines...) Expand all Loading... | |
1905 } else { | 1992 } else { |
1906 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); | 1993 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); |
1907 } | 1994 } |
1908 m_pCanvas->restore(); | 1995 m_pCanvas->restore(); |
1909 if (ct) | 1996 if (ct) |
1910 ct->unref(); | 1997 ct->unref(); |
1911 DebugValidate(m_pBitmap, m_pOriDevice); | 1998 DebugValidate(m_pBitmap, m_pOriDevice); |
1912 #endif // _SKIA_SUPPORT_ | 1999 #endif // _SKIA_SUPPORT_ |
1913 | 2000 |
1914 #ifdef _SKIA_SUPPORT_PATHS_ | 2001 #ifdef _SKIA_SUPPORT_PATHS_ |
2002 Flush(); | |
1915 if (!m_pBitmap->GetBuffer()) | 2003 if (!m_pBitmap->GetBuffer()) |
1916 return true; | 2004 return true; |
1917 m_pBitmap->UnPreMultiply(); | 2005 m_pBitmap->UnPreMultiply(); |
1918 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; | 2006 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; |
1919 pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, | 2007 pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, |
1920 pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr); | 2008 pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr); |
1921 handle = pRenderer; | 2009 handle = pRenderer; |
1922 #endif // _SKIA_SUPPORT_PATHS_ | 2010 #endif // _SKIA_SUPPORT_PATHS_ |
1923 return true; | 2011 return true; |
1924 } | 2012 } |
1925 | 2013 |
1926 bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { | 2014 bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
1927 #ifdef _SKIA_SUPPORT_ | 2015 #ifdef _SKIA_SUPPORT_ |
2016 m_pCache->FlushForDraw(); | |
1928 return false; | 2017 return false; |
1929 #endif // _SKIA_SUPPORT_ | 2018 #endif // _SKIA_SUPPORT_ |
1930 | 2019 |
1931 #ifdef _SKIA_SUPPORT_PATHS_ | 2020 #ifdef _SKIA_SUPPORT_PATHS_ |
2021 Flush(); | |
1932 if (!m_pBitmap->GetBuffer()) { | 2022 if (!m_pBitmap->GetBuffer()) { |
1933 return true; | 2023 return true; |
1934 } | 2024 } |
1935 return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause); | 2025 return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause); |
1936 #endif // _SKIA_SUPPORT_PATHS_ | 2026 #endif // _SKIA_SUPPORT_PATHS_ |
1937 } | 2027 } |
1938 | 2028 |
1939 #if defined _SKIA_SUPPORT_ | 2029 #if defined _SKIA_SUPPORT_ |
1940 void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { | 2030 void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { |
1941 pDIBitmap->PreMultiply(); | 2031 pDIBitmap->PreMultiply(); |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3006 } | 3096 } |
3007 } | 3097 } |
3008 if (m_pDevice->GetBPP() == 1) { | 3098 if (m_pDevice->GetBPP() == 1) { |
3009 composite_span = &CFX_Renderer::CompositeSpan1bpp; | 3099 composite_span = &CFX_Renderer::CompositeSpan1bpp; |
3010 } | 3100 } |
3011 return true; | 3101 return true; |
3012 } | 3102 } |
3013 }; | 3103 }; |
3014 | 3104 |
3015 #endif // _SKIA_SUPPORT_PATHS_ | 3105 #endif // _SKIA_SUPPORT_PATHS_ |
OLD | NEW |