ad5944cf8d
Insert/Delete/Backspace Status line Change-Id: I38727ddb86bf20cdd6c64363c33ffda03ab3c2c7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431179 Reviewed-by: Julia Lavrova <jlavrova@google.com> Commit-Queue: Julia Lavrova <jlavrova@google.com>
36 lines
892 B
C++
36 lines
892 B
C++
// Copyright 2021 Google LLC.
|
|
#include "experimental/sktext/editor/Cursor.h"
|
|
|
|
using namespace skia::text;
|
|
|
|
namespace skia {
|
|
namespace editor {
|
|
|
|
std::unique_ptr<Cursor> Cursor::Make() { return std::make_unique<Cursor>(); }
|
|
|
|
Cursor::Cursor() {
|
|
fLinePaint.setColor(SK_ColorGRAY);
|
|
fLinePaint.setAntiAlias(true);
|
|
|
|
fRectPaint.setColor(DEFAULT_CURSOR_COLOR);
|
|
fRectPaint.setStyle(SkPaint::kStroke_Style);
|
|
fRectPaint.setStrokeWidth(2);
|
|
fRectPaint.setAntiAlias(true);
|
|
|
|
fXY = SkPoint::Make(0, 0);
|
|
fSize = SkSize::Make(0, 0);
|
|
fBlink = true;
|
|
}
|
|
|
|
void Cursor::paint(SkCanvas* canvas) {
|
|
|
|
if (fBlink) {
|
|
canvas->drawRect(SkRect::MakeXYWH(fXY.fX, fXY.fY, DEFAULT_CURSOR_WIDTH, fSize.fHeight), fRectPaint);
|
|
} else {
|
|
//canvas->drawLine(fXY + xy, fXY + xy + SkPoint::Make(1, fSize.fHeight), fLinePaint);
|
|
}
|
|
}
|
|
|
|
} // namespace editor
|
|
} // namespace skia
|