From kde-commits Sun Jul 01 09:14:06 2012 From: Dominik Haumann Date: Sun, 01 Jul 2012 09:14:06 +0000 To: kde-commits Subject: [kate] part/render: const correctness, use fontHeight() & lineHeight() Message-Id: <20120701091406.B43E4A60A6 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=134113427521606 Git commit dad98368d74117b2c43a769d5a6cec30600737a1 by Dominik Haumann. Committed on 01/07/2012 at 11:08. Pushed by dhaumann into branch 'master'. const correctness, use fontHeight() & lineHeight() M +9 -9 part/render/katerenderer.cpp M +3 -3 part/render/katerenderer.h http://commits.kde.org/kate/dad98368d74117b2c43a769d5a6cec30600737a1 diff --git a/part/render/katerenderer.cpp b/part/render/katerenderer.cpp index 134ff6f..77b2b16 100644 --- a/part/render/katerenderer.cpp +++ b/part/render/katerenderer.cpp @@ -211,7 +211,7 @@ void KateRenderer::paintTextLineBackground(QPainter& pa= int, KateLineLayoutPtr la } = // Draw line background - paint.fillRect(0, 0, xEnd - xStart, config()->fontMetrics().height() * l= ayout->viewLineCount(), backgroundColor); + paint.fillRect(0, 0, xEnd - xStart, lineHeight() * layout->viewLineCount= (), backgroundColor); = // paint the current line background if we're on the current line if (currentViewLine !=3D -1) { @@ -226,7 +226,7 @@ void KateRenderer::paintTextLineBackground(QPainter& pa= int, KateLineLayoutPtr la ); } = - paint.fillRect(0, config()->fontMetrics().height() * currentViewLine, = xEnd - xStart, config()->fontMetrics().height(), currentLineColor); + paint.fillRect(0, lineHeight() * currentViewLine, xEnd - xStart, lineH= eight(), currentLineColor); } } = @@ -274,7 +274,7 @@ void KateRenderer::paintNonBreakSpace(QPainter &paint, = qreal x, qreal y) paint.setPen( pen ); paint.setRenderHint(QPainter::Antialiasing, false); = - const int height =3D config()->fontMetrics().height(); + const int height =3D fontHeight(); const int width =3D spaceWidth(); = QPoint points[6]; @@ -293,7 +293,7 @@ void KateRenderer::paintIndentMarker(QPainter &paint, u= int x, uint row) QPen penBackup( paint.pen() ); paint.setPen( config()->indentationLineColor() ); = - const int height =3D config()->fontMetrics().height(); + const int height =3D fontHeight(); const int top =3D 0; const int bottom =3D height-1; = @@ -776,19 +776,19 @@ const QFontMetrics& KateRenderer::currentFontMetrics(= ) const return config()->fontMetrics(); } = -uint KateRenderer::fontHeight() +uint KateRenderer::fontHeight() const { return config()->fontMetrics().height(); } = -uint KateRenderer::documentHeight() +uint KateRenderer::documentHeight() const { return m_doc->lines() * lineHeight(); } = -int KateRenderer::lineHeight() +int KateRenderer::lineHeight() const { - return fontHeight(); // for now + return fontHeight(); } = bool KateRenderer::getSelectionBounds(int line, int lineLength, int &start= , int &end) const @@ -936,7 +936,7 @@ void KateRenderer::layoutLine(KateLineLayoutPtr lineLay= out, int maxwidth, bool c lineLayout->setShiftX(shiftX); } = - height +=3D config()->fontMetrics().height(); + height +=3D lineHeight(); } = l->endLayout(); diff --git a/part/render/katerenderer.h b/part/render/katerenderer.h index 88dae0a..6f36aae 100644 --- a/part/render/katerenderer.h +++ b/part/render/katerenderer.h @@ -260,13 +260,13 @@ public: KTextEditor::Cursor xToCursor(const KateTextLayout& range, int x, bool= returnPastLine =3D false) const; = // Font height - uint fontHeight(); + uint fontHeight() const; = // Line height - int lineHeight(); + int lineHeight() const; = // Document height - uint documentHeight(); + uint documentHeight() const; = // Selection boundaries bool getSelectionBounds(int line, int lineLength, int &start, int &end= ) const;