Make SkCubicMap immutable
Drop setter, only keep the parameterized constructor. Change-Id: I31517df23688b8bd7485bf70c9c055cd1c87edcf Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198245 Auto-Submit: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
parent
d0c1bd43d9
commit
34336e3633
@ -20,13 +20,7 @@
|
||||
*/
|
||||
class SK_API SkCubicMap {
|
||||
public:
|
||||
SkCubicMap() {} // must call setPts() before using
|
||||
|
||||
SkCubicMap(SkPoint p1, SkPoint p2) {
|
||||
this->setPts(p1, p2);
|
||||
}
|
||||
|
||||
void setPts(SkPoint p1, SkPoint p2);
|
||||
SkCubicMap(SkPoint p1, SkPoint p2);
|
||||
|
||||
float computeYFromX(float x) const;
|
||||
|
||||
@ -38,6 +32,7 @@ private:
|
||||
kCubeRoot_Type, // At^3 == x
|
||||
kSolver_Type, // general monotonic cubic solver
|
||||
};
|
||||
|
||||
SkPoint fCoeff[3];
|
||||
Type fType;
|
||||
};
|
||||
|
@ -105,9 +105,7 @@ protected:
|
||||
if (c0 != kDefaultC0 || c1 != kDefaultC1) {
|
||||
// TODO: is it worth de-duping these?
|
||||
cm_idx = SkToInt(fCubicMaps.size());
|
||||
fCubicMaps.emplace_back();
|
||||
// TODO: why do we have to plug these inverted?
|
||||
fCubicMaps.back().setPts(c1, c0);
|
||||
fCubicMaps.emplace_back(c1, c0);
|
||||
}
|
||||
|
||||
fRecs.push_back({t0, t0, v0_idx, v1_idx, cm_idx });
|
||||
|
@ -189,7 +189,7 @@ static inline bool coeff_nearly_zero(float delta) {
|
||||
return sk_float_abs(delta) <= 0.0000001f;
|
||||
}
|
||||
|
||||
void SkCubicMap::setPts(SkPoint p1, SkPoint p2) {
|
||||
SkCubicMap::SkCubicMap(SkPoint p1, SkPoint p2) {
|
||||
Sk2s s1 = Sk2s::Load(&p1) * 3;
|
||||
Sk2s s2 = Sk2s::Load(&p2) * 3;
|
||||
|
||||
|
@ -115,9 +115,8 @@ public:
|
||||
: fDir(dir)
|
||||
, fRect(focusRect)
|
||||
, fTarget(nullptr)
|
||||
, fMap(kFocusCtrl1, kFocusCtrl0)
|
||||
, fState(State::kIdle) {
|
||||
fMap.setPts(kFocusCtrl1, kFocusCtrl0);
|
||||
|
||||
fShadePaint = sksg::Color::Make(kFocusShade);
|
||||
fShade = sksg::Draw::Make(sksg::Plane::Make(), fShadePaint);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user