Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLBasicPolylineRenderer.cpp @ 655:1e26bb5f2a02
Fixed truncating conversion warnings + fixed deletion of incomplete type
(seemingly due to M$ auto_ptr implementation)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 14 May 2019 13:51:32 +0200 |
parents | 6bf8f881fcb5 |
children | 61ba4b504e9a |
comparison
equal
deleted
inserted
replaced
654:462a5074f914 | 655:1e26bb5f2a02 |
---|---|
11 * | 11 * |
12 * This program is distributed in the hope that it will be useful, but | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | 15 * Affero General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Affero General Public License | 17 * You should have received a copy of the GNU Affero General Public License |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
26 namespace OrthancStone | 26 namespace OrthancStone |
27 { | 27 { |
28 namespace Internals | 28 namespace Internals |
29 { | 29 { |
30 OpenGLBasicPolylineRenderer::OpenGLBasicPolylineRenderer(OpenGL::IOpenGLContext& context, | 30 OpenGLBasicPolylineRenderer::OpenGLBasicPolylineRenderer(OpenGL::IOpenGLContext& context, |
31 const PolylineSceneLayer& layer) : | 31 const PolylineSceneLayer& layer) : |
32 context_(context) | 32 context_(context) |
33 { | 33 { |
34 layer_.Copy(layer); | 34 layer_.Copy(layer); |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 void OpenGLBasicPolylineRenderer::Render(const AffineTransform2D& transform) | 38 void OpenGLBasicPolylineRenderer::Render(const AffineTransform2D& transform) |
39 { | 39 { |
40 AffineTransform2D t = AffineTransform2D::Combine( | 40 AffineTransform2D t = AffineTransform2D::Combine( |
41 AffineTransform2D::CreateOpenGLClipspace(context_.GetCanvasWidth(), context_.GetCanvasHeight()), | 41 AffineTransform2D::CreateOpenGLClipspace(context_.GetCanvasWidth(), context_.GetCanvasHeight()), |
42 transform); | 42 transform); |
56 | 56 |
57 for (size_t j = 1; j < chain.size(); j++) | 57 for (size_t j = 1; j < chain.size(); j++) |
58 { | 58 { |
59 ScenePoint2D p = chain[j].Apply(t); | 59 ScenePoint2D p = chain[j].Apply(t); |
60 | 60 |
61 glVertex2f(previous.GetX(), previous.GetY()); | 61 glVertex2f(static_cast<GLfloat>(previous.GetX()), |
62 glVertex2f(p.GetX(), p.GetY()); | 62 static_cast<GLfloat>(previous.GetY())); |
63 glVertex2f(static_cast<GLfloat>(p.GetX()), | |
64 static_cast<GLfloat>(p.GetY())); | |
63 | 65 |
64 previous = p; | 66 previous = p; |
65 } | 67 } |
66 | 68 |
67 if (layer_.IsClosedChain(i)) | 69 if (layer_.IsClosedChain(i)) |
68 { | 70 { |
69 ScenePoint2D p = chain[0].Apply(t); | 71 ScenePoint2D p = chain[0].Apply(t); |
70 | 72 |
71 glVertex2f(previous.GetX(), previous.GetY()); | 73 glVertex2f(static_cast<GLfloat>(previous.GetX()), |
72 glVertex2f(p.GetX(), p.GetY()); | 74 static_cast<GLfloat>(previous.GetY())); |
75 glVertex2f(static_cast<GLfloat>(p.GetX()), | |
76 static_cast<GLfloat>(p.GetY())); | |
73 } | 77 } |
74 } | 78 } |
75 } | 79 } |
76 | 80 |
77 glEnd(); | 81 glEnd(); |
78 } | 82 } |
79 | 83 |
80 | 84 |
81 void OpenGLBasicPolylineRenderer::Update(const ISceneLayer& layer) | 85 void OpenGLBasicPolylineRenderer::Update(const ISceneLayer& layer) |
82 { | 86 { |
83 layer_.Copy(dynamic_cast<const PolylineSceneLayer&>(layer)); | 87 layer_.Copy(dynamic_cast<const PolylineSceneLayer&>(layer)); |
84 } | 88 } |
85 } | 89 } |