glimage: Only support uploading one region

This commit is contained in:
Timm Bäder 2019-02-14 15:22:40 +01:00 committed by Matthias Clasen
parent b74bb90c7d
commit e2ffad7b07
3 changed files with 10 additions and 19 deletions

View File

@ -277,7 +277,7 @@ upload_dirty_glyph (GskGLGlyphCache *self,
if (render_glyph (atlas, (DirtyGlyph *)atlas->user_data, &region))
{
gsk_gl_image_upload_regions (&atlas->image, self->gl_driver, 1, &region);
gsk_gl_image_upload_region (&atlas->image, self->gl_driver, &region);
g_free (region.data);
}

View File

@ -44,23 +44,15 @@ gsk_gl_image_write_to_png (const GskGLImage *self,
}
void
gsk_gl_image_upload_regions (GskGLImage *self,
GskGLDriver *gl_driver,
guint n_regions,
const GskImageRegion *regions)
gsk_gl_image_upload_region (GskGLImage *self,
GskGLDriver *gl_driver,
const GskImageRegion *region)
{
guint i;
gsk_gl_driver_bind_source_texture (gl_driver, self->texture_id);
glBindTexture (GL_TEXTURE_2D, self->texture_id);
for (i = 0; i < n_regions; i ++)
{
const GskImageRegion *region = &regions[i];
gsk_gl_driver_bind_source_texture (gl_driver, self->texture_id);
glBindTexture (GL_TEXTURE_2D, self->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0, region->x, region->y, region->width, region->height,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, region->data);
}
glTexSubImage2D (GL_TEXTURE_2D, 0, region->x, region->y, region->width, region->height,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, region->data);
#ifdef G_ENABLE_DEBUG
/*gsk_gl_driver_bind_source_texture (gl_driver, self->texture_id);*/

View File

@ -30,10 +30,9 @@ void gsk_gl_image_destroy (GskGLImage *self,
void gsk_gl_image_write_to_png (const GskGLImage *self,
GskGLDriver *gl_driver,
const char *filename);
void gsk_gl_image_upload_regions (GskGLImage *self,
void gsk_gl_image_upload_region (GskGLImage *self,
GskGLDriver *gl_driver,
guint n_regions,
const GskImageRegion *regions);
const GskImageRegion *region);
#endif