void tscrollbar_container::set_visible_area(const SDL_Rect& area) { // Inherited. tcontainer_::set_visible_area(area); // Now get the visible part of the content. content_visible_area_ = intersect_rects(area, content_->get_rect()); content_grid_->set_visible_area(content_visible_area_); }
void twidget::set_visible_area(const SDL_Rect& area) { clip_rect_ = intersect_rects(area, get_rect()); if(clip_rect_ == get_rect()) { drawing_action_ = DRAWN; } else if(clip_rect_ == empty_rect) { drawing_action_ = NOT_DRAWN; } else { drawing_action_ = PARTLY_DRAWN; } }
void twidget::set_visible_rectangle(const SDL_Rect& rectangle) { clipping_rectangle_ = intersect_rects(rectangle, get_rectangle()); if(clipping_rectangle_ == get_rectangle()) { redraw_action_ = tredraw_action::full; } else if(clipping_rectangle_ == empty_rect) { redraw_action_ = tredraw_action::none; } else { redraw_action_ = tredraw_action::partly; } }
SDL_Rect twidget::calculate_clipping_rectangle(SDL_Surface* surf, const int x_offset, const int y_offset) { SDL_Rect clip_rect = clip_rect_; clip_rect.x += x_offset; clip_rect.y += y_offset; SDL_Rect surf_clip_rect; SDL_GetClipRect(surf, &surf_clip_rect); if (surf_clip_rect.w != surf->w || surf_clip_rect.h != surf->h) { return intersect_rects(clip_rect, surf_clip_rect); } return clip_rect; }