| Index: src/pdf/SkPDFDevice.cpp
|
| ===================================================================
|
| --- src/pdf/SkPDFDevice.cpp (revision 12933)
|
| +++ src/pdf/SkPDFDevice.cpp (working copy)
|
| @@ -1912,8 +1912,10 @@
|
| ContentEntry* contentEntries = getContentEntries()->get();
|
| SkASSERT(dst);
|
| SkASSERT(!contentEntries->fNext.get());
|
| - // We have to make a copy of these here because changing the current
|
| - // content into a form-xobject will destroy them.
|
| + // Changing the current content into a form-xobject will destroy the clip
|
| + // objects which is fine since the xobject will already be clipped. However
|
| + // if source has shape, we need to clip it too, so a copy of the clip is
|
| + // saved.
|
| SkClipStack clipStack = contentEntries->fState.fClipStack;
|
| SkRegion clipRegion = contentEntries->fState.fClipRegion;
|
|
|
| @@ -1930,7 +1932,8 @@
|
| // reduces to Dst.
|
| if (shape == NULL || xfermode == SkXfermode::kDstOut_Mode ||
|
| xfermode == SkXfermode::kSrcATop_Mode) {
|
| - ScopedContentEntry content(this, &clipStack, clipRegion, identity,
|
| + ScopedContentEntry content(this, &fExistingClipStack,
|
| + fExistingClipRegion, identity,
|
| stockPaint);
|
| SkPDFUtils::DrawFormXObject(this->addXObjectResource(dst),
|
| &content.entry()->fContent);
|
| @@ -1951,7 +1954,7 @@
|
| // the non-transparent parts of the device and the outlines (shape) of
|
| // all images and devices drawn.
|
| drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()), dst,
|
| - &clipStack, clipRegion,
|
| + &fExistingClipStack, fExistingClipRegion,
|
| SkXfermode::kSrcOver_Mode, true);
|
| } else {
|
| SkAutoTUnref<SkPDFFormXObject> dstMaskStorage;
|
| @@ -1970,16 +1973,17 @@
|
| dstMaskStorage.reset(createFormXObjectFromDevice());
|
| dstMask = dstMaskStorage.get();
|
| }
|
| - drawFormXObjectWithMask(addXObjectResource(dst), dstMask, &clipStack,
|
| - clipRegion, SkXfermode::kSrcOver_Mode, true);
|
| + drawFormXObjectWithMask(addXObjectResource(dst), dstMask,
|
| + &fExistingClipStack, fExistingClipRegion,
|
| + SkXfermode::kSrcOver_Mode, true);
|
| }
|
|
|
| if (xfermode == SkXfermode::kClear_Mode) {
|
| return;
|
| } else if (xfermode == SkXfermode::kSrc_Mode ||
|
| xfermode == SkXfermode::kDstATop_Mode) {
|
| - ScopedContentEntry content(this, &clipStack, clipRegion, identity,
|
| - stockPaint);
|
| + ScopedContentEntry content(this, &fExistingClipStack,
|
| + fExistingClipRegion, identity, stockPaint);
|
| if (content.entry()) {
|
| SkPDFUtils::DrawFormXObject(
|
| this->addXObjectResource(srcFormXObject.get()),
|
| @@ -1989,8 +1993,8 @@
|
| return;
|
| }
|
| } else if (xfermode == SkXfermode::kSrcATop_Mode) {
|
| - ScopedContentEntry content(this, &clipStack, clipRegion, identity,
|
| - stockPaint);
|
| + ScopedContentEntry content(this, &fExistingClipStack,
|
| + fExistingClipRegion, identity, stockPaint);
|
| if (content.entry()) {
|
| SkPDFUtils::DrawFormXObject(this->addXObjectResource(dst),
|
| &content.entry()->fContent);
|
| @@ -2005,30 +2009,24 @@
|
| xfermode == SkXfermode::kDstATop_Mode ||
|
| xfermode == SkXfermode::kModulate_Mode);
|
|
|
| - ScopedContentEntry inShapeContentEntry(this, &fExistingClipStack,
|
| - fExistingClipRegion, identity,
|
| - stockPaint);
|
| - if (!inShapeContentEntry.entry()) {
|
| - return;
|
| - }
|
| -
|
| if (xfermode == SkXfermode::kSrcIn_Mode ||
|
| xfermode == SkXfermode::kSrcOut_Mode ||
|
| xfermode == SkXfermode::kSrcATop_Mode) {
|
| drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()), dst,
|
| - &clipStack, clipRegion,
|
| + &fExistingClipStack, fExistingClipRegion,
|
| SkXfermode::kSrcOver_Mode,
|
| xfermode == SkXfermode::kSrcOut_Mode);
|
| } else {
|
| SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode;
|
| if (xfermode == SkXfermode::kModulate_Mode) {
|
| drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()),
|
| - dst, &clipStack, clipRegion,
|
| + dst, &fExistingClipStack,
|
| + fExistingClipRegion,
|
| SkXfermode::kSrcOver_Mode, false);
|
| mode = SkXfermode::kMultiply_Mode;
|
| }
|
| drawFormXObjectWithMask(addXObjectResource(dst), srcFormXObject.get(),
|
| - &clipStack, clipRegion, mode,
|
| + &fExistingClipStack, fExistingClipRegion, mode,
|
| xfermode == SkXfermode::kDstOut_Mode);
|
| }
|
| }
|
|
|