/* * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _TVG_SWCANVAS_CPP_ #define _TVG_SWCANVAS_CPP_ #include "tvgCommon.h" #include "tvgSwRenderer.h" /************************************************************************/ /* Internal Class Implementation */ /************************************************************************/ struct SwCanvas::Impl { Impl() {} }; /************************************************************************/ /* External Class Implementation */ /************************************************************************/ SwCanvas::SwCanvas() : Canvas(SwRenderer::inst()), pImpl(make_unique()) { } SwCanvas::~SwCanvas() { } int SwCanvas::clear() noexcept { auto renderer = dynamic_cast(engine()); assert(renderer); if (!renderer->clear()) return -1; return Canvas::clear(); } int SwCanvas::target(uint32_t* buffer, size_t stride, size_t w, size_t h) noexcept { auto renderer = dynamic_cast(engine()); assert(renderer); if (!renderer->target(buffer, stride, w, h)) return -1; if (!renderer->clear()) return -1; return 0; } int SwCanvas::sync() noexcept { return 0; } unique_ptr SwCanvas::gen() noexcept { auto canvas = unique_ptr(new SwCanvas); assert(canvas); return canvas; } #endif /* _TVG_SWCANVAS_CPP_ */