remove SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER dead code
Bug: skia: Change-Id: Ia88f3e2fdf6d5c6e5128eaefda0d68c7042ae7a2 Reviewed-on: https://skia-review.googlesource.com/85500 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
a088365e2f
commit
7f846f273c
@ -84,11 +84,7 @@ protected:
|
||||
return;
|
||||
}
|
||||
while (loops-- > 0) {
|
||||
auto object = SkPDFCreateBitmapObject(fImage,
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
nullptr,
|
||||
#endif
|
||||
false);
|
||||
auto object = SkPDFCreateBitmapObject(fImage);
|
||||
SkASSERT(object);
|
||||
if (!object) {
|
||||
return;
|
||||
@ -125,11 +121,7 @@ protected:
|
||||
return;
|
||||
}
|
||||
while (loops-- > 0) {
|
||||
auto object = SkPDFCreateBitmapObject(fImage,
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
nullptr,
|
||||
#endif
|
||||
false);
|
||||
auto object = SkPDFCreateBitmapObject(fImage);
|
||||
SkASSERT(object);
|
||||
if (!object) {
|
||||
return;
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
#include "SkBitmap.h"
|
||||
#include "SkPicture.h"
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
#include "SkPixelSerializer.h"
|
||||
#endif
|
||||
#include "SkRect.h"
|
||||
#include "SkRefCnt.h"
|
||||
#include "SkString.h"
|
||||
@ -115,49 +112,6 @@ public:
|
||||
int fEncodingQuality = 101;
|
||||
};
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
/**
|
||||
* 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 stream 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.
|
||||
* @param metadata a PDFmetadata object. Any fields may be left
|
||||
* empty.
|
||||
* @param pdfa Iff true, include XMP metadata, a document UUID,
|
||||
* and sRGB output intent information. This adds length
|
||||
* to the document and makes it non-reproducable, but are
|
||||
* necessary features for PDF/A-2b conformance
|
||||
*
|
||||
* @returns NULL if there is an error, otherwise a newly created
|
||||
* PDF-backed SkDocument.
|
||||
*/
|
||||
static sk_sp<SkDocument> MakePDF(SkWStream* stream,
|
||||
SkScalar dpi,
|
||||
const PDFMetadata& metadata,
|
||||
sk_sp<SkPixelSerializer> jpegEncoder,
|
||||
bool pdfa);
|
||||
/**
|
||||
* Create a PDF-backed document, writing the results into a file.
|
||||
*/
|
||||
static sk_sp<SkDocument> MakePDF(const char outputFilePath[],
|
||||
SkScalar dpi = SK_ScalarDefaultRasterDPI);
|
||||
static sk_sp<SkDocument> MakePDF(SkWStream* stream, SkScalar dpi);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a PDF-backed document, writing the results into a
|
||||
* SkWStream.
|
||||
|
@ -586,7 +586,6 @@ def base_defines(os_conditions):
|
||||
"SK_JUMPER_DISABLE_8BIT",
|
||||
# JPEG is in codec_limited
|
||||
"SK_HAS_JPEG_LIBRARY",
|
||||
"SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER",
|
||||
] + skia_select(
|
||||
os_conditions,
|
||||
[
|
||||
|
@ -15,18 +15,3 @@ sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream,
|
||||
SkScalar dpi,
|
||||
const PDFMetadata& metadata,
|
||||
sk_sp<SkPixelSerializer> jpegEncoder,
|
||||
bool pdfa) {
|
||||
return nullptr;
|
||||
}
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, SkScalar dpi) {
|
||||
return nullptr;
|
||||
}
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(const char path[], SkScalar dpi) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
@ -407,11 +407,7 @@ void PDFJpegBitmap::emitObject(SkWStream* stream,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage> image,
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
SkPixelSerializer* pixelSerializer,
|
||||
#endif
|
||||
int encodingQuality) {
|
||||
sk_sp<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage> image, int encodingQuality) {
|
||||
SkASSERT(image);
|
||||
SkASSERT(encodingQuality >= 0);
|
||||
sk_sp<SkData> data = image->refEncodedData();
|
||||
@ -427,21 +423,6 @@ sk_sp<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage> image,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
if (pixelSerializer) {
|
||||
SkBitmap bm;
|
||||
if (SkPDFUtils::ToBitmap(image.get(), &bm)) {
|
||||
data = pixelSerializer->encodeToData(bm.pixmap());
|
||||
if (data && SkIsJFIF(data.get(), &info)) {
|
||||
bool yuv = info.fType == SkJFIFInfo::kYCbCr;
|
||||
if (info.fSize == image->dimensions()) { // Sanity check.
|
||||
return sk_make_sp<PDFJpegBitmap>(info.fSize, data.get(), yuv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const bool isOpaque = image_compute_is_opaque(image.get());
|
||||
|
||||
if (encodingQuality <= 100 && isOpaque) {
|
||||
|
@ -10,20 +10,15 @@
|
||||
#include "SkRefCnt.h"
|
||||
|
||||
class SkImage;
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
class SkPixelSerializer;
|
||||
#endif
|
||||
class SkPDFObject;
|
||||
|
||||
/**
|
||||
* SkPDFBitmap wraps a SkImage and serializes it as an image Xobject.
|
||||
* It is designed to use a minimal amout of memory, aside from refing
|
||||
* the image, and its emitObject() does not cache any data.
|
||||
*
|
||||
* quality > 100 means lossless
|
||||
*/
|
||||
sk_sp<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage>,
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
SkPixelSerializer*,
|
||||
#endif
|
||||
int encodingQuality);
|
||||
sk_sp<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage>, int encodingQuality = 101);
|
||||
|
||||
#endif // SkPDFBitmap_DEFINED
|
||||
|
@ -11,9 +11,6 @@
|
||||
#include "SkPDFGradientShader.h"
|
||||
#include "SkPDFGraphicState.h"
|
||||
#include "SkPDFShader.h"
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
#include "SkPixelSerializer.h"
|
||||
#endif
|
||||
#include "SkTDArray.h"
|
||||
#include "SkTHash.h"
|
||||
#include "SkTypeface.h"
|
||||
@ -45,9 +42,6 @@ public:
|
||||
SkTHashMap<SkPDFStrokeGraphicState, sk_sp<SkPDFDict>> fStrokeGSMap;
|
||||
SkTHashMap<SkPDFFillGraphicState, sk_sp<SkPDFDict>> fFillGSMap;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
sk_sp<SkPixelSerializer> fPixelSerializer;
|
||||
#endif
|
||||
sk_sp<SkPDFStream> fInvertFunction;
|
||||
sk_sp<SkPDFDict> fNoSmaskGraphicState;
|
||||
sk_sp<SkPDFArray> fRangeObject;
|
||||
|
@ -2512,9 +2512,6 @@ void SkPDFDevice::internalDrawImageRect(SkKeyedImage imageSubset,
|
||||
if (!pdfimage) {
|
||||
SkASSERT(imageSubset);
|
||||
pdfimage = SkPDFCreateBitmapObject(imageSubset.release(),
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
fDocument->canon()->fPixelSerializer.get(),
|
||||
#endif
|
||||
fDocument->metadata().fEncodingQuality);
|
||||
if (!pdfimage) {
|
||||
return;
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "SkPDFCanon.h"
|
||||
#include "SkPDFDevice.h"
|
||||
#include "SkPDFUtils.h"
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
#include "SkPixelSerializer.h"
|
||||
#endif
|
||||
#include "SkStream.h"
|
||||
|
||||
SkPDFObjectSerializer::SkPDFObjectSerializer() : fBaseOffset(0), fNextToBeSerialized(0) {}
|
||||
@ -176,16 +173,9 @@ static sk_sp<SkPDFDict> generate_page_tree(SkTArray<sk_sp<SkPDFDict>>* pages) {
|
||||
|
||||
SkPDFDocument::SkPDFDocument(SkWStream* stream,
|
||||
void (*doneProc)(SkWStream*, bool),
|
||||
const SkDocument::PDFMetadata& metadata
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
, sk_sp<SkPixelSerializer> jpegEncoder
|
||||
#endif
|
||||
)
|
||||
const SkDocument::PDFMetadata& metadata)
|
||||
: SkDocument(stream, doneProc)
|
||||
, fMetadata(metadata) {
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
fCanon.fPixelSerializer = std::move(jpegEncoder);
|
||||
#endif
|
||||
}
|
||||
|
||||
SkPDFDocument::~SkPDFDocument() {
|
||||
@ -436,11 +426,7 @@ void SkPDFDocument::onClose(SkWStream* stream) {
|
||||
|
||||
sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
|
||||
void (*proc)(SkWStream*, bool),
|
||||
const SkDocument::PDFMetadata& metadata
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
, sk_sp<SkPixelSerializer> jpeg
|
||||
#endif
|
||||
) {
|
||||
const SkDocument::PDFMetadata& metadata) {
|
||||
SkDocument::PDFMetadata meta = metadata;
|
||||
if (meta.fRasterDPI <= 0) {
|
||||
meta.fRasterDPI = 72.0f;
|
||||
@ -448,12 +434,7 @@ sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
|
||||
if (meta.fEncodingQuality < 0) {
|
||||
meta.fEncodingQuality = 0;
|
||||
}
|
||||
return stream ? sk_make_sp<SkPDFDocument>(stream, proc, meta
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
, std::move(jpeg)
|
||||
#endif
|
||||
)
|
||||
: nullptr;
|
||||
return stream ? sk_make_sp<SkPDFDocument>(stream, proc, meta) : nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, const PDFMetadata& metadata) {
|
||||
@ -464,30 +445,3 @@ sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream) {
|
||||
return SkPDFMakeDocument(stream, nullptr, PDFMetadata());
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream,
|
||||
SkScalar dpi,
|
||||
const PDFMetadata& metadata,
|
||||
sk_sp<SkPixelSerializer> jpegEncoder,
|
||||
bool pdfa) {
|
||||
PDFMetadata meta = metadata;
|
||||
meta.fRasterDPI = dpi;
|
||||
meta.fPDFA = pdfa;
|
||||
return SkPDFMakeDocument(stream, nullptr, meta, jpegEncoder);
|
||||
}
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, SkScalar dpi) {
|
||||
PDFMetadata meta;
|
||||
meta.fRasterDPI = dpi;
|
||||
return SkPDFMakeDocument(stream, nullptr, meta, nullptr);
|
||||
}
|
||||
sk_sp<SkDocument> SkDocument::MakePDF(const char path[], SkScalar dpi) {
|
||||
auto delete_wstream = [](SkWStream* stream, bool) { delete stream; };
|
||||
auto stream = skstd::make_unique<SkFILEWStream>(path);
|
||||
if (!stream->isValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
PDFMetadata meta;
|
||||
meta.fRasterDPI = dpi;
|
||||
return SkPDFMakeDocument(stream.release(), delete_wstream, meta, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "SkDocument.h"
|
||||
#include "SkPDFCanon.h"
|
||||
#include "SkPDFMetadata.h"
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
#include "SkPixelSerializer.h"
|
||||
#endif
|
||||
#include "SkPDFFont.h"
|
||||
|
||||
class SkPDFDevice;
|
||||
@ -29,11 +26,7 @@ class SkPDFDevice;
|
||||
*/
|
||||
sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
|
||||
void (*doneProc)(SkWStream*, bool),
|
||||
const SkDocument::PDFMetadata&
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
, sk_sp<SkPixelSerializer> = nullptr
|
||||
#endif
|
||||
);
|
||||
const SkDocument::PDFMetadata&);
|
||||
|
||||
// Logically part of SkPDFDocument (like SkPDFCanon), but separate to
|
||||
// keep similar functionality together.
|
||||
@ -60,11 +53,7 @@ class SkPDFDocument : public SkDocument {
|
||||
public:
|
||||
SkPDFDocument(SkWStream*,
|
||||
void (*)(SkWStream*, bool),
|
||||
const SkDocument::PDFMetadata&
|
||||
#ifdef SK_SUPPORT_LEGACY_PDF_PIXELSERIALIZER
|
||||
, sk_sp<SkPixelSerializer> = nullptr
|
||||
#endif
|
||||
);
|
||||
const SkDocument::PDFMetadata&);
|
||||
~SkPDFDocument() override;
|
||||
SkCanvas* onBeginPage(SkScalar, SkScalar) override;
|
||||
void onEndPage() override;
|
||||
|
Loading…
Reference in New Issue
Block a user