diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-19 14:33:44 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-19 14:33:44 +0200 |
commit | a661fed926a6d0766962f9fc9725855d6a73ae7a (patch) | |
tree | 6dff395c086de6489d2d64de8730d904f1ae2ab6 /components/richtext | |
parent | 7fde5cefbe8a3790699dc12babf3b8df960cea39 (diff) | |
download | fpGUI-a661fed926a6d0766962f9fc9725855d6a73ae7a.tar.xz |
Removed redundant ProfileEvent() debug calls.
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'components/richtext')
-rw-r--r-- | components/richtext/CanvasFontManager.pas | 18 | ||||
-rw-r--r-- | components/richtext/RichTextLayoutUnit.pas | 35 | ||||
-rw-r--r-- | components/richtext/RichTextStyleUnit.pas | 3 |
3 files changed, 2 insertions, 54 deletions
diff --git a/components/richtext/CanvasFontManager.pas b/components/richtext/CanvasFontManager.pas index ed2cbc8d..ee3232ff 100644 --- a/components/richtext/CanvasFontManager.pas +++ b/components/richtext/CanvasFontManager.pas @@ -834,7 +834,6 @@ ProfileEvent(' FLogicalFonts.Count=' + intToStr(FLogicalFonts.Coun try for FontIndex := 0 to FLogicalFonts.Count - 1 do begin -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 1 of 6'); AFont := TLogicalFont(FLogicalFonts[ FontIndex ]); if AFont.PointSize = FontSpec.PointSize then begin @@ -842,16 +841,13 @@ ProfileEvent('DEBUG: TCanvasFontManager.GetFont 1 of 6'); or ( ( AFont.lAveCharWidth = FontSpec.XSize ) and ( AFont.lMaxbaselineExt = FontSpec.YSize ) ) then begin -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 2'); if AFont.Attributes = FontSpec.Attributes then begin -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 3'); // search name last since it's the slowest thing ProfileEvent(' AFont.FaceName=' + AFont.FaceName); ProfileEvent(' FontSpec.FaceName=' + FontSpec.FaceName); if AFont.FaceName = FontSpec.FaceName then begin -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 4'); // Found a logical font already created Result := AFont; // done @@ -864,15 +860,15 @@ ProfileEvent('DEBUG: TCanvasFontManager.GetFont 4'); except + { TODO -oGraeme -cknow bug : An Access Violation error occurs often here! No idea why? } on E: Exception do ProfileEvent('Unexpected error occured. Error: ' + E.Message); end; -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 5'); + // Need to create new logical font Result := CreateFont( FontSpec ); if Result <> nil then begin -ProfileEvent('DEBUG: TCanvasFontManager.GetFont 6'); RegisterFont( Result ); end; ProfileEvent('DEBUG: TCanvasFontManager.GetFont <<<'); @@ -887,31 +883,24 @@ var lDefaultFontSpec: TFontSpec; begin ProfileEvent('DEBUG: TCanvasFontManager.SetFont >>>>'); - //if FCurrentFontSpec = FontSpec then if (FCurrentFontSpec.FaceName = FontSpec.FaceName) and (FCurrentFontSpec.PointSize = FontSpec.PointSize) and (FCurrentFontSpec.Attributes = FontSpec.Attributes) then // same font exit; -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 1 of 9'); Font := GetFont( FontSpec ); -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 2'); if Font = nil then begin // ack! Pfffbt! Couldn't find the font. -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 3'); // Try to get the default font Font := GetFont( FDefaultFontSpec ); if Font = nil then begin -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 4'); FPGuiFontToFontSpec( fpgApplication.DefaultFont, lDefaultFontSpec ); -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 5'); Font := GetFont( lDefaultFontSpec ); -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 6'); if Font = nil then // Jimminy! We can't even get the default system font raise Exception.Create( 'Could not access default font ' @@ -923,12 +912,9 @@ ProfileEvent('DEBUG: TCanvasFontManager.SetFont 6'); end; -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 7'); SelectFont( Font, 1 ); FCurrentFontSpec := FontSpec; -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 8'); FCurrentFont.Free; -ProfileEvent('DEBUG: TCanvasFontManager.SetFont 9'); FCurrentFont := Font; ProfileEvent('DEBUG: TCanvasFontManager.SetFont <<<<'); end; diff --git a/components/richtext/RichTextLayoutUnit.pas b/components/richtext/RichTextLayoutUnit.pas index a4d3884a..98bd2900 100644 --- a/components/richtext/RichTextLayoutUnit.pas +++ b/components/richtext/RichTextLayoutUnit.pas @@ -300,7 +300,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout >>>>'); FWidth := 0; FHeight := FRichTextSettings.Margins.Top; Style := GetDefaultStyle( FRichTextSettings ); -ProfileEvent('DEBUG: TRichTextLayout.Layout 1 of 10'); ApplyStyle( Style, FFontManager ); CurrentLinkIndex := -1; P := FText; // P is the current search position @@ -319,23 +318,19 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 1 of 10'); WordStarted := false; DisplayedCharsSinceFontChange := false; -ProfileEvent('DEBUG: TRichTextLayout.Layout 2'); repeat CurrentElement := ExtractNextTextElement( P, NextP ); assert( NextP > P ); OnBreak := false; -ProfileEvent('DEBUG: TRichTextLayout.Layout 3'); case CurrentElement.ElementType of teWordBreak: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teWordBreak (' + CurrentLine.Text + ')'); CurrentCharWidth := FFontManager.CharWidth( ' ' ); OnBreak := true; end; teLineBreak: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teLineBreak'); DoLine( P, NextP, WordStartX + WordX ); // remember start of line @@ -349,7 +344,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teLineBreak'); teTextEnd: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teTextEnd'); DoLine( P, NextP, WordStartX + WordX ); // end of text, done @@ -358,8 +352,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teTextEnd'); teImage: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teImage'); - BitmapHeight := 0; try BitmapIndex := StrToInt( CurrentElement.Tag.Arguments ); @@ -379,7 +371,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teImage'); teText: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teText'); // Normal (non-leading-space) character CurrentCharWidth := FFontManager.CharWidth( CurrentElement.Character ); WordStarted := true; @@ -387,11 +378,9 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teText'); teStyle: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle'); case CurrentElement.Tag.TagType of ttBeginLink: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle.ttBeginLink'); CurrentLinkIndex := FLinks.Add( CurrentElement.Tag.Arguments ); P := NextP; continue; @@ -399,7 +388,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle.ttBeginLink'); ttEndLink: begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle.ttEndLink'); CurrentLinkIndex := -1; P := NextP; continue; @@ -407,11 +395,9 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle.ttEndLink'); ttSetLeftMargin: // SPECIAL CASE... could affect display immediately begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle.ttSetLeftMargin'); PerformStyleTag( CurrentElement.Tag, Style, WordstartX + WordX ); if Style.LeftMargin {* FontWidthPrecisionFactor} < WordStartX then begin -ProfileEvent('we are already post the margin being set???? Style.LeftMargin=' + intToStr(Style.LeftMargin)); // we're already past the margin being set if pos( 'breakifpast', CurrentElement.Tag.Arguments ) > 0 then begin @@ -434,11 +420,9 @@ ProfileEvent('we are already post the margin being set???? Style.LeftMargin=' + continue; end; -ProfileEvent('CurrentCharWidth (margin) before = ' + IntToStr(CurrentCharWidth)); // skip across to the new margin CurrentCharWidth := (Style.LeftMargin {* FontWidthPrecisionFactor}) - WordStartX - WordX; -ProfileEvent('CurrentCharWidth (margin) after = ' + IntToStr(CurrentCharWidth)); // BUT! Don't treat it as a space, because you would not // expect wrapping to take place in a margin change... // at least not for IPF :) @@ -447,36 +431,24 @@ ProfileEvent('CurrentCharWidth (margin) after = ' + IntToStr(CurrentCharWidth)); else begin -ProfileEvent('DEBUG: TRichTextLayout.Layout teStyle case..else'); - // before processing the tag see if font height needs updating if DisplayedCharsSinceFontChange then CheckFontHeights( CurrentLine ); -ProfileEvent('DEBUG: TRichTextLayout.Layout 3.1 of 5'); if ( CurrentElement.Tag.TagType = ttItalicOff ) and ( faItalic in Style.Font.Attributes ) then begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 3.2'); if not FFontManager.IsFixed then begin // end of italic; add a space -ProfileEvent('DEBUG: TRichTextLayout.Layout 3.3'); inc( WordX, FFontManager.CharWidth( ' ' ) ); end; end; -ProfileEvent('DEBUG: TRichTextLayout.Layout 3.4'); -ProfileEvent('DEBUG: TRichTextLayout.Layout tagtype str=' + TagStr[CurrentElement.Tag.TagType]); -if CurrentElement.Tag.TagType = ttInvalid then - writeln('<' + CurrentElement.Character + '> tagtype = ttInvalid'); -if CurrentElement.Tag.TagType = ttEnd then - ProfileEvent(' tagtype = ttEnd'); PerformStyleTag( CurrentElement.Tag, Style, WordX ); -ProfileEvent('DEBUG: TRichTextLayout.Layout 3.5'); DisplayedCharsSinceFontChange := false; P := NextP; continue; // continue loop @@ -489,7 +461,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 3.5'); if OnBreak then begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 4'); // we just processed a space if WordStarted then begin @@ -517,7 +488,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 4'); // (or leading spaces) if not Style.Wrap then begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 5'); // No alignment // We don't care about how wide it gets inc( WordX, CurrentCharWidth ); @@ -534,7 +504,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 5'); DoWrap := false; -ProfileEvent('DEBUG: TRichTextLayout.Layout 6'); // Calculate position of end of character // see if char would exceed width if (WordStartX + WordX + CurrentCharWidth) >= WrapX then @@ -550,7 +519,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 6'); if DoWrap then begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 7'); if LineWordsCompleted = 0 then begin // the first word did not fit on the line. so draw @@ -593,7 +561,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 7'); end else begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 8'); // Normal wrap; at least one word fitted on the line CurrentLine.Wrapped := true; @@ -615,7 +582,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 8'); end else begin -ProfileEvent('DEBUG: TRichTextLayout.Layout 9'); // Character fits. inc( WordX, CurrentCharWidth ); DisplayedCharsSinceFontChange := true; @@ -627,7 +593,6 @@ ProfileEvent('DEBUG: TRichTextLayout.Layout 9'); P := NextP; until false; // loop is exited by finding end of text -ProfileEvent('DEBUG: TRichTextLayout.Layout 10'); inc( FHeight, FRichTextSettings.Margins.Bottom ); ProfileEvent('DEBUG: TRichTextLayout.Layout <<<<'); diff --git a/components/richtext/RichTextStyleUnit.pas b/components/richtext/RichTextStyleUnit.pas index d56e6c07..b3c2830e 100644 --- a/components/richtext/RichTextStyleUnit.pas +++ b/components/richtext/RichTextStyleUnit.pas @@ -138,10 +138,7 @@ Procedure ApplyStyle( var Style: TTextDrawStyle; FontManager: TCanvasFontManager begin ProfileEvent('DEBUG: ApplyStyle >>>'); assert(FontManager <> nil, 'FontManager should not have been nil'); -ProfileEvent('DEBUG: ApplyStyle - setting font to...'); -ProfileEvent(' ' + Style.Font.FaceName); FontManager.SetFont( Style.Font ); -ProfileEvent('DEBUG: ApplyStyle - setting text color'); FontManager.Canvas.TextColor := Style.Color; ProfileEvent('DEBUG: ApplyStyle <<<'); end; |