2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "control-renderer-impl.h"
22 #include <dali/public-api/common/dali-common.h>
25 #include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
36 ControlRenderer::ControlRenderer()
41 ControlRenderer::~ControlRenderer()
46 void ControlRenderer::SetSize( const Vector2& size )
51 void ControlRenderer::SetClipRect( const Rect<int>& clipRect )
53 mImpl->mClipRect = clipRect;
56 void ControlRenderer::SetOffset( const Vector2& offset )
58 mImpl->mOffset = offset;
61 void ControlRenderer::SetDepthIndex( float index )
63 mImpl->mDepthIndex = index;
64 if( mImpl->mRenderer )
66 mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
70 void ControlRenderer::SetOnStage( Actor& actor )
72 Material material = Material::New( mImpl->mShader );
73 mImpl->mRenderer = Renderer::New( mImpl->mGeometry, material );
74 mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
75 actor.AddRenderer( mImpl->mRenderer );
78 void ControlRenderer::SetOffStage( Actor& actor )
80 actor.RemoveRenderer( mImpl->mRenderer );
81 mImpl->mRenderer.Reset();
84 } // namespace Internal
86 } // namespace Toolkit