2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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.
17 #ifndef _TVG_FILL_CPP_
18 #define _TVG_FILL_CPP_
20 #include "tvgCommon.h"
23 /************************************************************************/
24 /* Internal Class Implementation */
25 /************************************************************************/
29 ColorStop* colorStops = nullptr;
35 if (colorStops) free(colorStops);
40 /************************************************************************/
41 /* External Class Implementation */
42 /************************************************************************/
44 Fill::Fill():pImpl(make_unique<Impl>())
54 Result Fill::colorStops(const ColorStop* colorStops, uint32_t cnt) noexcept
56 auto impl = pImpl.get();
59 if (impl->colorStops) {
60 free(impl->colorStops);
61 impl->colorStops = nullptr;
64 return Result::Success;
67 if (impl->cnt != cnt) {
68 impl->colorStops = static_cast<ColorStop*>(realloc(impl->colorStops, cnt * sizeof(ColorStop)));
72 memcpy(impl->colorStops, colorStops, cnt * sizeof(ColorStop));
74 return Result::Success;
78 uint32_t Fill::colorStops(const ColorStop** colorStops) const noexcept
80 if (colorStops) *colorStops = IMPL->colorStops;
86 Result Fill::spread(FillSpread s) noexcept
90 return Result::Success;
94 FillSpread Fill::spread() const noexcept
99 #endif /* _TVG_FILL_CPP_ */