dwrite: Store run info for IDWriteGlyphRunAnalysis instance.
This commit is contained in:
parent
876d1d9eb8
commit
fb35557db9
@ -124,7 +124,7 @@ extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *refer
|
|||||||
extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN;
|
extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_fontface(DWRITE_FONT_FACE_TYPE,UINT32,IDWriteFontFile* const*,UINT32,DWRITE_FONT_SIMULATIONS,IDWriteFontFace2**) DECLSPEC_HIDDEN;
|
extern HRESULT create_fontface(DWRITE_FONT_FACE_TYPE,UINT32,IDWriteFontFile* const*,UINT32,DWRITE_FONT_SIMULATIONS,IDWriteFontFace2**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_font_collection(IDWriteFactory2*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection**) DECLSPEC_HIDDEN;
|
extern HRESULT create_font_collection(IDWriteFactory2*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection**) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN;
|
extern HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE,DWRITE_GLYPH_RUN const*,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN;
|
||||||
extern BOOL is_system_collection(IDWriteFontCollection*) DECLSPEC_HIDDEN;
|
extern BOOL is_system_collection(IDWriteFontCollection*) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT get_local_refkey(const WCHAR*,const FILETIME*,void**,UINT32*) DECLSPEC_HIDDEN;
|
extern HRESULT get_local_refkey(const WCHAR*,const FILETIME*,void**,UINT32*) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT get_filestream_from_file(IDWriteFontFile*,IDWriteFontFileStream**) DECLSPEC_HIDDEN;
|
extern HRESULT get_filestream_from_file(IDWriteFontFile*,IDWriteFontFileStream**) DECLSPEC_HIDDEN;
|
||||||
|
@ -111,6 +111,10 @@ struct dwrite_glyphrunanalysis {
|
|||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
DWRITE_RENDERING_MODE rendering_mode;
|
DWRITE_RENDERING_MODE rendering_mode;
|
||||||
|
DWRITE_GLYPH_RUN run;
|
||||||
|
UINT16 *glyphs;
|
||||||
|
FLOAT *advances;
|
||||||
|
DWRITE_GLYPH_OFFSET *offsets;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GLYPH_BLOCK_SHIFT 8
|
#define GLYPH_BLOCK_SHIFT 8
|
||||||
@ -2890,6 +2894,10 @@ static ULONG WINAPI glyphrunanalysis_Release(IDWriteGlyphRunAnalysis *iface)
|
|||||||
TRACE("(%p)->(%u)\n", This, ref);
|
TRACE("(%p)->(%u)\n", This, ref);
|
||||||
|
|
||||||
if (!ref) {
|
if (!ref) {
|
||||||
|
IDWriteFontFace_Release(This->run.fontFace);
|
||||||
|
heap_free(This->glyphs);
|
||||||
|
heap_free(This->advances);
|
||||||
|
heap_free(This->offsets);
|
||||||
heap_free(This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2941,7 +2949,7 @@ static const struct IDWriteGlyphRunAnalysisVtbl glyphrunanalysisvtbl = {
|
|||||||
glyphrunanalysis_GetAlphaBlendParams
|
glyphrunanalysis_GetAlphaBlendParams
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, IDWriteGlyphRunAnalysis **ret)
|
HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_GLYPH_RUN const *run, IDWriteGlyphRunAnalysis **ret)
|
||||||
{
|
{
|
||||||
struct dwrite_glyphrunanalysis *analysis;
|
struct dwrite_glyphrunanalysis *analysis;
|
||||||
|
|
||||||
@ -2958,6 +2966,31 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, IDWriteGly
|
|||||||
analysis->IDWriteGlyphRunAnalysis_iface.lpVtbl = &glyphrunanalysisvtbl;
|
analysis->IDWriteGlyphRunAnalysis_iface.lpVtbl = &glyphrunanalysisvtbl;
|
||||||
analysis->ref = 1;
|
analysis->ref = 1;
|
||||||
analysis->rendering_mode = rendering_mode;
|
analysis->rendering_mode = rendering_mode;
|
||||||
|
analysis->run = *run;
|
||||||
|
IDWriteFontFace_AddRef(analysis->run.fontFace);
|
||||||
|
analysis->glyphs = heap_alloc(run->glyphCount*sizeof(*run->glyphIndices));
|
||||||
|
analysis->advances = heap_alloc(run->glyphCount*sizeof(*run->glyphAdvances));
|
||||||
|
analysis->offsets = heap_alloc(run->glyphCount*sizeof(*run->glyphOffsets));
|
||||||
|
if (!analysis->glyphs || !analysis->advances || !analysis->offsets) {
|
||||||
|
heap_free(analysis->glyphs);
|
||||||
|
heap_free(analysis->advances);
|
||||||
|
heap_free(analysis->offsets);
|
||||||
|
|
||||||
|
analysis->glyphs = NULL;
|
||||||
|
analysis->advances = NULL;
|
||||||
|
analysis->offsets = NULL;
|
||||||
|
|
||||||
|
IDWriteGlyphRunAnalysis_Release(&analysis->IDWriteGlyphRunAnalysis_iface);
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
analysis->run.glyphIndices = analysis->glyphs;
|
||||||
|
analysis->run.glyphAdvances = analysis->advances;
|
||||||
|
analysis->run.glyphOffsets = analysis->offsets;
|
||||||
|
|
||||||
|
memcpy(analysis->glyphs, run->glyphIndices, run->glyphCount*sizeof(*run->glyphIndices));
|
||||||
|
memcpy(analysis->advances, run->glyphAdvances, run->glyphCount*sizeof(*run->glyphAdvances));
|
||||||
|
memcpy(analysis->offsets, run->glyphOffsets, run->glyphCount*sizeof(*run->glyphOffsets));
|
||||||
|
|
||||||
*ret = &analysis->IDWriteGlyphRunAnalysis_iface;
|
*ret = &analysis->IDWriteGlyphRunAnalysis_iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -1070,16 +1070,16 @@ static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory2 *if
|
|||||||
return create_numbersubstitution(method, locale, ignore_user_override, substitution);
|
return create_numbersubstitution(method, locale, ignore_user_override, substitution);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *iface, DWRITE_GLYPH_RUN const *glyph_run,
|
static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *iface, DWRITE_GLYPH_RUN const *run,
|
||||||
FLOAT pixels_per_dip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode,
|
FLOAT ppdip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode,
|
||||||
DWRITE_MEASURING_MODE measuring_mode, FLOAT baseline_x, FLOAT baseline_y, IDWriteGlyphRunAnalysis **analysis)
|
DWRITE_MEASURING_MODE measuring_mode, FLOAT baseline_x, FLOAT baseline_y, IDWriteGlyphRunAnalysis **analysis)
|
||||||
{
|
{
|
||||||
struct dwritefactory *This = impl_from_IDWriteFactory2(iface);
|
struct dwritefactory *This = impl_from_IDWriteFactory2(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%p %f %p %d %d %f %f %p)\n", This, glyph_run, pixels_per_dip, transform, rendering_mode,
|
TRACE("(%p)->(%p %f %p %d %d %f %f %p)\n", This, run, ppdip, transform, rendering_mode,
|
||||||
measuring_mode, baseline_x, baseline_y, analysis);
|
measuring_mode, baseline_x, baseline_y, analysis);
|
||||||
|
|
||||||
return create_glyphrunanalysis(rendering_mode, analysis);
|
return create_glyphrunanalysis(rendering_mode, run, analysis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *iface, IDWriteFontCollection **collection,
|
static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *iface, IDWriteFontCollection **collection,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user