From: Kouhei S. <ko...@co...> - 2005-09-18 12:59:15
|
須藤です. In <200...@hi...> "Re: [ruby-gnome2-devel-ja] Gdk::Pixbuf#pixelsのサイズの計算方法" on Sun, 18 Sep 2005 21:39:26 +0900, Masao Mutoh <mu...@hi...> wrote: > > Gdk::Pixbuf#pixelsのサイズの計算方法がちょっとまずいかもしれ > > ません. > > > > http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbufError > > > > のちょっと上の方にあるNoteには以下のように書いてあります. > > > > If you are doing memcpy() of raw pixbuf data, note that > > the last row in the pixbuf may not be as wide as the full > > rowstride, but rather just as wide as the pixel data needs > > to be. That is, it is unsafe to do memcpy (dest, pixels, > > rowstride * height) to copy a whole pixbuf. Use > > gdk_pixbuf_copy() instead, or compute the width in bytes > > of the last row as width * ((n_channels * bits_per_sample > > + 7) / 8). > > > > 現在のGdk::Pixbuf#pixelsはrowstride * heightでサイズを計算し > > ています.サイズの計算方法をgdk_pixbuf_copy()と同じようにし > > た方がよいのではないでしょうか? > > なるほど。パッチあててください。 あてました. |