muhammara 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +3 -0
- package/node_modules/@mapbox/node-pre-gyp/package.json +6 -7
- package/node_modules/ansi-regex/package.json +1 -2
- package/node_modules/brace-expansion/package.json +2 -1
- package/node_modules/gauge/CHANGELOG.md +163 -0
- package/node_modules/gauge/LICENSE +13 -0
- package/node_modules/gauge/README.md +1 -1
- package/node_modules/gauge/{lib/base-theme.js → base-theme.js} +3 -7
- package/node_modules/gauge/{lib/error.js → error.js} +0 -0
- package/node_modules/gauge/{lib/has-color.js → has-color.js} +0 -0
- package/node_modules/gauge/{lib/index.js → index.js} +32 -89
- package/node_modules/gauge/package.json +42 -37
- package/node_modules/gauge/{lib/plumbing.js → plumbing.js} +1 -3
- package/node_modules/gauge/{lib/process.js → process.js} +0 -0
- package/node_modules/gauge/{lib/progress-bar.js → progress-bar.js} +5 -11
- package/node_modules/gauge/{lib/render-template.js → render-template.js} +24 -68
- package/node_modules/gauge/{lib/set-immediate.js → set-immediate.js} +0 -0
- package/node_modules/gauge/{lib/set-interval.js → set-interval.js} +0 -0
- package/node_modules/gauge/{lib/spin.js → spin.js} +0 -0
- package/node_modules/gauge/{lib/template-item.js → template-item.js} +6 -21
- package/node_modules/gauge/{lib/theme-set.js → theme-set.js} +23 -31
- package/node_modules/gauge/{lib/themes.js → themes.js} +13 -13
- package/node_modules/gauge/{lib/wide-truncate.js → wide-truncate.js} +3 -9
- package/node_modules/minimatch/README.md +22 -1
- package/node_modules/minimatch/minimatch.js +93 -69
- package/node_modules/minimatch/package.json +11 -10
- package/node_modules/minipass/index.js +6 -1
- package/node_modules/minipass/package.json +5 -5
- package/node_modules/node-fetch/lib/index.es.js +28 -2
- package/node_modules/node-fetch/lib/index.js +28 -2
- package/node_modules/node-fetch/lib/index.mjs +28 -2
- package/node_modules/node-fetch/package.json +13 -5
- package/node_modules/npmlog/LICENSE +15 -0
- package/node_modules/npmlog/{lib/log.js → log.js} +9 -9
- package/node_modules/npmlog/package.json +20 -31
- package/node_modules/object-assign/index.js +90 -0
- package/node_modules/object-assign/license +21 -0
- package/node_modules/object-assign/package.json +74 -0
- package/node_modules/object-assign/readme.md +61 -0
- package/node_modules/signal-exit/index.js +4 -2
- package/node_modules/signal-exit/package.json +5 -5
- package/package.json +1 -1
- package/src/deps/PDFWriter/CMakeLists.txt +8 -0
- package/src/deps/PDFWriter/DecryptionHelper.cpp +10 -8
- package/src/deps/PDFWriter/Deletable.h +46 -0
- package/src/deps/PDFWriter/DocumentContext.h +3 -3
- package/src/deps/PDFWriter/IDeletable.h +6 -0
- package/src/deps/PDFWriter/InputLZWDecodeStream.cpp +208 -0
- package/src/deps/PDFWriter/InputLZWDecodeStream.h +77 -0
- package/src/deps/PDFWriter/InputStreamSkipperStream.cpp +1 -1
- package/src/deps/PDFWriter/JPEGImageHandler.h +2 -2
- package/src/deps/PDFWriter/ObjectsContext.cpp +5 -0
- package/src/deps/PDFWriter/ObjectsContext.h +1 -0
- package/src/deps/PDFWriter/PDFDocumentHandler.cpp +19 -3
- package/src/deps/PDFWriter/PDFObject.cpp +13 -11
- package/src/deps/PDFWriter/PDFObject.h +7 -5
- package/src/deps/PDFWriter/PDFObjectParser.cpp +8 -0
- package/src/deps/PDFWriter/PDFObjectParser.h +6 -0
- package/src/deps/PDFWriter/PDFParser.cpp +25 -13
- package/src/deps/PDFWriter/PDFParserTokenizer.cpp +25 -24
- package/src/deps/PDFWriter/PDFParserTokenizer.h +1 -0
- package/src/deps/PDFWriter/PDFWriter.h +2 -2
- package/src/deps/PDFWriter/binding.gyp +2 -0
- package/node_modules/gauge/LICENSE.md +0 -20
- package/node_modules/gauge/lib/demo.js +0 -45
- package/node_modules/npmlog/LICENSE.md +0 -20
- package/src/deps/PDFWriter/InputPredictorPNGAverageStream.cpp +0 -120
- package/src/deps/PDFWriter/InputPredictorPNGAverageStream.h +0 -49
- package/src/deps/PDFWriter/InputPredictorPNGNoneStream.cpp +0 -109
- package/src/deps/PDFWriter/InputPredictorPNGNoneStream.h +0 -47
- package/src/deps/PDFWriter/InputPredictorPNGPaethStream.cpp +0 -136
- package/src/deps/PDFWriter/InputPredictorPNGPaethStream.h +0 -51
- package/src/deps/PDFWriter/InputPredictorPNGSubStream.cpp +0 -113
- package/src/deps/PDFWriter/InputPredictorPNGSubStream.h +0 -47
- package/src/deps/PDFWriter/InputPredictorPNGUpStream.cpp +0 -120
- package/src/deps/PDFWriter/InputPredictorPNGUpStream.h +0 -49
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGPaethStream.cpp
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#include "InputPredictorPNGPaethStream.h"
|
|
22
|
-
#include "Trace.h"
|
|
23
|
-
|
|
24
|
-
#include <stdlib.h>
|
|
25
|
-
|
|
26
|
-
using namespace IOBasicTypes;
|
|
27
|
-
|
|
28
|
-
InputPredictorPNGPaethStream::InputPredictorPNGPaethStream(void)
|
|
29
|
-
{
|
|
30
|
-
mSourceStream = NULL;
|
|
31
|
-
mBuffer = NULL;
|
|
32
|
-
mIndex = NULL;
|
|
33
|
-
mBufferSize = 0;
|
|
34
|
-
mUpValues = NULL;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
InputPredictorPNGPaethStream::~InputPredictorPNGPaethStream(void)
|
|
39
|
-
{
|
|
40
|
-
delete[] mBuffer;
|
|
41
|
-
delete[] mUpValues;
|
|
42
|
-
delete mSourceStream;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
InputPredictorPNGPaethStream::InputPredictorPNGPaethStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
46
|
-
{
|
|
47
|
-
mSourceStream = NULL;
|
|
48
|
-
mBuffer = NULL;
|
|
49
|
-
mIndex = NULL;
|
|
50
|
-
mBufferSize = 0;
|
|
51
|
-
mUpValues = NULL;
|
|
52
|
-
|
|
53
|
-
Assign(inSourceStream,inColumns);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
LongBufferSizeType InputPredictorPNGPaethStream::Read(Byte* inBuffer,LongBufferSizeType inBufferSize)
|
|
58
|
-
{
|
|
59
|
-
LongBufferSizeType readBytes = 0;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// exhaust what's in the buffer currently
|
|
63
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
64
|
-
{
|
|
65
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
66
|
-
++readBytes;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// now repeatedly read bytes from the input stream, and decode
|
|
70
|
-
while(readBytes < inBufferSize && mSourceStream->NotEnded())
|
|
71
|
-
{
|
|
72
|
-
memcpy(mUpValues,mBuffer,mBufferSize);
|
|
73
|
-
|
|
74
|
-
LongBufferSizeType readFromSource = mSourceStream->Read(mBuffer, mBufferSize);
|
|
75
|
-
if (readFromSource == 0) {
|
|
76
|
-
break; // a belated end. must be flate
|
|
77
|
-
}
|
|
78
|
-
if (readFromSource != mBufferSize)
|
|
79
|
-
{
|
|
80
|
-
TRACE_LOG("InputPredictorPNGOptimumStream::Read, problem, expected columns number read. didn't make it");
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
*mBuffer = 0; // so i can use this as "left" value...we don't care about this one...it's just a tag
|
|
84
|
-
mIndex = mBuffer+1; // skip the first tag
|
|
85
|
-
|
|
86
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
87
|
-
{
|
|
88
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
89
|
-
++readBytes;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return readBytes;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
bool InputPredictorPNGPaethStream::NotEnded()
|
|
96
|
-
{
|
|
97
|
-
return mSourceStream->NotEnded() || (LongBufferSizeType)(mIndex - mBuffer) < mBufferSize;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
void InputPredictorPNGPaethStream::DecodeNextByte(Byte& outDecodedByte)
|
|
101
|
-
{
|
|
102
|
-
outDecodedByte = (Byte)(PaethPredictor(mBuffer[mIndex-mBuffer - 1],mUpValues[mIndex-mBuffer],mUpValues[mIndex-mBuffer - 1]) + (char)*mIndex);
|
|
103
|
-
|
|
104
|
-
*mIndex = outDecodedByte; // saving the encoded value back to the buffer, for later copying as "Up value", and current using as "Left" value
|
|
105
|
-
++mIndex;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
void InputPredictorPNGPaethStream::Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
109
|
-
{
|
|
110
|
-
mSourceStream = inSourceStream;
|
|
111
|
-
|
|
112
|
-
delete[] mBuffer;
|
|
113
|
-
delete[] mUpValues;
|
|
114
|
-
mBufferSize = inColumns + 1;
|
|
115
|
-
mBuffer = new Byte[mBufferSize];
|
|
116
|
-
memset(mBuffer,0,mBufferSize);
|
|
117
|
-
mUpValues = new Byte[mBufferSize];
|
|
118
|
-
memset(mUpValues,0,mBufferSize); // that's less important
|
|
119
|
-
mIndex = mBuffer + mBufferSize;
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
char InputPredictorPNGPaethStream::PaethPredictor(char inLeft,char inUp,char inUpLeft)
|
|
124
|
-
{
|
|
125
|
-
int p = inLeft + inUp - inUpLeft;
|
|
126
|
-
int pLeft = abs(p - inLeft);
|
|
127
|
-
int pUp = abs(p - inUp);
|
|
128
|
-
int pUpLeft = abs(p - inUpLeft);
|
|
129
|
-
|
|
130
|
-
if(pLeft <= pUp && pLeft <= pUpLeft)
|
|
131
|
-
return pLeft;
|
|
132
|
-
else if(pUp <= pUpLeft)
|
|
133
|
-
return inUp;
|
|
134
|
-
else
|
|
135
|
-
return inUpLeft;
|
|
136
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGPaethStream.h
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#pragma once
|
|
22
|
-
|
|
23
|
-
#include "IByteReader.h"
|
|
24
|
-
|
|
25
|
-
class InputPredictorPNGPaethStream : public IByteReader
|
|
26
|
-
{
|
|
27
|
-
public:
|
|
28
|
-
InputPredictorPNGPaethStream(void);
|
|
29
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
30
|
-
InputPredictorPNGPaethStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
31
|
-
virtual ~InputPredictorPNGPaethStream(void);
|
|
32
|
-
|
|
33
|
-
virtual IOBasicTypes::LongBufferSizeType Read(IOBasicTypes::Byte* inBuffer,IOBasicTypes::LongBufferSizeType inBufferSize);
|
|
34
|
-
|
|
35
|
-
virtual bool NotEnded();
|
|
36
|
-
|
|
37
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
38
|
-
void Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
39
|
-
|
|
40
|
-
private:
|
|
41
|
-
IByteReader* mSourceStream;
|
|
42
|
-
IOBasicTypes::Byte* mBuffer;
|
|
43
|
-
IOBasicTypes::LongBufferSizeType mBufferSize;
|
|
44
|
-
IOBasicTypes::Byte* mIndex;
|
|
45
|
-
|
|
46
|
-
IOBasicTypes::Byte* mUpValues;
|
|
47
|
-
|
|
48
|
-
void DecodeNextByte(IOBasicTypes::Byte& outDecodedByte);
|
|
49
|
-
|
|
50
|
-
char PaethPredictor(char inLeft,char inUp,char inUpLeft);
|
|
51
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGSubStream.cpp
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#include "InputPredictorPNGSubStream.h"
|
|
22
|
-
|
|
23
|
-
#include "Trace.h"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
using namespace IOBasicTypes;
|
|
27
|
-
|
|
28
|
-
InputPredictorPNGSubStream::InputPredictorPNGSubStream(void)
|
|
29
|
-
{
|
|
30
|
-
mSourceStream = NULL;
|
|
31
|
-
mBuffer = NULL;
|
|
32
|
-
mIndex = NULL;
|
|
33
|
-
mBufferSize = 0;
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
InputPredictorPNGSubStream::~InputPredictorPNGSubStream(void)
|
|
38
|
-
{
|
|
39
|
-
delete[] mBuffer;
|
|
40
|
-
delete mSourceStream;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
InputPredictorPNGSubStream::InputPredictorPNGSubStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
44
|
-
{
|
|
45
|
-
mSourceStream = NULL;
|
|
46
|
-
mBuffer = NULL;
|
|
47
|
-
mIndex = NULL;
|
|
48
|
-
mBufferSize = 0;
|
|
49
|
-
|
|
50
|
-
Assign(inSourceStream,inColumns);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
LongBufferSizeType InputPredictorPNGSubStream::Read(Byte* inBuffer,LongBufferSizeType inBufferSize)
|
|
55
|
-
{
|
|
56
|
-
LongBufferSizeType readBytes = 0;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// exhaust what's in the buffer currently
|
|
60
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
61
|
-
{
|
|
62
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
63
|
-
++readBytes;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// now repeatedly read bytes from the input stream, and decode
|
|
67
|
-
while(readBytes < inBufferSize && mSourceStream->NotEnded())
|
|
68
|
-
{
|
|
69
|
-
LongBufferSizeType readFromSource = mSourceStream->Read(mBuffer, mBufferSize);
|
|
70
|
-
if (readFromSource == 0) {
|
|
71
|
-
break; // a belated end. must be flate
|
|
72
|
-
}
|
|
73
|
-
if (readFromSource != mBufferSize)
|
|
74
|
-
{
|
|
75
|
-
TRACE_LOG("InputPredictorPNGOptimumStream::Read, problem, expected columns number read. didn't make it");
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
*mBuffer = 0; // so i can use this as "left" value...we don't care about this one...it's just a tag
|
|
79
|
-
mIndex = mBuffer+1; // skip the first tag
|
|
80
|
-
|
|
81
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
82
|
-
{
|
|
83
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
84
|
-
++readBytes;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return readBytes;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
bool InputPredictorPNGSubStream::NotEnded()
|
|
91
|
-
{
|
|
92
|
-
return mSourceStream->NotEnded() || (LongBufferSizeType)(mIndex - mBuffer) < mBufferSize;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
void InputPredictorPNGSubStream::DecodeNextByte(Byte& outDecodedByte)
|
|
96
|
-
{
|
|
97
|
-
outDecodedByte = (Byte)((char)mBuffer[mIndex-mBuffer - 1] + (char)*mIndex);
|
|
98
|
-
|
|
99
|
-
*mIndex = outDecodedByte; // saving the encoded value back to the buffer, as "Left" value
|
|
100
|
-
++mIndex;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
void InputPredictorPNGSubStream::Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
104
|
-
{
|
|
105
|
-
mSourceStream = inSourceStream;
|
|
106
|
-
|
|
107
|
-
delete[] mBuffer;
|
|
108
|
-
mBufferSize = inColumns + 1;
|
|
109
|
-
mBuffer = new Byte[mBufferSize];
|
|
110
|
-
memset(mBuffer,0,mBufferSize);
|
|
111
|
-
mIndex = mBuffer + mBufferSize;
|
|
112
|
-
|
|
113
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGSubStream.h
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#pragma once
|
|
22
|
-
|
|
23
|
-
#include "IByteReader.h"
|
|
24
|
-
|
|
25
|
-
class InputPredictorPNGSubStream : public IByteReader
|
|
26
|
-
{
|
|
27
|
-
public:
|
|
28
|
-
InputPredictorPNGSubStream(void);
|
|
29
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
30
|
-
InputPredictorPNGSubStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
31
|
-
virtual ~InputPredictorPNGSubStream(void);
|
|
32
|
-
|
|
33
|
-
virtual IOBasicTypes::LongBufferSizeType Read(IOBasicTypes::Byte* inBuffer,IOBasicTypes::LongBufferSizeType inBufferSize);
|
|
34
|
-
|
|
35
|
-
virtual bool NotEnded();
|
|
36
|
-
|
|
37
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
38
|
-
void Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
39
|
-
|
|
40
|
-
private:
|
|
41
|
-
IByteReader* mSourceStream;
|
|
42
|
-
IOBasicTypes::Byte* mBuffer;
|
|
43
|
-
IOBasicTypes::LongBufferSizeType mBufferSize;
|
|
44
|
-
IOBasicTypes::Byte* mIndex;
|
|
45
|
-
|
|
46
|
-
void DecodeNextByte(IOBasicTypes::Byte& outDecodedByte);
|
|
47
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGUpStream.cpp
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#include "InputPredictorPNGUpStream.h"
|
|
22
|
-
|
|
23
|
-
#include "Trace.h"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
using namespace IOBasicTypes;
|
|
27
|
-
|
|
28
|
-
InputPredictorPNGUpStream::InputPredictorPNGUpStream(void)
|
|
29
|
-
{
|
|
30
|
-
mSourceStream = NULL;
|
|
31
|
-
mBuffer = NULL;
|
|
32
|
-
mIndex = NULL;
|
|
33
|
-
mBufferSize = 0;
|
|
34
|
-
mUpValues = NULL;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
InputPredictorPNGUpStream::~InputPredictorPNGUpStream(void)
|
|
39
|
-
{
|
|
40
|
-
delete[] mBuffer;
|
|
41
|
-
delete[] mUpValues;
|
|
42
|
-
delete mSourceStream;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
InputPredictorPNGUpStream::InputPredictorPNGUpStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
46
|
-
{
|
|
47
|
-
mSourceStream = NULL;
|
|
48
|
-
mBuffer = NULL;
|
|
49
|
-
mIndex = NULL;
|
|
50
|
-
mBufferSize = 0;
|
|
51
|
-
mUpValues = NULL;
|
|
52
|
-
|
|
53
|
-
Assign(inSourceStream,inColumns);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
LongBufferSizeType InputPredictorPNGUpStream::Read(Byte* inBuffer,LongBufferSizeType inBufferSize)
|
|
58
|
-
{
|
|
59
|
-
LongBufferSizeType readBytes = 0;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// exhaust what's in the buffer currently
|
|
63
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
64
|
-
{
|
|
65
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
66
|
-
++readBytes;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// now repeatedly read bytes from the input stream, and decode
|
|
70
|
-
while(readBytes < inBufferSize && mSourceStream->NotEnded())
|
|
71
|
-
{
|
|
72
|
-
memcpy(mUpValues,mBuffer,mBufferSize);
|
|
73
|
-
|
|
74
|
-
LongBufferSizeType readFromSource = mSourceStream->Read(mBuffer, mBufferSize);
|
|
75
|
-
if (readFromSource == 0) {
|
|
76
|
-
break; // a belated end. must be flate
|
|
77
|
-
}
|
|
78
|
-
if (readFromSource != mBufferSize)
|
|
79
|
-
{
|
|
80
|
-
TRACE_LOG("InputPredictorPNGOptimumStream::Read, problem, expected columns number read. didn't make it");
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
mIndex = mBuffer+1; // skip the first tag
|
|
84
|
-
|
|
85
|
-
while(mBufferSize > (LongBufferSizeType)(mIndex - mBuffer) && readBytes < inBufferSize)
|
|
86
|
-
{
|
|
87
|
-
DecodeNextByte(inBuffer[readBytes]);
|
|
88
|
-
++readBytes;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return readBytes;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
bool InputPredictorPNGUpStream::NotEnded()
|
|
95
|
-
{
|
|
96
|
-
return mSourceStream->NotEnded() || (LongBufferSizeType)(mIndex - mBuffer) < mBufferSize;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
void InputPredictorPNGUpStream::DecodeNextByte(Byte& outDecodedByte)
|
|
100
|
-
{
|
|
101
|
-
outDecodedByte = (Byte)((char)mUpValues[mIndex-mBuffer] + (char)*mIndex);
|
|
102
|
-
|
|
103
|
-
*mIndex = outDecodedByte; // saving the encoded value back to the buffer, for later copying as "Up value"
|
|
104
|
-
++mIndex;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
void InputPredictorPNGUpStream::Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns)
|
|
108
|
-
{
|
|
109
|
-
mSourceStream = inSourceStream;
|
|
110
|
-
|
|
111
|
-
delete[] mBuffer;
|
|
112
|
-
delete[] mUpValues;
|
|
113
|
-
mBufferSize = inColumns + 1;
|
|
114
|
-
mBuffer = new Byte[mBufferSize];
|
|
115
|
-
memset(mBuffer,0,mBufferSize);
|
|
116
|
-
mUpValues = new Byte[mBufferSize];
|
|
117
|
-
memset(mUpValues,0,mBufferSize); // that's less important
|
|
118
|
-
mIndex = mBuffer + mBufferSize;
|
|
119
|
-
|
|
120
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Source File : InputPredictorPNGUpStream.h
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright 2011 Gal Kahana PDFWriter
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
#pragma once
|
|
22
|
-
|
|
23
|
-
#include "IByteReader.h"
|
|
24
|
-
|
|
25
|
-
class InputPredictorPNGUpStream : public IByteReader
|
|
26
|
-
{
|
|
27
|
-
public:
|
|
28
|
-
InputPredictorPNGUpStream(void);
|
|
29
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
30
|
-
InputPredictorPNGUpStream(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
31
|
-
virtual ~InputPredictorPNGUpStream(void);
|
|
32
|
-
|
|
33
|
-
virtual IOBasicTypes::LongBufferSizeType Read(IOBasicTypes::Byte* inBuffer,IOBasicTypes::LongBufferSizeType inBufferSize);
|
|
34
|
-
|
|
35
|
-
virtual bool NotEnded();
|
|
36
|
-
|
|
37
|
-
// Takes ownership (use Assign(NULL,0) to unassign)
|
|
38
|
-
void Assign(IByteReader* inSourceStream,IOBasicTypes::LongBufferSizeType inColumns);
|
|
39
|
-
|
|
40
|
-
private:
|
|
41
|
-
IByteReader* mSourceStream;
|
|
42
|
-
IOBasicTypes::Byte* mBuffer;
|
|
43
|
-
IOBasicTypes::LongBufferSizeType mBufferSize;
|
|
44
|
-
IOBasicTypes::Byte* mIndex;
|
|
45
|
-
|
|
46
|
-
IOBasicTypes::Byte* mUpValues;
|
|
47
|
-
|
|
48
|
-
void DecodeNextByte(IOBasicTypes::Byte& outDecodedByte);
|
|
49
|
-
};
|