glamor: Add clipping to setspans.
This commit is contained in:
		
							parent
							
								
									5fadea5d9c
								
							
						
					
					
						commit
						4a51cc0440
					
				| 
						 | 
					@ -40,6 +40,8 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
 | 
				
			||||||
    uint8_t *temp_src = NULL, *drawpixels_src = (uint8_t *)src;
 | 
					    uint8_t *temp_src = NULL, *drawpixels_src = (uint8_t *)src;
 | 
				
			||||||
    int i, j;
 | 
					    int i, j;
 | 
				
			||||||
    int wmax = 0;
 | 
					    int wmax = 0;
 | 
				
			||||||
 | 
					    RegionPtr clip = fbGetCompositeClip(gc);
 | 
				
			||||||
 | 
					    BoxRec *pbox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0 ; i < n; i++) {
 | 
					    for (i = 0 ; i < n; i++) {
 | 
				
			||||||
	if (wmax < widths[i])
 | 
						if (wmax < widths[i])
 | 
				
			||||||
| 
						 | 
					@ -87,12 +89,23 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glRasterPos2i(points[i].x - dest_pixmap->screen_x,
 | 
						n = REGION_NUM_RECTS(clip);
 | 
				
			||||||
		      points[i].y - dest_pixmap->screen_y);
 | 
						pbox = REGION_RECTS(clip);
 | 
				
			||||||
	glDrawPixels(widths[i],
 | 
						while (n--) {
 | 
				
			||||||
		     1,
 | 
						    if (pbox->y1 > points[i].y)
 | 
				
			||||||
		     format, type,
 | 
							break;
 | 
				
			||||||
		     drawpixels_src);
 | 
						    glScissor(pbox->x1,
 | 
				
			||||||
 | 
							      points[i].y - dest_pixmap->screen_y,
 | 
				
			||||||
 | 
							      pbox->x2 - pbox->x1,
 | 
				
			||||||
 | 
							      1);
 | 
				
			||||||
 | 
						    glEnable(GL_SCISSOR_TEST);
 | 
				
			||||||
 | 
						    glRasterPos2i(points[i].x - dest_pixmap->screen_x,
 | 
				
			||||||
 | 
								  points[i].y - dest_pixmap->screen_y);
 | 
				
			||||||
 | 
						    glDrawPixels(widths[i],
 | 
				
			||||||
 | 
								 1,
 | 
				
			||||||
 | 
								 format, type,
 | 
				
			||||||
 | 
								 drawpixels_src);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (temp_src) {
 | 
						if (temp_src) {
 | 
				
			||||||
	    src += PixmapBytePad(widths[i], drawable->depth);
 | 
						    src += PixmapBytePad(widths[i], drawable->depth);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -100,6 +113,7 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
fail:
 | 
					fail:
 | 
				
			||||||
 | 
					    glDisable(GL_SCISSOR_TEST);
 | 
				
			||||||
    glamor_set_planemask(dest_pixmap, ~0);
 | 
					    glamor_set_planemask(dest_pixmap, ~0);
 | 
				
			||||||
    glamor_set_alu(GXcopy);
 | 
					    glamor_set_alu(GXcopy);
 | 
				
			||||||
    xfree(temp_src);
 | 
					    xfree(temp_src);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue