| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| ===================================================================
|
| --- gpu/command_buffer/client/gles2_implementation.cc (revision 110309)
|
| +++ gpu/command_buffer/client/gles2_implementation.cc (working copy)
|
| @@ -543,6 +543,7 @@
|
| pack_alignment_(4),
|
| unpack_alignment_(4),
|
| unpack_flip_y_(false),
|
| + pack_flip_y_(false),
|
| active_texture_unit_(0),
|
| bound_framebuffer_(0),
|
| bound_renderbuffer_(0),
|
| @@ -1221,6 +1222,9 @@
|
| case GL_UNPACK_FLIP_Y_CHROMIUM:
|
| unpack_flip_y_ = (param != 0);
|
| return;
|
| + case GL_PACK_FLIP_Y_ANGLE:
|
| + pack_flip_y_ = (param != 0);
|
| + break;
|
| default:
|
| break;
|
| }
|
| @@ -1975,13 +1979,25 @@
|
| result_shm_id(), result_shm_offset());
|
| WaitForCmd();
|
| if (*result != 0) {
|
| + // when doing a y-flip we have to iterate through top-to-bottom chunks
|
| + // of the dst. The service side handles reversing the rows within a
|
| + // chunk.
|
| + int8* rows_dst;
|
| + if (pack_flip_y_) {
|
| + rows_dst = dest + (height - num_rows) * padded_row_size;
|
| + } else {
|
| + rows_dst = dest;
|
| + }
|
| // We have to copy 1 row at a time to avoid writing pad bytes.
|
| const int8* src = static_cast<const int8*>(buffer);
|
| for (GLint yy = 0; yy < num_rows; ++yy) {
|
| - memcpy(dest, src, unpadded_row_size);
|
| - dest += padded_row_size;
|
| + memcpy(rows_dst, src, unpadded_row_size);
|
| + rows_dst += padded_row_size;
|
| src += padded_row_size;
|
| }
|
| + if (!pack_flip_y_) {
|
| + dest = rows_dst;
|
| + }
|
| }
|
| transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
|
| // If it was not marked as successful exit.
|
| @@ -1998,6 +2014,10 @@
|
| GLsizeiptr element_size = temp_size;
|
| max_size -= max_size % element_size;
|
| GLint max_sub_row_pixels = max_size / element_size;
|
| + if (pack_flip_y_) {
|
| + // start at the last row when flipping y.
|
| + dest = dest + (height - 1) * padded_row_size;
|
| + }
|
| for (; height; --height) {
|
| GLint temp_width = width;
|
| GLint temp_xoffset = xoffset;
|
| @@ -2025,7 +2045,7 @@
|
| temp_width -= num_pixels;
|
| }
|
| ++yoffset;
|
| - dest += padded_row_size;
|
| + dest += pack_flip_y_ ? -padded_row_size : padded_row_size;
|
| }
|
| }
|
| }
|
|
|