2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiEffects_RendererEngineModelRenderTarget.cpp
20 * @brief This file contains implementation of RenderTarget class
24 #include <renderer/engine-model/FUiEffects_RendererEngineModelRenderTarget.h>
25 #include <renderer/engine-model/FUiEffects_RendererEngineModelRenderTargetVisitor.h>
27 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer
32 RenderTarget::RenderTarget():
38 RenderTarget::~RenderTarget(void)
40 const unsigned int len = RenderTarget::Attachment::ATTACHMENT_MAX;
41 for (unsigned int i = 0; len > i; ++i)
45 _pTextures[i]->RemovedFromRenderTarget(this);
57 RenderTarget::Visit(RenderTargetVisitor& v)
59 v.OnRenderTarget(*this);
64 RenderTarget::AttachTexture2D(Attachment::Value attachment, Texture2DAttachmentPropertyPtr pTexture, size_t mipLevel)
66 _pTextures[attachment] = pTexture;
67 _attachments[attachment].Set(System::GetImpl(pTexture), mipLevel);
68 pTexture->AttachedToRenderTarget(this);
71 __pCache->Invalidate();
77 RenderTarget::AttachStub(Attachment::Value attachment, StubAttachmentPtr pStub)
79 _pTextures[attachment] = pStub;
80 _attachments[attachment].Set(System::GetImpl(pStub));
81 pStub->AttachedToRenderTarget(this);
84 __pCache->Invalidate();
90 RenderTarget::Detach(Attachment::Value attachment)
92 if (_pTextures[attachment])
94 _pTextures[attachment]->RemovedFromRenderTarget(this);
96 System::Reset(_pTextures[attachment]);
100 __pCache->Invalidate();
105 RenderTarget::AttachInfo*
106 RenderTarget::GetAttachment(Attachment::Value attachment)
108 if (!_pTextures[attachment])
112 return &_attachments[attachment];
116 RenderTarget::GetCache(void)
122 RenderTarget::SetCache(CachePtr pCache)
133 RenderTarget::GetWidth(void)
139 RenderTarget::GetHeight(void)
145 RenderTarget::SetSize(unsigned int width, unsigned int height)
151 __pCache->Invalidate();
156 }}}}} //Tizen::Ui::Effects::_Renderer::EngineModel