summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_texture.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-03-04 16:37:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-03-04 17:31:07 +0900
commit53d3cb4fec32d7876aba1c878501fe7ca9e06c46 (patch)
tree1e43d0673ba7d15616ddc3f611ad57f7048e3f57 /src/modules/evas/engines/gl_common/evas_gl_texture.c
parentb19d3599a58d310c65a465ba7cddab75c2b16f80 (diff)
Evas GL common: Improve quality of miniature image
Sample in the middle of the "macro pixels" and fool around with the borders (usually used to limit linear sampling artifacts) to improve image quality on the edges. Those miniatures are still 16x16 but MAAAYYYYYBE they will look a bit less awful. NOTE: The first row still doesn't scale properly (interpolates with garbage above y=0).
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c51
1 files changed, 43 insertions, 8 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 2f3852f7cd..6c3b0343a6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -1283,26 +1283,61 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
1283 1283
1284 out = alloca(bytes_count * EVAS_GL_TILE_SIZE * EVAS_GL_TILE_SIZE); 1284 out = alloca(bytes_count * EVAS_GL_TILE_SIZE * EVAS_GL_TILE_SIZE);
1285 xstep = (float)tex->w / (EVAS_GL_TILE_SIZE - 2); 1285 xstep = (float)tex->w / (EVAS_GL_TILE_SIZE - 2);
1286 ystep = (float)tex->h / (EVAS_GL_TILE_SIZE - 1); 1286 ystep = (float)tex->h / (EVAS_GL_TILE_SIZE - 2);
1287 in = im->image.data8; 1287 in = im->image.data8;
1288 1288
1289 for (y = 0, j = 0; j < EVAS_GL_TILE_SIZE - 1; y += ystep, j++) 1289 // top-left
1290 memcpy(&out[0],
1291 &in[0],
1292 bytes_count);
1293
1294 // top
1295 for (x = xstep * 0.5f, i = 1; i < EVAS_GL_TILE_SIZE - 1; x += xstep, i++)
1296 {
1297 memcpy(&out[i * bytes_count],
1298 &in[(int)x * bytes_count],
1299 bytes_count);
1300 }
1301
1302 // top-right
1303 memcpy(&out[((EVAS_GL_TILE_SIZE - 1) * bytes_count)],
1304 &in[(im->cache_entry.w - 1) * bytes_count],
1305 bytes_count);
1306
1307 for (y = ystep * 0.5f, j = 1; j < EVAS_GL_TILE_SIZE - 1; y += ystep, j++)
1290 { 1308 {
1309 // left
1291 memcpy(&out[j * EVAS_GL_TILE_SIZE * bytes_count], 1310 memcpy(&out[j * EVAS_GL_TILE_SIZE * bytes_count],
1292 &in[(int)y * im->cache_entry.w * bytes_count], 1311 &in[((int)y * im->cache_entry.w) * bytes_count],
1293 bytes_count); 1312 bytes_count);
1294 for (x = 0, i = 1; i < EVAS_GL_TILE_SIZE - 1; x += xstep, i++) 1313 // middle
1314 for (x = xstep * 0.5f, i = 1; i < EVAS_GL_TILE_SIZE - 1; x += xstep, i++)
1295 memcpy(&out[(j * EVAS_GL_TILE_SIZE + i) * bytes_count], 1315 memcpy(&out[(j * EVAS_GL_TILE_SIZE + i) * bytes_count],
1296 &in[((int)y * im->cache_entry.w + (int)x) * bytes_count], 1316 &in[(((int)y * im->cache_entry.w) + (int)x) * bytes_count],
1297 bytes_count); 1317 bytes_count);
1318 // right
1298 memcpy(&out[(j * EVAS_GL_TILE_SIZE + i) * bytes_count], 1319 memcpy(&out[(j * EVAS_GL_TILE_SIZE + i) * bytes_count],
1299 &in[((int)y * im->cache_entry.w + (int)(x - xstep)) * bytes_count], 1320 &in[(((int)y * im->cache_entry.w) + (im->cache_entry.w - 1)) * bytes_count],
1300 bytes_count); 1321 bytes_count);
1301 } 1322 }
1302 1323
1324 // bottom-left
1303 memcpy(&out[(j * EVAS_GL_TILE_SIZE) * bytes_count], 1325 memcpy(&out[(j * EVAS_GL_TILE_SIZE) * bytes_count],
1304 &out[((j - 1) * EVAS_GL_TILE_SIZE) * bytes_count], 1326 &in[((im->cache_entry.w * (im->cache_entry.h - 1)) + 1) * bytes_count],
1305 EVAS_GL_TILE_SIZE * bytes_count); 1327 bytes_count);
1328
1329 // bottom
1330 for (x = xstep * 0.5f, i = 1; i < EVAS_GL_TILE_SIZE - 1; x += xstep, i++)
1331 {
1332 memcpy(&out[((EVAS_GL_TILE_SIZE * j) + i) * bytes_count],
1333 &in[((int)x + im->cache_entry.w * (im->cache_entry.h - 1)) * bytes_count],
1334 bytes_count);
1335 }
1336
1337 // bottom-right
1338 memcpy(&out[((EVAS_GL_TILE_SIZE * EVAS_GL_TILE_SIZE) - 1) * bytes_count],
1339 &in[((im->cache_entry.w * im->cache_entry.h) - 1) * bytes_count],
1340 bytes_count);
1306 1341
1307 // out is a miniature of the texture, upload that now and schedule the data for later. 1342 // out is a miniature of the texture, upload that now and schedule the data for later.
1308 1343