pdfviewer: make pdfviewer compile on mac
Review URL: https://codereview.chromium.org/23163007 git-svn-id: http://skia.googlecode.com/svn/trunk@10721 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
de1559c5a7
commit
33f11b6fcd
@ -359,11 +359,12 @@ smoothness number (PDF 1.3) The precision with which col
|
||||
|
||||
// TODO(edisonn): better class design.
|
||||
// TODO(edisonn): rename to SkPdfContext
|
||||
struct SkPdfContext {
|
||||
std::stack<SkPdfNativeObject*> fObjectStack;
|
||||
class SkPdfContext {
|
||||
public:
|
||||
std::stack<SkPdfNativeObject*> fObjectStack;
|
||||
std::stack<SkPdfGraphicsState> fStateStack;
|
||||
SkPdfGraphicsState fGraphicsState;
|
||||
SkPdfNativeDoc* fPdfDoc;
|
||||
SkPdfNativeDoc* fPdfDoc;
|
||||
// TODO(edisonn): the allocator, could be freed after the page is done drawing.
|
||||
SkPdfAllocator* fTmpPageAllocator;
|
||||
SkMatrix fOriginalMatrix;
|
||||
|
@ -479,9 +479,9 @@ static SkBitmap* getImageFromObjectCore(SkPdfContext* pdfContext, SkPdfImageDict
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int64_t bpc = image->BitsPerComponent(pdfContext->fPdfDoc);
|
||||
int64_t width = image->Width(pdfContext->fPdfDoc);
|
||||
int64_t height = image->Height(pdfContext->fPdfDoc);
|
||||
int bpc = (int)image->BitsPerComponent(pdfContext->fPdfDoc);
|
||||
int width = (int)image->Width(pdfContext->fPdfDoc);
|
||||
int height = (int)image->Height(pdfContext->fPdfDoc);
|
||||
std::string colorSpace = "DeviceRGB";
|
||||
|
||||
bool indexed = false;
|
||||
@ -500,7 +500,7 @@ static SkBitmap* getImageFromObjectCore(SkPdfContext* pdfContext, SkPdfImageDict
|
||||
) {
|
||||
// TODO(edisonn): suport only DeviceRGB for now.
|
||||
indexed = true;
|
||||
cnt = array->objAtAIndex(2)->intValue() + 1;
|
||||
cnt = (int)array->objAtAIndex(2)->intValue() + 1;
|
||||
if (cnt > 256) {
|
||||
// TODO(edionn): report NYIs
|
||||
return NULL;
|
||||
@ -1041,8 +1041,6 @@ static SkPdfResult PdfOp_Td(SkPdfContext* pdfContext, SkCanvas* canvas, PdfToken
|
||||
printf("stack size = %i\n", (int)pdfContext->fObjectStack.size());
|
||||
#endif
|
||||
double ty = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjectStack.pop();
|
||||
SkPdfNativeObject* obj = pdfContext->fObjectStack.top();
|
||||
obj = obj;
|
||||
double tx = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjectStack.pop();
|
||||
|
||||
double array[6] = {1, 0, 0, 1, tx, -ty};
|
||||
@ -1445,7 +1443,7 @@ static SkPdfResult PdfOp_ET(SkPdfContext* pdfContext, SkCanvas* canvas, PdfToken
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyFontCore(SkPdfContext* pdfContext, const SkPdfNativeObject* fontName, double fontSize) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyFontCore(SkPdfContext* pdfContext, const SkPdfNativeObject* fontName, double fontSize) {
|
||||
#ifdef PDF_TRACE
|
||||
printf("font name: %s\n", fontName->nameValue2().c_str());
|
||||
#endif
|
||||
@ -1799,32 +1797,32 @@ static SkPdfResult PdfOp_EI(SkPdfContext* pdfContext, SkCanvas* canvas, PdfToken
|
||||
|
||||
|
||||
// TODO(edisonn): security review here, make sure all parameters are valid, and safe.
|
||||
SkPdfResult skpdfGraphicsStateApply_ca(SkPdfContext* pdfContext, double ca) {
|
||||
static SkPdfResult skpdfGraphicsStateApply_ca(SkPdfContext* pdfContext, double ca) {
|
||||
pdfContext->fGraphicsState.fNonStroking.fOpacity = ca;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApply_CA(SkPdfContext* pdfContext, double CA) {
|
||||
static SkPdfResult skpdfGraphicsStateApply_CA(SkPdfContext* pdfContext, double CA) {
|
||||
pdfContext->fGraphicsState.fStroking.fOpacity = CA;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyLW(SkPdfContext* pdfContext, double lineWidth) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyLW(SkPdfContext* pdfContext, double lineWidth) {
|
||||
pdfContext->fGraphicsState.fLineWidth = lineWidth;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyLC(SkPdfContext* pdfContext, int64_t lineCap) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyLC(SkPdfContext* pdfContext, int64_t lineCap) {
|
||||
pdfContext->fGraphicsState.fLineCap = (int)lineCap;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyLJ(SkPdfContext* pdfContext, int64_t lineJoin) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyLJ(SkPdfContext* pdfContext, int64_t lineJoin) {
|
||||
pdfContext->fGraphicsState.fLineJoin = (int)lineJoin;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyML(SkPdfContext* pdfContext, double miterLimit) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyML(SkPdfContext* pdfContext, double miterLimit) {
|
||||
pdfContext->fGraphicsState.fMiterLimit = miterLimit;
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
@ -1839,7 +1837,7 @@ SkPdfResult skpdfGraphicsStateApplyML(SkPdfContext* pdfContext, double miterLimi
|
||||
6) [2 3] 11 1 on, 3 off, 2 on, 3 off, 2 on, …
|
||||
*/
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* intervals, SkPdfNativeObject* phase) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* intervals, SkPdfNativeObject* phase) {
|
||||
int cnt = intervals->size();
|
||||
if (cnt >= 256) {
|
||||
// TODO(edisonn): report error/warning, unsuported;
|
||||
@ -1877,7 +1875,7 @@ SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* inter
|
||||
return kOK_SkPdfResult;
|
||||
}
|
||||
|
||||
SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* dash) {
|
||||
static SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* dash) {
|
||||
// TODO(edisonn): verify input
|
||||
if (!dash || dash->isArray() || dash->size() != 2 || !dash->objAtAIndex(0)->isArray() || !dash->objAtAIndex(1)->isNumber()) {
|
||||
// TODO(edisonn): report error/warning
|
||||
@ -1886,7 +1884,7 @@ SkPdfResult skpdfGraphicsStateApplyD(SkPdfContext* pdfContext, SkPdfArray* dash)
|
||||
return skpdfGraphicsStateApplyD(pdfContext, (SkPdfArray*)dash->objAtAIndex(0), dash->objAtAIndex(1));
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplyFont(SkPdfContext* pdfContext, SkPdfArray* fontAndSize) {
|
||||
static void skpdfGraphicsStateApplyFont(SkPdfContext* pdfContext, SkPdfArray* fontAndSize) {
|
||||
if (!fontAndSize || fontAndSize->isArray() || fontAndSize->size() != 2 || !fontAndSize->objAtAIndex(0)->isName() || !fontAndSize->objAtAIndex(1)->isNumber()) {
|
||||
// TODO(edisonn): report error/warning
|
||||
return;
|
||||
@ -1978,7 +1976,7 @@ public:
|
||||
|
||||
InitBlendModes _gDummyInniter;
|
||||
|
||||
SkXfermode::Mode xferModeFromBlendMode(const char* blendMode, size_t len) {
|
||||
static SkXfermode::Mode xferModeFromBlendMode(const char* blendMode, size_t len) {
|
||||
SkXfermode::Mode mode = (SkXfermode::Mode)(SkXfermode::kLastMode + 1);
|
||||
if (gPdfBlendModes.find(blendMode, len, &mode)) {
|
||||
return mode;
|
||||
@ -1987,7 +1985,7 @@ SkXfermode::Mode xferModeFromBlendMode(const char* blendMode, size_t len) {
|
||||
return (SkXfermode::Mode)(SkXfermode::kLastMode + 1);
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplyBM_name(SkPdfContext* pdfContext, const std::string& blendMode) {
|
||||
static void skpdfGraphicsStateApplyBM_name(SkPdfContext* pdfContext, const std::string& blendMode) {
|
||||
SkXfermode::Mode mode = xferModeFromBlendMode(blendMode.c_str(), blendMode.length());
|
||||
if (mode <= SkXfermode::kLastMode) {
|
||||
pdfContext->fGraphicsState.fBlendModesLength = 1;
|
||||
@ -1997,7 +1995,7 @@ void skpdfGraphicsStateApplyBM_name(SkPdfContext* pdfContext, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplyBM_array(SkPdfContext* pdfContext, SkPdfArray* blendModes) {
|
||||
static void skpdfGraphicsStateApplyBM_array(SkPdfContext* pdfContext, SkPdfArray* blendModes) {
|
||||
if (!blendModes || blendModes->isArray() || blendModes->size() == 0 || blendModes->size() > 256) {
|
||||
// TODO(edisonn): report error/warning
|
||||
return;
|
||||
@ -2023,7 +2021,7 @@ void skpdfGraphicsStateApplyBM_array(SkPdfContext* pdfContext, SkPdfArray* blend
|
||||
}
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplySMask_dict(SkPdfContext* pdfContext, SkPdfDictionary* sMask) {
|
||||
static void skpdfGraphicsStateApplySMask_dict(SkPdfContext* pdfContext, SkPdfDictionary* sMask) {
|
||||
// TODO(edisonn): verify input
|
||||
if (pdfContext->fPdfDoc->mapper()->mapSoftMaskDictionary(sMask)) {
|
||||
pdfContext->fGraphicsState.fSoftMaskDictionary = (SkPdfSoftMaskDictionary*)sMask;
|
||||
@ -2035,7 +2033,7 @@ void skpdfGraphicsStateApplySMask_dict(SkPdfContext* pdfContext, SkPdfDictionary
|
||||
}
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplySMask_name(SkPdfContext* pdfContext, const std::string& sMask) {
|
||||
static void skpdfGraphicsStateApplySMask_name(SkPdfContext* pdfContext, const std::string& sMask) {
|
||||
if (sMask == "None") {
|
||||
pdfContext->fGraphicsState.fSoftMaskDictionary = NULL;
|
||||
pdfContext->fGraphicsState.fSMask = NULL;
|
||||
@ -2065,7 +2063,7 @@ void skpdfGraphicsStateApplySMask_name(SkPdfContext* pdfContext, const std::stri
|
||||
skpdfGraphicsStateApplySMask_dict(pdfContext, obj->asDictionary());
|
||||
}
|
||||
|
||||
void skpdfGraphicsStateApplyAIS(SkPdfContext* pdfContext, bool alphaSource) {
|
||||
static void skpdfGraphicsStateApplyAIS(SkPdfContext* pdfContext, bool alphaSource) {
|
||||
pdfContext->fGraphicsState.fAlphaSource = alphaSource;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "SkPdfUtils.h"
|
||||
#include "SkPdfConfig.h"
|
||||
|
||||
#ifdef PDF_TRACE
|
||||
void SkTraceMatrix(const SkMatrix& matrix, const char* sz) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "SkMatrix.h"
|
||||
#include "SkRect.h"
|
||||
#include "SkPdfConfig.h"
|
||||
|
||||
class SkPdfArray;
|
||||
class SkPdfContext;
|
||||
|
@ -39,7 +39,7 @@ static const Format gFormats[] = {
|
||||
{ SkImageEncoder::kWEBP_Type, SkImageDecoder::kWEBP_Format, ".webp" }
|
||||
};
|
||||
|
||||
SkISize opaqueSize(const SkBitmap& bm) {
|
||||
static SkISize opaqueSize(const SkBitmap& bm) {
|
||||
int width = 1;
|
||||
int height = 1;
|
||||
for (int y = 0 ; y < bm.height(); y++) {
|
||||
|
9
experimental/PdfViewer/copy_files.py
Normal file
9
experimental/PdfViewer/copy_files.py
Normal file
@ -0,0 +1,9 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
dstdir = sys.argv[1]
|
||||
|
||||
for i in range(2, len(sys.argv)):
|
||||
shutil.copy(sys.argv[i], dstdir)
|
||||
|
@ -468,12 +468,10 @@ class PdfClassManager:
|
||||
fileMapperNativeCpp.write('\n')
|
||||
|
||||
fileMapperNative.write('class SkPdfMapper {\n')
|
||||
|
||||
fileMapperNative.write(' SkPdfNativeDoc* fParsedDoc;\n')
|
||||
|
||||
fileMapperNative.write('public:\n')
|
||||
|
||||
fileMapperNative.write(' SkPdfMapper(SkPdfNativeDoc* doc) : fParsedDoc(doc) {}\n')
|
||||
fileMapperNative.write(' SkPdfMapper() {}\n')
|
||||
fileMapperNative.write('\n')
|
||||
|
||||
for name in self.fClassesNamesInOrder:
|
||||
|
@ -83,7 +83,7 @@ static bool add_page_and_replace_filename_extension(SkString* path, int page,
|
||||
return false;
|
||||
}
|
||||
|
||||
void make_filepath(SkString* path, const SkString& dir, const SkString& name) {
|
||||
static void make_filepath(SkString* path, const SkString& dir, const SkString& name) {
|
||||
size_t len = dir.size();
|
||||
path->set(dir);
|
||||
if (0 < len && '/' != dir[len - 1]) {
|
||||
@ -92,7 +92,7 @@ void make_filepath(SkString* path, const SkString& dir, const SkString& name) {
|
||||
path->append(name);
|
||||
}
|
||||
|
||||
bool is_path_seperator(const char chr) {
|
||||
static bool is_path_seperator(const char chr) {
|
||||
#if defined(SK_BUILD_FOR_WIN)
|
||||
return chr == '\\' || chr == '/';
|
||||
#else
|
||||
@ -100,7 +100,7 @@ bool is_path_seperator(const char chr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void get_basename(SkString* basename, const SkString& path) {
|
||||
static void get_basename(SkString* basename, const SkString& path) {
|
||||
if (path.size() == 0) {
|
||||
basename->reset();
|
||||
return;
|
||||
|
@ -7,10 +7,13 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "SkPdfFileTrailerDictionary_autogen.h"
|
||||
#include "SkPdfCatalogDictionary_autogen.h"
|
||||
#include "SkPdfPageObjectDictionary_autogen.h"
|
||||
#include "SkPdfPageTreeNodeDictionary_autogen.h"
|
||||
// TODO(edisonn): for some reason on mac these files are found here, but are found from headers
|
||||
//#include "SkPdfFileTrailerDictionary_autogen.h"
|
||||
//#include "SkPdfCatalogDictionary_autogen.h"
|
||||
//#include "SkPdfPageObjectDictionary_autogen.h"
|
||||
//#include "SkPdfPageTreeNodeDictionary_autogen.h"
|
||||
#include "SkPdfHeaders_autogen.h"
|
||||
|
||||
#include "SkPdfMapper_autogen.h"
|
||||
|
||||
#include "SkStream.h"
|
||||
@ -361,7 +364,7 @@ SkPdfNativeObject* SkPdfNativeDoc::readObject(int id/*, int expectedGeneration*/
|
||||
const unsigned char* current = fFileContent + startOffset;
|
||||
const unsigned char* end = fFileContent + fContentLength;
|
||||
|
||||
SkPdfNativeTokenizer tokenizer(current, end - current, fMapper, fAllocator, this);
|
||||
SkPdfNativeTokenizer tokenizer(current, end - current, fAllocator, this);
|
||||
|
||||
SkPdfNativeObject idObj;
|
||||
SkPdfNativeObject generationObj;
|
||||
@ -465,7 +468,7 @@ SkPdfNativeTokenizer* SkPdfNativeDoc::tokenizerOfStream(SkPdfNativeObject* strea
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new SkPdfNativeTokenizer(stream, fMapper, allocator, this);
|
||||
return new SkPdfNativeTokenizer(stream, allocator, this);
|
||||
}
|
||||
|
||||
// TODO(edisonn): NYI
|
||||
@ -473,7 +476,7 @@ SkPdfNativeTokenizer* SkPdfNativeDoc::tokenizerOfBuffer(const unsigned char* buf
|
||||
SkPdfAllocator* allocator) {
|
||||
// warning does not track two calls in the same buffer! the buffer is updated!
|
||||
// make a clean copy if needed!
|
||||
return new SkPdfNativeTokenizer(buffer, len, fMapper, allocator, this);
|
||||
return new SkPdfNativeTokenizer(buffer, len, allocator, this);
|
||||
}
|
||||
|
||||
size_t SkPdfNativeDoc::objects() const {
|
||||
|
@ -1,6 +1,9 @@
|
||||
|
||||
#include "SkPdfNativeObject.h"
|
||||
#include "SkPdfStreamCommonDictionary_autogen.h"
|
||||
|
||||
// TODO(edisonn): mac builder does not find the header ... but from headers is ok
|
||||
//#include "SkPdfStreamCommonDictionary_autogen.h"
|
||||
#include "SkPdfHeaders_autogen.h"
|
||||
|
||||
#include "SkFlate.h"
|
||||
#include "SkStream.h"
|
||||
|
@ -3,8 +3,11 @@
|
||||
#include "SkPdfNativeObject.h"
|
||||
#include "SkPdfConfig.h"
|
||||
|
||||
#include "SkPdfStreamCommonDictionary_autogen.h"
|
||||
#include "SkPdfImageDictionary_autogen.h"
|
||||
// TODO(edisonn): mac builder does not find the header ... but from headers is ok
|
||||
//#include "SkPdfStreamCommonDictionary_autogen.h"
|
||||
//#include "SkPdfImageDictionary_autogen.h"
|
||||
#include "SkPdfHeaders_autogen.h"
|
||||
|
||||
|
||||
// TODO(edisonn): perf!!!
|
||||
// there could be 0s between start and end! but not in the needle.
|
||||
@ -902,7 +905,7 @@ SkPdfNativeObject* SkPdfAllocator::allocObject() {
|
||||
}
|
||||
|
||||
// TODO(edisonn): perf: do no copy the buffers, but use them, and mark cache the result, so there is no need of a second pass
|
||||
SkPdfNativeTokenizer::SkPdfNativeTokenizer(SkPdfNativeObject* objWithStream, const SkPdfMapper* mapper, SkPdfAllocator* allocator, SkPdfNativeDoc* doc) : fDoc(doc), fMapper(mapper), fAllocator(allocator), fUncompressedStream(NULL), fUncompressedStreamEnd(NULL), fEmpty(false), fHasPutBack(false) {
|
||||
SkPdfNativeTokenizer::SkPdfNativeTokenizer(SkPdfNativeObject* objWithStream, SkPdfAllocator* allocator, SkPdfNativeDoc* doc) : fDoc(doc), fAllocator(allocator), fUncompressedStream(NULL), fUncompressedStreamEnd(NULL), fEmpty(false), fHasPutBack(false) {
|
||||
const unsigned char* buffer = NULL;
|
||||
size_t len = 0;
|
||||
objWithStream->GetFilteredStreamRef(&buffer, &len);
|
||||
@ -915,7 +918,7 @@ SkPdfNativeTokenizer::SkPdfNativeTokenizer(SkPdfNativeObject* objWithStream, con
|
||||
fUncompressedStreamEnd = fUncompressedStream + len;
|
||||
}
|
||||
|
||||
SkPdfNativeTokenizer::SkPdfNativeTokenizer(const unsigned char* buffer, int len, const SkPdfMapper* mapper, SkPdfAllocator* allocator, SkPdfNativeDoc* doc) : fDoc(doc), fMapper(mapper), fAllocator(allocator), fEmpty(false), fHasPutBack(false) {
|
||||
SkPdfNativeTokenizer::SkPdfNativeTokenizer(const unsigned char* buffer, int len, SkPdfAllocator* allocator, SkPdfNativeDoc* doc) : fDoc(doc), fAllocator(allocator), fEmpty(false), fHasPutBack(false) {
|
||||
// TODO(edisonn): hack, find end of object
|
||||
char* endobj = strrstrk((char*)buffer, (char*)buffer + len, "endobj");
|
||||
if (endobj) {
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
class SkPdfMapper;
|
||||
class SkPdfDictionary;
|
||||
class SkPdfImageDictionary;
|
||||
|
||||
@ -128,8 +127,8 @@ struct PdfToken {
|
||||
|
||||
class SkPdfNativeTokenizer {
|
||||
public:
|
||||
SkPdfNativeTokenizer(SkPdfNativeObject* objWithStream, const SkPdfMapper* mapper, SkPdfAllocator* allocator, SkPdfNativeDoc* doc);
|
||||
SkPdfNativeTokenizer(const unsigned char* buffer, int len, const SkPdfMapper* mapper, SkPdfAllocator* allocator, SkPdfNativeDoc* doc);
|
||||
SkPdfNativeTokenizer(SkPdfNativeObject* objWithStream, SkPdfAllocator* allocator, SkPdfNativeDoc* doc);
|
||||
SkPdfNativeTokenizer(const unsigned char* buffer, int len, SkPdfAllocator* allocator, SkPdfNativeDoc* doc);
|
||||
|
||||
virtual ~SkPdfNativeTokenizer();
|
||||
|
||||
@ -140,7 +139,6 @@ public:
|
||||
|
||||
private:
|
||||
SkPdfNativeDoc* fDoc;
|
||||
const SkPdfMapper* fMapper;
|
||||
SkPdfAllocator* fAllocator;
|
||||
|
||||
const unsigned char* fUncompressedStreamStart;
|
||||
|
@ -7,6 +7,21 @@
|
||||
'includes': [
|
||||
'apptype_console.gypi',
|
||||
],
|
||||
# TODO(edisonn): Hack! on mack, SHARED_INTERMEDIATE_DIR can't be reliable used in a sources context
|
||||
'conditions' : [
|
||||
[ 'skia_os != "mac"', {
|
||||
'variables': {
|
||||
'GENERATE_DIR%' : '<(SHARED_INTERMEDIATE_DIR)',
|
||||
},
|
||||
},
|
||||
],
|
||||
[ 'skia_os == "mac"', {
|
||||
'variables': {
|
||||
'GENERATE_DIR%' : '../src/tmp_autogen',
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'libpdfviewer',
|
||||
@ -22,17 +37,8 @@
|
||||
'../experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.cpp',
|
||||
'../experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp',
|
||||
'../experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp',
|
||||
],
|
||||
'copies': [
|
||||
{
|
||||
'files': [
|
||||
'../experimental/PdfViewer/datatypes.py',
|
||||
'../experimental/PdfViewer/generate_code.py',
|
||||
],
|
||||
'destination': '<(SHARED_INTERMEDIATE_DIR)',
|
||||
},
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
@ -42,34 +48,49 @@
|
||||
'../experimental/PdfViewer/PdfReference-okular-1.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py',
|
||||
'<(GENERATE_DIR)/pdfspec_autogen.py',
|
||||
],
|
||||
'action': ['python', '../experimental/PdfViewer/spec2def.py', '../experimental/PdfViewer/PdfReference-okular-1.txt', '<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py'],
|
||||
'action': ['python', '../experimental/PdfViewer/spec2def.py', '../experimental/PdfViewer/PdfReference-okular-1.txt', '<(GENERATE_DIR)/pdfspec_autogen.py'],
|
||||
},
|
||||
{
|
||||
'action_name': 'copy_files',
|
||||
'variables': {
|
||||
'sources' : [
|
||||
'../experimental/PdfViewer/datatypes.py',
|
||||
'../experimental/PdfViewer/generate_code.py',
|
||||
]
|
||||
},
|
||||
'inputs' : ['<(sources)'],
|
||||
'outputs': [
|
||||
'<(GENERATE_DIR)/datatypes.py',
|
||||
'<(GENERATE_DIR)/generate_code.py',
|
||||
],
|
||||
'action': ['python', '../experimental/PdfViewer/copy_files.py', '<(GENERATE_DIR)', '<@(sources)'],
|
||||
},
|
||||
{
|
||||
'action_name': 'generate_code',
|
||||
'inputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/datatypes.py',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/generate_code.py',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pdfspec_autogen.py',
|
||||
'<(GENERATE_DIR)/datatypes.py',
|
||||
'<(GENERATE_DIR)/generate_code.py',
|
||||
'<(GENERATE_DIR)/pdfspec_autogen.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfEnums_autogen.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfEnums_autogen.h',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfMapper_autogen.h',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfHeaders_autogen.h',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfMapper_autogen.cpp',
|
||||
'<(GENERATE_DIR)/native/autogen/SkPdfHeaders_autogen.cpp',
|
||||
# TODO(edisonn): ok, there are many more files here, which we should list but since
|
||||
# any change in the above should trigger a change here, we should be fine normally
|
||||
],
|
||||
'action': ['python', '<(SHARED_INTERMEDIATE_DIR)/generate_code.py', '<(SHARED_INTERMEDIATE_DIR)'],
|
||||
'action': ['python', '<(GENERATE_DIR)/generate_code.py', '<(GENERATE_DIR)'],
|
||||
},
|
||||
],
|
||||
'include_dirs': [
|
||||
'../experimental/PdfViewer',
|
||||
'../experimental/PdfViewer/pdfparser',
|
||||
'../experimental/PdfViewer/pdfparser/native',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/native/autogen',
|
||||
'<(GENERATE_DIR)/native/autogen',
|
||||
],
|
||||
'dependencies': [
|
||||
'skia_lib.gyp:skia_lib',
|
||||
|
Loading…
Reference in New Issue
Block a user