mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Removed some of the "normal" pointers and replaced them by smart pointer to prevent memory problems
This commit is contained in:
+6
-6
@@ -176,11 +176,11 @@ void MainWindow::addQuad()
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
// Create input and output quads.
|
||||
Quad* outputQuad = Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height());
|
||||
Quad* inputQuad = Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height());
|
||||
Shape::ptr outputQuad = Shape::ptr(Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
Shape::ptr inputQuad = Shape::ptr(Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
|
||||
// Create texture mapping.
|
||||
int mappingId = mappingManager->addMapping(Mapping::ptr(new TextureMapping(paint.get(), outputQuad, inputQuad)));
|
||||
int mappingId = mappingManager->addMapping(Mapping::ptr(new TextureMapping(paint, outputQuad, inputQuad)));
|
||||
|
||||
addMappingItem(mappingId);
|
||||
}
|
||||
@@ -197,11 +197,11 @@ void MainWindow::addTriangle()
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
// Create input and output quads.
|
||||
Triangle* outputTriangle = Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height());
|
||||
Triangle* inputTriangle = Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height());
|
||||
Shape::ptr outputTriangle = Shape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
Shape::ptr inputTriangle = Shape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
|
||||
// Create texture mapping.
|
||||
int mappingId = mappingManager->addMapping(Mapping::ptr(new TextureMapping(paint.get(), inputTriangle, outputTriangle)));
|
||||
int mappingId = mappingManager->addMapping(Mapping::ptr(new TextureMapping(paint, inputTriangle, outputTriangle)));
|
||||
|
||||
addMappingItem(mappingId);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Mapping> ptr;
|
||||
Mapping(Paint* paint, Shape* shape)
|
||||
Mapping(Paint::ptr paint, Shape::ptr shape)
|
||||
: _paint(paint), _shape(shape)
|
||||
{}
|
||||
virtual ~Mapping() {}
|
||||
@@ -67,9 +67,9 @@ private:
|
||||
Shape::ptr _inputShape;
|
||||
|
||||
public:
|
||||
TextureMapping(Paint* paint,
|
||||
Shape* shape,
|
||||
Shape* inputShape)
|
||||
TextureMapping(Paint::ptr paint,
|
||||
Shape::ptr shape,
|
||||
Shape::ptr inputShape)
|
||||
: Mapping(paint, shape),
|
||||
_inputShape(inputShape)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user