skia2/include/views
Brian Osman 42bb6acf56 Simplify some Viewer code, and fix a few bugs
The content rect was always identical to the window rect,
so most of the related code did nothing. The translation
limit code is always useful (to avoid dragging the slide
way off-screen with the mouse), so always include it.
The auto-scaling to fit the screen is also still useful,
but just base it on the window rect.

The zoom code has four state variables, only used two of
them, and one was a trivially derived computation. Fold
most of that work into computeMatrix. (The translation
was always zero -- we never changed the zoom center.)

Include fDefaultMatrix in the matrix from computeMatrix,
rather than needing to apply it specially to the canvas.

Don't apply the inverse default matrix to touch or mouse
points. The absolute positions of those touch points is
not important, but because that matrix includes scale
(and sometimes very large or very small scale), it just
had the effect of greatly amplifying or damping the drag
speed. Without it, the slide always pans at the speed of
the touch/mouse drag -- which seems more desirable.

The use of the inverse default matrix was a clever trick,
but it caused the translation (applied to the global mtx)
to be scaled, so the slide was always pinned incorrectly.
Instead, supply the unmodified window rect and the default
matrix, so the trans limit code can do the obvious correct
thing: xform the slide bounds completely, then limit the
translation that will be applied after that. Slides are
now correctly pinned to screen edge regardless of how
much zoom is present in the default matrix.

Note: There are still several bugs related to all of this
code, but given the web of xform state, it's hard to
unravel. The touch gesture still doesn't know about
viewer's zoom, so that's ignored when doing the pinning.
Beyond that, it doesn't even know about window resize -
it only configures the translation limit when setting up
a slide. I had a fix for all of this (doing the
translation limiting in computeMatrix), but then the touch
gesture doesn't know about it, and can accumulate drag
motion that needs to be un-dragged to get back on-screen,
even though the slide is never really translated that far.

SkTouchGesture is in include. No one uses it except viewer:
TBR=bsalomon@google.com

Bug: skia:
Change-Id: I460cc07c3de6d36e63826f57d359faf1facf5ab3
Reviewed-on: https://skia-review.googlesource.com/18524
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-05 15:21:43 +00:00
..
SkApplication.h
SkEvent.h headers: forward declare SkDOM, and include SkClipOp 2017-02-24 16:03:27 +00:00
SkEventSink.h remove SkInstCnt 2015-06-26 11:45:03 -07:00
SkKey.h
SkOSMenu.h Move SkTDArray to private. 2016-02-18 08:53:33 -08:00
SkOSWindow_iOS.h GN: iOS basics 2016-11-03 19:31:50 +00:00
SkOSWindow_Mac.h Remove command buffer sample app support. 2016-06-14 09:43:52 -07:00
SkOSWindow_Unix.h Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
SkOSWindow_Win.h Remove SkAutoTUnref and SkAutoTDelete from public includes. 2016-10-27 09:30:08 -07:00
SkSystemEventTypes.h
SkTouchGesture.h Simplify some Viewer code, and fix a few bugs 2017-06-05 15:21:43 +00:00
SkView.h headers: forward declare SkDOM, and include SkClipOp 2017-02-24 16:03:27 +00:00
SkWindow.h SK_USE_SDL is never defined 2017-02-06 18:52:54 +00:00