]> git.sesse.net Git - casparcg/blob - core/frame/geometry.cpp
c547f981d32b93376a928cb8d0753b24e6fc606d
[casparcg] / core / frame / geometry.cpp
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
20 */
21
22
23 #include "..\StdAfx.h"
24
25 #include "geometry.h"
26
27 namespace caspar { namespace core {
28
29 struct frame_geometry::impl
30 {
31         impl() : type_(frame_geometry::none) {}
32         impl(frame_geometry::geometry_type t, std::vector<float> d) : type_(t), data_(std::move(d)) {}
33         
34         frame_geometry::geometry_type type_;
35         std::vector<float> data_;
36 };
37
38 frame_geometry::frame_geometry() : impl_(new impl()) {}
39 frame_geometry::frame_geometry(const frame_geometry& rhs) : impl_(rhs.impl_) {}
40 frame_geometry::frame_geometry(geometry_type t, std::vector<float> d) : impl_(new impl(t, std::move(d))) {}
41
42 const frame_geometry& frame_geometry::operator=(const frame_geometry& rhs) { impl_ = rhs.impl_; return *this; }
43
44 frame_geometry::geometry_type frame_geometry::type() { return impl_->type_; }
45 const std::vector<float>& frame_geometry::data() { return impl_->data_; }
46         
47 const frame_geometry& frame_geometry::get_default()
48 {
49         const float d[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f};
50         static frame_geometry g(frame_geometry::quad, std::move(std::vector<float>(d, d+8)));
51
52         return g;
53 }
54
55 }}