On 3/12/07, <b class="gmail_sendername">H. Verbeet</b> <<a href="mailto:hverbeet@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">hverbeet@gmail.com</a>> wrote:<div><span class="gmail_quote">
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 12/03/07, Erich Hoover <<a href="mailto:ehoover@mines.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ehoover@mines.edu</a>> wrote:<br>> I think that the allocated memory should be the size of the resource
<br>> multiplied by 4 (instead of adding 4).
<br>What makes you think that?</blockquote><div><br>Just that (pLockedRect->Pitch * pRect->top) with pRect->top = This->currentDesc.Height would return a value 4x that of This->resource.size.<br></div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
IIRC the +4 there is for dodgy applications reading just past the end<br>of the surface, but that line could do with a comment in either case.<br><br>> I've dug around a bit to see if This->resource.size was just allocated
<br>> incorrectly but that does not appear the case. So, if someone could confirm<br>> or deny that this is a typo problem then I'd really appreciate it.<br>><br>Could you look into my comment in bugzilla? I'll probably write a test
<br>for that either way, but it's probably quite a bit faster for you to<br>check if what I posted there makes any difference.<br></blockquote></div><br>Dividing pRect->top by 4 seems to solve the problem. Allocating 4 times as much memory also solves the problem (no apparent visual difference), but your explanation in bugzilla makes sense. Will you be taking care of this, or should I write up a patch with the divide by 4 and a bounds check?
<br>