[SkPDFDevice] Enable pathops-based inverse fills
authorfmalita <fmalita@chromium.org>
Wed, 22 Apr 2015 22:02:03 +0000 (15:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 22 Apr 2015 22:02:04 +0000 (15:02 -0700)
Keeping the old compile guard for clipping only.

BUG=skia:3749
R=halcanary@google.com,caryclark@google.com,reed@google.com

Review URL: https://codereview.chromium.org/1099953002

include/config/SkUserConfig.h
src/pdf/SkPDFDevice.cpp
src/pdf/SkPDFDevice.h

index 607b26a..43cf7ce 100644 (file)
 //#define SK_SUPPORT_GPU 1
 
 
-/* The PDF generation code uses Path Ops to generate inverse fills and 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.
+/* 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
+//#define SK_PDF_USE_PATHOPS_CLIPPING
 
 #endif
index 1b16397..b08bb17 100644 (file)
@@ -328,7 +328,6 @@ static void emit_clip(SkPath* clipPath, SkRect* clipRect,
     }
 }
 
-#ifdef SK_PDF_USE_PATHOPS
 /* Calculate an inverted path's equivalent non-inverted path, given the
  * canvas bounds.
  * outPath may alias with invPath (since this is supported by PathOps).
@@ -343,6 +342,7 @@ static bool calculate_inverse_path(const SkRect& bounds, const SkPath& invPath,
     return Op(clipPath, invPath, kIntersect_PathOp, 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
@@ -440,7 +440,7 @@ void GraphicStackState::updateClip(const SkClipStack& clipStack,
     SkMatrix transform;
     transform.setTranslate(translation.fX, translation.fY);
 
-#ifdef SK_PDF_USE_PATHOPS
+#ifdef SK_PDF_USE_PATHOPS_CLIPPING
     SkPath clipPath;
     if (get_clip_stack_path(transform, clipStack, clipRegion, &clipPath)) {
         emit_clip(&clipPath, NULL, fContentStream);
@@ -951,11 +951,9 @@ void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath,
         return;
     }
 
-#ifdef SK_PDF_USE_PATHOPS
     if (handleInversePath(d, origPath, paint, pathIsMutable, prePathMatrix)) {
         return;
     }
-#endif
 
     if (handleRectAnnotation(pathPtr->getBounds(), matrix, paint)) {
         return;
@@ -1363,7 +1361,6 @@ void SkPDFDevice::writeContent(SkWStream* out) const {
     SkPDFDevice::copyContentEntriesToData(fContentEntries.get(), out);
 }
 
-#ifdef SK_PDF_USE_PATHOPS
 /* Draws an inverse filled path by using Path Ops to compute the positive
  * inverse using the current clip as the inverse bounds.
  * Return true if this was an inverse path and was properly handled,
@@ -1429,7 +1426,6 @@ bool SkPDFDevice::handleInversePath(const SkDraw& d, const SkPath& origPath,
     drawPath(d, modifiedPath, noInversePaint, prePathMatrix, true);
     return true;
 }
-#endif
 
 bool SkPDFDevice::handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
                                        const SkPaint& p) {
index a701405..2850cf9 100644 (file)
@@ -290,11 +290,9 @@ private:
      */
     void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
 
-#ifdef SK_PDF_USE_PATHOPS
     bool handleInversePath(const SkDraw& d, const SkPath& origPath,
                            const SkPaint& paint, bool pathIsMutable,
                            const SkMatrix* prePathMatrix = NULL);
-#endif
     bool handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
                               const SkPaint& paint);
     bool handlePointAnnotation(const SkPoint* points, size_t count,