diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-18 14:21:36 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-18 14:23:07 (GMT) |
commit | 6a12eb655e2cb1e2f29177dfff00607dfbb01b25 (patch) | |
tree | fb4595ac5c8f9aecd05d1c7686cfac7305cfec63 /src | |
parent | 94ac0b1608cd3142096835536ac56f9335094a33 (diff) | |
download | Qt-6a12eb655e2cb1e2f29177dfff00607dfbb01b25.zip Qt-6a12eb655e2cb1e2f29177dfff00607dfbb01b25.tar.gz Qt-6a12eb655e2cb1e2f29177dfff00607dfbb01b25.tar.bz2 |
Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 5699175f55acbdfa4ac95ab6c727ebd4a201f3a2
Author: Andreas Kling <andreas.kling@nokia.com>
Date: Fri Jun 18 16:10:31 2010 +0200
Make HB_AnchorFormat3's Device tables a pointer array
Saves sizeof(pointer) * 1 when the font doesn't have these tables.
Cuts resident memory consumption by 40kB when loading qt.nokia.com
in QtWebKit.
Signed-off-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h | 5 | ||||
-rw-r--r-- | src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 43 |
2 files changed, 31 insertions, 17 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h index 3a4952b..39f3159 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h @@ -105,13 +105,14 @@ struct HB_AnchorFormat2_ typedef struct HB_AnchorFormat2_ HB_AnchorFormat2; +#define AF3_X_DEVICE_TABLE 0 +#define AF3_Y_DEVICE_TABLE 1 struct HB_AnchorFormat3_ { HB_Short XCoordinate; /* horizontal value */ HB_Short YCoordinate; /* vertical value */ - HB_Device* XDeviceTable; /* device table for X coordinate */ - HB_Device* YDeviceTable; /* device table for Y coordinate */ + HB_Device** DeviceTables; /* device tables for coordinates */ }; typedef struct HB_AnchorFormat3_ HB_AnchorFormat3; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index 1933f3d..d71a85e 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -631,19 +631,21 @@ static HB_Error Load_Anchor( HB_Anchor* an, if ( new_offset ) { + if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) + return error; + + an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] = 0; + an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] = 0; + new_offset += base_offset; cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = _HB_OPEN_Load_Device( &an->af.af3.XDeviceTable, + ( error = _HB_OPEN_Load_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], stream ) ) != HB_Err_Ok ) return error; (void)FILE_Seek( cur_offset ); } - else - { - an->af.af3.XDeviceTable = 0; - } if ( ACCESS_Frame( 2L ) ) goto Fail; @@ -654,19 +656,24 @@ static HB_Error Load_Anchor( HB_Anchor* an, if ( new_offset ) { + if ( !an->af.af3.DeviceTables ) + { + if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) + return error; + + an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] = 0; + an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] = 0; + } + new_offset += base_offset; cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = _HB_OPEN_Load_Device( &an->af.af3.YDeviceTable, + ( error = _HB_OPEN_Load_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], stream ) ) != HB_Err_Ok ) goto Fail; (void)FILE_Seek( cur_offset ); } - else - { - an->af.af3.YDeviceTable = 0; - } break; case 4: @@ -691,7 +698,9 @@ static HB_Error Load_Anchor( HB_Anchor* an, return HB_Err_Ok; Fail: - _HB_OPEN_Free_Device( &an->af.af3.XDeviceTable ); + _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + + FREE( an->af.af3.DeviceTables ); return error; } @@ -700,8 +709,9 @@ static void Free_Anchor( HB_Anchor* an) { if ( an->PosFormat == 3 ) { - _HB_OPEN_Free_Device( &an->af.af3.YDeviceTable ); - _HB_OPEN_Free_Device( &an->af.af3.XDeviceTable ); + _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] ); + FREE( an->af.af3.DeviceTables ); } } @@ -769,9 +779,12 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, case 3: if ( !gpi->dvi ) { - _HB_OPEN_Get_Device( &an->af.af3.XDeviceTable, x_ppem, &pixel_value ); + if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) + return error; + + _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value ); *x_value = pixel_value << 6; - _HB_OPEN_Get_Device( &an->af.af3.YDeviceTable, y_ppem, &pixel_value ); + _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value ); *y_value = pixel_value << 6; } else |