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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 m_bRgbByteOrder(bRgbByteOrder), | 561 m_bRgbByteOrder(bRgbByteOrder), |
562 m_bGroupKnockout(bGroupKnockout) { | 562 m_bGroupKnockout(bGroupKnockout) { |
563 SkBitmap skBitmap; | 563 SkBitmap skBitmap; |
564 SkImageInfo imageInfo = | 564 SkImageInfo imageInfo = |
565 SkImageInfo::Make(pBitmap->GetWidth(), pBitmap->GetHeight(), | 565 SkImageInfo::Make(pBitmap->GetWidth(), pBitmap->GetHeight(), |
566 kN32_SkColorType, kOpaque_SkAlphaType); | 566 kN32_SkColorType, kOpaque_SkAlphaType); |
567 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), | 567 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), |
568 nullptr, /* to do : set color table */ | 568 nullptr, /* to do : set color table */ |
569 nullptr, nullptr); | 569 nullptr, nullptr); |
570 m_pCanvas = new SkCanvas(skBitmap); | 570 m_pCanvas = new SkCanvas(skBitmap); |
| 571 if (m_bGroupKnockout) |
| 572 SkDebugf(""); // FIXME(caryclark) suppress 'm_bGroupKnockout is unused' |
571 } | 573 } |
572 | 574 |
573 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) | 575 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) |
574 : m_pBitmap(nullptr), | 576 : m_pBitmap(nullptr), |
575 m_pOriDevice(nullptr), | 577 m_pOriDevice(nullptr), |
576 m_pRecorder(new SkPictureRecorder), | 578 m_pRecorder(new SkPictureRecorder), |
577 m_ditherBits(0), | 579 m_ditherBits(0), |
578 m_bRgbByteOrder(FALSE), | 580 m_bRgbByteOrder(FALSE), |
579 m_bGroupKnockout(FALSE) { | 581 m_bGroupKnockout(FALSE) { |
580 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); | 582 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 if (clipStart || clipEnd) { | 904 if (clipStart || clipEnd) { |
903 if (clipStart && start_r) | 905 if (clipStart && start_r) |
904 skClip.addCircle(pts[0].fX, pts[0].fY, start_r); | 906 skClip.addCircle(pts[0].fX, pts[0].fY, start_r); |
905 if (clipEnd) | 907 if (clipEnd) |
906 skClip.addCircle(pts[1].fX, pts[1].fY, end_r, SkPath::kCCW_Direction); | 908 skClip.addCircle(pts[1].fX, pts[1].fY, end_r, SkPath::kCCW_Direction); |
907 else | 909 else |
908 skClip.setFillType(SkPath::kInverseWinding_FillType); | 910 skClip.setFillType(SkPath::kInverseWinding_FillType); |
909 skClip.transform(skMatrix); | 911 skClip.transform(skMatrix); |
910 } | 912 } |
911 SkMatrix inverse; | 913 SkMatrix inverse; |
912 skMatrix.invert(&inverse); | 914 if (!skMatrix.invert(&inverse)) |
| 915 return false; |
913 skPath.addRect(skRect); | 916 skPath.addRect(skRect); |
914 skPath.transform(inverse); | 917 skPath.transform(inverse); |
915 } | 918 } |
916 m_pCanvas->save(); | 919 m_pCanvas->save(); |
917 if (!skClip.isEmpty()) | 920 if (!skClip.isEmpty()) |
918 m_pCanvas->clipPath(skClip); | 921 m_pCanvas->clipPath(skClip); |
919 m_pCanvas->concat(skMatrix); | 922 m_pCanvas->concat(skMatrix); |
920 m_pCanvas->drawPath(skPath, paint); | 923 m_pCanvas->drawPath(skPath, paint); |
921 m_pCanvas->restore(); | 924 m_pCanvas->restore(); |
922 return true; | 925 return true; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 SetDeviceDriver(pDriver); | 1187 SetDeviceDriver(pDriver); |
1185 return TRUE; | 1188 return TRUE; |
1186 } | 1189 } |
1187 | 1190 |
1188 CFX_SkiaDevice::~CFX_SkiaDevice() { | 1191 CFX_SkiaDevice::~CFX_SkiaDevice() { |
1189 if (m_bOwnedBitmap && GetBitmap()) | 1192 if (m_bOwnedBitmap && GetBitmap()) |
1190 delete GetBitmap(); | 1193 delete GetBitmap(); |
1191 } | 1194 } |
1192 | 1195 |
1193 #endif | 1196 #endif |
OLD | NEW |