| 982 | } |
| 983 | |
| 984 | void Widget::paint(Graphics* graphics, const gfx::Region& drawRegion) |
| 985 | { |
| 986 | if (drawRegion.isEmpty()) |
| 987 | return; |
| 988 | |
| 989 | std::queue<Widget*> processing; |
| 990 | processing.push(this); |
| 991 | |
| 992 | while (!processing.empty()) { |
| 993 | Widget* widget = processing.front(); |
| 994 | processing.pop(); |
| 995 | |
| 996 | ASSERT_VALID_WIDGET(widget); |
| 997 | |
| 998 | // If the widget is hidden |
| 999 | if (!widget->isVisible()) |
| 1000 | continue; |
| 1001 | |
| 1002 | for (auto child : widget->children()) |
| 1003 | processing.push(child); |
| 1004 | |
| 1005 | // Intersect drawRegion with widget's drawable region. |
| 1006 | Region region; |
| 1007 | widget->getDrawableRegion(region, kCutTopWindows); |
| 1008 | region.createIntersection(region, drawRegion); |
| 1009 | |
| 1010 | Graphics graphics2( |
| 1011 | graphics->getInternalSurface(), |
| 1012 | widget->bounds().x, |
| 1013 | widget->bounds().y); |
| 1014 | graphics2.setFont(widget->font()); |
| 1015 | |
| 1016 | for (Region::const_iterator |
| 1017 | it = region.begin(), |
| 1018 | end = region.end(); it != end; ++it) { |
| 1019 | IntersectClip clip(&graphics2, Rect(*it).offset( |
| 1020 | -widget->bounds().x, |
| 1021 | -widget->bounds().y)); |
| 1022 | widget->paintEvent(&graphics2); |
| 1023 | } |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | bool Widget::paintEvent(Graphics* graphics) |
| 1028 | { |
no test coverage detected