mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
86 lines
2 KiB
C++
86 lines
2 KiB
C++
/*
|
|
* 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_GLCANVAS_CPP_
|
|
#define _TVG_GLCANVAS_CPP_
|
|
|
|
#include "tvgCommon.h"
|
|
#include "tvgCanvasBase.h"
|
|
#include "tvgGlRaster.h"
|
|
|
|
/************************************************************************/
|
|
/* Internal Class Implementation */
|
|
/************************************************************************/
|
|
|
|
struct GlCanvas::Impl : CanvasBase
|
|
{
|
|
Impl() : CanvasBase(GlRaster::inst()) {}
|
|
};
|
|
|
|
|
|
/************************************************************************/
|
|
/* External Class Implementation */
|
|
/************************************************************************/
|
|
|
|
GlCanvas::GlCanvas() : pImpl(make_unique<Impl>())
|
|
{
|
|
}
|
|
|
|
|
|
GlCanvas::~GlCanvas()
|
|
{
|
|
cout << "GlCanvas(" << this << ") destroyed!" << endl;
|
|
}
|
|
|
|
|
|
unique_ptr<GlCanvas> GlCanvas::gen() noexcept
|
|
{
|
|
auto canvas = unique_ptr<GlCanvas>(new GlCanvas);
|
|
assert(canvas);
|
|
|
|
return canvas;
|
|
}
|
|
|
|
|
|
int GlCanvas::push(unique_ptr<PaintNode> paint) noexcept
|
|
{
|
|
auto impl = pImpl.get();
|
|
assert(impl);
|
|
return impl->push(move(paint));
|
|
}
|
|
|
|
int GlCanvas::clear() noexcept
|
|
{
|
|
auto impl = pImpl.get();
|
|
assert(impl);
|
|
return impl->clear();
|
|
}
|
|
|
|
|
|
int GlCanvas::update() noexcept
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
RasterMethod* GlCanvas::engine() noexcept
|
|
{
|
|
auto impl = pImpl.get();
|
|
assert(impl);
|
|
return impl->raster;
|
|
}
|
|
|
|
#endif /* _TVG_GLCANVAS_CPP_ */
|