[skottie] Show inval rects on mouse click in SkottieSlide
Also fix a SlideDir sizing bug. TBR= Change-Id: Iee61bb6665dc56ddd6fc062a686a9c0ef87dea92 Reviewed-on: https://skia-review.googlesource.com/108902 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
cbb85a7275
commit
60d3bfcef5
@ -77,3 +77,16 @@ bool SkottieSlide::onChar(SkUnichar c) {
|
||||
|
||||
return INHERITED::onChar(c);
|
||||
}
|
||||
|
||||
bool SkottieSlide::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state, uint32_t) {
|
||||
switch (state) {
|
||||
case sk_app::Window::kUp_InputState:
|
||||
fShowAnimationInval = !fShowAnimationInval;
|
||||
fAnimation->setShowInval(fShowAnimationInval);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
bool animate(const SkAnimTimer&) override;
|
||||
|
||||
bool onChar(SkUnichar) override;
|
||||
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
|
||||
|
||||
private:
|
||||
SkString fPath;
|
||||
|
@ -337,8 +337,8 @@ void SlideDir::unload() {
|
||||
}
|
||||
|
||||
SkISize SlideDir::getDimensions() const {
|
||||
return SkSize::Make(fWinSize.width(),
|
||||
fCellSize.height() * (fSlides.count() / fColumns)).toCeil();
|
||||
return SkSize::Make(fWinSize.width(),
|
||||
fCellSize.height() * (1 + (fSlides.count() - 1) / fColumns)).toCeil();
|
||||
}
|
||||
|
||||
void SlideDir::draw(SkCanvas* canvas) {
|
||||
@ -414,5 +414,5 @@ const SlideDir::Rec* SlideDir::findCell(float x, float y) const {
|
||||
row = static_cast<int>(y / fCellSize.height()),
|
||||
idx = row * fColumns + col;
|
||||
|
||||
return idx <= fRecs.count() ? &fRecs[idx] : nullptr;
|
||||
return idx < fRecs.count() ? &fRecs[idx] : nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user