loplugin:useuniqueptr in EMFPBrush
Change-Id: I17fc33cfd7c15734fd961fa76c676424900a4373
This commit is contained in:
@@ -67,26 +67,7 @@ namespace cppcanvas
|
||||
|
||||
EMFPBrush::~EMFPBrush()
|
||||
{
|
||||
if (blendPositions != nullptr) {
|
||||
delete[] blendPositions;
|
||||
blendPositions = nullptr;
|
||||
}
|
||||
if (colorblendPositions != nullptr) {
|
||||
delete[] colorblendPositions;
|
||||
colorblendPositions = nullptr;
|
||||
}
|
||||
if (colorblendColors != nullptr) {
|
||||
delete[] colorblendColors;
|
||||
colorblendColors = nullptr;
|
||||
}
|
||||
if (surroundColors != nullptr) {
|
||||
delete[] surroundColors;
|
||||
surroundColors = nullptr;
|
||||
}
|
||||
if (path) {
|
||||
delete path;
|
||||
path = nullptr;
|
||||
}
|
||||
path.reset();
|
||||
}
|
||||
|
||||
void EMFPBrush::Read(SvStream& s, ImplRenderer const & rR)
|
||||
@@ -149,7 +130,7 @@ namespace cppcanvas
|
||||
if (surroundColorsNumber<0 || sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32 / sizeof(::Color))
|
||||
surroundColorsNumber = SAL_MAX_INT32 / sizeof(::Color);
|
||||
|
||||
surroundColors = new ::Color[surroundColorsNumber];
|
||||
surroundColors.reset( new ::Color[surroundColorsNumber] );
|
||||
for (int i = 0; i < surroundColorsNumber; i++) {
|
||||
s.ReadUInt32(color);
|
||||
surroundColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
|
||||
@@ -173,7 +154,7 @@ namespace cppcanvas
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tpath (brush path gradient)");
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec);
|
||||
|
||||
path = new EMFPPath(pathPoints);
|
||||
path.reset( new EMFPPath(pathPoints) );
|
||||
path->Read(s, pathFlags, rR);
|
||||
|
||||
s.Seek(pos + pathLength);
|
||||
@@ -190,7 +171,7 @@ namespace cppcanvas
|
||||
|
||||
sal_uInt64 const pos = s.Tell();
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\t use boundary, points: " << boundaryPointCount);
|
||||
path = new EMFPPath(boundaryPointCount);
|
||||
path.reset( new EMFPPath(boundaryPointCount) );
|
||||
path->Read(s, 0x0, rR);
|
||||
|
||||
s.Seek(pos + 8 * boundaryPointCount);
|
||||
@@ -216,8 +197,8 @@ namespace cppcanvas
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tuse blend, points: " << blendPoints);
|
||||
if (blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32 / (2 * sizeof(float)))
|
||||
blendPoints = SAL_MAX_INT32 / (2 * sizeof(float));
|
||||
blendPositions = new float[2 * blendPoints];
|
||||
blendFactors = blendPositions + blendPoints;
|
||||
blendPositions.reset( new float[2 * blendPoints] );
|
||||
blendFactors = blendPositions.get() + blendPoints;
|
||||
for (int i = 0; i < blendPoints; i++) {
|
||||
s.ReadFloat(blendPositions[i]);
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << blendPositions[i]);
|
||||
@@ -235,8 +216,8 @@ namespace cppcanvas
|
||||
colorblendPoints = SAL_MAX_INT32 / sizeof(float);
|
||||
if (sal_uInt32(colorblendPoints)>SAL_MAX_INT32 / sizeof(::Color))
|
||||
colorblendPoints = SAL_MAX_INT32 / sizeof(::Color);
|
||||
colorblendPositions = new float[colorblendPoints];
|
||||
colorblendColors = new ::Color[colorblendPoints];
|
||||
colorblendPositions.reset( new float[colorblendPoints] );
|
||||
colorblendColors.reset( new ::Color[colorblendPoints] );
|
||||
for (int i = 0; i < colorblendPoints; i++) {
|
||||
s.ReadFloat(colorblendPositions[i]);
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << colorblendPositions[i]);
|
||||
@@ -288,8 +269,8 @@ namespace cppcanvas
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tuse blend, points: " << blendPoints);
|
||||
if (blendPoints<0 || sal_uInt32(blendPoints)>SAL_MAX_INT32 / (2 * sizeof(float)))
|
||||
blendPoints = SAL_MAX_INT32 / (2 * sizeof(float));
|
||||
blendPositions = new float[2 * blendPoints];
|
||||
blendFactors = blendPositions + blendPoints;
|
||||
blendPositions.reset( new float[2 * blendPoints] );
|
||||
blendFactors = blendPositions.get() + blendPoints;
|
||||
for (int i = 0; i < blendPoints; i++) {
|
||||
s.ReadFloat(blendPositions[i]);
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << blendPositions[i]);
|
||||
@@ -307,8 +288,8 @@ namespace cppcanvas
|
||||
colorblendPoints = SAL_MAX_INT32 / sizeof(float);
|
||||
if (sal_uInt32(colorblendPoints)>SAL_MAX_INT32 / sizeof(::Color))
|
||||
colorblendPoints = sal_uInt32(SAL_MAX_INT32) / sizeof(::Color);
|
||||
colorblendPositions = new float[colorblendPoints];
|
||||
colorblendColors = new ::Color[colorblendPoints];
|
||||
colorblendPositions.reset(new float[colorblendPoints] );
|
||||
colorblendColors.reset( new ::Color[colorblendPoints] );
|
||||
for (int i = 0; i < colorblendPoints; i++) {
|
||||
s.ReadFloat(colorblendPositions[i]);
|
||||
SAL_INFO("cppcanvas.emf", "EMF+\tposition[" << i << "]: " << colorblendPositions[i]);
|
||||
|
@@ -105,14 +105,14 @@ namespace cppcanvas
|
||||
XForm brush_transformation;
|
||||
bool hasTransformation;
|
||||
sal_Int32 blendPoints;
|
||||
float* blendPositions;
|
||||
std::unique_ptr<float[]> blendPositions;
|
||||
float* blendFactors;
|
||||
sal_Int32 colorblendPoints;
|
||||
float* colorblendPositions;
|
||||
::Color* colorblendColors;
|
||||
std::unique_ptr<float[]> colorblendPositions;
|
||||
std::unique_ptr<::Color[]> colorblendColors;
|
||||
sal_Int32 surroundColorsNumber;
|
||||
::Color* surroundColors;
|
||||
EMFPPath *path;
|
||||
std::unique_ptr<::Color[]> surroundColors;
|
||||
std::unique_ptr<EMFPPath> path;
|
||||
EmfPlusHatchStyle hatchStyle;
|
||||
|
||||
EMFPBrush();
|
||||
|
Reference in New Issue
Block a user