Skip to content

Commit

Permalink
Mark Predict() in StrokeModeler as const again.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 665347196
  • Loading branch information
Ink Open Source authored and copybara-github committed Aug 20, 2024
1 parent 7439def commit a726d0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ink_stroke_modeler/stroke_modeler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ absl::Status StrokeModeler::Update(const Input &input,
return absl::InvalidArgumentError("Invalid EventType.");
}

absl::Status StrokeModeler::Predict(std::vector<Result> &results) {
absl::Status StrokeModeler::Predict(std::vector<Result> &results) const {
results.clear();

if (!stroke_model_params_.has_value()) {
Expand Down
6 changes: 4 additions & 2 deletions ink_stroke_modeler/stroke_modeler.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class StrokeModeler {
//
// The output is limited to results where the predictor has sufficient
// confidence.
absl::Status Predict(std::vector<Result>& results);
absl::Status Predict(std::vector<Result>& results) const;

// Saves the current modeler state.
//
Expand Down Expand Up @@ -121,7 +121,9 @@ class StrokeModeler {
PositionModeler position_modeler_;
StylusStateModeler stylus_state_modeler_;

std::vector<TipState> tip_state_buffer_;
// This buffer is used as optimization to avoid re-allocating the vector in
// the predictor but doesn't hold state between calls, so can be mutable.
mutable std::vector<TipState> tip_state_buffer_;

struct InputAndCorrectedPosition {
Input input;
Expand Down

0 comments on commit a726d0e

Please sign in to comment.