gfx.c
changeset 4429 b4eb6d97996f
parent 4428 6d9fab57f2af
child 4437 49e79e135539
equal deleted inserted replaced
4428:6d9fab57f2af 4429:b4eb6d97996f
  1878 void MarkWholeScreenDirty(void)
  1878 void MarkWholeScreenDirty(void)
  1879 {
  1879 {
  1880 	SetDirtyBlocks(0, 0, _screen.width, _screen.height);
  1880 	SetDirtyBlocks(0, 0, _screen.width, _screen.height);
  1881 }
  1881 }
  1882 
  1882 
  1883 bool FillDrawPixelInfo(DrawPixelInfo *n, const DrawPixelInfo *o, int left, int top, int width, int height)
  1883 bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
  1884 {
  1884 {
  1885 	int t;
  1885 	const DrawPixelInfo *o = _cur_dpi;
  1886 
       
  1887 	if (o == NULL) o = _cur_dpi;
       
  1888 
  1886 
  1889 	n->zoom = 0;
  1887 	n->zoom = 0;
  1890 
  1888 
  1891 	assert(width > 0);
  1889 	assert(width > 0);
  1892 	assert(height > 0);
  1890 	assert(height > 0);
  1893 
  1891 
  1894 	n->left = 0;
       
  1895 	if ((left -= o->left) < 0) {
  1892 	if ((left -= o->left) < 0) {
  1896 		width += left;
  1893 		width += left;
  1897 		if (width < 0) return false;
  1894 		if (width < 0) return false;
  1898 		n->left = -left;
  1895 		n->left = -left;
  1899 		left = 0;
  1896 		left = 0;
  1900 	}
  1897 	} else {
  1901 
  1898 		n->left = 0;
  1902 	if ((t=width + left - o->width) > 0) {
  1899 	}
  1903 		width -= t;
  1900 
       
  1901 	if (width > o->width - left) {
       
  1902 		width = o->width - left;
  1904 		if (width < 0) return false;
  1903 		if (width < 0) return false;
  1905 	}
  1904 	}
  1906 	n->width = width;
  1905 	n->width = width;
  1907 
  1906 
  1908 	n->top = 0;
       
  1909 	if ((top -= o->top) < 0) {
  1907 	if ((top -= o->top) < 0) {
  1910 		height += top;
  1908 		height += top;
  1911 		if (height < 0) return false;
  1909 		if (height < 0) return false;
  1912 		n->top = -top;
  1910 		n->top = -top;
  1913 		top = 0;
  1911 		top = 0;
       
  1912 	} else {
       
  1913 		n->top = 0;
  1914 	}
  1914 	}
  1915 
  1915 
  1916 	n->dst_ptr = o->dst_ptr + left + top * (n->pitch = o->pitch);
  1916 	n->dst_ptr = o->dst_ptr + left + top * (n->pitch = o->pitch);
  1917 
  1917 
  1918 	if ((t=height + top - o->height) > 0) {
  1918 	if (height > o->height - top) {
  1919 		height -= t;
  1919 		height = o->height - top;
  1920 		if (height < 0) return false;
  1920 		if (height < 0) return false;
  1921 	}
  1921 	}
  1922 	n->height = height;
  1922 	n->height = height;
  1923 
  1923 
  1924 	return true;
  1924 	return true;