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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex, | 1562 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex, |
1563 SkPDFFormXObject* mask, | 1563 SkPDFFormXObject* mask, |
1564 const SkClipStack* clipStack, | 1564 const SkClipStack* clipStack, |
1565 const SkRegion& clipRegion, | 1565 const SkRegion& clipRegion, |
1566 SkXfermode::Mode mode, | 1566 SkXfermode::Mode mode, |
1567 bool invertClip) { | 1567 bool invertClip) { |
1568 if (clipRegion.isEmpty() && !invertClip) { | 1568 if (clipRegion.isEmpty() && !invertClip) { |
1569 return; | 1569 return; |
1570 } | 1570 } |
1571 | 1571 |
1572 SkAutoTUnref<SkPDFGraphicState> sMaskGS( | 1572 SkAutoTUnref<SkPDFObject> sMaskGS(SkPDFGraphicState::GetSMaskGraphicState( |
1573 SkPDFGraphicState::GetSMaskGraphicState( | |
1574 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode)); | 1573 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode)); |
1575 | 1574 |
1576 SkMatrix identity; | 1575 SkMatrix identity; |
1577 identity.reset(); | 1576 identity.reset(); |
1578 SkPaint paint; | 1577 SkPaint paint; |
1579 paint.setXfermodeMode(mode); | 1578 paint.setXfermodeMode(mode); |
1580 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint); | 1579 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint); |
1581 if (!content.entry()) { | 1580 if (!content.entry()) { |
1582 return; | 1581 return; |
1583 } | 1582 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 entry->fGraphicStateIndex = resourceIndex; | 1933 entry->fGraphicStateIndex = resourceIndex; |
1935 | 1934 |
1936 if (hasText) { | 1935 if (hasText) { |
1937 entry->fTextScaleX = paint.getTextScaleX(); | 1936 entry->fTextScaleX = paint.getTextScaleX(); |
1938 entry->fTextFill = paint.getStyle(); | 1937 entry->fTextFill = paint.getStyle(); |
1939 } else { | 1938 } else { |
1940 entry->fTextScaleX = 0; | 1939 entry->fTextScaleX = 0; |
1941 } | 1940 } |
1942 } | 1941 } |
1943 | 1942 |
1944 int SkPDFDevice::addGraphicStateResource(SkPDFGraphicState* gs) { | 1943 int SkPDFDevice::addGraphicStateResource(SkPDFObject* gs) { |
1945 // Assumes that gs has been canonicalized (so we can directly compare | 1944 // Assumes that gs has been canonicalized (so we can directly compare |
1946 // pointers). | 1945 // pointers). |
1947 int result = fGraphicStateResources.find(gs); | 1946 int result = fGraphicStateResources.find(gs); |
1948 if (result < 0) { | 1947 if (result < 0) { |
1949 result = fGraphicStateResources.count(); | 1948 result = fGraphicStateResources.count(); |
1950 fGraphicStateResources.push(gs); | 1949 fGraphicStateResources.push(gs); |
1951 gs->ref(); | 1950 gs->ref(); |
1952 } | 1951 } |
1953 return result; | 1952 return result; |
1954 } | 1953 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 return; | 2132 return; |
2134 } | 2133 } |
2135 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); | 2134 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); |
2136 if (!image) { | 2135 if (!image) { |
2137 return; | 2136 return; |
2138 } | 2137 } |
2139 | 2138 |
2140 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2139 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
2141 &content.entry()->fContent); | 2140 &content.entry()->fContent); |
2142 } | 2141 } |
OLD | NEW |