skia2/include
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
..
android Let region decoders query the type and color space 2017-04-14 13:59:35 +00:00
c C API: document sk_matrix_t 2017-03-21 18:04:34 +00:00
codec Add animation support to SkWebpCodec 2017-05-23 15:28:37 +00:00
config Revert "Revert "SkUserConfig.h: remove out-of-date comment on SK_SFNTLY_SUBSETTER"" 2017-01-27 14:40:01 +00:00
core Don't move raw pointers in SkCanvas 2017-06-05 01:17:51 +00:00
effects slant colorfilter away from filterSpan4f 2017-05-31 19:54:05 +00:00
encode remove SK_API from namespaced enum 2017-05-17 10:23:56 +00:00
gpu Remove ImmediateFlush mode 2017-06-02 17:35:18 +00:00
pathops use reversePathTo in place of addPathReverse 2016-11-07 05:09:28 -08:00
ports SkFontMgr::matchFamily should not crash on nullptr. 2017-05-01 18:13:02 +00:00
private Make instantiate return a Boolean 2017-06-05 14:03:10 +00:00
svg no need for SK_SUPPORT_LEGACY_CANVAS_IS_REFCNT anymore 2016-12-07 22:28:04 +00:00
utils Remove ambient and spot mask filters. 2017-05-18 19:45:45 +00:00
views Simplify some Viewer code, and fix a few bugs 2017-06-05 15:21:43 +00:00