print addons: remove invalid use of auto_ptr
GCC 13 warns that the use of auto_ptr on an array can lead to undefined behavior, because auto_ptr will use `delete` instead of `delete[]`. Replaced the use with `std::vector` instead. Since the `data()` member was only introduced in C++11, the solution uses the [] operator instead to get the address of the beginning of the array. Change-Id: Ib457580eedb03338a454fb96b27602c3830c1634 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6644 Reviewed-by: Adrien Destugues <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
1f2e9ca260
commit
fdc8b001a9
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "Lips3.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Bitmap.h>
|
||||
@@ -51,7 +51,7 @@ LIPS3Driver::StartDocument()
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ LIPS3Driver::StartPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ LIPS3Driver::EndPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ LIPS3Driver::EndDocument(bool)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,13 +162,10 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
int compressedSize;
|
||||
const uchar* buffer;
|
||||
|
||||
uchar* in_buffer = new uchar[in_size];
|
||||
uchar* out_buffer = new uchar[out_size];
|
||||
std::vector<uchar> in_buffer(in_size);
|
||||
std::vector<uchar> out_buffer(out_size);
|
||||
|
||||
auto_ptr<uchar> _in_buffer (in_buffer);
|
||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||
|
||||
uchar* ptr2 = static_cast<uchar*>(in_buffer);
|
||||
uchar* ptr2 = &in_buffer[0];
|
||||
|
||||
DBGMSG(("move\n"));
|
||||
|
||||
@@ -181,12 +178,12 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
y++;
|
||||
}
|
||||
|
||||
compressedSize = compress3(out_buffer, in_buffer, in_size);
|
||||
compressedSize = compress3(&out_buffer[0], &in_buffer[0], in_size);
|
||||
|
||||
if (compressedSize < in_size) {
|
||||
compressionMethod = 9;
|
||||
// compress3
|
||||
buffer = out_buffer;
|
||||
buffer = &out_buffer[0];
|
||||
} else if (compressedSize > out_size) {
|
||||
BAlert* alert = new BAlert("memory overrun!!!", "warning",
|
||||
"OK");
|
||||
@@ -195,7 +192,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
return false;
|
||||
} else {
|
||||
compressionMethod = 0;
|
||||
buffer = in_buffer;
|
||||
buffer = &in_buffer[0];
|
||||
compressedSize = in_size;
|
||||
}
|
||||
|
||||
@@ -228,7 +225,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "Lips4Cap.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Bitmap.h>
|
||||
@@ -53,7 +53,7 @@ LIPS4Driver::StartDocument()
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ LIPS4Driver::StartPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ LIPS4Driver::EndPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ LIPS4Driver::EndDocument(bool)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,13 +172,10 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
int compressed_size;
|
||||
const uchar* buffer;
|
||||
|
||||
uchar* in_buffer = new uchar[in_size];
|
||||
uchar* out_buffer = new uchar[out_size];
|
||||
std::vector<uchar> in_buffer(in_size);
|
||||
std::vector<uchar> out_buffer(out_size);
|
||||
|
||||
auto_ptr<uchar> _in_buffer (in_buffer);
|
||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||
|
||||
uchar* ptr2 = static_cast<uchar *>(in_buffer);
|
||||
uchar* ptr2 = &in_buffer[0];
|
||||
|
||||
DBGMSG(("move\n"));
|
||||
|
||||
@@ -193,11 +190,11 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
|
||||
DBGMSG(("PackBits\n"));
|
||||
|
||||
compressed_size = pack_bits(out_buffer, in_buffer, in_size);
|
||||
compressed_size = pack_bits(&out_buffer[0], &in_buffer[0], in_size);
|
||||
|
||||
if (compressed_size < in_size) {
|
||||
compression_method = 11;
|
||||
buffer = out_buffer;
|
||||
buffer = &out_buffer[0];
|
||||
} else if (compressed_size > out_size) {
|
||||
BAlert* alert = new BAlert("memory overrun!!!", "warning", "OK");
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
@@ -205,7 +202,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
return false;
|
||||
} else {
|
||||
compression_method = 0;
|
||||
buffer = in_buffer;
|
||||
buffer = &in_buffer[0];
|
||||
compressed_size = in_size;
|
||||
}
|
||||
|
||||
@@ -238,7 +235,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "PCL5.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Bitmap.h>
|
||||
@@ -45,7 +45,7 @@ PCL5Driver::StartDocument()
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ PCL5Driver::EndPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ PCL5Driver::EndDocument(bool)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,11 +148,8 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
int compressedSize;
|
||||
const uchar* buffer;
|
||||
|
||||
uchar* in_buffer = new uchar[in_size];
|
||||
uchar* out_buffer = new uchar[out_size];
|
||||
|
||||
auto_ptr<uchar> _in_buffer (in_buffer);
|
||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||
std::vector<uchar> in_buffer(in_size);
|
||||
std::vector<uchar> out_buffer(out_size);
|
||||
|
||||
DBGMSG(("move\n"));
|
||||
|
||||
@@ -161,36 +158,36 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
|
||||
const bool color = GetJobData()->GetColor() == JobData::kColor;
|
||||
const int num_planes = color ? 3 : 1;
|
||||
|
||||
|
||||
if (color) {
|
||||
fHalftone->SetPlanes(Halftone::kPlaneRGB1);
|
||||
fHalftone->SetBlackValue(Halftone::kLowValueMeansBlack);
|
||||
}
|
||||
|
||||
|
||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||
|
||||
|
||||
for (int plane = 0; plane < num_planes; plane ++) {
|
||||
|
||||
fHalftone->Dither(in_buffer, ptr, x, y, width);
|
||||
|
||||
compressedSize = pack_bits(out_buffer, in_buffer, in_size);
|
||||
|
||||
|
||||
fHalftone->Dither(&in_buffer[0], ptr, x, y, width);
|
||||
|
||||
compressedSize = pack_bits(&out_buffer[0], &in_buffer[0], in_size);
|
||||
|
||||
if (compressedSize + _BytesToEnterCompressionMethod(2)
|
||||
< in_size + _BytesToEnterCompressionMethod(0)) {
|
||||
compressionMethod = 2; // back bits
|
||||
buffer = out_buffer;
|
||||
buffer = &out_buffer[0];
|
||||
} else {
|
||||
compressionMethod = 0; // uncompressed
|
||||
buffer = in_buffer;
|
||||
buffer = &in_buffer[0];
|
||||
compressedSize = in_size;
|
||||
}
|
||||
|
||||
|
||||
_RasterGraphics(
|
||||
compressionMethod,
|
||||
buffer,
|
||||
compressedSize,
|
||||
plane == num_planes - 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
ptr += delta;
|
||||
@@ -216,7 +213,7 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "ValidRect.h"
|
||||
|
||||
|
||||
// DeltaRowStreamCompressor writes the delta row directly to the
|
||||
// DeltaRowStreamCompressor writes the delta row directly to the
|
||||
// in the contructor specified stream.
|
||||
class DeltaRowStreamCompressor : public AbstractDeltaRowCompressor
|
||||
{
|
||||
@@ -37,15 +37,15 @@ public:
|
||||
AbstractDeltaRowCompressor(rowSize, initialSeed),
|
||||
fWriter(writer)
|
||||
{}
|
||||
|
||||
|
||||
protected:
|
||||
void AppendByteToDeltaRow(uchar byte)
|
||||
{
|
||||
fWriter->Append(byte);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
PCL6Writer* fWriter;
|
||||
PCL6Writer* fWriter;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ PCL6Driver::StartDocument()
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ PCL6Driver::EndDocument(bool)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
|
||||
try {
|
||||
int y = (int)offset->y;
|
||||
|
||||
|
||||
PCL6Rasterizer* rasterizer;
|
||||
if (_UseColorMode()) {
|
||||
#if COLOR_DEPTH == 8
|
||||
@@ -113,7 +113,7 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
#elif COLOR_DEPTH == 1
|
||||
rasterizer = new ColorRasterizer(fHalftone);
|
||||
#else
|
||||
#error COLOR_DEPTH must be either 1 or 8!
|
||||
#error COLOR_DEPTH must be either 1 or 8!
|
||||
#endif
|
||||
} else
|
||||
rasterizer = new MonochromeRasterizer(fHalftone);
|
||||
@@ -121,14 +121,14 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
auto_ptr<Rasterizer> _rasterizer(rasterizer);
|
||||
bool valid = rasterizer->SetBitmap((int)offset->x, (int)offset->y,
|
||||
bitmap, GetPageHeight());
|
||||
|
||||
|
||||
if (valid) {
|
||||
rasterizer->InitializeBuffer();
|
||||
|
||||
|
||||
// Use compressor to calculate delta row size
|
||||
DeltaRowCompressor* deltaRowCompressor = NULL;
|
||||
if (_SupportsDeltaRowCompression()) {
|
||||
deltaRowCompressor =
|
||||
deltaRowCompressor =
|
||||
new DeltaRowCompressor(rasterizer->GetOutRowSize(), 0);
|
||||
if (deltaRowCompressor->InitCheck() != B_OK) {
|
||||
delete deltaRowCompressor;
|
||||
@@ -137,15 +137,15 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
}
|
||||
auto_ptr<DeltaRowCompressor>_deltaRowCompressor(deltaRowCompressor);
|
||||
int deltaRowSize = 0;
|
||||
|
||||
// remember position
|
||||
|
||||
// remember position
|
||||
int xPage = rasterizer->GetX();
|
||||
int yPage = rasterizer->GetY();
|
||||
|
||||
|
||||
while (rasterizer->HasNextLine()) {
|
||||
const uchar* rowBuffer =
|
||||
const uchar* rowBuffer =
|
||||
static_cast<const uchar*>(rasterizer->RasterizeNextLine());
|
||||
|
||||
|
||||
if (deltaRowCompressor != NULL) {
|
||||
int size =
|
||||
deltaRowCompressor->CalculateSize(rowBuffer, true);
|
||||
@@ -153,9 +153,9 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
// two bytes for the row byte count
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
y = rasterizer->GetY();
|
||||
|
||||
|
||||
uchar* outBuffer = rasterizer->GetOutBuffer();
|
||||
int outBufferSize = rasterizer->GetOutBufferSize();
|
||||
int outRowSize = rasterizer->GetOutRowSize();
|
||||
@@ -179,7 +179,7 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -207,17 +207,17 @@ PCL6Driver::_WriteBitmap(const uchar* buffer, int outSize, int rowSize, int x,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// write bitmap
|
||||
_Move(x, y);
|
||||
|
||||
|
||||
_StartRasterGraphics(x, y, width, height, compressionMethod);
|
||||
|
||||
_RasterGraphics(buffer, outSize, dataSize, rowSize, height,
|
||||
compressionMethod);
|
||||
|
||||
_EndRasterGraphics();
|
||||
|
||||
|
||||
#if DISPLAY_COMPRESSION_STATISTICS
|
||||
fprintf(stderr, "Out Size %d %2.2f\n", (int)outSize, 100.0);
|
||||
#if ENABLE_RLE_COMPRESSION
|
||||
@@ -257,16 +257,16 @@ PCL6Driver::StartPage(int)
|
||||
if (GetJobData()->GetOrientation() == JobData::kLandscape) {
|
||||
orientation = PCL6Writer::kLandscape;
|
||||
}
|
||||
|
||||
PCL6Writer::MediaSize mediaSize =
|
||||
|
||||
PCL6Writer::MediaSize mediaSize =
|
||||
_MediaSize(GetJobData()->GetPaper());
|
||||
PCL6Writer::MediaSource mediaSource =
|
||||
PCL6Writer::MediaSource mediaSource =
|
||||
_MediaSource(GetJobData()->GetPaperSource());
|
||||
if (GetJobData()->GetPrintStyle() == JobData::kSimplex) {
|
||||
fWriter->BeginPage(orientation, mediaSize, mediaSource);
|
||||
} else if (GetJobData()->GetPrintStyle() == JobData::kDuplex) {
|
||||
// TODO move duplex binding option to UI
|
||||
fWriter->BeginPage(orientation, mediaSize, mediaSource,
|
||||
fWriter->BeginPage(orientation, mediaSize, mediaSource,
|
||||
PCL6Writer::kDuplexVerticalBinding, fMediaSide);
|
||||
|
||||
if (fMediaSide == PCL6Writer::kFrontMediaSide)
|
||||
@@ -275,7 +275,7 @@ PCL6Driver::StartPage(int)
|
||||
fMediaSide = PCL6Writer::kFrontMediaSide;
|
||||
} else
|
||||
return false;
|
||||
|
||||
|
||||
// PageOrigin from Windows NT printer driver
|
||||
int x = 142 * GetJobData()->GetXres() / 600;
|
||||
int y = 100 * GetJobData()->GetYres() / 600;
|
||||
@@ -300,7 +300,7 @@ PCL6Driver::_StartRasterGraphics(int x, int y, int width, int height,
|
||||
#elif COLOR_DEPTH == 1
|
||||
colorDepth = PCL6Writer::k1Bit;
|
||||
#else
|
||||
#error COLOR_DEPTH must be either 1 or 8!
|
||||
#error COLOR_DEPTH must be either 1 or 8!
|
||||
#endif
|
||||
} else
|
||||
colorDepth = PCL6Writer::k1Bit;
|
||||
@@ -324,7 +324,7 @@ PCL6Driver::_RasterGraphics(const uchar* buffer, int bufferSize, int dataSize,
|
||||
{
|
||||
// write bitmap byte size
|
||||
fWriter->EmbeddedDataPrefix32(dataSize);
|
||||
|
||||
|
||||
// write data
|
||||
if (compressionMethod == PCL6Writer::kRLECompression) {
|
||||
// use RLE compression
|
||||
@@ -339,18 +339,18 @@ PCL6Driver::_RasterGraphics(const uchar* buffer, int bufferSize, int dataSize,
|
||||
if (compressor.InitCheck() != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const uint8* row = buffer;
|
||||
for (int i = 0; i < height; i ++) {
|
||||
// write row byte count
|
||||
int32 size = compressor.CalculateSize(row);
|
||||
fWriter->Append((uint16)size);
|
||||
|
||||
|
||||
if (size > 0) {
|
||||
// write delta row
|
||||
compressor.Compress(row);
|
||||
}
|
||||
|
||||
|
||||
row += rowSize;
|
||||
}
|
||||
} else {
|
||||
@@ -369,7 +369,7 @@ PCL6Driver::EndPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "PS.h"
|
||||
|
||||
#include <memory.h>
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -96,7 +96,7 @@ PSDriver::_WritePSString(const char* format, ...)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_WritePSData(const void* data, size_t size)
|
||||
{
|
||||
if (fFilterIO)
|
||||
@@ -120,7 +120,7 @@ PSDriver::StartDocument()
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ PSDriver::EndPage(int)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ PSDriver::_SetupCTM()
|
||||
GetJobData()->GetPaperRect().Height()-topMargin);
|
||||
} else {
|
||||
// landscape:
|
||||
// move origin from bottom left to margin top and left
|
||||
// move origin from bottom left to margin top and left
|
||||
// and rotate page contents
|
||||
_WritePSString("%f %f translate\n", topMargin, leftMargin);
|
||||
_WritePSString("90 rotate\n");
|
||||
@@ -190,7 +190,7 @@ PSDriver::EndDocument(bool)
|
||||
}
|
||||
catch (TransportException& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ ToHexDigit(uchar value)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
{
|
||||
DBGMSG(("> nextBand\n"));
|
||||
@@ -266,14 +266,11 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
int compressed_size;
|
||||
const uchar* buffer;
|
||||
|
||||
uchar* in_buffer = new uchar[in_size];
|
||||
std::vector<uchar> in_buffer(in_size);
|
||||
// gray values
|
||||
uchar* out_buffer = new uchar[out_size];
|
||||
std::vector<uchar> out_buffer(out_size);
|
||||
// gray values in hexadecimal
|
||||
|
||||
auto_ptr<uchar> _in_buffer(in_buffer);
|
||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||
|
||||
DBGMSG(("move\n"));
|
||||
|
||||
int size = color ? width * 3 : in_size;
|
||||
@@ -281,7 +278,7 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
|
||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||
if (color) {
|
||||
uchar* out = out_buffer;
|
||||
uchar* out = &out_buffer[0];
|
||||
uchar* in = ptr;
|
||||
for (int w = width; w > 0; w --) {
|
||||
*out++ = ToHexDigit((in[2]) >> 4);
|
||||
@@ -293,21 +290,21 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
in += 4;
|
||||
}
|
||||
} else {
|
||||
fHalftone->Dither(in_buffer, ptr, x, y, width);
|
||||
fHalftone->Dither(&in_buffer[0], ptr, x, y, width);
|
||||
|
||||
uchar* in = &in_buffer[0];
|
||||
uchar* out = &out_buffer[0];
|
||||
|
||||
uchar* in = in_buffer;
|
||||
uchar* out = out_buffer;
|
||||
|
||||
for (int w = in_size; w > 0; w --, in ++) {
|
||||
*in = ~*in; // invert pixels
|
||||
*out++ = ToHexDigit((*in) >> 4);
|
||||
*out++ = ToHexDigit((*in) & 15);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
{
|
||||
compression_method = 0; // uncompressed
|
||||
buffer = out_buffer;
|
||||
buffer = &out_buffer[0];
|
||||
compressed_size = out_size;
|
||||
}
|
||||
|
||||
@@ -339,11 +336,11 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_JobStart()
|
||||
{
|
||||
// PostScript header
|
||||
@@ -360,14 +357,14 @@ PSDriver::_JobStart()
|
||||
GetJobData()->GetPaperRect().IntegerHeight());
|
||||
_WritePSString("%%%%Pages: (atend)\n");
|
||||
_WritePSString("%%%%EndComments\n");
|
||||
|
||||
|
||||
_WritePSString("%%%%BeginDefaults\n");
|
||||
_WritePSString("%%%%PageMedia: Plain\n");
|
||||
_WritePSString("%%%%EndDefaults\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_StartRasterGraphics(int x, int y, int width, int height,
|
||||
int widthByte)
|
||||
{
|
||||
@@ -391,14 +388,14 @@ PSDriver::_StartRasterGraphics(int x, int y, int width, int height,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_EndRasterGraphics()
|
||||
{
|
||||
_WritePSString("grestore\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_RasterGraphics(int compression_method, const uchar* buffer,
|
||||
int size)
|
||||
{
|
||||
@@ -410,7 +407,7 @@ PSDriver::_RasterGraphics(int compression_method, const uchar* buffer,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
PSDriver::_JobEnd()
|
||||
{
|
||||
_WritePSString("%%%%Pages: %d\n", fPrintedPages);
|
||||
|
||||
Reference in New Issue
Block a user