Skip to content

Commit 9e39b1c

Browse files
committed
Fix drawing bugs in the battery, disk, and net graphs.
1 parent 8c926f5 commit 9e39b1c

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Graph Views/XRGBatteryView.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ - (void)drawRect:(NSRect)rect {
222222
// draw the battery bar
223223
[[appSettings graphFG1Color] set];
224224
if (self.batteryMiner.batteries.count) {
225-
percentRect.size.width = rect.size.width * ((float)[self.batteryMiner chargePercent] / 100.);
226-
225+
percentRect.size.width = bounds.size.width * ((float)[self.batteryMiner chargePercent] / 100.);
226+
227227
if ([self shouldDrawMiniGraph]) {
228-
percentRect.origin.y = self.bounds.origin.y;
229-
percentRect.size.height = self.bounds.size.height;
228+
percentRect.origin.y = bounds.origin.y;
229+
percentRect.size.height = bounds.size.height;
230230
}
231231

232232
NSRectFill(percentRect);
@@ -237,7 +237,7 @@ - (void)drawRect:(NSRect)rect {
237237
if (powerStatus == XRGBatteryStatusCharging) {
238238
NSRect chargingRect = NSMakeRect(percentRect.origin.x + percentRect.size.width,
239239
percentRect.origin.y,
240-
(rect.size.width - percentRect.size.width) * ((float)tripleCount / 3.),
240+
(bounds.size.width - percentRect.size.width) * ((float)tripleCount / 3.),
241241
percentRect.size.height);
242242

243243
NSRectFill(chargingRect);
@@ -247,8 +247,8 @@ - (void)drawRect:(NSRect)rect {
247247

248248
if (![self shouldDrawMiniGraph]) {
249249
// Draw the watts bar
250-
percentRect.origin.x = rect.size.width / 2.;
251-
percentRect.size.width = (rect.size.width / 2.) * (fabs(currentWatts) / maxWatts);
250+
percentRect.origin.x = bounds.size.width / 2.;
251+
percentRect.size.width = (bounds.size.width / 2.) * (fabs(currentWatts) / maxWatts);
252252
if (currentWatts < 0) {
253253
percentRect.origin.x -= percentRect.size.width;
254254
}
@@ -266,8 +266,8 @@ - (void)drawRect:(NSRect)rect {
266266
NSRectFill(percentRect);
267267

268268
// Fill the split bar for the amp graph
269-
NSRectFill(NSMakeRect((rect.size.width / 2.) - 1., topOfGraph, 2., textRectHeight + 2.));
270-
269+
NSRectFill(NSMakeRect((bounds.size.width / 2.) - 1., topOfGraph, 2., textRectHeight + 2.));
270+
271271
// Draw the battery capacity graph, only if there is space for it on the graph.
272272
percentRect.size.width = graphSize.width;
273273
percentRect.origin.y = 0;

Graph Views/XRGDiskView.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ - (void)drawRect:(NSRect)rect {
313313
for (i = 0; i < numSamples; ++i) data[i] = (CGFloat)values[i];
314314
}
315315

316-
[self drawGraphWithData:data size:numSamples currentIndex:currentIndex maxValue:maxVal inRect:rect flipped:([appSettings diskGraphMode] == 1) color: [appSettings graphFG2Color]];
317-
316+
[self drawGraphWithData:data size:numSamples currentIndex:currentIndex maxValue:maxVal inRect:bounds flipped:([appSettings diskGraphMode] == 1) color: [appSettings graphFG2Color]];
317+
318318
for (i = 0; i < numSamples; ++i) data[i] = (CGFloat)writeValues[i];
319319

320-
[self drawGraphWithData:data size:numSamples currentIndex:currentIndex maxValue:maxVal inRect:rect flipped:([appSettings diskGraphMode] == 2) color: [appSettings graphFG1Color]];
320+
[self drawGraphWithData:data size:numSamples currentIndex:currentIndex maxValue:maxVal inRect:bounds flipped:([appSettings diskGraphMode] == 2) color: [appSettings graphFG1Color]];
321321

322322
[gc setShouldAntialias:YES];
323323

Graph Views/XRGNetView.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ - (void)drawRect:(NSRect)rect {
132132

133133
/* received data */
134134
if (netGraphMode == 0) {
135-
[self drawGraphWithDataFromDataSet:self.miner.totalValues maxValue:max inRect:rect flipped:(netGraphMode == 2) filled:YES color:[appSettings graphFG2Color]];
135+
[self drawGraphWithDataFromDataSet:self.miner.totalValues maxValue:max inRect:bounds flipped:(netGraphMode == 2) filled:YES color:[appSettings graphFG2Color]];
136136
}
137137
else {
138-
[self drawGraphWithDataFromDataSet:self.miner.rxValues maxValue:max inRect:rect flipped:(netGraphMode == 2) filled:YES color:[appSettings graphFG2Color]];
138+
[self drawGraphWithDataFromDataSet:self.miner.rxValues maxValue:max inRect:bounds flipped:(netGraphMode == 2) filled:YES color:[appSettings graphFG2Color]];
139139
}
140140

141141
/* sent data */
142-
[self drawGraphWithDataFromDataSet:self.miner.txValues maxValue:max inRect:rect flipped:(netGraphMode == 1) filled:YES color:[appSettings graphFG1Color]];
142+
[self drawGraphWithDataFromDataSet:self.miner.txValues maxValue:max inRect:bounds flipped:(netGraphMode == 1) filled:YES color:[appSettings graphFG1Color]];
143143

144144
[gc setShouldAntialias:YES];
145145

0 commit comments

Comments
 (0)