124 src += _screen.pitch; |
124 src += _screen.pitch; |
125 dst += _screen.pitch; |
125 dst += _screen.pitch; |
126 } |
126 } |
127 } |
127 } |
128 |
128 |
|
129 void Blitter_8bppBase::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) |
|
130 { |
|
131 const uint8 *src; |
|
132 uint8 *dst; |
|
133 |
|
134 if (scroll_y > 0) { |
|
135 /*Calculate pointers */ |
|
136 dst = (uint8 *)video + left + (top + height - 1) * _screen.pitch; |
|
137 src = dst - scroll_y * _screen.pitch; |
|
138 |
|
139 /* Decrease height and increase top */ |
|
140 top += scroll_y; |
|
141 height -= scroll_y; |
|
142 assert(height > 0); |
|
143 |
|
144 /* Adjust left & width */ |
|
145 if (scroll_x >= 0) { |
|
146 dst += scroll_x; |
|
147 left += scroll_x; |
|
148 width -= scroll_x; |
|
149 } else { |
|
150 src -= scroll_x; |
|
151 width += scroll_x; |
|
152 } |
|
153 |
|
154 /* Negative height as we want to copy from bottom to top */ |
|
155 this->CopyFromBuffer(dst, src, width, -height, _screen.pitch); |
|
156 } else { |
|
157 /* Calculate pointers */ |
|
158 dst = (uint8 *)video + left + top * _screen.pitch; |
|
159 src = dst - scroll_y * _screen.pitch; |
|
160 |
|
161 /* Decrese height. (scroll_y is <=0). */ |
|
162 height += scroll_y; |
|
163 assert(height > 0); |
|
164 |
|
165 /* Adjust left & width */ |
|
166 if (scroll_x >= 0) { |
|
167 dst += scroll_x; |
|
168 left += scroll_x; |
|
169 width -= scroll_x; |
|
170 } else { |
|
171 src -= scroll_x; |
|
172 width += scroll_x; |
|
173 } |
|
174 |
|
175 /* the y-displacement may be 0 therefore we have to use memmove, |
|
176 * because source and destination may overlap */ |
|
177 this->MoveBuffer(dst, src, width, height); |
|
178 } |
|
179 } |
|
180 |
129 int Blitter_8bppBase::BufferSize(int width, int height) |
181 int Blitter_8bppBase::BufferSize(int width, int height) |
130 { |
182 { |
131 return width * height; |
183 return width * height; |
132 } |
184 } |