[dali_1.0.32] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / public-api / images / atlas.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/images/atlas.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/images/atlas-impl.h>
23 #include <dali/internal/event/images/buffer-image-impl.h>
24
25 namespace Dali
26 {
27
28 Atlas Atlas::New( std::size_t width,
29                   std::size_t height,
30                   Pixel::Format pixelFormat )
31 {
32   DALI_ASSERT_ALWAYS( 0u != width  && "Invalid Atlas width requested" );
33   DALI_ASSERT_ALWAYS( 0u != height && "Invalid Atlas height requested" );
34
35   return Atlas( Internal::Atlas::New( width, height, pixelFormat ) );
36 }
37
38 Atlas::Atlas()
39 {
40 }
41
42 bool Atlas::Upload( const BufferImage& bufferImage,
43                     std::size_t xOffset,
44                     std::size_t yOffset )
45 {
46   return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
47 }
48
49 Atlas Atlas::DownCast( BaseHandle handle )
50 {
51   return Atlas( dynamic_cast<Dali::Internal::Atlas*>(handle.GetObjectPtr()) );
52 }
53
54 Atlas::~Atlas()
55 {
56 }
57
58 Atlas::Atlas( const Atlas& handle )
59 : Image( handle )
60 {
61 }
62
63 Atlas& Atlas::operator=( const Atlas& rhs )
64 {
65   BaseHandle::operator=(rhs);
66   return *this;
67 }
68
69 Atlas::Atlas( Internal::Atlas* internal )
70 : Image( internal )
71 {
72 }
73
74 } // namespace Dali