瀏覽代碼

fixed drawing point issue when this point is out of buffer dc.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1719 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 14 年之前
父節點
當前提交
c2badd8983
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      components/rtgui/common/dc_buffer.c

+ 3 - 0
components/rtgui/common/dc_buffer.c

@@ -134,6 +134,9 @@ static void rtgui_dc_buffer_draw_point(struct rtgui_dc* self, int x, int y)
 
 	dc = (struct rtgui_dc_buffer*)self;
 
+	/* does not draw point out of dc */
+	if ((x > dc->width) || (y > dc->height)) return ;
+	
 	/* note: there is no parameter check in this function */
 	ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t));