(self, widget=None, event=None)
| 444 | |
| 445 | |
| 446 | def draw(self, widget=None, event=None): |
| 447 | |
| 448 | ctxWindow = self.window.cairo_create() |
| 449 | |
| 450 | self.loadGraphics(ctxWindow) |
| 451 | |
| 452 | winRect = self.get_allocation() |
| 453 | winX = winRect.x |
| 454 | winY = winRect.y |
| 455 | winWidth = winRect.width |
| 456 | winHeight = winRect.height |
| 457 | |
| 458 | windowBuffer = self.windowBuffer |
| 459 | windowBufferWidth = self.windowBufferWidth |
| 460 | windowBufferHeight = self.windowBufferHeight |
| 461 | |
| 462 | slop = 4 |
| 463 | |
| 464 | if ((not windowBuffer) or |
| 465 | (windowBufferWidth < winWidth) or |
| 466 | (windowBufferHeight < winHeight)): |
| 467 | |
| 468 | nativeTarget = ctxWindow.get_target() |
| 469 | windowBufferWidth = max(windowBufferWidth, winWidth + slop) |
| 470 | windowBufferHeight = max(windowBufferHeight, winHeight + slop) |
| 471 | |
| 472 | #print "!!!! Window Buffer growing from", self.windowBufferWidth, self.windowBufferHeight, "to", windowBufferWidth, windowBufferHeight |
| 473 | |
| 474 | windowBuffer = nativeTarget.create_similar(cairo.CONTENT_COLOR, windowBufferWidth, windowBufferHeight) |
| 475 | |
| 476 | self.windowBuffer = windowBuffer |
| 477 | self.windowBufferWidth = windowBufferWidth |
| 478 | self.windowBufferHeight = windowBufferHeight |
| 479 | |
| 480 | ctxWindowBuffer = cairo.Context(windowBuffer) |
| 481 | |
| 482 | debugInset = self.debugInset |
| 483 | if debugInset: |
| 484 | # Enable debugInset to help debug the tile drawing optimization, |
| 485 | # by insetting the view and drawing a rectangle over where it |
| 486 | # would be clipped. |
| 487 | |
| 488 | winX += debugInset |
| 489 | winY += debugInset |
| 490 | winWidth -= debugInset * 2 |
| 491 | winHeight -= debugInset * 2 |
| 492 | |
| 493 | ctxWindowBuffer.save() |
| 494 | ctxWindowBuffer.set_fill_rule(cairo.FILL_RULE_EVEN_ODD) |
| 495 | ctxWindowBuffer.rectangle(winRect.x, winRect.y, winRect.width, winRect.height) |
| 496 | ctxWindowBuffer.rectangle(winX, winY, winWidth, winHeight) |
| 497 | ctxWindowBuffer.set_source_rgb(1.0, 1.0, 0.0) |
| 498 | ctxWindowBuffer.fill() |
| 499 | |
| 500 | panX = self.panX |
| 501 | panY = self.panY |
| 502 | cellCols = self.cellCols |
| 503 | cellRows = self.cellRows |
no test coverage detected