comparison layer/LinearColourScale.cpp @ 805:1d526ba11a24 warnfix_no_size_t

Remove size_t's and fix warnings in layer/
author Chris Cannam
date Tue, 17 Jun 2014 15:18:06 +0100
parents 1a1448f7beb2
children 3ca3b8fbbcee
comparison
equal deleted inserted replaced
782:ddae586bc47b 805:1d526ba11a24
21 #include <cmath> 21 #include <cmath>
22 22
23 #include "view/View.h" 23 #include "view/View.h"
24 24
25 int 25 int
26 LinearColourScale::getWidth(View *v, 26 LinearColourScale::getWidth(View *,
27 QPainter &paint) 27 QPainter &paint)
28 { 28 {
29 return paint.fontMetrics().width("-000.00") + 15; 29 return paint.fontMetrics().width("-000.00") + 15;
30 } 30 }
31 31
32 void 32 void
33 LinearColourScale::paintVertical(View *v, 33 LinearColourScale::paintVertical(View *v,
34 const ColourScaleLayer *layer, 34 const ColourScaleLayer *layer,
35 QPainter &paint, 35 QPainter &paint,
36 int x0, 36 int /* x0 */,
37 float min, 37 float min,
38 float max) 38 float max)
39 { 39 {
40 int h = v->height(); 40 int h = v->height();
41 41
43 43
44 float val = min; 44 float val = min;
45 float inc = (max - val) / n; 45 float inc = (max - val) / n;
46 46
47 char buffer[40]; 47 char buffer[40];
48
49 int w = getWidth(v, paint) + x0;
50 48
51 int boxx = 5, boxy = 5; 49 int boxx = 5, boxy = 5;
52 if (layer->getScaleUnits() != "") { 50 if (layer->getScaleUnits() != "") {
53 boxy += paint.fontMetrics().height(); 51 boxy += paint.fontMetrics().height();
54 } 52 }
63 paint.setPen(layer->getColourForValue(v, val)); 61 paint.setPen(layer->getColourForValue(v, val));
64 paint.drawLine(boxx + 1, y + boxy + 1, boxx + boxw, y + boxy + 1); 62 paint.drawLine(boxx + 1, y + boxy + 1, boxx + boxw, y + boxy + 1);
65 } 63 }
66 paint.restore(); 64 paint.restore();
67 65
68 float round = 1.f; 66 // float round = 1.f;
69 int dp = 0; 67 int dp = 0;
70 if (inc > 0) { 68 if (inc > 0) {
71 int prec = trunc(log10f(inc)); 69 int prec = trunc(log10f(inc));
72 prec -= 1; 70 prec -= 1;
73 if (prec < 0) dp = -prec; 71 if (prec < 0) dp = -prec;
74 round = powf(10.f, prec); 72 // round = powf(10.f, prec);
75 #ifdef DEBUG_TIME_VALUE_LAYER 73 //#ifdef DEBUG_TIME_VALUE_LAYER
76 cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl; 74 // cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl;
77 #endif 75 //#endif
78 } 76 }
79 77
80 for (int i = 0; i < n; ++i) { 78 for (int i = 0; i < n; ++i) {
81 79
82 int y, ty; 80 int y, ty;