| 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 #include "SkAnnotationKeys.h" | 9 #include "SkAnnotationKeys.h" |
| 10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
| 11 #include "SkBitmapKey.h" | 11 #include "SkBitmapKey.h" |
| 12 #include "SkColor.h" | 12 #include "SkColor.h" |
| 13 #include "SkColorFilter.h" | 13 #include "SkColorFilter.h" |
| 14 #include "SkDraw.h" | 14 #include "SkDraw.h" |
| 15 #include "SkGlyphCache.h" | 15 #include "SkGlyphCache.h" |
| 16 #include "SkMakeUnique.h" |
| 16 #include "SkPath.h" | 17 #include "SkPath.h" |
| 17 #include "SkPathEffect.h" | 18 #include "SkPathEffect.h" |
| 18 #include "SkPathOps.h" | 19 #include "SkPathOps.h" |
| 19 #include "SkPDFBitmap.h" | 20 #include "SkPDFBitmap.h" |
| 20 #include "SkPDFCanon.h" | 21 #include "SkPDFCanon.h" |
| 21 #include "SkPDFDocument.h" | 22 #include "SkPDFDocument.h" |
| 22 #include "SkPDFFont.h" | 23 #include "SkPDFFont.h" |
| 23 #include "SkPDFFormXObject.h" | 24 #include "SkPDFFormXObject.h" |
| 24 #include "SkPDFGraphicState.h" | 25 #include "SkPDFGraphicState.h" |
| 25 #include "SkPDFResourceDict.h" | 26 #include "SkPDFResourceDict.h" |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 translation.iset(this->getOrigin()); | 1338 translation.iset(this->getOrigin()); |
| 1338 translation.negate(); | 1339 translation.negate(); |
| 1339 gsState.updateClip(entry.fState.fClipStack, entry.fState.fClipRegion, | 1340 gsState.updateClip(entry.fState.fClipStack, entry.fState.fClipRegion, |
| 1340 translation); | 1341 translation); |
| 1341 gsState.updateMatrix(entry.fState.fMatrix); | 1342 gsState.updateMatrix(entry.fState.fMatrix); |
| 1342 gsState.updateDrawingState(entry.fState); | 1343 gsState.updateDrawingState(entry.fState); |
| 1343 | 1344 |
| 1344 entry.fContent.writeToStream(&buffer); | 1345 entry.fContent.writeToStream(&buffer); |
| 1345 } | 1346 } |
| 1346 gsState.drainStack(); | 1347 gsState.drainStack(); |
| 1347 | 1348 if (buffer.bytesWritten() > 0) { |
| 1348 return std::unique_ptr<SkStreamAsset>( | 1349 return std::unique_ptr<SkStreamAsset>(buffer.detachAsStream()); |
| 1349 buffer.bytesWritten() > 0 | 1350 } else { |
| 1350 ? buffer.detachAsStream() | 1351 return skstd::make_unique<SkMemoryStream>(); |
| 1351 : new SkMemoryStream); | 1352 } |
| 1352 } | 1353 } |
| 1353 | 1354 |
| 1354 /* Draws an inverse filled path by using Path Ops to compute the positive | 1355 /* Draws an inverse filled path by using Path Ops to compute the positive |
| 1355 * inverse using the current clip as the inverse bounds. | 1356 * inverse using the current clip as the inverse bounds. |
| 1356 * Return true if this was an inverse path and was properly handled, | 1357 * Return true if this was an inverse path and was properly handled, |
| 1357 * otherwise returns false and the normal drawing routine should continue, | 1358 * otherwise returns false and the normal drawing routine should continue, |
| 1358 * either as a (incorrect) fallback or because the path was not inverse | 1359 * either as a (incorrect) fallback or because the path was not inverse |
| 1359 * in the first place. | 1360 * in the first place. |
| 1360 */ | 1361 */ |
| 1361 bool SkPDFDevice::handleInversePath(const SkDraw& d, const SkPath& origPath, | 1362 bool SkPDFDevice::handleInversePath(const SkDraw& d, const SkPath& origPath, |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 } | 2143 } |
| 2143 | 2144 |
| 2144 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { | 2145 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { |
| 2145 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), | 2146 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), |
| 2146 image->makeNonTextureImage()); | 2147 image->makeNonTextureImage()); |
| 2147 } | 2148 } |
| 2148 | 2149 |
| 2149 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { | 2150 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { |
| 2150 return nullptr; | 2151 return nullptr; |
| 2151 } | 2152 } |
| OLD | NEW |