private:
/// detach shader from all surfaces, surface groups, etc... from surfaces
- void removeShaderFromAllSurfaces(const SurfaceMap & surfaceMap, Shader* shader);
+ bool removeShaderFromAllSurfaces(const SurfaceMap & surfaceMap, Shader* shader);
- void removeShaderFromAllLayers(const LayerMap & layerMap, Shader *& shader);
+ bool removeShaderFromAllLayers(const LayerMap & layerMap, Shader *& shader);
private:
const unsigned int m_id;
if (layer != NULL && surface != NULL)
{
- unsigned int layer_id = surface->getContainingLayerId();
- if (layer_id != GraphicalObject::INVALID_ID)
+ if (layer->addSurface(surface))
{
- LOG_WARNING("LayerAddSurfaceCommand","surface : id [ " << m_surfaceid << " ] already belongs to layer : id [ " << layer_id << " ]");
+ LOG_DEBUG("LayerAddSurfaceCommand","Adding surface(" << m_surfaceid << ")" << surface->getID() << " to layer(" << m_layerid << ") " << layer->getID());
+ LOG_DEBUG("LayerAddSurfaceCommand", "Layer now has #surfaces:" << layer->getAllSurfaces().size());
+ result = surface->hasNativeContent() ? ExecutionSuccessRedraw : ExecutionSuccess;
}
else
{
- LOG_DEBUG("LayerAddSurfaceCommand","add surface(" << m_surfaceid << ")" << surface->getID() << " to layer(" << m_layerid << ") " << layer->getID());
- layer->addSurface(surface);
- LOG_DEBUG("LayerAddSurfaceCommand", "Layer now has #surfaces:" << layer->getAllSurfaces().size());
- result = ExecutionSuccessRedraw;
+ unsigned int layer_id = surface->getContainingLayerId();
+ LOG_WARNING("LayerAddSurfaceCommand","surface : id [ " << m_surfaceid << " ] already belongs to layer : id [ " << layer_id << " ]");
+ result = (m_layerid == layer_id) ? ExecutionSuccess : ExecutionFailed;
}
}
Layer* layer = scene.getLayer(m_idToRemove);
if (layer)
{
- if (scene.isLayerInCurrentRenderOrder(m_idToRemove))
+ if (scene.removeLayer(layer))
{
IRenderer* renderer = *((executor->getRendererList())->begin());
renderer->forceCompositionWindowSystem();
+ result = ExecutionSuccessRedraw;
+ }
+ else
+ {
+ result = ExecutionSuccess;
}
- scene.removeLayer(layer);
- result = ExecutionSuccessRedraw;
}
return result;
if (layer && surface)
{
- layer->removeSurface(surface);
- result = ExecutionSuccessRedraw;
+ result = layer->removeSurface(surface) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
const Rectangle rectangle(m_x, m_y, m_width, m_height);
- layer->setDestinationRegion(rectangle);
- result = ExecutionSuccessRedraw;
+ result = layer->setDestinationRegion(rectangle) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
- layer->setDimension(m_width, m_height);
- result = ExecutionSuccessRedraw;
+ result = layer->setDimension(m_width, m_height) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
LOG_DEBUG("LayerSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
- layer->setOpacity(m_opacity);
- result = ExecutionSuccessRedraw;
+ result = layer->setOpacity(m_opacity) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
- layer->setOrientation(m_orientation);
- result = ExecutionSuccessRedraw;
+ result = layer->setOrientation(m_orientation) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
- layer->setPosition(m_x, m_y);
- result = ExecutionSuccessRedraw;
+ result = layer->setPosition(m_x, m_y) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
}
if (layer)
{
- layer->removeAllSurfaces();
- result = ExecutionSuccessRedraw;
+ result = layer->removeAllSurfaces() ? ExecutionSuccessRedraw : ExecutionSuccess;
for (unsigned int surfaceIndex = 0; surfaceIndex < m_length; ++surfaceIndex)
{
if (surface)
{
unsigned int layer_id = surface->getContainingLayerId();
- if (layer_id != GraphicalObject::INVALID_ID)
+ if (layer->addSurface(surface))
{
- LOG_WARNING("LayerSetRenderOrderCommand","surface : id [ " << m_array[surfaceIndex] << " ] already belongs to layer : id [ " << layer_id << " ]");
+ LOG_DEBUG("LayerSetRenderOrderCommand","Adding surface " << surface->getID() << " to renderorder of layer " << m_layerid);
+ result = ExecutionSuccessRedraw;
}
else
{
- LOG_DEBUG("LayerSetRenderOrderCommand","add surface " << surface->getID() << " to renderorder of layer " << m_layerid);
- layer->addSurface(surface);
- result = ExecutionSuccessRedraw;
+ LOG_WARNING("LayerSetRenderOrderCommand","surface : id [ " << m_array[surfaceIndex] << " ] already belongs to layer : id [ " << layer_id << " ]");
}
}
}
if (layer)
{
const Rectangle rectangle(m_x, m_y, m_width, m_height);
- layer->setSourceRegion(rectangle);
- result = ExecutionSuccessRedraw;
+ result = layer->setSourceRegion(rectangle) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
LOG_DEBUG("LayerSetTypeCommand", "setting type: " << m_layerType << " of layer id " << m_idtoSet);
- layer->setLayerType(m_layerType);
- result = ExecutionSuccessRedraw;
+ result = layer->setLayerType(m_layerType) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layer)
{
LOG_DEBUG("LayerSetVisibilityCommand", "setting visibility: " << m_visibility << " of id " << m_idtoSet);
- layer->setVisibility(m_visibility);
- result = ExecutionSuccessRedraw;
+ result = layer->setVisibility(m_visibility) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layergroup)
{
LOG_DEBUG("LayergroupSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
- layergroup->setOpacity(m_opacity);
- result = ExecutionSuccessRedraw;
+ result = layergroup->setOpacity(m_opacity) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (layergroup)
{
LOG_DEBUG("LayergroupSetVisibilityCommand", "setting visibility: " << m_visibility << " of id " << m_idtoSet);
- layergroup->setVisibility(m_visibility);
- result = ExecutionSuccessRedraw;
+ result = layergroup->setVisibility(m_visibility) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
{
Scene& scene = *(executor->getScene());
ExecutionResult result = ExecutionFailed;
- IRenderer* renderer = *((executor->getRendererList())->begin());
// check for doubles
for (unsigned int i = 0; i < m_length; i++)
// return false;
// } // TODO insert again later
+ if (scene.getCurrentRenderOrder().size() != 0)
+ {
+ IRenderer* renderer = *((executor->getRendererList())->begin());
+ renderer->forceCompositionWindowSystem();
+ result = ExecutionSuccessRedraw;
+ }
+
scene.getCurrentRenderOrder().clear();
- result = ExecutionSuccessRedraw;
- renderer->forceCompositionWindowSystem();
LOG_DEBUG("ScreenSetRenderOrderCommand", "Length to set: " << m_length);
result = ExecutionSuccessRedraw;
}
}
+
return result;
}
{
Scene& scene = *(executor->getScene());
ShaderMap& shaderMap = scene.m_shaderMap;
+ ExecutionResult result = ExecutionFailed;
// get shader by its ID
ShaderMapIterator iter = shaderMap.find(m_id);
if (shader)
{
const SurfaceMap& surfaceMap = scene.getAllSurfaces();
- removeShaderFromAllSurfaces(surfaceMap, shader);
+ result = removeShaderFromAllSurfaces(surfaceMap, shader) ? ExecutionSuccessRedraw : ExecutionSuccess;
const LayerMap& layerMap = scene.getAllLayers();
- removeShaderFromAllLayers(layerMap, shader);
+ result = removeShaderFromAllLayers(layerMap, shader) ? ExecutionSuccessRedraw : result;
// remove shader from global shader list
scene.m_shaderMap.erase(iter);
delete shader;
}
- return ExecutionSuccessRedraw;
+ return result;
}
/// detach shader from all surfaces, surface groups, etc... from surfaces
-void ShaderDestroyCommand::removeShaderFromAllSurfaces(const SurfaceMap & surfaceMap, Shader* shader)
+bool ShaderDestroyCommand::removeShaderFromAllSurfaces(const SurfaceMap & surfaceMap, Shader* shader)
{
+ bool result = false;
SurfaceMapConstIterator iter = surfaceMap.begin();
SurfaceMapConstIterator iterEnd = surfaceMap.end();
for (; iter != iterEnd; ++iter)
if (obj && obj->getShader() == shader)
{
obj->setShader(NULL);
+ result = true;
}
}
+
+ return result;
}
-void ShaderDestroyCommand::removeShaderFromAllLayers(const LayerMap & layerMap, Shader *& shader)
+bool ShaderDestroyCommand::removeShaderFromAllLayers(const LayerMap & layerMap, Shader *& shader)
{
+ bool result = false;
LayerMapConstIterator iter = layerMap.begin();
LayerMapConstIterator iterEnd = layerMap.end();
for (; iter != iterEnd; ++iter)
if (obj && obj->getShader()==shader)
{
obj->setShader(NULL);
+ result = true;
}
}
+
+ return result;
}
unsigned int ShaderDestroyCommand::getShaderID() const
ExecutionResult result = ExecutionFailed;
- Surface* surface = scene.getSurface(m_idToRemove);
- if (surface)
- {
- scene.removeSurface(surface);
- result = ExecutionSuccessRedraw;
- }
+ Surface* surface = scene.getSurface(m_idToRemove);
+ if (surface)
+ {
+ result = scene.removeSurface(surface) ? ExecutionSuccessRedraw : ExecutionSuccess;
+ }
return result;
}
if (surface)
{
const Rectangle rectangle(m_x, m_y, m_width, m_height);
- surface->setDestinationRegion(rectangle);
- result = ExecutionSuccessRedraw;
+ result = surface->setDestinationRegion(rectangle) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surface)
{
- surface->setDimension(m_width, m_height);
- result = ExecutionSuccessRedraw;
+ result = surface->setDimension(m_width, m_height) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surface)
{
LOG_DEBUG("SurfaceSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
- surface->setOpacity(m_opacity);
- result = ExecutionSuccessRedraw;
+ result = surface->setOpacity(m_opacity) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surface)
{
- surface->setOrientation(m_orientation);
- result = ExecutionSuccessRedraw;
+ result = surface->setOrientation(m_orientation) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surface)
{
- surface->setPosition(m_x, m_y);
- result = ExecutionSuccessRedraw;
+ result = surface->setPosition(m_x, m_y) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
}
// shaderId==0 detaches the custom shader
// (shader is supposed to be NULL in this case)
- object->setShader(shader);
- result = ExecutionSuccessRedraw;
+ result = object->setShader(shader) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
else
{
if (surface)
{
const Rectangle rectangle(m_x, m_y, m_width, m_height);
- surface->setSourceRegion(rectangle);
- result = ExecutionSuccessRedraw;
+ result = surface->setSourceRegion(rectangle) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surface)
{
LOG_DEBUG("SurfaceSetVisibilityCommand", "setting visibility: " << m_visibility << " of id " << m_idtoSet);
- surface->setVisibility(m_visibility);
- result = ExecutionSuccessRedraw;
+ result = surface->setVisibility(m_visibility) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surfacegroup)
{
LOG_DEBUG("SurfacegroupSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
- surfacegroup->setOpacity(m_opacity);
- result = ExecutionSuccessRedraw;
+ result = surfacegroup->setOpacity(m_opacity) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
if (surfacegroup)
{
LOG_DEBUG("SurfacegroupSetVisibilityCommand", "setting visibility: " << m_visibility << " of id " << m_idtoSet);
- surfacegroup->setVisibility(m_visibility);
- result = ExecutionSuccessRedraw;
+ result = surfacegroup->setVisibility(m_visibility) ? ExecutionSuccessRedraw : ExecutionSuccess;
}
return result;
/**
* Set visibility on every element of the group
*/
- virtual void setVisibility(bool visible)
+ virtual bool setVisibility(bool visible)
{
+ bool result = false;
this->visibility = visible;
for(typename std::list<T*>::iterator it = list.begin(); it != list.end(); ++it)
{
- (*it)->setVisibility(visible);
+ result |= (*it)->setVisibility(visible);
}
+ return result;
}
/**
* Set opacity on every element of the group
*/
- virtual void setOpacity(double opacity)
+ virtual bool setOpacity(double opacity)
{
+ bool result = false;
this->opacity = opacity;
for(typename std::list<T*>::iterator it = list.begin(); it != list.end(); ++it)
{
- (*it)->setOpacity(opacity);
+ result |= (*it)->setOpacity(opacity);
}
+ return result;
}
const std::list<T*> getList() const
{
public:
- GraphicalObject(ObjectType type, double opacity, bool visibility);
+ GraphicalObject(ObjectType type, double opacity, bool visibility);
- GraphicalObject(int externalId,ObjectType type, double opacity, bool visibility);
+ GraphicalObject(int externalId,ObjectType type, double opacity, bool visibility);
- virtual ~GraphicalObject() {}
+ virtual ~GraphicalObject() {}
/**
* @brief Set alpha value
* @param[in] newOpacity The new Alpha Value between 0.0 (full transparency) and 1.0 (fully visible)
+ * @return TRUE if the new Alpha Value is not equal to the current Alpha Value
+ * FALSE if they are equal
*/
- virtual void setOpacity(double newOpacity);
+ virtual bool setOpacity(double newOpacity);
/**
* @brief Get alpha value
*/
double getOpacity() const;
- /**
- * Set the visibility
- * @param[in] newVisibility set this object visible (true) or invisible (false)
- */
- virtual void setVisibility(bool newVisibility);
+ /**
+ * Set the visibility
+ * @param[in] newVisibility set this object visible (true) or invisible (false)
+ * @return TRUE if the new visiblity value is not equal to the current visibility value
+ * FALSE if they are equal
+ */
+ virtual bool setVisibility(bool newVisibility);
- bool getVisibility() const;
+ bool getVisibility() const;
/**
* @brief Get external ID for graphical object
*/
virtual unsigned int getID();
- /**
- * Assign custom shader for rendering
- *
- * @param[in] s Custom shader. If NULL, default shader will be used.
- */
- void setShader(Shader* s);
+ /**
+ * Assign custom shader for rendering
+ *
+ * @param[in] s Custom shader. If NULL, default shader will be used.
+ * @return TRUE if the new custom shader is different from the current custom shader
+ * FALSE if they are same
+ */
+ bool setShader(Shader* s);
/**
* @brief get the currently assigned custom shader object
public:
static const unsigned int INVALID_ID;
ObjectType type;
- bool renderPropertyChanged;
- bool damaged;
+ bool renderPropertyChanged;
+ bool damaged;
/// Pointer to currently assigned shader. If NULL, a default shader will be used.
Shader* shader;
{
}
-inline void GraphicalObject::setOpacity(double newOpacity)
+inline bool GraphicalObject::setOpacity(double newOpacity)
{
- if (opacity != newOpacity)
- {
- renderPropertyChanged = true;
- }
- opacity = newOpacity;
+ if (opacity != newOpacity)
+ {
+ opacity = newOpacity;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline double GraphicalObject::getOpacity() const
return opacity;
}
-inline void GraphicalObject::setVisibility(bool newVisibility)
+inline bool GraphicalObject::setVisibility(bool newVisibility)
{
- if (visibility != newVisibility)
- {
- renderPropertyChanged = true;
- }
- visibility = newVisibility;
+ if (visibility != newVisibility)
+ {
+ visibility = newVisibility;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline bool GraphicalObject::getVisibility() const
return graphicExternalId;
}
-inline void GraphicalObject::setShader(Shader* s)
+inline bool GraphicalObject::setShader(Shader* s)
{
- renderPropertyChanged = true;
- shader = s;
+ if (shader != s)
+ {
+ shader = s;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline Shader* GraphicalObject::getShader()
/**
* @brief Set Orientation value
* @param[in] newOrientation the new value. Multiples of 90 degrees. (0->0°, 1->90°, 2->180°,3->279°)
+ * @return TRUE if the new orientation value is not equal to the current orientation value
+ * FALSE if they are equal
*/
- void setOrientation(OrientationType newOrientation);
+ bool setOrientation(OrientationType newOrientation);
OrientationType getOrientation() const;
/**
* @brief Set Source Viewport (only use portion of source graphics)
* @param[in] newSource Rectangle defining position and size within surface (clip from the left)
+ * @return TRUE if the new source rectangle is not equal to the current source rectangle
+ * FALSE if they are equal
*/
- void setSourceRegion(const Rectangle& newSource);
+ bool setSourceRegion(const Rectangle& newSource);
const Rectangle& getSourceRegion() const;
/**
* Set Destination Viewport (Scale output)
* @param[in] newDestination Rectangle defining destination position and size
+ * @return TRUE if the new destination rectangle is not equal to the current destination rectangle
+ * FALSE if they are equal
*/
- void setDestinationRegion(const Rectangle& newDestination);
+ bool setDestinationRegion(const Rectangle& newDestination);
- void setPosition(const unsigned int& x, const unsigned int& y);
+ bool setPosition(const unsigned int& x, const unsigned int& y);
Vector2 getPosition();
- void setDimension(const unsigned int& width, const unsigned int& height);
+ bool setDimension(const unsigned int& width, const unsigned int& height);
const Rectangle& getDestinationRegion() const;
Vector2 getDimension();
{
}
-inline void GraphicalSurface::setOrientation(OrientationType newOrientation)
+inline bool GraphicalSurface::setOrientation(OrientationType newOrientation)
{
- if (m_orientation != newOrientation)
- {
- renderPropertyChanged = true;
- }
- m_orientation = newOrientation;
+ if (m_orientation != newOrientation)
+ {
+ m_orientation = newOrientation;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline OrientationType GraphicalSurface::getOrientation() const
return m_orientation;
}
-inline void GraphicalSurface::setSourceRegion(const Rectangle& newSource)
+inline bool GraphicalSurface::setSourceRegion(const Rectangle& newSource)
{
- if (!(m_sourceViewport == newSource))
- {
- renderPropertyChanged = true;
- }
- m_sourceViewport = newSource;}
+ if (!(m_sourceViewport == newSource))
+ {
+ m_sourceViewport = newSource;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
+}
inline const Rectangle& GraphicalSurface::getSourceRegion() const
{
return m_sourceViewport;
}
-inline void GraphicalSurface::setDestinationRegion(const Rectangle& newDestination)
+inline bool GraphicalSurface::setDestinationRegion(const Rectangle& newDestination)
{
- if (!(m_destinationViewport == newDestination))
- {
- renderPropertyChanged = true;
- }
- m_destinationViewport = newDestination;}
+ if (!(m_destinationViewport == newDestination))
+ {
+ m_destinationViewport = newDestination;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
+}
-inline void GraphicalSurface::setPosition(const unsigned int& x, const unsigned int& y)
+inline bool GraphicalSurface::setPosition(const unsigned int& x, const unsigned int& y)
{
- if (m_destinationViewport.x != x || m_destinationViewport.y != y)
- {
- renderPropertyChanged = true;
- }
- m_destinationViewport.x = x; m_destinationViewport.y = y;
+ if (m_destinationViewport.x != x || m_destinationViewport.y != y)
+ {
+ m_destinationViewport.x = x;
+ m_destinationViewport.y = y;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline Vector2 GraphicalSurface::getPosition()
return Vector2(m_destinationViewport.x,m_destinationViewport.y);
}
-inline void GraphicalSurface::setDimension(const unsigned int& width, const unsigned int& height)
+inline bool GraphicalSurface::setDimension(const unsigned int& width, const unsigned int& height)
{
- if (m_destinationViewport.width != width || m_destinationViewport.height != height)
- {
- renderPropertyChanged = true;
- }
- m_destinationViewport.width = width; m_destinationViewport.height = height;
+ if (m_destinationViewport.width != width || m_destinationViewport.height != height)
+ {
+ m_destinationViewport.width = width;
+ m_destinationViewport.height = height;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline const Rectangle& GraphicalSurface::getDestinationRegion() const
* \ingroup SceneAPI
* \param[in] layer pointer to layer
*/
- virtual void removeLayer(Layer* layer) = 0;
+ virtual bool removeLayer(Layer* layer) = 0;
/**
* \brief Remove surface from scene.
* \ingroup SceneAPI
* \param[in] surface pointer to surface
*/
- virtual void removeSurface(Surface* surface) = 0;
+ virtual bool removeSurface(Surface* surface) = 0;
/**
* \brief Get a layer of the scene by id.
virtual ~Layer() {}
LayerType getLayerType() const;
- void setLayerType(LayerType lt);
- void setLayerCapabilities(unsigned int newCapabilities);
+ bool setLayerType(LayerType lt);
+ bool setLayerCapabilities(unsigned int newCapabilities);
unsigned int getCapabilities() const;
- void addSurface(Surface* s);
- void removeSurface(Surface* s);
+ bool addSurface(Surface* s);
+ bool removeSurface(Surface* s);
SurfaceList& getAllSurfaces();
- void removeAllSurfaces();
+ bool removeAllSurfaces();
private:
SurfaceList m_surfaces;
return m_layerType;
}
-inline void Layer::setLayerType(LayerType lt)
+inline bool Layer::setLayerType(LayerType lt)
{
- if (m_layerType != lt)
- {
- renderPropertyChanged = true;
- }
- m_layerType = lt;
+ if (m_layerType != lt)
+ {
+ m_layerType = lt;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
-inline void Layer::setLayerCapabilities(uint newCapabilities)
+inline bool Layer::setLayerCapabilities(uint newCapabilities)
{
- if (m_capabilities != newCapabilities)
- {
- renderPropertyChanged = true;
- }
- m_capabilities = newCapabilities;
+ if (m_capabilities != newCapabilities)
+ {
+ m_capabilities = newCapabilities;
+ renderPropertyChanged = true;
+ return true;
+ }
+ return false;
}
inline uint Layer::getCapabilities() const
return m_capabilities;
}
-inline void Layer::addSurface(Surface* s)
+inline bool Layer::addSurface(Surface* s)
{
if (s->getContainingLayerId() == INVALID_ID)
{
m_surfaces.push_back(s);
s->setContainingLayerId(getID());
renderPropertyChanged = true;
+ return true;
}
+ return false;
}
-inline void Layer::removeSurface(Surface* s)
+inline bool Layer::removeSurface(Surface* s)
{
if (s->getContainingLayerId() == getID())
{
m_surfaces.remove(s);
s->setContainingLayerId(INVALID_ID);
renderPropertyChanged = true;
+ return true;
}
+ return false;
}
inline SurfaceList& Layer::getAllSurfaces()
return m_surfaces;
}
-inline void Layer::removeAllSurfaces()
+inline bool Layer::removeAllSurfaces()
{
SurfaceListConstIterator iter = m_surfaces.begin();
SurfaceListConstIterator iterEnd = m_surfaces.end();
+
+ if(iter == iterEnd)
+ return false;
+
for (; iter != iterEnd; ++iter)
{
(*iter)->setContainingLayerId(GraphicalObject::INVALID_ID);
}
m_surfaces.clear();
renderPropertyChanged = true;
+ return true;
}
#endif /* _LAYER_H_ */
virtual LayerGroup *createLayerGroup(const uint id);
virtual SurfaceGroup *createSurfaceGroup(const uint id);
- virtual void removeLayer(Layer* layer);
- virtual void removeSurface(Surface* surface);
+ virtual bool removeLayer(Layer* layer);
+ virtual bool removeSurface(Surface* surface);
virtual void removeSurfaceNativeContent(Surface* surface);
virtual Layer* getLayer(const uint id) const;
virtual Surface* getSurface(const uint id) const;
}
/// \brief take layer out of list of layers
-void Scene::removeLayer(Layer* layer)
+bool Scene::removeLayer(Layer* layer)
{
+ bool result = false;
+
if (layer != NULL)
{
+ result = isLayerInCurrentRenderOrder(layer->getID());
layer->removeAllSurfaces();
m_currentRenderOrder.remove(layer);
m_layerMap.erase(layer->getID());
removeLayerFromAllLayerGroups(layer);
delete layer;
}
+
+ return result;
}
/// \brief remove surface from all surfacegroups it might be part of
}
/// \brief take surface out of list of surfaces
-void Scene::removeSurface(Surface* surface)
+bool Scene::removeSurface(Surface* surface)
{
+ bool result = false;
+
if (surface != NULL)
{
uint surfaceId = surface->getID();
Layer* layer = getLayer(layerId);
if (layer != NULL)
{
- layer->removeSurface(surface);
+ result = layer->removeSurface(surface);
}
}
delete surface;
}
+
+ return result;
}
/// \brief take removing applied native content
void Scene::removeSurfaceNativeContent(Surface* surface)