}
static void
-_tbm_surface_internal_dump_file_png(const char *file, const void *data, int width, int height, int format)
+_tbm_surface_internal_dump_file_png(const char *file, const void *data, int width, int height, int stride, int format)
{
unsigned int *blocks = (unsigned int *)data;
FILE *fp;
row_pointers[y] = (png_bytep)row;
for (x = 0; x < width; ++x) {
- unsigned int curBlock = blocks[y * width + x];
+ unsigned int curBlock = blocks[(y * (stride >> 2)) + x];
if (pixel_size == 3) { // XRGB8888
row[x * pixel_size] = (curBlock & 0xFF);
case TBM_FORMAT_ARGB8888:
_tbm_surface_internal_dump_file_png(file, bo_handle.ptr,
buf_info->info.planes[0].stride >> 2,
- buf_info->info.height, TBM_FORMAT_ARGB8888);
+ buf_info->info.height,
+ buf_info->info.planes[0].stride,
+ TBM_FORMAT_ARGB8888);
break;
case TBM_FORMAT_XRGB8888:
_tbm_surface_internal_dump_file_png(file, bo_handle.ptr,
buf_info->info.planes[0].stride >> 2,
- buf_info->info.height, TBM_FORMAT_XRGB8888);
+ buf_info->info.height,
+ buf_info->info.planes[0].stride,
+ TBM_FORMAT_XRGB8888);
break;
case TBM_FORMAT_YVU420:
case TBM_FORMAT_YUV420:
} else if (buf_info->dirty_shm)
_tbm_surface_internal_dump_file_png(file, bo_handle.ptr,
buf_info->shm_stride >> 2,
- buf_info->shm_h, 0);
+ buf_info->shm_h,
+ buf_info->shm_stride, 0);
tbm_bo_unmap(buf_info->bo);
tbm_bo_unref(buf_info->bo);
switch (info.format) {
case TBM_FORMAT_ARGB8888:
_tbm_surface_internal_dump_file_png(file, info.planes[0].ptr,
- info.planes[0].stride >> 2,
- info.height, TBM_FORMAT_ARGB8888);
+ info.width,
+ info.height,
+ info.planes[0].stride,
+ TBM_FORMAT_ARGB8888);
break;
case TBM_FORMAT_XRGB8888:
_tbm_surface_internal_dump_file_png(file, info.planes[0].ptr,
- info.planes[0].stride >> 2,
- info.height, TBM_FORMAT_XRGB8888);
+ info.width,
+ info.height,
+ info.planes[0].stride,
+ TBM_FORMAT_XRGB8888);
break;
case TBM_FORMAT_YVU420:
case TBM_FORMAT_YUV420:
return 0;
}
- _tbm_surface_internal_dump_file_png(file, ptr, w, h, 0);
+ _tbm_surface_internal_dump_file_png(file, ptr, w, h, stride, 0);
TBM_TRACE_SURFACE_INTERNAL("Capture %s \n", file);