| 115 | |
| 116 | |
| 117 | Frame *Frame::getTile(int x, int y, int width, int height) |
| 118 | { |
| 119 | Frame *f; |
| 120 | |
| 121 | if(!bits || !pitch || !pf->size) THROW("Frame not initialized"); |
| 122 | if(x < 0 || y < 0 || width < 1 || height < 1 || (x + width) > hdr.width |
| 123 | || (y + height) > hdr.height) |
| 124 | throw Error("Frame::getTile", "Argument out of range"); |
| 125 | |
| 126 | f = new Frame(false); |
| 127 | f->hdr = hdr; |
| 128 | f->hdr.x = x; |
| 129 | f->hdr.y = y; |
| 130 | f->hdr.width = width; |
| 131 | f->hdr.height = height; |
| 132 | f->pf = pf; |
| 133 | f->flags = flags; |
| 134 | f->pitch = pitch; |
| 135 | f->stereo = stereo; |
| 136 | f->isGL = isGL; |
| 137 | bool bu = (flags & FRAME_BOTTOMUP); |
| 138 | f->bits = &bits[pitch * (bu ? hdr.height - y - height : y) + pf->size * x]; |
| 139 | if(stereo && rbits) |
| 140 | f->rbits = |
| 141 | &rbits[pitch * (bu ? hdr.height - y - height : y) + pf->size * x]; |
| 142 | return f; |
| 143 | } |
| 144 | |
| 145 | |
| 146 | bool Frame::tileEquals(Frame *last, int x, int y, int width, int height) |