OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
9 | 9 |
10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 * canvas bounds. | 338 * canvas bounds. |
339 * outPath may alias with invPath (since this is supported by PathOps). | 339 * outPath may alias with invPath (since this is supported by PathOps). |
340 */ | 340 */ |
341 static bool calculate_inverse_path(const SkRect& bounds, const SkPath& invPath, | 341 static bool calculate_inverse_path(const SkRect& bounds, const SkPath& invPath, |
342 SkPath* outPath) { | 342 SkPath* outPath) { |
343 SkASSERT(invPath.isInverseFillType()); | 343 SkASSERT(invPath.isInverseFillType()); |
344 | 344 |
345 SkPath clipPath; | 345 SkPath clipPath; |
346 clipPath.addRect(bounds); | 346 clipPath.addRect(bounds); |
347 | 347 |
348 return Op(clipPath, invPath, kIntersect_SkPathOp, outPath); | 348 return Op(clipPath, invPath, kIntersect_PathOp, outPath); |
349 } | 349 } |
350 | 350 |
351 #ifdef SK_PDF_USE_PATHOPS_CLIPPING | 351 #ifdef SK_PDF_USE_PATHOPS_CLIPPING |
352 // Sanity check the numerical values of the SkRegion ops and PathOps ops | 352 // Sanity check the numerical values of the SkRegion ops and PathOps ops |
353 // enums so region_op_to_pathops_op can do a straight passthrough cast. | 353 // enums so region_op_to_pathops_op can do a straight passthrough cast. |
354 // If these are failing, it may be necessary to make region_op_to_pathops_op | 354 // If these are failing, it may be necessary to make region_op_to_pathops_op |
355 // do more. | 355 // do more. |
356 SK_COMPILE_ASSERT(SkRegion::kDifference_Op == (int)kDifference_SkPathOp, | 356 SK_COMPILE_ASSERT(SkRegion::kDifference_Op == (int)kDifference_PathOp, |
357 region_pathop_mismatch); | 357 region_pathop_mismatch); |
358 SK_COMPILE_ASSERT(SkRegion::kIntersect_Op == (int)kIntersect_SkPathOp, | 358 SK_COMPILE_ASSERT(SkRegion::kIntersect_Op == (int)kIntersect_PathOp, |
359 region_pathop_mismatch); | 359 region_pathop_mismatch); |
360 SK_COMPILE_ASSERT(SkRegion::kUnion_Op == (int)kUnion_SkPathOp, | 360 SK_COMPILE_ASSERT(SkRegion::kUnion_Op == (int)kUnion_PathOp, |
361 region_pathop_mismatch); | 361 region_pathop_mismatch); |
362 SK_COMPILE_ASSERT(SkRegion::kXOR_Op == (int)kXOR_SkPathOp, | 362 SK_COMPILE_ASSERT(SkRegion::kXOR_Op == (int)kXOR_PathOp, |
363 region_pathop_mismatch); | 363 region_pathop_mismatch); |
364 SK_COMPILE_ASSERT(SkRegion::kReverseDifference_Op == | 364 SK_COMPILE_ASSERT(SkRegion::kReverseDifference_Op == |
365 (int)kReverseDifference_SkPathOp, | 365 (int)kReverseDifference_PathOp, |
366 region_pathop_mismatch); | 366 region_pathop_mismatch); |
367 | 367 |
368 static SkPathOp region_op_to_pathops_op(SkRegion::Op op) { | 368 static SkPathOp region_op_to_pathops_op(SkRegion::Op op) { |
369 SkASSERT(op >= 0); | 369 SkASSERT(op >= 0); |
370 SkASSERT(op <= SkRegion::kReverseDifference_Op); | 370 SkASSERT(op <= SkRegion::kReverseDifference_Op); |
371 return (SkPathOp)op; | 371 return (SkPathOp)op; |
372 } | 372 } |
373 | 373 |
374 /* Uses Path Ops to calculate a vector SkPath clip from a clip stack. | 374 /* Uses Path Ops to calculate a vector SkPath clip from a clip stack. |
375 * Returns true if successful, or false if not successful. | 375 * Returns true if successful, or false if not successful. |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 return; | 2195 return; |
2196 } | 2196 } |
2197 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); | 2197 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); |
2198 if (!image) { | 2198 if (!image) { |
2199 return; | 2199 return; |
2200 } | 2200 } |
2201 | 2201 |
2202 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2202 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
2203 &content.entry()->fContent); | 2203 &content.entry()->fContent); |
2204 } | 2204 } |
OLD | NEW |