Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: ui/gfx/render_text.cc

Issue 2943823002: Remove gfx::DIAGONAL_STRIKE and supporting code. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 5cf77374234e44f461096a3e2051dc8cd06eb0c1..dfac16495193edac4772265f9f6903c821d1d734 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -60,8 +60,6 @@ const SkScalar kStrikeThroughOffset = (-SK_Scalar1 * 6 / 21);
const SkScalar kUnderlineOffset = (SK_Scalar1 / 9);
// Fraction of the text size to use for a strike through or under-line.
const SkScalar kLineThickness = (SK_Scalar1 / 18);
-// Fraction of the text size to use for a top margin of a diagonal strike.
-const SkScalar kDiagonalStrikeMarginOffset = (SK_Scalar1 / 4);
// Invalid value of baseline. Assigning this value to |baseline_| causes
// re-calculation of baseline.
@@ -249,26 +247,15 @@ void SkiaTextRenderer::DrawPosText(const SkPoint* pos,
canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], flags_);
}
-void SkiaTextRenderer::DrawDecorations(int x, int y, int width, bool underline,
- bool strike, bool diagonal_strike) {
+void SkiaTextRenderer::DrawDecorations(int x,
+ int y,
+ int width,
+ bool underline,
+ bool strike) {
if (underline)
DrawUnderline(x, y, width);
if (strike)
DrawStrike(x, y, width);
- if (diagonal_strike) {
- if (!diagonal_)
- diagonal_.reset(new DiagonalStrike(canvas_, Point(x, y), flags_));
- diagonal_->AddPiece(width, flags_.getColor());
- } else if (diagonal_) {
- EndDiagonalStrike();
- }
-}
-
-void SkiaTextRenderer::EndDiagonalStrike() {
- if (diagonal_) {
- diagonal_->Draw();
- diagonal_.reset();
- }
}
void SkiaTextRenderer::DrawUnderline(int x, int y, int width) {
@@ -294,51 +281,6 @@ void SkiaTextRenderer::DrawStrike(int x, int y, int width) const {
canvas_skia_->drawRect(r, flags_);
}
-SkiaTextRenderer::DiagonalStrike::DiagonalStrike(Canvas* canvas,
- Point start,
- const cc::PaintFlags& flags)
- : canvas_(canvas), start_(start), flags_(flags), total_length_(0) {}
-
-SkiaTextRenderer::DiagonalStrike::~DiagonalStrike() {
-}
-
-void SkiaTextRenderer::DiagonalStrike::AddPiece(int length, SkColor color) {
- pieces_.push_back(Piece(length, color));
- total_length_ += length;
-}
-
-void SkiaTextRenderer::DiagonalStrike::Draw() {
- const SkScalar text_size = flags_.getTextSize();
- const SkScalar offset = text_size * kDiagonalStrikeMarginOffset;
- const int thickness = SkScalarCeilToInt(text_size * kLineThickness * 2);
- const int height = SkScalarCeilToInt(text_size - offset);
- const Point end = start_ + Vector2d(total_length_, -height);
- const int clip_height = height + 2 * thickness;
-
- flags_.setAntiAlias(true);
- flags_.setStrokeWidth(SkIntToScalar(thickness));
-
- const bool clipped = pieces_.size() > 1;
- int x = start_.x();
-
- for (size_t i = 0; i < pieces_.size(); ++i) {
- flags_.setColor(pieces_[i].second);
-
- if (clipped) {
- canvas_->Save();
- canvas_->ClipRect(
- Rect(x, end.y() - thickness, pieces_[i].first, clip_height));
- }
-
- canvas_->DrawLine(start_, end, flags_);
-
- if (clipped)
- canvas_->Restore();
-
- x += pieces_[i].first;
- }
-}
-
StyleIterator::StyleIterator(const BreakList<SkColor>& colors,
const BreakList<BaselineStyle>& baselines,
const BreakList<Font::Weight>& weights,
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698