diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-20 15:55:39 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-04-05 11:49:17 +0200 |
commit | 394e2aa7171943b7b0be77be7b19bc4a97c36905 (patch) | |
tree | e90ac54cc8e8b3c4d476cd6b19cf0f39f446dc8b | |
parent | be3b5917c169a6d5e6fcdc3cca15ca78e44dfd1d (diff) | |
download | qtlocation-mapboxgl-394e2aa7171943b7b0be77be7b19bc4a97c36905.tar.gz |
[core] prefer static_cast for casts to derived classes
-rw-r--r-- | src/mbgl/gl/program.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/gl/texture.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_custom_layer.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_layer.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_heatmap_layer.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_impl.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/util/offscreen_texture.cpp | 4 |
8 files changed, 10 insertions, 10 deletions
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 1cec7671a1..92747e60c4 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -168,7 +168,7 @@ public: const gfx::IndexBuffer& indexBuffer, std::size_t indexOffset, std::size_t indexLength) override { - auto& context = reinterpret_cast<gl::Context&>(genericContext); + auto& context = static_cast<gl::Context&>(genericContext); context.setDepthMode(depthMode); context.setStencilMode(stencilMode); @@ -194,7 +194,7 @@ public: instance.textureStates.bind(context, textureBindings); - auto& vertexArray = reinterpret_cast<gl::DrawScopeResource&>(*drawScope.resource).vertexArray; + auto& vertexArray = static_cast<gl::DrawScopeResource&>(*drawScope.resource).vertexArray; vertexArray.bind(context, indexBuffer, instance.attributeLocations.toBindingArray(attributeBindings)); diff --git a/src/mbgl/gl/texture.cpp b/src/mbgl/gl/texture.cpp index 2b41e7ae8e..ef4d083677 100644 --- a/src/mbgl/gl/texture.cpp +++ b/src/mbgl/gl/texture.cpp @@ -9,7 +9,7 @@ namespace gl { using namespace platform; void bindTexture(gl::Context& context, const uint8_t unit, const gfx::TextureBinding& binding) { - auto& resource = reinterpret_cast<gl::TextureResource&>(*binding.resource); + auto& resource = static_cast<gl::TextureResource&>(*binding.resource); if (binding.filter != resource.filter || binding.mipmap != resource.mipmap || binding.wrapX != resource.wrapX || binding.wrapY != resource.wrapY) { context.activeTextureUnit = unit; diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index 8ac7d29ff6..10cc375585 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -58,7 +58,7 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) } // TODO: remove cast - gl::Context& glContext = reinterpret_cast<gl::Context&>(paintParameters.context); + gl::Context& glContext = static_cast<gl::Context&>(paintParameters.context); const TransformState& state = paintParameters.state; // Reset GL state to a known state so the CustomLayer always has a clean slate. diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index c261e9048f..25c3db2e49 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -52,7 +52,7 @@ bool RenderFillExtrusionLayer::hasCrossfade() const { void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*) { // TODO: remove cast - gl::Context& glContext = reinterpret_cast<gl::Context&>(parameters.context); + gl::Context& glContext = static_cast<gl::Context&>(parameters.context); if (parameters.pass == RenderPass::Opaque) { return; diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 205a38e380..10c3df762a 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -64,7 +64,7 @@ bool RenderFillLayer::hasCrossfade() const { void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { // TODO: remove cast - gl::Context& glContext = reinterpret_cast<gl::Context&>(parameters.context); + gl::Context& glContext = static_cast<gl::Context&>(parameters.context); if (unevaluated.get<FillPattern>().isUndefined()) { for (const RenderTile& tile : renderTiles) { diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index f8ba68965e..88a81ca494 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -53,7 +53,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { } // TODO: remove cast - gl::Context& glContext = reinterpret_cast<gl::Context&>(parameters.context); + gl::Context& glContext = static_cast<gl::Context&>(parameters.context); if (parameters.pass == RenderPass::Pass3D) { const auto& viewportSize = parameters.staticData.backendSize; diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 00e40ae485..f5d72712b6 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -311,7 +311,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { backend.updateAssumedState(); // TODO: remove cast - gl::Context& glContext = reinterpret_cast<gl::Context&>(parameters.context); + gl::Context& glContext = static_cast<gl::Context&>(parameters.context); if (parameters.contextMode == GLContextMode::Shared) { glContext.setDirtyState(); diff --git a/src/mbgl/util/offscreen_texture.cpp b/src/mbgl/util/offscreen_texture.cpp index d7d5c55564..9fa1dcd90e 100644 --- a/src/mbgl/util/offscreen_texture.cpp +++ b/src/mbgl/util/offscreen_texture.cpp @@ -66,7 +66,7 @@ OffscreenTexture::OffscreenTexture(gfx::Context& context, const Size size, const gfx::TextureChannelDataType type) // TODO: remove cast - : impl(std::make_unique<Impl>(reinterpret_cast<gl::Context&>(context), std::move(size), type)) { + : impl(std::make_unique<Impl>(static_cast<gl::Context&>(context), std::move(size), type)) { assert(!size.isEmpty()); } @@ -75,7 +75,7 @@ OffscreenTexture::OffscreenTexture(gfx::Context& context, gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& renderbuffer, const gfx::TextureChannelDataType type) // TODO: remove cast - : impl(std::make_unique<Impl>(reinterpret_cast<gl::Context&>(context), std::move(size), renderbuffer, type)) { + : impl(std::make_unique<Impl>(static_cast<gl::Context&>(context), std::move(size), renderbuffer, type)) { assert(!size.isEmpty()); } |