void ResourceDefault::SplitRect(const LayerRect &src_rect, const LayerRect &dst_rect,
                           LayerRect *src_left, LayerRect *dst_left, LayerRect *src_right,
                           LayerRect *dst_right) {
  // Split rectangle horizontally and evenly into two.
  float src_width = src_rect.right - src_rect.left;
  float dst_width = dst_rect.right - dst_rect.left;
  float src_width_ori = src_width;
  src_width = ROUND_UP_ALIGN_DOWN(src_width / 2, 1);
  dst_width = ROUND_UP_ALIGN_DOWN(dst_width * src_width / src_width_ori, 1);

  src_left->left = src_rect.left;
  src_left->right = src_rect.left + src_width;
  src_right->left = src_left->right;
  src_right->right = src_rect.right;

  src_left->top = src_rect.top;
  src_left->bottom = src_rect.bottom;
  src_right->top = src_rect.top;
  src_right->bottom = src_rect.bottom;

  dst_left->top = dst_rect.top;
  dst_left->bottom = dst_rect.bottom;
  dst_right->top = dst_rect.top;
  dst_right->bottom = dst_rect.bottom;

  dst_left->left = dst_rect.left;
  dst_left->right = dst_rect.left + dst_width;
  dst_right->left = dst_left->right;
  dst_right->right = dst_rect.right;
}
void Normalize(const uint32_t &align_x, const uint32_t &align_y, LayerRect *rect) {
    rect->left = ROUND_UP_ALIGN_UP(rect->left, align_x);
    rect->right = ROUND_UP_ALIGN_DOWN(rect->right, align_x);
    rect->top = ROUND_UP_ALIGN_UP(rect->top, align_y);
    rect->bottom = ROUND_UP_ALIGN_DOWN(rect->bottom, align_y);
}