| 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 "core/fxge/include/fx_ge.h" | 5 #include "core/fxge/include/fx_ge.h" |
| 6 | 6 |
| 7 #if defined(_SKIA_SUPPORT_) | 7 #if defined(_SKIA_SUPPORT_) |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 DebugShowSkiaPath(skPath); | 752 DebugShowSkiaPath(skPath); |
| 753 DebugShowCanvasMatrix(m_pCanvas); | 753 DebugShowCanvasMatrix(m_pCanvas); |
| 754 skPaint.setStyle(SkPaint::kStroke_Style); | 754 skPaint.setStyle(SkPaint::kStroke_Style); |
| 755 skPaint.setColor(stroke_color); | 755 skPaint.setColor(stroke_color); |
| 756 m_pCanvas->drawPath(skPath, skPaint); | 756 m_pCanvas->drawPath(skPath, skPaint); |
| 757 } | 757 } |
| 758 m_pCanvas->restore(); | 758 m_pCanvas->restore(); |
| 759 return TRUE; | 759 return TRUE; |
| 760 } | 760 } |
| 761 | 761 |
| 762 FX_BOOL CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, |
| 763 FX_FLOAT y1, |
| 764 FX_FLOAT x2, |
| 765 FX_FLOAT y2, |
| 766 uint32_t color, |
| 767 int blend_type) { |
| 768 return FALSE; |
| 769 } |
| 770 |
| 762 FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, | 771 FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, |
| 763 uint32_t fill_color, | 772 uint32_t fill_color, |
| 764 int blend_type) { | 773 int blend_type) { |
| 765 SkPaint spaint; | 774 SkPaint spaint; |
| 766 spaint.setAntiAlias(true); | 775 spaint.setAntiAlias(true); |
| 767 spaint.setColor(fill_color); | 776 spaint.setColor(fill_color); |
| 768 spaint.setXfermodeMode(GetSkiaBlendMode(blend_type)); | 777 spaint.setXfermodeMode(GetSkiaBlendMode(blend_type)); |
| 769 | 778 |
| 770 m_pCanvas->drawRect( | 779 m_pCanvas->drawRect( |
| 771 SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom), | 780 SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom), |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 } | 909 } |
| 901 m_pCanvas->save(); | 910 m_pCanvas->save(); |
| 902 if (!skClip.isEmpty()) | 911 if (!skClip.isEmpty()) |
| 903 m_pCanvas->clipPath(skClip); | 912 m_pCanvas->clipPath(skClip); |
| 904 m_pCanvas->concat(skMatrix); | 913 m_pCanvas->concat(skMatrix); |
| 905 m_pCanvas->drawPath(skPath, paint); | 914 m_pCanvas->drawPath(skPath, paint); |
| 906 m_pCanvas->restore(); | 915 m_pCanvas->restore(); |
| 907 return true; | 916 return true; |
| 908 } | 917 } |
| 909 | 918 |
| 919 uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const { |
| 920 return m_pBitmap->GetBuffer(); |
| 921 } |
| 922 |
| 910 FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { | 923 FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { |
| 911 // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead | 924 // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead |
| 912 pRect->left = 0; | 925 pRect->left = 0; |
| 913 pRect->top = 0; | 926 pRect->top = 0; |
| 914 const SkImageInfo& canvasSize = m_pCanvas->imageInfo(); | 927 const SkImageInfo& canvasSize = m_pCanvas->imageInfo(); |
| 915 pRect->right = canvasSize.width(); | 928 pRect->right = canvasSize.width(); |
| 916 pRect->bottom = canvasSize.height(); | 929 pRect->bottom = canvasSize.height(); |
| 917 return TRUE; | 930 return TRUE; |
| 918 } | 931 } |
| 919 | 932 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 946 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), | 959 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), |
| 947 pBack, left, top); | 960 pBack, left, top); |
| 948 } else { | 961 } else { |
| 949 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, | 962 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, |
| 950 left, top, nullptr); | 963 left, top, nullptr); |
| 951 } | 964 } |
| 952 delete pBack; | 965 delete pBack; |
| 953 return bRet; | 966 return bRet; |
| 954 } | 967 } |
| 955 | 968 |
| 969 CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { |
| 970 return m_pOriDevice; |
| 971 } |
| 972 |
| 956 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 973 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
| 957 uint32_t argb, | 974 uint32_t argb, |
| 958 const FX_RECT* pSrcRect, | 975 const FX_RECT* pSrcRect, |
| 959 int left, | 976 int left, |
| 960 int top, | 977 int top, |
| 961 int blend_type) { | 978 int blend_type) { |
| 962 if (!m_pBitmap || !m_pBitmap->GetBuffer()) | 979 if (!m_pBitmap || !m_pBitmap->GetBuffer()) |
| 963 return TRUE; | 980 return TRUE; |
| 964 | 981 |
| 965 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, | 982 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); | 1096 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); |
| 1080 paint.setAlpha(bitmap_alpha); | 1097 paint.setAlpha(bitmap_alpha); |
| 1081 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); | 1098 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); |
| 1082 m_pCanvas->restore(); | 1099 m_pCanvas->restore(); |
| 1083 if (ct) | 1100 if (ct) |
| 1084 ct->unref(); | 1101 ct->unref(); |
| 1085 DebugValidate(m_pBitmap, m_pOriDevice); | 1102 DebugValidate(m_pBitmap, m_pOriDevice); |
| 1086 return TRUE; | 1103 return TRUE; |
| 1087 } | 1104 } |
| 1088 | 1105 |
| 1106 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
| 1107 return FALSE; |
| 1108 } |
| 1109 |
| 1089 void CFX_SkiaDeviceDriver::PreMultiply() { | 1110 void CFX_SkiaDeviceDriver::PreMultiply() { |
| 1090 void* buffer = m_pBitmap->GetBuffer(); | 1111 void* buffer = m_pBitmap->GetBuffer(); |
| 1091 if (!buffer) | 1112 if (!buffer) |
| 1092 return; | 1113 return; |
| 1093 if (m_pBitmap->GetBPP() != 32) { | 1114 if (m_pBitmap->GetBPP() != 32) { |
| 1094 return; | 1115 return; |
| 1095 } | 1116 } |
| 1096 int height = m_pBitmap->GetHeight(); | 1117 int height = m_pBitmap->GetHeight(); |
| 1097 int width = m_pBitmap->GetWidth(); | 1118 int width = m_pBitmap->GetWidth(); |
| 1098 int rowBytes = m_pBitmap->GetPitch(); | 1119 int rowBytes = m_pBitmap->GetPitch(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 | 1258 |
| 1238 FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, | 1259 FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, |
| 1239 const CFX_Matrix* pMatrix, | 1260 const CFX_Matrix* pMatrix, |
| 1240 const FX_RECT& clip_rect, | 1261 const FX_RECT& clip_rect, |
| 1241 int alpha, | 1262 int alpha, |
| 1242 FX_BOOL bAlphaMode) { | 1263 FX_BOOL bAlphaMode) { |
| 1243 return false; | 1264 return false; |
| 1244 } | 1265 } |
| 1245 | 1266 |
| 1246 #endif | 1267 #endif |
| OLD | NEW |