SkPDF: move all pdf sources into src/pdf
also, consolidate XPS backend into src/xps remove from include/ almost always a good thing. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1781773002 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1781773002
This commit is contained in:
parent
351c0d24f1
commit
23f4d4d1b9
@ -204,9 +204,10 @@ endif()
|
||||
if (ZLIB_FOUND)
|
||||
list (APPEND private_includes ${ZLIB_INCLUDE_DIRS})
|
||||
list (APPEND libs ${ZLIB_LIBRARIES})
|
||||
remove_srcs(../src/doc/SkDocument_PDF_None.cpp)
|
||||
remove_srcs(../src/pdf/SkDocument_PDF_None.cpp)
|
||||
else()
|
||||
remove_srcs(../src/pdf/*.cpp ../src/doc/SkDocument_PDF.cpp)
|
||||
remove_srcs(../src/pdf/*.cpp)
|
||||
set (srcs ${srcs} ../src/pdf/SkDocument_PDF_None.cpp)
|
||||
endif()
|
||||
|
||||
if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES)
|
||||
|
@ -100,6 +100,7 @@
|
||||
'<(skia_src_path)/core/SkDistanceFieldGen.h',
|
||||
'<(skia_src_path)/core/SkDither.cpp',
|
||||
'<(skia_src_path)/core/SkDither.h',
|
||||
'<(skia_src_path)/core/SkDocument.cpp',
|
||||
'<(skia_src_path)/core/SkDraw.cpp',
|
||||
'<(skia_src_path)/core/SkDrawable.cpp',
|
||||
'<(skia_src_path)/core/SkDrawLooper.cpp',
|
||||
@ -316,8 +317,6 @@
|
||||
'<(skia_src_path)/core/SkYUVPlanesCache.cpp',
|
||||
'<(skia_src_path)/core/SkYUVPlanesCache.h',
|
||||
|
||||
'<(skia_src_path)/doc/SkDocument.cpp',
|
||||
|
||||
'<(skia_src_path)/image/SkImage.cpp',
|
||||
'<(skia_src_path)/image/SkImage_Generator.cpp',
|
||||
# '<(skia_src_path)/image/SkImage_Gpu.cpp',
|
||||
|
@ -9,7 +9,7 @@
|
||||
'target_name': 'nopdf',
|
||||
'type': 'static_library',
|
||||
'dependencies': [ 'skia_lib.gyp:skia_lib', ],
|
||||
'sources': [ '<(skia_src_path)/doc/SkDocument_PDF_None.cpp', ],
|
||||
'sources': [ '<(skia_src_path)/pdf/SkDocument_PDF_None.cpp', ],
|
||||
'defines': [ 'SK_SUPPORT_PDF=0', ],
|
||||
},
|
||||
{
|
||||
@ -28,7 +28,6 @@
|
||||
'include_dirs': [
|
||||
'../include/private',
|
||||
'../src/core', # needed to get SkGlyphCache.h and SkTextFormatParams.h
|
||||
'../src/pdf',
|
||||
'../src/image',
|
||||
'../src/utils', # needed to get SkBitSet.h
|
||||
],
|
||||
|
@ -11,7 +11,6 @@
|
||||
#
|
||||
{
|
||||
'sources': [
|
||||
'<(skia_src_path)/doc/SkDocument_PDF.cpp',
|
||||
'<(skia_src_path)/pdf/SkDeflate.cpp',
|
||||
'<(skia_src_path)/pdf/SkDeflate.h',
|
||||
'<(skia_src_path)/pdf/SkJpegInfo.cpp',
|
||||
@ -22,6 +21,8 @@
|
||||
'<(skia_src_path)/pdf/SkPDFCanon.h',
|
||||
'<(skia_src_path)/pdf/SkPDFDevice.cpp',
|
||||
'<(skia_src_path)/pdf/SkPDFDevice.h',
|
||||
'<(skia_src_path)/pdf/SkPDFDocument.cpp',
|
||||
'<(skia_src_path)/pdf/SkPDFDocument.h',
|
||||
'<(skia_src_path)/pdf/SkPDFFont.cpp',
|
||||
'<(skia_src_path)/pdf/SkPDFFont.h',
|
||||
'<(skia_src_path)/pdf/SkPDFFontImpl.h',
|
||||
|
11
gyp/xps.gyp
11
gyp/xps.gyp
@ -16,17 +16,16 @@
|
||||
'skia_lib.gyp:skia_lib',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include/device/xps',
|
||||
'../include/private',
|
||||
'../include/utils/win',
|
||||
'../src/core', # needed to get SkGlyphCache.h
|
||||
'../src/utils', # needed to get SkBitSet.h
|
||||
],
|
||||
'sources': [
|
||||
'../include/device/xps/SkConstexprMath.h',
|
||||
'../include/device/xps/SkXPSDevice.h',
|
||||
'../src/device/xps/SkXPSDevice.cpp',
|
||||
'../src/doc/SkDocument_XPS.cpp',
|
||||
'../src/xps/SkConstexprMath.h',
|
||||
'../src/xps/SkDocument_XPS.cpp',
|
||||
'../src/xps/SkXPSDevice.cpp',
|
||||
'../src/xps/SkXPSDevice.h',
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
@ -42,7 +41,7 @@
|
||||
],
|
||||
},
|
||||
},{ #else if 'skia_os != "win"'
|
||||
'sources': [ '../src/doc/SkDocument_XPS_None.cpp', ],
|
||||
'sources': [ '../src/xps/SkDocument_XPS_None.cpp', ],
|
||||
'dependencies': [ 'skia_lib.gyp:skia_lib', ],
|
||||
}],
|
||||
],
|
||||
|
@ -5,17 +5,15 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkDocument.h"
|
||||
#include "SkPDFCanon.h"
|
||||
#include "SkPDFDevice.h"
|
||||
#include "SkPDFDocument.h"
|
||||
#include "SkPDFFont.h"
|
||||
#include "SkPDFMetadata.h"
|
||||
#include "SkPDFStream.h"
|
||||
#include "SkPDFTypes.h"
|
||||
#include "SkPDFUtils.h"
|
||||
#include "SkStream.h"
|
||||
#include "SkPDFMetadata.h"
|
||||
|
||||
class SkPDFDict;
|
||||
|
||||
static void emit_pdf_header(SkWStream* stream) {
|
||||
stream->writeText("%PDF-1.4\n%");
|
||||
@ -309,9 +307,9 @@ template <typename T> static T* clone(const T* o) { return o ? new T(*o) : nullp
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace {
|
||||
class SkDocument_PDF : public SkDocument {
|
||||
class SkPDFDocument : public SkDocument {
|
||||
public:
|
||||
SkDocument_PDF(SkWStream* stream,
|
||||
SkPDFDocument(SkWStream* stream,
|
||||
void (*doneProc)(SkWStream*, bool),
|
||||
SkScalar rasterDpi,
|
||||
SkPixelSerializer* jpegEncoder)
|
||||
@ -320,7 +318,7 @@ public:
|
||||
fCanon.setPixelSerializer(SkSafeRef(jpegEncoder));
|
||||
}
|
||||
|
||||
virtual ~SkDocument_PDF() {
|
||||
virtual ~SkPDFDocument() {
|
||||
// subclasses must call close() in their destructors
|
||||
this->close();
|
||||
}
|
||||
@ -380,24 +378,27 @@ private:
|
||||
} // namespace
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
|
||||
void (*proc)(SkWStream*, bool),
|
||||
SkScalar dpi,
|
||||
SkPixelSerializer* jpeg) {
|
||||
return stream ? sk_make_sp<SkPDFDocument>(stream, proc, dpi, jpeg) : nullptr;
|
||||
}
|
||||
|
||||
SkDocument* SkDocument::CreatePDF(SkWStream* stream, SkScalar dpi) {
|
||||
return stream ? new SkDocument_PDF(stream, nullptr, dpi, nullptr) : nullptr;
|
||||
return SkPDFMakeDocument(stream, nullptr, dpi, nullptr).release();
|
||||
}
|
||||
|
||||
SkDocument* SkDocument::CreatePDF(SkWStream* stream,
|
||||
SkScalar dpi,
|
||||
SkPixelSerializer* jpegEncoder) {
|
||||
return stream
|
||||
? new SkDocument_PDF(stream, nullptr, dpi, jpegEncoder)
|
||||
: nullptr;
|
||||
return SkPDFMakeDocument(stream, nullptr, dpi, jpegEncoder).release();
|
||||
}
|
||||
|
||||
SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) {
|
||||
SkFILEWStream* stream = new SkFILEWStream(path);
|
||||
if (!stream->isValid()) {
|
||||
delete stream;
|
||||
return nullptr;
|
||||
}
|
||||
auto delete_wstream = [](SkWStream* stream, bool) { delete stream; };
|
||||
return new SkDocument_PDF(stream, delete_wstream, dpi, nullptr);
|
||||
SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
|
||||
return stream->isValid()
|
||||
? SkPDFMakeDocument(stream.detach(), delete_wstream, dpi, nullptr).release()
|
||||
: nullptr;
|
||||
}
|
18
src/pdf/SkPDFDocument.h
Normal file
18
src/pdf/SkPDFDocument.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2016 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
#ifndef SkPDFDocument_DEFINED
|
||||
#define SkPDFDocument_DEFINED
|
||||
|
||||
#include "SkDocument.h"
|
||||
|
||||
sk_sp<SkDocument> SkPDFMakeDocument(
|
||||
SkWStream* stream,
|
||||
void (*doneProc)(SkWStream*, bool),
|
||||
SkScalar rasterDpi,
|
||||
SkPixelSerializer* jpegEncoder);
|
||||
|
||||
#endif // SkPDFDocument_DEFINED
|
Loading…
Reference in New Issue
Block a user