On 3/12/07, <b class="gmail_sendername">H. Verbeet</b> &lt;<a href="mailto:hverbeet@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">hverbeet@gmail.com</a>&gt; 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 &lt;<a href="mailto:ehoover@mines.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ehoover@mines.edu</a>&gt; wrote:<br>&gt; I think that the allocated memory should be the size of the resource
<br>&gt; multiplied by 4 (instead of adding 4).
<br>What makes you think that?</blockquote><div><br>Just that (pLockedRect-&gt;Pitch * pRect-&gt;top) with pRect-&gt;top = This-&gt;currentDesc.Height would return a value 4x that of This-&gt;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>&gt; I&#39;ve dug around a bit to see if This-&gt;resource.size was just allocated
<br>&gt; incorrectly but that does not appear the case.&nbsp;&nbsp;So, if someone could confirm<br>&gt; or deny that this is a typo problem then I&#39;d really appreciate it.<br>&gt;<br>Could you look into my comment in bugzilla? I&#39;ll probably write a test
<br>for that either way, but it&#39;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-&gt;top by 4 seems to solve the problem.&nbsp; Allocating 4 times as much memory also solves the problem (no apparent visual difference), but your explanation in bugzilla makes sense.&nbsp; Will you be taking care of this, or should I write up a patch with the divide by 4 and a bounds check?
<br>