[Redbutton-devel] SF.net SVN: redbutton: [128] redbutton-browser/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-06-29 16:15:49
|
Revision: 128 Author: skilvington Date: 2006-06-29 09:15:27 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=128&view=rev Log Message: ----------- use clip rectangles to ensure objects don't draw outside their bboxes Modified Paths: -------------- redbutton-browser/trunk/BitmapClass.c redbutton-browser/trunk/DynamicLineArtClass.c redbutton-browser/trunk/EntryFieldClass.c redbutton-browser/trunk/HyperTextClass.c redbutton-browser/trunk/MHEGDisplay.c redbutton-browser/trunk/MHEGFont.c redbutton-browser/trunk/RectangleClass.c redbutton-browser/trunk/SliderClass.c redbutton-browser/trunk/TODO redbutton-browser/trunk/TextClass.c redbutton-browser/trunk/VideoClass.c Modified: redbutton-browser/trunk/BitmapClass.c =================================================================== --- redbutton-browser/trunk/BitmapClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/BitmapClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -471,6 +471,8 @@ if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) return; + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* work out where the intersection starts on the bitmap */ src.x_position = ins_pos.x_position - t->inst.Position.x_position; src.y_position = ins_pos.y_position - t->inst.Position.y_position; @@ -485,6 +487,8 @@ MHEGDisplay_drawBitmap(d, &src, &ins_box, t->inst.Bitmap, &ins_pos); + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/DynamicLineArtClass.c =================================================================== --- redbutton-browser/trunk/DynamicLineArtClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/DynamicLineArtClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -395,8 +395,13 @@ if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) return; + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* TODO */ printf("TODO: DynamicLineArtClass_render\n"); + + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/EntryFieldClass.c =================================================================== --- redbutton-browser/trunk/EntryFieldClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/EntryFieldClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -559,10 +559,21 @@ void EntryFieldClass_render(EntryFieldClass *t, MHEGDisplay *d, XYPosition *pos, OriginalBoxSize *box) { + XYPosition ins_pos; + OriginalBoxSize ins_box; + verbose("EntryFieldClass: %s; render", ExternalReference_name(&t->rootClass.inst.ref)); + if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) + return; + + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* TODO */ printf("TODO: EntryFieldClass_render\n"); + + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/HyperTextClass.c =================================================================== --- redbutton-browser/trunk/HyperTextClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/HyperTextClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -553,10 +553,21 @@ void HyperTextClass_render(HyperTextClass *t, MHEGDisplay *d, XYPosition *pos, OriginalBoxSize *box) { + XYPosition ins_pos; + OriginalBoxSize ins_box; + verbose("HyperTextClass: %s; render", ExternalReference_name(&t->rootClass.inst.ref)); + if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) + return; + + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* TODO */ printf("TODO: HyperTextClass_render\n"); + + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/MHEGDisplay.c =================================================================== --- redbutton-browser/trunk/MHEGDisplay.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/MHEGDisplay.c 2006-06-29 16:15:27 UTC (rev 128) @@ -423,8 +423,17 @@ void MHEGDisplay_unsetClipRectangle(MHEGDisplay *d) { - XRenderSetPictureClipRectangles(d->dpy, d->next_overlay_pic, 0, 0, NULL, 0); + /* + * this doesn't work... + * XRenderSetPictureClipRectangles(d->dpy, d->next_overlay_pic, 0, 0, NULL, 0); + */ + XRenderPictureAttributes attr; + + attr.clip_mask = None; + + XRenderChangePicture(d->dpy, d->next_overlay_pic, CPClipMask, &attr); + return; } Modified: redbutton-browser/trunk/MHEGFont.c =================================================================== --- redbutton-browser/trunk/MHEGFont.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/MHEGFont.c 2006-06-29 16:15:27 UTC (rev 128) @@ -428,7 +428,7 @@ /* TODO */ /* truncation: ie remove chars outside box */ -/* if we set a clip rectangle in MHEGEngine_redrawArea it will solve the problem */ +/* setting the clip rectangle in TextClass_render solves the problem */ /* but UK profile says we shouldn't draw any partial characters */ return elem_list; Modified: redbutton-browser/trunk/RectangleClass.c =================================================================== --- redbutton-browser/trunk/RectangleClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/RectangleClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -390,6 +390,8 @@ if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) return; + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* fill it */ MHEGDisplay_fillRectangle(d, &ins_pos, &ins_box, &t->inst.RefFillColour); @@ -414,6 +416,8 @@ len = t->inst.BoxSize.x_length - t->inst.LineWidth; MHEGDisplay_drawHoriLine(d, &p, len, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour); + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/SliderClass.c =================================================================== --- redbutton-browser/trunk/SliderClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/SliderClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -375,11 +375,21 @@ void SliderClass_render(SliderClass *t, MHEGDisplay *d, XYPosition *pos, OriginalBoxSize *box) { + XYPosition ins_pos; + OriginalBoxSize ins_box; + verbose("SliderClass: %s; render", ExternalReference_name(&t->rootClass.inst.ref)); + if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) + return; + + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* TODO */ printf("TODO: SliderClass_render\n"); + + MHEGDisplay_unsetClipRectangle(d); + return; } - Modified: redbutton-browser/trunk/TODO =================================================================== --- redbutton-browser/trunk/TODO 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/TODO 2006-06-29 16:15:27 UTC (rev 128) @@ -1,7 +1,3 @@ -use setClipRectangle on the intersection area in each _render() method -(remember to unsetClipRectangle at the end of _render) - - if openStream fails - need to make sure either: contents picture gets filled with black, or VideoClass_render does not make a transparent rectangle in the overlay picture Modified: redbutton-browser/trunk/TextClass.c =================================================================== --- redbutton-browser/trunk/TextClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/TextClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -590,6 +590,8 @@ if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) return; + MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box); + /* draw the background */ MHEGDisplay_fillRectangle(d, &ins_pos, &ins_box, &t->inst.BackgroundColour); @@ -612,6 +614,8 @@ element = element->next; } + MHEGDisplay_unsetClipRectangle(d); + return; } Modified: redbutton-browser/trunk/VideoClass.c =================================================================== --- redbutton-browser/trunk/VideoClass.c 2006-06-29 13:25:13 UTC (rev 127) +++ redbutton-browser/trunk/VideoClass.c 2006-06-29 16:15:27 UTC (rev 128) @@ -379,12 +379,6 @@ if(!intersects(pos, box, &t->inst.Position, &t->inst.BoxSize, &ins_pos, &ins_box)) return; - /* draw the video frame onto the Window contents Pixmap */ -// need to do the equivalent of this, but not here -// => get rid of VideoClass.inst.player too -// if(t->inst.player != NULL) -// MHEGStreamPlayer_drawCurrentFrame(t->inst.player); - /* make a transparent hole in the MHEG overlay so we can see the video below it */ MHEGDisplay_fillTransparentRectangle(d, &ins_pos, &ins_box); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |