aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-09-06 09:32:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-06 09:32:13 -0700
commite86134fc703eba776715a9e0fdcb6c4e6f7d60e7 (patch)
tree326882ae8b7808eb31e21959c942ff6c604da983
parent02f9ed74ead11fcb01a24faa7d93f853e869f1ab (diff)
SkDocument: turn off SK_SUPPORT_LEGACY_DOCUMENT_API
no one seems to be using it. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2299653002 Review-Url: https://codereview.chromium.org/2299653002
-rw-r--r--include/core/SkDocument.h91
-rw-r--r--src/pdf/SkPDFDocument.cpp20
-rw-r--r--src/pdf/SkPDFDocument.h7
-rw-r--r--src/pdf/SkPDFMetadata.cpp13
-rw-r--r--src/pdf/SkPDFMetadata.h6
5 files changed, 1 insertions, 136 deletions
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index eede42003d..ba870120c2 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -19,8 +19,6 @@
class SkCanvas;
class SkWStream;
-#define SK_SUPPORT_LEGACY_DOCUMENT_API
-
/** SK_ScalarDefaultDPI is 72 DPI.
*/
#define SK_ScalarDefaultRasterDPI 72.0f
@@ -157,65 +155,6 @@ public:
static sk_sp<SkDocument> MakeXPS(const char path[],
SkScalar dpi = SK_ScalarDefaultRasterDPI);
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
-
- /**
- * Create a PDF-backed document, writing the results into a SkWStream.
- *
- * PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm.
- *
- * @param SkWStream* A PDF document will be written to this
- * stream. The document may write to the stream at
- * anytime during its lifetime, until either close() is
- * called or the document is deleted.
- * @param dpi The DPI (pixels-per-inch) at which features without
- * native PDF support will be rasterized (e.g. draw image
- * with perspective, draw text with perspective, ...) A
- * larger DPI would create a PDF that reflects the
- * original intent with better fidelity, but it can make
- * for larger PDF files too, which would use more memory
- * while rendering, and it would be slower to be processed
- * or sent online or to printer.
- * @returns NULL if there is an error, otherwise a newly created
- * PDF-backed SkDocument.
- */
- static SkDocument* CreatePDF(SkWStream* stream,
- SkScalar dpi = SK_ScalarDefaultRasterDPI) {
- return SkDocument::MakePDF(stream, dpi, SkDocument::PDFMetadata(),
- nullptr, false).release();
- }
-
- /**
- * @param jpegEncoder For PDF documents, if a jpegEncoder is set,
- * use it to encode SkImages and SkBitmaps as [JFIF]JPEGs.
- * This feature is deprecated and is only supplied for
- * backwards compatability.
- *
- * The prefered method to create PDFs with JPEG images is
- * to use SkImage::NewFromEncoded() and not jpegEncoder.
- * Chromium uses NewFromEncoded.
- *
- * If the encoder is unset, or if jpegEncoder->onEncode()
- * returns NULL, fall back on encoding images losslessly
- * with Deflate.
- */
- static SkDocument* CreatePDF(SkWStream* stream,
- SkScalar dpi,
- SkPixelSerializer* jpegEncoder) {
- return SkDocument::MakePDF(stream, dpi, SkDocument::PDFMetadata(),
- sk_ref_sp(jpegEncoder), false).release();
- }
-
- /**
- * Create a PDF-backed document, writing the results into a file.
- */
- static SkDocument* CreatePDF(const char outputFilePath[],
- SkScalar dpi = SK_ScalarDefaultRasterDPI) {
- return SkDocument::MakePDF(outputFilePath, dpi).release();
- }
-
-#endif // SK_SUPPORT_LEGACY_DOCUMENT_API
-
/**
* Begin a new page for the document, returning the canvas that will draw
* into the page. The document owns this canvas, and it will go out of
@@ -246,36 +185,6 @@ public:
*/
void abort();
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
- /**
- * Set the document's metadata, if supported by the document
- * type. The creationDate and modifiedDate parameters can be
- * nullptr. For example:
- *
- * SkDocument* make_doc(SkWStream* output) {
- * std::vector<SkDocument::Attribute> info;
- * info.emplace_back(SkString("Title"), SkString("..."));
- * info.emplace_back(SkString("Author"), SkString("..."));
- * info.emplace_back(SkString("Subject"), SkString("..."));
- * info.emplace_back(SkString("Keywords"), SkString("..."));
- * info.emplace_back(SkString("Creator"), SkString("..."));
- * SkTime::DateTime now;
- * SkTime::GetDateTime(&now);
- * SkDocument* doc = SkDocument::CreatePDF(output);
- * doc->setMetadata(&info[0], (int)info.size(), &now, &now);
- * return doc;
- * }
- */
- struct Attribute {
- SkString fKey, fValue;
- Attribute(const SkString& k, const SkString& v) : fKey(k), fValue(v) {}
- };
- virtual void setMetadata(const SkDocument::Attribute[],
- int /* attributeCount */,
- const SkTime::DateTime* /* creationDate */,
- const SkTime::DateTime* /* modifiedDate */) {}
-#endif // SK_SUPPORT_LEGACY_DOCUMENT_API
-
protected:
SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted));
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 6122dbd565..8734927901 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -256,26 +256,6 @@ void SkPDFDocument::reset() {
fFonts.reset();
}
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
-void SkPDFDocument::setMetadata(const SkDocument::Attribute info[],
- int infoCount,
- const SkTime::DateTime* creationDate,
- const SkTime::DateTime* modifiedDate) {
- for (int i = 0; i < infoCount; ++i) {
- const SkDocument::Attribute& kv = info[i];
- SkPDFMetadata::SetMetadataByKey(kv.fKey, kv.fValue, &fMetadata);
- }
- if (creationDate) {
- fMetadata.fCreation.fEnabled = true;
- fMetadata.fCreation.fDateTime = *creationDate;
- }
- if (modifiedDate) {
- fMetadata.fModified.fEnabled = true;
- fMetadata.fModified.fDateTime = *modifiedDate;
- }
-}
-#endif // SK_SUPPORT_LEGACY_DOCUMENT_API
-
static sk_sp<SkData> SkSrgbIcm() {
// Source: http://www.argyllcms.com/icclibsrc.html
static const char kProfile[] =
diff --git a/src/pdf/SkPDFDocument.h b/src/pdf/SkPDFDocument.h
index 5221dd2728..eeafbca624 100644
--- a/src/pdf/SkPDFDocument.h
+++ b/src/pdf/SkPDFDocument.h
@@ -55,12 +55,7 @@ public:
void onEndPage() override;
bool onClose(SkWStream*) override;
void onAbort() override;
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
- void setMetadata(const SkDocument::Attribute[],
- int,
- const SkTime::DateTime*,
- const SkTime::DateTime*) override;
-#endif // SK_SUPPORT_LEGACY_DOCUMENT_API
+
/**
Serialize the object, as well as any other objects it
indirectly refers to. If any any other objects have been added
diff --git a/src/pdf/SkPDFMetadata.cpp b/src/pdf/SkPDFMetadata.cpp
index 46fe461be5..42068843bf 100644
--- a/src/pdf/SkPDFMetadata.cpp
+++ b/src/pdf/SkPDFMetadata.cpp
@@ -43,19 +43,6 @@ static const struct {
};
} // namespace
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
-void SkPDFMetadata::SetMetadataByKey(const SkString& key,
- const SkString& value,
- SkDocument::PDFMetadata* metadata) {
- for (const auto keyValuePtr : gMetadataKeys) {
- if (key.equals(keyValuePtr.key)) {
- metadata->*(keyValuePtr.valuePtr) = value;
- }
- }
-}
-
-#endif
-
sk_sp<SkPDFObject> SkPDFMetadata::MakeDocumentInformationDict(
const SkDocument::PDFMetadata& metadata) {
auto dict = sk_make_sp<SkPDFDict>();
diff --git a/src/pdf/SkPDFMetadata.h b/src/pdf/SkPDFMetadata.h
index d386488222..3091be4d77 100644
--- a/src/pdf/SkPDFMetadata.h
+++ b/src/pdf/SkPDFMetadata.h
@@ -26,11 +26,5 @@ sk_sp<SkPDFObject> MakePdfId(const UUID& doc, const UUID& instance);
sk_sp<SkPDFObject> MakeXMPObject(const SkDocument::PDFMetadata&,
const UUID& doc,
const UUID& instance);
-
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
-void SetMetadataByKey(const SkString& key,
- const SkString& value,
- SkDocument::PDFMetadata*);
-#endif
}
#endif // SkPDFMetadata_DEFINED