From dda239e25b54f4265734c62e2fdc76c872406f28 Mon Sep 17 00:00:00 2001 From: halcanary Date: Thu, 31 Mar 2016 07:33:57 -0700 Subject: [PATCH] SkPDF: Use Pathops clipping Turn this on all the time. Remove the SK_PDF_USE_PATHOPS_CLIPPING define that used to hide this functionality. All rendering tests are the same or improved by this. Also, remove non-functional SK_ALLOW_LARGE_PDF_SCALARS. TBR=reed@google.com removing dead #defines from SkUserConfig.h BUG=591805 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845623002 Review URL: https://codereview.chromium.org/1845623002 --- include/config/SkUserConfig.h | 15 --------------- src/pdf/SkPDFDevice.cpp | 5 +---- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h index a3e40ec5db..3022b1fef6 100644 --- a/include/config/SkUserConfig.h +++ b/include/config/SkUserConfig.h @@ -93,11 +93,6 @@ */ //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024) -/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow - them, but modern PDF interpreters should handle them just fine. - */ -//#define SK_ALLOW_LARGE_PDF_SCALARS - /* Define this to provide font subsetter in PDF generation. */ //#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h" @@ -136,16 +131,6 @@ */ //#define SK_SUPPORT_GPU 1 - -/* The PDF generation code uses Path Ops to handle complex clipping paths, - * but at this time, Path Ops is not release ready yet. So, the code is - * hidden behind this #define guard. If you are feeling adventurous and - * want the latest and greatest PDF generation code, uncomment the #define. - * When Path Ops is release ready, the define guards and this user config - * define should be removed entirely. - */ -//#define SK_PDF_USE_PATHOPS_CLIPPING - /* Skia makes use of histogram logging macros to trace the frequency of * events. By default, Skia provides no-op versions of these macros. * Skia consumers can provide their own definitions of these macros to diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index df6a8f8fe2..38e6d1f021 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -320,7 +320,6 @@ static bool calculate_inverse_path(const SkRect& bounds, const SkPath& invPath, return Op(clipPath, invPath, kIntersect_SkPathOp, outPath); } -#ifdef SK_PDF_USE_PATHOPS_CLIPPING // Sanity check the numerical values of the SkRegion ops and PathOps ops // enums so region_op_to_pathops_op can do a straight passthrough cast. // If these are failing, it may be necessary to make region_op_to_pathops_op @@ -387,7 +386,6 @@ static bool get_clip_stack_path(const SkMatrix& transform, } return true; } -#endif // TODO(vandebo): Take advantage of SkClipStack::getSaveCount(), the PDF // graphic state stack, and the fact that we can know all the clips used @@ -413,13 +411,12 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack, SkMatrix transform; transform.setTranslate(translation.fX, translation.fY); -#ifdef SK_PDF_USE_PATHOPS_CLIPPING SkPath clipPath; if (get_clip_stack_path(transform, clipStack, clipRegion, &clipPath)) { emit_clip(&clipPath, nullptr, fContentStream); return; } -#endif + // gsState->initialEntry()->fClipStack/Region specifies the clip that has // already been applied. (If this is a top level device, then it specifies // a clip to the content area. If this is a layer, then it specifies -- 2.34.1