@@ -23,8 +23,8 @@ struct Color32
2323 // @param cr, cg, cb, ca: Color components
2424 inline void SetComponents (unsigned char cr, unsigned char cg, unsigned char cb, unsigned char ca)
2525 {
26- mA = cr ;
27- mR = cg ;
26+ mA = ca ;
27+ mR = cr ;
2828 mG = cg;
2929 mB = cb;
3030 }
@@ -253,73 +253,4 @@ struct Palette256
253253 }
254254public:
255255 Color32 mColors [256 ];
256- };
257-
258- // defines time interval in milliseconds
259- struct Timespan
260- {
261- public:
262- // @param timeMilliseconds: Milliseconds
263- Timespan () = default ;
264- Timespan (long long timeMilliseconds) : mMilliseconds (timeMilliseconds)
265- {
266- }
267- inline Timespan& operator += (const Timespan& timespan)
268- {
269- mMilliseconds += timespan.mMilliseconds ;
270- return *this ;
271- }
272- inline Timespan& operator -= (const Timespan& timespan)
273- {
274- mMilliseconds -= timespan.mMilliseconds ;
275- return *this ;
276- }
277-
278- static const long long MillisecondsPerSecond = 1000LL ;
279- static const long long MillisecondsPerMinute = 60000LL ;
280- static const long long MillisecondsPerHour = 3600000LL ;
281- static const long long MillisecondsPerDay = 86400000LL ;
282-
283- // convert time to timespan
284- // @param intime: Input amount of time specified in days/hours/minutes/seconds
285- static Timespan FromDays (float intime)
286- {
287- return (long long )(intime * MillisecondsPerDay);
288- }
289-
290- static Timespan FromHours (float intime)
291- {
292- return (long long )(intime * MillisecondsPerHour);
293- }
294-
295- static Timespan FromMinutes (float intime)
296- {
297- return (long long )(intime * MillisecondsPerMinute);
298- }
299-
300- static Timespan FromSeconds (float intime)
301- {
302- return (long long )(intime * MillisecondsPerSecond);
303- }
304-
305- // convert timespan to specific time values
306- inline float ToMinutes () const { return (mMilliseconds * 1 .0f ) / (MillisecondsPerMinute * 1 .0f ); }
307- inline float ToSeconds () const { return (mMilliseconds * 1 .0f ) / (MillisecondsPerSecond * 1 .0f ); }
308- inline float ToDays () const { return (mMilliseconds * 1 .0f ) / (MillisecondsPerDay * 1 .0f ); }
309- inline float ToHours () const { return (mMilliseconds * 1 .0f ) / (MillisecondsPerHour * 1 .0f ); }
310-
311- public:
312- long long mMilliseconds = 0 ;
313- };
314-
315- inline bool operator == (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds == theR.mMilliseconds ; }
316- inline bool operator != (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds != theR.mMilliseconds ; }
317-
318- inline bool operator > (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds > theR.mMilliseconds ; }
319- inline bool operator < (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds < theR.mMilliseconds ; }
320-
321- inline bool operator >= (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds >= theR.mMilliseconds ; }
322- inline bool operator <= (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds <= theR.mMilliseconds ; }
323-
324- inline Timespan operator - (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds - theR.mMilliseconds ; }
325- inline Timespan operator + (const Timespan& theL, const Timespan& theR) { return theL.mMilliseconds + theR.mMilliseconds ; }
256+ };
0 commit comments