Changeset View
Changeset View
Standalone View
Standalone View
commands/kpCommandSize.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
50 | } | 50 | } | ||
51 | 51 | | |||
52 | // public static | 52 | // public static | ||
53 | kpCommandSize::SizeType kpCommandSize::PixmapSize (int width, int height, int depth) | 53 | kpCommandSize::SizeType kpCommandSize::PixmapSize (int width, int height, int depth) | ||
54 | { | 54 | { | ||
55 | // handle 15bpp | 55 | // handle 15bpp | ||
56 | int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); | 56 | int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); | ||
57 | kpCommandSize::SizeType ret = | 57 | kpCommandSize::SizeType ret = | ||
58 | (kpCommandSize::SizeType) width * height * roundedDepth / 8; | 58 | static_cast<kpCommandSize::SizeType> (width) * height * roundedDepth / 8; | ||
59 | 59 | | |||
60 | #if DEBUG_KP_COMMAND_SIZE && 0 | 60 | #if DEBUG_KP_COMMAND_SIZE && 0 | ||
61 | qCDebug(kpLogCommands) << "kpCommandSize::PixmapSize() w=" << width | 61 | qCDebug(kpLogCommands) << "kpCommandSize::PixmapSize() w=" << width | ||
62 | << " h=" << height | 62 | << " h=" << height | ||
63 | << " d=" << depth | 63 | << " d=" << depth | ||
64 | << " roundedDepth=" << roundedDepth | 64 | << " roundedDepth=" << roundedDepth | ||
65 | << " ret=" << ret | 65 | << " ret=" << ret | ||
66 | << endl; | 66 | << endl; | ||
Show All 15 Lines | |||||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | // public static | 84 | // public static | ||
85 | kpCommandSize::SizeType kpCommandSize::QImageSize (int width, int height, int depth) | 85 | kpCommandSize::SizeType kpCommandSize::QImageSize (int width, int height, int depth) | ||
86 | { | 86 | { | ||
87 | // handle 15bpp | 87 | // handle 15bpp | ||
88 | int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); | 88 | int roundedDepth = (depth > 8 ? (depth + 7) / 8 * 8 : depth); | ||
89 | kpCommandSize::SizeType ret = | 89 | kpCommandSize::SizeType ret = | ||
90 | (kpCommandSize::SizeType) width * height * roundedDepth / 8; | 90 | static_cast<kpCommandSize::SizeType> (width) * height * roundedDepth / 8; | ||
91 | 91 | | |||
92 | #if DEBUG_KP_COMMAND_SIZE && 0 | 92 | #if DEBUG_KP_COMMAND_SIZE && 0 | ||
93 | qCDebug(kpLogCommands) << "kpCommandSize::QImageSize() w=" << width | 93 | qCDebug(kpLogCommands) << "kpCommandSize::QImageSize() w=" << width | ||
94 | << " h=" << height | 94 | << " h=" << height | ||
95 | << " d=" << depth | 95 | << " d=" << depth | ||
96 | << " roundedDepth=" << roundedDepth | 96 | << " roundedDepth=" << roundedDepth | ||
97 | << " ret=" << ret | 97 | << " ret=" << ret | ||
98 | << endl; | 98 | << endl; | ||
Show All 33 Lines | |||||
132 | kpCommandSize::SizeType kpCommandSize::StringSize (const QString &string) | 132 | kpCommandSize::SizeType kpCommandSize::StringSize (const QString &string) | ||
133 | { | 133 | { | ||
134 | #if DEBUG_KP_COMMAND_SIZE && 1 | 134 | #if DEBUG_KP_COMMAND_SIZE && 1 | ||
135 | qCDebug(kpLogCommands) << "kpCommandSize::StringSize(" << string << ")" | 135 | qCDebug(kpLogCommands) << "kpCommandSize::StringSize(" << string << ")" | ||
136 | << " len=" << string.length () | 136 | << " len=" << string.length () | ||
137 | << " sizeof(QChar)=" << sizeof (QChar) | 137 | << " sizeof(QChar)=" << sizeof (QChar) | ||
138 | << endl; | 138 | << endl; | ||
139 | #endif | 139 | #endif | ||
140 | return ((SizeType) string.length () * sizeof (QChar)); | 140 | return static_cast<SizeType> (static_cast<unsigned int> (string.length ()) * sizeof (QChar)); | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | 143 | | |||
144 | // public static | 144 | // public static | ||
145 | kpCommandSize::SizeType kpCommandSize::PolygonSize (const QPolygon &points) | 145 | kpCommandSize::SizeType kpCommandSize::PolygonSize (const QPolygon &points) | ||
146 | { | 146 | { | ||
147 | #if DEBUG_KP_COMMAND_SIZE && 1 | 147 | #if DEBUG_KP_COMMAND_SIZE && 1 | ||
148 | qCDebug(kpLogCommands) << "kpCommandSize::PolygonSize() points.size=" | 148 | qCDebug(kpLogCommands) << "kpCommandSize::PolygonSize() points.size=" | ||
149 | << points.size () | 149 | << points.size () | ||
150 | << " sizeof(QPoint)=" << sizeof (QPoint) | 150 | << " sizeof(QPoint)=" << sizeof (QPoint) | ||
151 | << endl; | 151 | << endl; | ||
152 | #endif | 152 | #endif | ||
153 | 153 | | |||
154 | return ((SizeType) points.size () * sizeof (QPoint)); | 154 | return static_cast<SizeType> (static_cast<unsigned int> (points.size ()) * sizeof (QPoint)); | ||
155 | } | 155 | } | ||
156 | 156 | |