1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "utils/data.h"
17
18 #include "impl_factory.h"
19 #include "utils/log.h"
20
21 namespace OHOS {
22 namespace Rosen {
23 namespace Drawing {
Data()24 Data::Data() noexcept : impl_(ImplFactory::CreateDataImpl()) {}
25
BuildFromMalloc(const void * data,size_t length)26 bool Data::BuildFromMalloc(const void* data, size_t length)
27 {
28 return impl_->BuildFromMalloc(data, length);
29 }
30
BuildWithCopy(const void * data,size_t length)31 bool Data::BuildWithCopy(const void* data, size_t length)
32 {
33 return impl_->BuildWithCopy(data, length);
34 }
35
BuildWithoutCopy(const void * data,size_t length)36 bool Data::BuildWithoutCopy(const void* data, size_t length)
37 {
38 return impl_->BuildWithoutCopy(data, length);
39 }
40
BuildUninitialized(size_t length)41 bool Data::BuildUninitialized(size_t length)
42 {
43 return impl_->BuildUninitialized(length);
44 }
45
GetSize() const46 size_t Data::GetSize() const
47 {
48 return impl_->GetSize();
49 }
50
GetData() const51 const void* Data::GetData() const
52 {
53 return impl_->GetData();
54 }
55
WritableData()56 void* Data::WritableData()
57 {
58 return impl_->WritableData();
59 }
60 } // namespace Drawing
61 } // namespace Rosen
62 } // namespace OHOS
63