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 <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
22 #include <dali/internal/update/manager/update-manager.h>
23 #include <dali/internal/event/common/stage-impl.h>
30 NewTexturePtr NewTexture::New(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
32 NewTexturePtr texture( new NewTexture( type, format, width, height ) );
33 texture->Initialize();
38 Render::NewTexture* NewTexture::GetRenderObject() const
43 NewTexture::NewTexture(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
44 : mEventThreadServices( *Stage::GetCurrent() ),
45 mRenderObject( NULL ),
53 void NewTexture::Initialize()
55 mRenderObject = new Render::NewTexture( mType, mFormat, mWidth, mHeight );
56 AddTexture( mEventThreadServices.GetUpdateManager(), *mRenderObject );
59 NewTexture::~NewTexture()
61 if( EventThreadServices::IsCoreRunning() && mRenderObject )
63 RemoveTexture( mEventThreadServices.GetUpdateManager(), *mRenderObject );
67 void NewTexture::Upload( Vector<unsigned char>& buffer, const TextureUploadParams& params )
69 UploadTextureMessage(mEventThreadServices.GetUpdateManager(), *mRenderObject, buffer, params );
72 void NewTexture::GenerateMipmaps()
74 GenerateMipmapsMessage(mEventThreadServices.GetUpdateManager(), *mRenderObject );
77 unsigned int NewTexture::GetWidth() const
82 unsigned int NewTexture::GetHeight() const
87 } // namespace Internal