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 "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
9 | 9 |
10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #else // DRAW_SKIA_CLIP | 74 #else // DRAW_SKIA_CLIP |
75 | 75 |
76 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) {} | 76 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) {} |
77 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {} | 77 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {} |
78 | 78 |
79 #endif // DRAW_SKIA_CLIP | 79 #endif // DRAW_SKIA_CLIP |
80 | 80 |
81 #undef SHOW_SKIA_PATH | 81 #undef SHOW_SKIA_PATH |
82 #undef DRAW_SKIA_CLIP | 82 #undef DRAW_SKIA_CLIP |
83 | 83 |
| 84 static void DebugVerifyBitmapIsPreMultiplied(void* buffer, |
| 85 int width, |
| 86 int height) { |
| 87 #ifdef SK_DEBUG |
| 88 // verify that input is really premultiplied |
| 89 for (int y = 0; y < height; ++y) { |
| 90 const uint32_t* srcRow = static_cast<const uint32_t*>(buffer) + y * width; |
| 91 for (int x = 0; x < width; ++x) { |
| 92 uint8_t a = SkGetPackedA32(srcRow[x]); |
| 93 uint8_t r = SkGetPackedR32(srcRow[x]); |
| 94 uint8_t g = SkGetPackedG32(srcRow[x]); |
| 95 uint8_t b = SkGetPackedB32(srcRow[x]); |
| 96 SkA32Assert(a); |
| 97 SkASSERT(r <= a); |
| 98 SkASSERT(g <= a); |
| 99 SkASSERT(b <= a); |
| 100 } |
| 101 } |
| 102 #endif |
| 103 } |
| 104 |
| 105 static void DebugValidate(const CFX_DIBitmap* bitmap, |
| 106 const CFX_DIBitmap* device) { |
| 107 if (bitmap) { |
| 108 SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32); |
| 109 if (bitmap->GetBPP() == 32) { |
| 110 DebugVerifyBitmapIsPreMultiplied(bitmap->GetBuffer(), bitmap->GetWidth(), |
| 111 bitmap->GetHeight()); |
| 112 } |
| 113 } |
| 114 if (device) { |
| 115 SkASSERT(device->GetBPP() == 8 || device->GetBPP() == 32); |
| 116 if (device->GetBPP() == 32) { |
| 117 DebugVerifyBitmapIsPreMultiplied(device->GetBuffer(), device->GetWidth(), |
| 118 device->GetHeight()); |
| 119 } |
| 120 } |
| 121 } |
| 122 |
84 SkPath BuildPath(const CFX_PathData* pPathData) { | 123 SkPath BuildPath(const CFX_PathData* pPathData) { |
85 SkPath skPath; | 124 SkPath skPath; |
86 const CFX_PathData* pFPath = pPathData; | 125 const CFX_PathData* pFPath = pPathData; |
87 int nPoints = pFPath->GetPointCount(); | 126 int nPoints = pFPath->GetPointCount(); |
88 FX_PATHPOINT* pPoints = pFPath->GetPoints(); | 127 FX_PATHPOINT* pPoints = pFPath->GetPoints(); |
89 for (int i = 0; i < nPoints; i++) { | 128 for (int i = 0; i < nPoints; i++) { |
90 FX_FLOAT x = pPoints[i].m_PointX; | 129 FX_FLOAT x = pPoints[i].m_PointX; |
91 FX_FLOAT y = pPoints[i].m_PointY; | 130 FX_FLOAT y = pPoints[i].m_PointY; |
92 int point_type = pPoints[i].m_Flag & FXPT_TYPE; | 131 int point_type = pPoints[i].m_Flag & FXPT_TYPE; |
93 if (point_type == FXPT_MOVETO) { | 132 if (point_type == FXPT_MOVETO) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | 541 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
503 FX_BOOL bRgbByteOrder, | 542 FX_BOOL bRgbByteOrder, |
504 CFX_DIBitmap* pOriDevice, | 543 CFX_DIBitmap* pOriDevice, |
505 FX_BOOL bGroupKnockout) | 544 FX_BOOL bGroupKnockout) |
506 : m_pBitmap(pBitmap), | 545 : m_pBitmap(pBitmap), |
507 m_pOriDevice(pOriDevice), | 546 m_pOriDevice(pOriDevice), |
508 m_pRecorder(nullptr), | 547 m_pRecorder(nullptr), |
509 m_bRgbByteOrder(bRgbByteOrder), | 548 m_bRgbByteOrder(bRgbByteOrder), |
510 m_bGroupKnockout(bGroupKnockout) { | 549 m_bGroupKnockout(bGroupKnockout) { |
511 SkBitmap skBitmap; | 550 SkBitmap skBitmap; |
512 SkImageInfo imageInfo = | 551 SkASSERT(pBitmap->GetBPP() == 8 || pBitmap->GetBPP() == 32); |
513 SkImageInfo::Make(pBitmap->GetWidth(), pBitmap->GetHeight(), | 552 SkImageInfo imageInfo = SkImageInfo::Make( |
514 kN32_SkColorType, kOpaque_SkAlphaType); | 553 pBitmap->GetWidth(), pBitmap->GetHeight(), |
| 554 pBitmap->GetBPP() == 8 ? kAlpha_8_SkColorType : kN32_SkColorType, |
| 555 kOpaque_SkAlphaType); |
515 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), | 556 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), |
516 nullptr, /* to do : set color table */ | 557 nullptr, /* to do : set color table */ |
517 nullptr, nullptr); | 558 nullptr, nullptr); |
518 m_pCanvas = new SkCanvas(skBitmap); | 559 m_pCanvas = new SkCanvas(skBitmap); |
519 if (m_bGroupKnockout) | 560 if (m_bGroupKnockout) |
520 SkDebugf(""); // FIXME(caryclark) suppress 'm_bGroupKnockout is unused' | 561 SkDebugf(""); // FIXME(caryclark) suppress 'm_bGroupKnockout is unused' |
521 } | 562 } |
522 | 563 |
523 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) | 564 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) |
524 : m_pBitmap(nullptr), | 565 : m_pBitmap(nullptr), |
(...skipping 21 matching lines...) Expand all Loading... |
546 | 587 |
547 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, | 588 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, |
548 const FXTEXT_CHARPOS* pCharPos, | 589 const FXTEXT_CHARPOS* pCharPos, |
549 CFX_Font* pFont, | 590 CFX_Font* pFont, |
550 CFX_FontCache* pCache, | 591 CFX_FontCache* pCache, |
551 const CFX_Matrix* pObject2Device, | 592 const CFX_Matrix* pObject2Device, |
552 FX_FLOAT font_size, | 593 FX_FLOAT font_size, |
553 uint32_t color, | 594 uint32_t color, |
554 int alpha_flag, | 595 int alpha_flag, |
555 void* pIccTransform) { | 596 void* pIccTransform) { |
556 CFX_TypeFace* typeface = pCache->GetDeviceCache(pFont); | 597 sk_sp<SkTypeface> typeface(SkSafeRef(pCache->GetDeviceCache(pFont))); |
557 SkPaint paint; | 598 SkPaint paint; |
558 paint.setAntiAlias(true); | 599 paint.setAntiAlias(true); |
559 paint.setColor(color); | 600 paint.setColor(color); |
560 paint.setTypeface(typeface); | 601 paint.setTypeface(typeface); |
561 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 602 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
562 paint.setTextSize(font_size); | 603 paint.setTextSize(font_size); |
563 paint.setSubpixelText(true); | 604 paint.setSubpixelText(true); |
564 m_pCanvas->save(); | 605 m_pCanvas->save(); |
565 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device); | 606 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device); |
566 m_pCanvas->concat(skMatrix); | 607 m_pCanvas->concat(skMatrix); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 966 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
926 uint32_t argb, | 967 uint32_t argb, |
927 const FX_RECT* pSrcRect, | 968 const FX_RECT* pSrcRect, |
928 int left, | 969 int left, |
929 int top, | 970 int top, |
930 int blend_type, | 971 int blend_type, |
931 int alpha_flag, | 972 int alpha_flag, |
932 void* pIccTransform) { | 973 void* pIccTransform) { |
933 if (!m_pBitmap || !m_pBitmap->GetBuffer()) | 974 if (!m_pBitmap || !m_pBitmap->GetBuffer()) |
934 return TRUE; | 975 return TRUE; |
935 if (pBitmap->IsAlphaMask()) { | 976 |
936 return m_pBitmap->CompositeMask( | 977 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, |
937 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, | 978 top + pBitmap->GetHeight()); |
938 pSrcRect->left, pSrcRect->top, blend_type, nullptr, m_bRgbByteOrder, | 979 void* dummy; |
939 alpha_flag, pIccTransform); | 980 return this->StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, alpha_flag, |
940 } | 981 pIccTransform, blend_type); |
941 return m_pBitmap->CompositeBitmap( | |
942 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, | |
943 pSrcRect->top, blend_type, nullptr, m_bRgbByteOrder, pIccTransform); | |
944 } | 982 } |
945 | 983 |
946 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, | 984 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
947 uint32_t argb, | 985 uint32_t argb, |
948 int dest_left, | 986 int dest_left, |
949 int dest_top, | 987 int dest_top, |
950 int dest_width, | 988 int dest_width, |
951 int dest_height, | 989 int dest_height, |
952 const FX_RECT* pClipRect, | 990 const FX_RECT* pClipRect, |
953 uint32_t flags, | 991 uint32_t flags, |
954 int alpha_flag, | 992 int alpha_flag, |
955 void* pIccTransform, | 993 void* pIccTransform, |
956 int blend_type) { | 994 int blend_type) { |
957 if (!m_pBitmap->GetBuffer()) | 995 if (!m_pBitmap->GetBuffer()) |
958 return TRUE; | 996 return TRUE; |
959 if (dest_width == pSource->GetWidth() && | 997 CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left, |
960 dest_height == pSource->GetHeight()) { | 998 dest_top + dest_height); |
961 FX_RECT rect(0, 0, dest_width, dest_height); | 999 |
962 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type, | 1000 m_pCanvas->save(); |
963 alpha_flag, pIccTransform); | 1001 SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom, |
964 } | 1002 pClipRect->right, pClipRect->top); |
965 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, | 1003 m_pCanvas->clipRect(skClipRect); |
966 dest_top + dest_height); | 1004 void* dummy; |
967 dest_rect.Normalize(); | 1005 FX_BOOL result = this->StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, |
968 FX_RECT dest_clip = dest_rect; | 1006 alpha_flag, pIccTransform, blend_type); |
969 dest_clip.Intersect(*pClipRect); | 1007 m_pCanvas->restore(); |
970 CFX_BitmapComposer composer; | 1008 |
971 composer.Compose(m_pBitmap, nullptr, 255, argb, dest_clip, FALSE, FALSE, | 1009 return result; |
972 FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, | |
973 blend_type); | |
974 dest_clip.Offset(-dest_rect.left, -dest_rect.top); | |
975 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, | |
976 dest_clip, flags); | |
977 if (stretcher.Start()) | |
978 stretcher.Continue(nullptr); | |
979 return TRUE; | |
980 } | 1010 } |
981 | 1011 |
982 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, | 1012 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
983 int bitmap_alpha, | 1013 int bitmap_alpha, |
984 uint32_t argb, | 1014 uint32_t argb, |
985 const CFX_Matrix* pMatrix, | 1015 const CFX_Matrix* pMatrix, |
986 uint32_t render_flags, | 1016 uint32_t render_flags, |
987 void*& handle, | 1017 void*& handle, |
988 int alpha_flag, | 1018 int alpha_flag, |
989 void* pIccTransform, | 1019 void* pIccTransform, |
990 int blend_type) { | 1020 int blend_type) { |
| 1021 DebugValidate(m_pBitmap, m_pOriDevice); |
991 SkColorType colorType = pSource->IsAlphaMask() | 1022 SkColorType colorType = pSource->IsAlphaMask() |
992 ? SkColorType::kAlpha_8_SkColorType | 1023 ? SkColorType::kAlpha_8_SkColorType |
993 : SkColorType::kGray_8_SkColorType; | 1024 : SkColorType::kGray_8_SkColorType; |
| 1025 SkAlphaType alphaType = |
| 1026 pSource->IsAlphaMask() ? kPremul_SkAlphaType : kOpaque_SkAlphaType; |
994 SkColorTable* ct = nullptr; | 1027 SkColorTable* ct = nullptr; |
995 void* buffer = pSource->GetBuffer(); | 1028 void* buffer = pSource->GetBuffer(); |
996 std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage; | 1029 std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage; |
997 std::unique_ptr<uint32_t, FxFreeDeleter> dst32Storage; | 1030 std::unique_ptr<uint32_t, FxFreeDeleter> dst32Storage; |
998 int width = pSource->GetWidth(); | 1031 int width = pSource->GetWidth(); |
999 int height = pSource->GetHeight(); | 1032 int height = pSource->GetHeight(); |
1000 int rowBytes = pSource->GetPitch(); | 1033 int rowBytes = pSource->GetPitch(); |
1001 switch (pSource->GetBPP()) { | 1034 switch (pSource->GetBPP()) { |
1002 case 1: { | 1035 case 1: { |
1003 dst8Storage.reset(FX_Alloc2D(uint8_t, width, height)); | 1036 dst8Storage.reset(FX_Alloc2D(uint8_t, width, height)); |
(...skipping 14 matching lines...) Expand all Loading... |
1018 colorType = SkColorType::kIndex_8_SkColorType; | 1051 colorType = SkColorType::kIndex_8_SkColorType; |
1019 } | 1052 } |
1020 break; | 1053 break; |
1021 case 24: { | 1054 case 24: { |
1022 dst32Storage.reset(FX_Alloc2D(uint32_t, width, height)); | 1055 dst32Storage.reset(FX_Alloc2D(uint32_t, width, height)); |
1023 uint32_t* dst32Pixels = dst32Storage.get(); | 1056 uint32_t* dst32Pixels = dst32Storage.get(); |
1024 for (int y = 0; y < height; ++y) { | 1057 for (int y = 0; y < height; ++y) { |
1025 const uint8_t* srcRow = | 1058 const uint8_t* srcRow = |
1026 static_cast<const uint8_t*>(buffer) + y * rowBytes; | 1059 static_cast<const uint8_t*>(buffer) + y * rowBytes; |
1027 uint32_t* dstRow = dst32Pixels + y * width; | 1060 uint32_t* dstRow = dst32Pixels + y * width; |
1028 for (int x = 0; x < width; ++x) | 1061 for (int x = 0; x < width; ++x) { |
1029 dstRow[x] = SkPackARGB32(0xFF, srcRow[x * 3 + 2], srcRow[x * 3 + 1], | 1062 dstRow[x] = SkPackARGB32(0xFF, srcRow[x * 3 + 2], srcRow[x * 3 + 1], |
1030 srcRow[x * 3 + 0]); | 1063 srcRow[x * 3 + 0]); |
| 1064 } |
1031 } | 1065 } |
1032 buffer = dst32Storage.get(); | 1066 buffer = dst32Storage.get(); |
1033 rowBytes = width * sizeof(uint32_t); | 1067 rowBytes = width * sizeof(uint32_t); |
1034 colorType = SkColorType::kN32_SkColorType; | 1068 colorType = SkColorType::kN32_SkColorType; |
| 1069 alphaType = kOpaque_SkAlphaType; |
1035 } break; | 1070 } break; |
1036 case 32: | 1071 case 32: |
1037 colorType = SkColorType::kN32_SkColorType; | 1072 colorType = SkColorType::kN32_SkColorType; |
| 1073 alphaType = kPremul_SkAlphaType; |
| 1074 DebugVerifyBitmapIsPreMultiplied(buffer, width, height); |
1038 break; | 1075 break; |
1039 default: | 1076 default: |
| 1077 SkASSERT(0); // TODO(caryclark) ensure that all cases are covered |
1040 colorType = SkColorType::kUnknown_SkColorType; | 1078 colorType = SkColorType::kUnknown_SkColorType; |
1041 } | 1079 } |
1042 SkImageInfo imageInfo = SkImageInfo::Make( | 1080 SkImageInfo imageInfo = |
1043 width, height, colorType, | 1081 SkImageInfo::Make(width, height, colorType, alphaType); |
1044 pSource->IsAlphaMask() ? kPremul_SkAlphaType : kOpaque_SkAlphaType); | |
1045 SkBitmap skBitmap; | 1082 SkBitmap skBitmap; |
1046 skBitmap.installPixels(imageInfo, buffer, rowBytes, ct, nullptr, nullptr); | 1083 skBitmap.installPixels(imageInfo, buffer, rowBytes, ct, nullptr, nullptr); |
1047 m_pCanvas->save(); | 1084 m_pCanvas->save(); |
1048 SkMatrix skMatrix; | 1085 SkMatrix skMatrix; |
1049 const CFX_Matrix& m = *pMatrix; | 1086 const CFX_Matrix& m = *pMatrix; |
1050 skMatrix.setAll(m.a / width, -m.c / height, m.c + m.e, m.b / width, | 1087 skMatrix.setAll(m.a / width, -m.c / height, m.c + m.e, m.b / width, |
1051 -m.d / height, m.d + m.f, 0, 0, 1); | 1088 -m.d / height, m.d + m.f, 0, 0, 1); |
1052 m_pCanvas->concat(skMatrix); | 1089 m_pCanvas->concat(skMatrix); |
1053 SkPaint paint; | 1090 SkPaint paint; |
1054 paint.setAntiAlias(true); | 1091 paint.setAntiAlias(true); |
1055 if (pSource->IsAlphaMask()) { | 1092 if (pSource->IsAlphaMask()) { |
1056 paint.setColorFilter( | 1093 paint.setColorFilter( |
1057 SkColorFilter::MakeModeFilter(argb, SkXfermode::kSrc_Mode)); | 1094 SkColorFilter::MakeModeFilter(argb, SkXfermode::kSrc_Mode)); |
1058 } | 1095 } |
1059 // paint.setFilterQuality(kHigh_SkFilterQuality); | 1096 // paint.setFilterQuality(kHigh_SkFilterQuality); |
1060 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); | 1097 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); |
1061 paint.setAlpha(bitmap_alpha); | 1098 paint.setAlpha(bitmap_alpha); |
1062 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); | 1099 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); |
1063 m_pCanvas->restore(); | 1100 m_pCanvas->restore(); |
1064 if (ct) | 1101 if (ct) |
1065 ct->unref(); | 1102 ct->unref(); |
| 1103 DebugValidate(m_pBitmap, m_pOriDevice); |
1066 return TRUE; | 1104 return TRUE; |
1067 } | 1105 } |
1068 | 1106 |
1069 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { | 1107 void CFX_SkiaDeviceDriver::PreMultiply() { |
1070 if (!m_pBitmap->GetBuffer()) | 1108 void* buffer = m_pBitmap->GetBuffer(); |
1071 return TRUE; | 1109 if (!buffer) |
1072 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); | |
1073 } | |
1074 | |
1075 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { | |
1076 if (!m_pBitmap->GetBuffer()) | |
1077 return; | 1110 return; |
1078 delete (CFX_ImageRenderer*)pHandle; | 1111 if (m_pBitmap->GetBPP() != 32) { |
| 1112 return; |
| 1113 } |
| 1114 int height = m_pBitmap->GetHeight(); |
| 1115 int width = m_pBitmap->GetWidth(); |
| 1116 int rowBytes = m_pBitmap->GetPitch(); |
| 1117 SkImageInfo unpremultipliedInfo = |
| 1118 SkImageInfo::Make(width, height, kN32_SkColorType, kUnpremul_SkAlphaType); |
| 1119 SkPixmap unpremultiplied(unpremultipliedInfo, buffer, rowBytes); |
| 1120 SkImageInfo premultipliedInfo = |
| 1121 SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType); |
| 1122 SkPixmap premultiplied(premultipliedInfo, buffer, rowBytes); |
| 1123 unpremultiplied.readPixels(premultiplied); |
| 1124 DebugVerifyBitmapIsPreMultiplied(buffer, width, height); |
1079 } | 1125 } |
1080 | 1126 |
1081 CFX_FxgeDevice::CFX_FxgeDevice() { | 1127 CFX_FxgeDevice::CFX_FxgeDevice() { |
1082 m_bOwnedBitmap = FALSE; | 1128 m_bOwnedBitmap = FALSE; |
1083 } | 1129 } |
1084 | 1130 |
1085 SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { | 1131 SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { |
1086 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); | 1132 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); |
1087 SetDeviceDriver(skDriver); | 1133 SetDeviceDriver(skDriver); |
1088 return skDriver->GetRecorder(); | 1134 return skDriver->GetRecorder(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 new CFX_SkiaDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE); | 1168 new CFX_SkiaDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE); |
1123 SetDeviceDriver(pDriver); | 1169 SetDeviceDriver(pDriver); |
1124 return true; | 1170 return true; |
1125 } | 1171 } |
1126 | 1172 |
1127 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1173 CFX_FxgeDevice::~CFX_FxgeDevice() { |
1128 if (m_bOwnedBitmap && GetBitmap()) | 1174 if (m_bOwnedBitmap && GetBitmap()) |
1129 delete GetBitmap(); | 1175 delete GetBitmap(); |
1130 } | 1176 } |
1131 | 1177 |
| 1178 void CFX_FxgeDevice::PreMultiply() { |
| 1179 (static_cast<CFX_SkiaDeviceDriver*>(this->GetDeviceDriver()))->PreMultiply(); |
| 1180 } |
| 1181 |
1132 #endif | 1182 #endif |
OLD | NEW |