Nikolay Sivov : dwrite: Store nominal breakpoint data in layout.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Dec 29 15:42:42 CST 2014
Module: wine
Branch: master
Commit: 83aafaaae80789868c46b090126a93bd59c59545
URL: http://source.winehq.org/git/wine.git/?a=commit;h=83aafaaae80789868c46b090126a93bd59c59545
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Dec 25 14:03:19 2014 +0300
dwrite: Store nominal breakpoint data in layout.
---
dlls/dwrite/layout.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 5b23a0c..1ede48c 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -120,6 +120,8 @@ struct dwrite_textlayout {
struct list ranges;
struct list runs;
BOOL recompute;
+
+ DWRITE_LINE_BREAKPOINT *breakpoints;
};
struct dwrite_textformat {
@@ -276,6 +278,24 @@ static HRESULT layout_compute(struct dwrite_textlayout *layout)
}
}
+ /* nominal breakpoints are evaluated only once, because string never changes */
+ if (!layout->breakpoints) {
+ IDWriteTextAnalyzer *analyzer;
+ HRESULT hr;
+
+ layout->breakpoints = heap_alloc(sizeof(DWRITE_LINE_BREAKPOINT)*layout->len);
+ if (!layout->breakpoints)
+ return E_OUTOFMEMORY;
+
+ hr = get_textanalyzer(&analyzer);
+ if (FAILED(hr))
+ return hr;
+
+ hr = IDWriteTextAnalyzer_AnalyzeLineBreakpoints(analyzer, &layout->IDWriteTextAnalysisSource_iface,
+ 0, layout->len, &layout->IDWriteTextAnalysisSink_iface);
+ IDWriteTextAnalyzer_Release(analyzer);
+ }
+
layout->recompute = FALSE;
return hr;
}
@@ -675,6 +695,7 @@ static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout2 *iface)
free_layout_ranges_list(This);
free_layout_runs(This);
release_format_data(&This->format);
+ heap_free(This->breakpoints);
heap_free(This->str);
heap_free(This);
}
@@ -1575,7 +1596,13 @@ static HRESULT WINAPI dwritetextlayout_sink_SetScriptAnalysis(IDWriteTextAnalysi
static HRESULT WINAPI dwritetextlayout_sink_SetLineBreakpoints(IDWriteTextAnalysisSink *iface,
UINT32 position, UINT32 length, DWRITE_LINE_BREAKPOINT const* breakpoints)
{
- return E_NOTIMPL;
+ struct dwrite_textlayout *layout = impl_from_IDWriteTextAnalysisSink(iface);
+
+ if (position + length > layout->len)
+ return E_FAIL;
+
+ memcpy(&layout->breakpoints[position], breakpoints, length*sizeof(DWRITE_LINE_BREAKPOINT));
+ return S_OK;
}
static HRESULT WINAPI dwritetextlayout_sink_SetBidiLevel(IDWriteTextAnalysisSink *iface, UINT32 position,
@@ -1806,6 +1833,7 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *forma
This->maxwidth = maxwidth;
This->maxheight = maxheight;
This->recompute = TRUE;
+ This->breakpoints = NULL;
layout_format_from_textformat(This, format);
list_init(&This->runs);
More information about the wine-cvs
mailing list