summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-10 16:35:22 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-10-28 17:09:51 -0700
commitee3235708f5422c2737c41fca948c67ace598f4b (patch)
tree53d00c00cbabf31b732d6e5ccb9fbe2960a1acae /src
parentfa96612888940df240dbad81c02a4b7b14654f06 (diff)
downloadqtlocation-mapboxgl-ee3235708f5422c2737c41fca948c67ace598f4b.tar.gz
[core] Methods don't need to be Painter instance methods
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/painter.hpp4
-rw-r--r--src/mbgl/renderer/painter_raster.cpp56
2 files changed, 28 insertions, 32 deletions
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index f339ed1aed..b64eb308c4 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -99,10 +99,6 @@ public:
void renderRaster(PaintParameters&, RasterBucket&, const style::RasterLayer&, const RenderTile&);
void renderBackground(PaintParameters&, const style::BackgroundLayer&);
- float saturationFactor(float saturation);
- float contrastFactor(float contrast);
- std::array<float, 3> spinWeights(float spin_value);
-
void drawClippingMasks(PaintParameters&, const std::map<UnwrappedTileID, ClipID>&);
bool needsAnimation() const;
diff --git a/src/mbgl/renderer/painter_raster.cpp b/src/mbgl/renderer/painter_raster.cpp
index 8b39c8adf8..98299ed342 100644
--- a/src/mbgl/renderer/painter_raster.cpp
+++ b/src/mbgl/renderer/painter_raster.cpp
@@ -11,6 +11,34 @@ namespace mbgl {
using namespace style;
+static float saturationFactor(float saturation) {
+ if (saturation > 0) {
+ return 1 - 1 / (1.001 - saturation);
+ } else {
+ return -saturation;
+ }
+}
+
+static float contrastFactor(float contrast) {
+ if (contrast > 0) {
+ return 1 / (1 - contrast);
+ } else {
+ return 1 + contrast;
+ }
+}
+
+static std::array<float, 3> spinWeights(float spin) {
+ spin *= util::DEG2RAD;
+ float s = std::sin(spin);
+ float c = std::cos(spin);
+ std::array<float, 3> spin_weights = {{
+ (2 * c + 1) / 3,
+ (-std::sqrt(3.0f) * s - c + 1) / 3,
+ (std::sqrt(3.0f) * s - c + 1) / 3
+ }};
+ return spin_weights;
+}
+
void Painter::renderRaster(PaintParameters& parameters,
RasterBucket& bucket,
const RasterLayer& layer,
@@ -51,32 +79,4 @@ void Painter::renderRaster(PaintParameters& parameters,
}
}
-float Painter::saturationFactor(float saturation) {
- if (saturation > 0) {
- return 1 - 1 / (1.001 - saturation);
- } else {
- return -saturation;
- }
-}
-
-float Painter::contrastFactor(float contrast) {
- if (contrast > 0) {
- return 1 / (1 - contrast);
- } else {
- return 1 + contrast;
- }
-}
-
-std::array<float, 3> Painter::spinWeights(float spin) {
- spin *= util::DEG2RAD;
- float s = std::sin(spin);
- float c = std::cos(spin);
- std::array<float, 3> spin_weights = {{
- (2 * c + 1) / 3,
- (-std::sqrt(3.0f) * s - c + 1) / 3,
- (std::sqrt(3.0f) * s - c + 1) / 3
- }};
- return spin_weights;
-}
-
} // namespace mbgl