Commit Graph

478 Commits

Author SHA1 Message Date
Ben Wagner
d10a78f57b Add filter quality to paint overrides in viewer.
Change-Id: I5e544174f5ddeaaf0a6252d88775112e545686c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198781
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-03-07 18:44:00 +00:00
Ben Wagner
0bb2db16d7 Correct argument order for blobs in viewer.
The glyph count goes before the offsets.

Change-Id: Ibc7120d174ee6098212430c1505c0c5f0e539a8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198252
Auto-Submit: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-07 00:42:28 +00:00
Florin Malita
34336e3633 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>
2019-03-06 22:55:08 +00:00
Brian Osman
b77d502946 Particles: Cleanup and better UI
Remove SkAnimTimer from the module interface entirely.
Clean up some other SkParticleEffect methods. Simplify
VisitTypes to just visit all of them, it's easier for
the client to do any filtering.

In the slide, make the UI far nicer. Load all files in
a given directory, and allow editing (and saving) them
all at once, or adding a new entry. Support multiple
playing effects, with a draggable handle to set the
position.

Bug: skia:
Change-Id: I0bec4077f9135bc122569f1410bebc96d5439480
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197243
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-06 18:42:11 +00:00
Robert Phillips
9882dae24d Reduce usage of SkCanvas::flush
SkCanvas::flush is problematic and we wish to deprecate it. As a first step, this CL begins to remove Skia's internal usage of it.

Ideally clients would use SkSurface::flush and/or GrContext::flush.

Change-Id: I39bb0702f8230134a97961a4ee70833fd5bd0dcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-03-04 22:09:39 +00:00
Brian Osman
bdcdf1a7c3 Add SkParticleValue to allow further customization of curve behavior
All curves (and path affectors) are driven by an SkParticleValue. The
value can derive its value from the current defaults (age of particle
or effect), or explicitly choose the other one, a random value, or any
other particle value. Values can be range adjusted and support repeat,
clamp, and mirror tiling.

Also fixed some more issues related to resource path in the slide GUI.

Bug: skia:
Change-Id: I4755018d5b57ae2d5ec400d541055ca4fb542978
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196760
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-04 22:04:17 +00:00
Mike Reed
58a75383a7 change particleslide to use Resources
standard way to find assets across different platforms

Bug: skia:
Change-Id: I4cb464be1e643a59431eba66b5caad70ecfed1e9
Reviewed-on: https://skia-review.googlesource.com/c/196775
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-03-03 01:38:01 +00:00
Jim Van Verth
74826c81bd Restore old Viewer setup order.
The backend needs to be set up before setting the current slide because
some slides require the backend resolution to set their size. We'll
check to see if a slide is set before drawing instead.

Also adds a null slide to be drawn when no slides are loaded.

Change-Id: Idb34deea80ea32762fa9e7434312e7b542c6a87e
Reviewed-on: https://skia-review.googlesource.com/c/196650
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-02 03:45:39 +00:00
Brian Osman
3d76d1bf46 Particles: Removed emitters, added more full-featured position affectors
Bug: skia:
Change-Id: Ie6485a11bb57fecef470d727dcf3b4fe5dff0b90
Reviewed-on: https://skia-review.googlesource.com/c/195582
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-28 21:16:02 +00:00
Brian Osman
34d1331323 Particles: Improvements to SkCurve
Added explicit Linear segment type, merge math evaluation helpers for
scalar and color curves. Add logic to visitFields that cuts down on the
serialized size of simple curves, and makes the GUI easier to work with.

Remove the curve plot from the GUI. It was incorrect (wrong points at
cubic handle locations), not terribly helpful, and difficult to
maintain.

Bug: skia:
Change-Id: I190cb5d118b1f4b910984e4df50ee3351c8be895
Reviewed-on: https://skia-review.googlesource.com/c/195884
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-27 16:46:29 +00:00
Brian Osman
e5d532edae Particles: remove non-stable random, add better enum reflection
The other generator was never used (or useful). String-based serialization
of enums is quite helpful, though.

Bug: skia:
Change-Id: Ic9d58f8d20cfe7aba47722bd74f1e6f8f0f219e5
Reviewed-on: https://skia-review.googlesource.com/c/195368
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-26 20:29:56 +00:00
jongdeok.kim
804f17e35b [Viewer] Set the current slide first before attaching the fBackendType to fWindow.
If call attach() first, Viewer::onBackendCreated() calls Window::show().
When WM_PAINT occurs, Viewer::drawSlide() is called, where a crash occurs using an uninitialized fCurrentSlide.

Bug: skia:https://bugs.chromium.org/p/skia/issues/detail?id=8792
Change-Id: I22ba6479052cb66e08d8bc2a94539473e899b604
Reviewed-on: https://skia-review.googlesource.com/c/195240
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-26 14:21:55 +00:00
Brian Osman
22eeb3ccae Use upper case hex in viewer's zoom window
Bug: skia:
Change-Id: I5452dd557e103ccf75fb70312d32ad7615a830ed
Reviewed-on: https://skia-review.googlesource.com/c/193468
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-02-20 15:40:39 +00:00
Brian Osman
b23532b7ef Fix layout feedback loop in particle GUI
Bug: skia:
Change-Id: I6c5a846ed7b896d3eea27893bd946d7d0dd3f7d6
Reviewed-on: https://skia-review.googlesource.com/c/193375
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-19 21:52:57 +00:00
Brian Osman
2991cbee62 Remove SkField, it's no longer used
Bug: skia:
Change-Id: I8efcbb09dce2cb0e4f33a10e4ff2148058c6fbc5
Reviewed-on: https://skia-review.googlesource.com/c/193362
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-19 16:08:42 +00:00
Brian Osman
543d2e2f2e Moved image params out to SkParticleDrawable
Added a simpler circle drawable, moved drawing code out so that frame
calculation is handled by the drawable. Fixed all the sample effects,
including some size adjustments to better create the intended effect.

Bug: skia:
Change-Id: I60af9cd6262ff98352ca8ceaf6768aef9c7e164c
Reviewed-on: https://skia-review.googlesource.com/c/193029
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 20:07:43 +00:00
Brian Osman
112aa2d22e Add curve visualization back, guard eval
Editing curves is still cumbersome, but that's fine.
Visualization is just for feedback (and imgui's path
renderer is a little wonky), but this helps a bit.

Bug: skia:
Change-Id: I3dace6d822d472314513bb1ad72bcea1e8991b77
Reviewed-on: https://skia-review.googlesource.com/c/192828
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 16:24:43 +00:00
Brian Osman
8b6283fc98 New SkCurve type with multiple curve segments
- Converted all linear force stuff into a single affector,
  used at either spawn or update time appropriately.
  The new affector can either set or adjust velocity.
- Converted lifetime to a curve.
- Removed SkRangedFloat, initial velocity params, etc.

Looks like a large addition, but that's mostly down to the
JSON getting bigger. There's a net reduction in LoC.

Bug: skia:
Change-Id: Iac7417f15f96d0313efd08c4b26dc3250b80fa77
Reviewed-on: https://skia-review.googlesource.com/c/192102
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 14:10:39 +00:00
Brian Osman
5c1f8eb094 Various particle system improvements
Effects now have a duration, and can be played looped
or one-shot. Added a second list of affectors that are
applied at spawn vs. update.

Effects grab and store the SkRandom at construction,
so it no longer needs to be passed to update().

Bug: skia:
Change-Id: Ib54d60466e162e4d4b70fa64c1215fc01680d47a
Reviewed-on: https://skia-review.googlesource.com/c/191722
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-14 20:19:08 +00:00
Brian Osman
5de7ea45bc Particles/SkReflected: Generalize array reflection
This supports arrays of any type, and removes all of the special case
code for arrays of SkReflected objects. (This is extracted from my
rewrite of SkCurve, which needed something like this to work).

Bug: skia:
Change-Id: I55ab942f7922335dca0685d28b3b122bc4d53daa
Reviewed-on: https://skia-review.googlesource.com/c/192620
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-14 20:04:48 +00:00
Ben Wagner
a57d868f19 Defer loading particle effect to load time.
Moving this out of the constructor means less going on at slide creation
time, making debugging easier.

Change-Id: I37bdd249abef663931bc8ef152a92a3a3436dcf4
Reviewed-on: https://skia-review.googlesource.com/c/192600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 18:58:15 +00:00
Brian Osman
7c979f52c3 Experimental Particle System
This adds a new "Particles" slide to viewer, that allows
editing, loading, and saving particle effects. All of the
particle system code is in modules/particles.

There are many rough edges and some not-yet-finished changes
to generalize the model[1]. A rough overview:

- SkReflected.h implements a lightweight reflection system
  for classes derived from SkReflected. Adding a new class
  involves deriving from SkReflected, adding a macro to the
  class declaration, and implementing visitFields(), which
  simply calls a virtual on an SkFieldVisitor for each field.
  Currently, emitters and affectors use this mechanism.

- SkParticleSerialization.h demonstrates two useful field
  visitors - for serializing to and from JSON. The driver
  code that uses those is directly in ParticlesSlide.

- SkParticleData.h and SkCurve.h define a variety of helper
  types for talking about particles, both for parameterizing
  individual values, and communicating about the state of a
  particle among the effect, affectors, and emitters.

- SkParticleEffect.h defines the static data definition of
  an effect (SkParticleEffectParams), as well as a running
  instance of an effect (SkParticleEffect). The effect has
  simple update() and draw() methods.

- ParticlesSlide.cpp adds a third field visitor to generate
  GUIs for interactively editing the running effect.

---

1: The critical change I'd like to make is to remove all
special case behavior over time and at spawn (setting sprite
frames, size over time, color over time, etc...). Integration
is the only fixed function behavior. Everything else is driven
by two lists of affectors. One is applied at spawn time, using
the effect's lifetime to evaluate curves. This allows spawning
particles with different colors as the effect ages out, for
example. The second list is applied every frame to update
existing particles, and is driven by the particle's lifetime.
This allows particles to change color after being spawned, for
example.

With a small set of affectors using a single expressive curve
primitive (keyframed list of cubic curve segments), we can
have affectors that update color, size, velocity, position,
sprite frame, etc., and implement many complex behaviors.

Bug: skia:
Change-Id: Id9402bef22825d55d021c5a2f9e5e41791aabaf4
Reviewed-on: https://skia-review.googlesource.com/c/181404
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-12 18:53:41 +00:00
Florin Malita
eb46bd892d [sksg] Hit-testing API
Introduce RenderNode::nodeAt(const SkPoint&) as the entry point for the hit-testing API.

This is backed by a onNodeAt() virtual, which gets dispatched throughout the render DAG,
and normally stops at the first leaf Draw node in encounters.

To support the implementation, introduce a GeometryNode::contains(const SkPoint&) API.

This is backed by a onContains() virtual, overridden in each concrete geometry class.

Expose nodeAt() on sksg::Scene, and add some basic unit tests.

Change-Id: I0c8abd9d1e51ecf2d8b4dd699f325cd636e21084
Reviewed-on: https://skia-review.googlesource.com/c/191296
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-12 15:01:05 +00:00
Brian Osman
535c5e34ee Add ImGui::DragCanvas, to simplify several custom widgets
Bug: skia:
Change-Id: Ic44ab00af1117a6bbc17df7f5005f4db707cb5c1
Reviewed-on: https://skia-review.googlesource.com/c/191002
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-11 16:31:59 +00:00
Jim Van Verth
be39f713e5 Add Metal context to Viewer.
Bug: skia:8737
Change-Id: I5c4c839bcf39f2cd3a9a32d005bf4bdb7c42e6a5
Reviewed-on: https://skia-review.googlesource.com/c/187925
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-08 21:26:52 +00:00
Brian Osman
a5ab35cc0e Fix vertex indexing error when using ImGui skiaWidgets
skiaWidget adds fake "images" to the ImGui draw list. Those have
vertices allocated for them (even though we don't consume them). We
still need to skip over those if any ImGui widget rendering happens
after the callback, though.

Bug: skia:
Change-Id: Ia0243e600bd32d90ba97ac9fbe58b715f70aa83a
Reviewed-on: https://skia-review.googlesource.com/c/190664
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-02-08 15:43:26 +00:00
Brian Osman
5b9126bc19 Give ImGui the correct DeltaTime
Fixes key repeat rate when vsync is disabled

Bug: skia:
Change-Id: I315932d0e0bcfd491a3c81deba56b137db1c3a0f
Reviewed-on: https://skia-review.googlesource.com/c/190304
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-02-07 20:19:26 +00:00
Robert Phillips
9da87e0e98 Rename GrContext::contextPriv to priv
Mechanical. This makes the priv() accessor the same for all the context types.

Change-Id: I40850eb05a33b8d7cc3eabdd42226d24b2ba58aa
Reviewed-on: https://skia-review.googlesource.com/c/189164
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-02-04 22:13:14 +00:00
Ben Wagner
9613e45775 Update Viewer for SkFont overrides.
Change-Id: I18871dd6db647b24db08a3e92e0470c5baa5850c
Reviewed-on: https://skia-review.googlesource.com/c/186082
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-01-23 16:38:40 +00:00
Hal Canary
02738a86e5 Revert "hide hinting and flag enums with PAINT_FLAGS"
This reverts commit 5d052dac3a.

Reason for revert: BREAKS CHROMIUM ROLL.

https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc?l=49
|   FAILED: obj/third_party/blink/renderer/platform/platform/font_platform_data_win.obj
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(49,29):
|     error: no member named 'kLCDRenderText_Flag' in 'SkPaint'
|     if (text_flags & SkPaint::kLCDRenderText_Flag) {
|                      ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(51,36):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|     } else if (text_flags & SkPaint::kAntiAlias_Flag) {
|                             ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(56,52):
|     error: no member named 'kSubpixelText_Flag' in 'SkPaint'
|     font->setSubpixel(SkToBool(text_flags & SkPaint::kSubpixelText_Flag));
|                                             ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(64,29):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|     if (text_flags & SkPaint::kAntiAlias_Flag)
|                      ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(85,27):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|                  ? SkPaint::kAntiAlias_Flag
|                    ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(91,35):
|     error: no member named 'kLCDRenderText_Flag' in 'SkPaint'
|                          ? SkPaint::kLCDRenderText_Flag
|                            ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(93,27):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|       text_flags = SkPaint::kAntiAlias_Flag | lcd_flag;
|                    ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(101,28):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|       text_flags |= SkPaint::kAntiAlias_Flag;
|                     ~~~~~~~~~^
|   8 errors generated.

Original change's description:
> hide hinting and flag enums with PAINT_FLAGS
> 
> A preflight for https://skia-review.googlesource.com/c/skia/+/185460
> 
> Bug: skia:2664
> Change-Id: I83f7f9cd500e8507b559462835477ba8ae7c11ab
> Reviewed-on: https://skia-review.googlesource.com/c/185540
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I4d1581a7e29267ad459ed31d4885b823fa00066f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:2664
Reviewed-on: https://skia-review.googlesource.com/c/185680
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-01-21 18:51:39 +00:00
Mike Reed
5d052dac3a hide hinting and flag enums with PAINT_FLAGS
A preflight for https://skia-review.googlesource.com/c/skia/+/185460

Bug: skia:2664
Change-Id: I83f7f9cd500e8507b559462835477ba8ae7c11ab
Reviewed-on: https://skia-review.googlesource.com/c/185540
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-21 15:45:37 +00:00
Brian Osman
a4e4680494 Fix variable shadowing in Viewer's ImGui code
This worked, but was confusing.

Bug: skia:
Change-Id: I9a387f2fc772277086e0f6ce532c834839b5e4dc
Reviewed-on: https://skia-review.googlesource.com/c/184800
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-01-17 14:52:30 +00:00
Florin Malita
760a052c1e [sksg] Consolidate Matrix node implementations
Matrix and Matrix44 look almost identical -- consolidate as a template
class.

TBR=
Change-Id: I8f299a6138f190eb18de2e67b051307cf6a33383
Reviewed-on: https://skia-review.googlesource.com/c/182973
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-10 21:50:54 +00:00
Mike Reed
e5f9cfad7b expand flag to include all text-related paint fields
Bug: skia:
Change-Id: I8453a6d607df4902cd05c5c9bc6162feda04ef9c
Reviewed-on: https://skia-review.googlesource.com/c/182969
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-10 20:06:07 +00:00
Brian Osman
707d202245 Make SkAnimTimer support speed control
Really helpful to slow down animated content for debugging, etc...

Bug: skia:
Change-Id: Id22ac555c7926dc858777d3d1be8afac1686407a
Reviewed-on: https://skia-review.googlesource.com/c/182920
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-10 17:38:31 +00:00
Brian Osman
207d410d3b Viewer: Add ability to pause timer from GUI and keyboard
Bug: skia:
Change-Id: I1e4991c996cadcdee928efdbc10fc3d7ac820045
Reviewed-on: https://skia-review.googlesource.com/c/182813
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-01-10 15:38:29 +00:00
Florin Malita
919e209d1a [sksg] 4x4 matrix support
Refactor the scene graph transform hierarchy to support 4x4 matrices:

  * rename current Transform to TransformEffect (operates as a render tree effect)
  * introduce a new Transform abstract base class, to replace current Matrix
  * refactor existing Matrix as a Transform specialization
  * introduce a new Matrix44 Transform specialization
  * refactor the existing composition helper (ComposedMatrix) as Concat,
    a Transform specialization (using composition instead of Matrix inheritance)

Change-Id: Ic3c1b499e10a0a229a7a76d4bef3dbc6a8b49194
Reviewed-on: https://skia-review.googlesource.com/c/182666
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-10 02:06:54 +00:00
Hal Canary
df2d27e0c7 drawText Cleanup, part 2
Change-Id: I6765d623924d12c6eea2c402dd27eade61b73b66
Reviewed-on: https://skia-review.googlesource.com/c/182151
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-01-09 16:01:59 +00:00
Brian Osman
82ebe04caf Reland "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Originally landed as:
https://skia.googlesource.com/skia/+/a9549ab31630fc244094e6f1692371cbaf87f666

Re-landing with a new serialization format, but maintaining ability to
load old serialized color spaces, for SKP compatibility.

Bug: skia:
Change-Id: Ib84a6e1cd5d7d9816175773fdbaff2ca32658667
Reviewed-on: https://skia-review.googlesource.com/c/181176
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-05 20:06:51 +00:00
Brian Osman
d4c7458f64 Revert "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
This reverts commit a9549ab316.

Reason for revert: SKPs changed?

Original change's description:
> Add SkColorSpace factory from 3x3 row-major gamut and transfer function
> 
> Moved named common transfer functions and gamuts to constexpr values in
> SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.
> 
> Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
> new factory with the named values. Multiple clients want a way to
> extract named transfer function and gamut - this still doesn't provide
> that, but this may be a better path forward for honestly advertising how
> SkColorSpace works internally.
> 
> Bug: skia:
> Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
> Reviewed-on: https://skia-review.googlesource.com/c/180360
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com,reed@google.com

Change-Id: Ie888f877b3c1dba33e1a8c0f5fa92594628de7fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/181300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 17:07:48 +00:00
Mike Reed
3ae473347e start to change Viewer's filtering to know about fonts
Did not hook-up all of the font flags, but these did not appear to be
"filtered" by viewer, so landing this version for now (to stop assuming
that text-fields are in paint).

Bug: skia:
Change-Id: Id8bdfc12f838b6c3ddc2981aca698d4d80a4c639
Reviewed-on: https://skia-review.googlesource.com/c/181169
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-04 15:39:27 +00:00
Brian Osman
a9549ab316 Add SkColorSpace factory from 3x3 row-major gamut and transfer function
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Bug: skia:
Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
Reviewed-on: https://skia-review.googlesource.com/c/180360
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 14:32:06 +00:00
Mike Klein
1688507f83 Try out clang-tidy, starting with bugprone-use-after-move
- add drop-in clang-tidy cxx wrapper
 - get build clean for bugprone-use-after-move

The wrapper can be used by setting

   cxx = "/path/to/skia/tools/clang-tidy.sh"

in GN.

Change-Id: Idbba911e23bd6ef7530b08fd31906b92c1c1b28c
Reviewed-on: https://skia-review.googlesource.com/c/176523
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-11 17:28:19 +00:00
Mike Reed
6d59568196 change private alloc methods to also take fonts
Bug: skia:2664
Change-Id: I772534179ce0c948984640f9fffc22e0372fce97
Reviewed-on: https://skia-review.googlesource.com/c/174848
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-06 02:15:36 +00:00
Brian Osman
e9ed0f0906 Add tiled rendering option to viewer
Bug: skia:
Change-Id: I4bb5e0107d06798040a37609499b4e2b48cf7e29
Reviewed-on: https://skia-review.googlesource.com/c/172962
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-26 20:36:11 +00:00
Brian Osman
03115dc284 Remove xform canvas mode from Viewer, simplify color management
There are now three modes: Legacy, and Color Managed 8888 or F16. Rules
about transfer functions are gone, so allow changing gamma in either
color managed mode.

To keep things much simpler, we always construct the window surface in
legacy mode, and draw offscreen whenever we're doing any color
management. This lets us avoid re-creating the window surface when
cycling modes, and avoid making re-tagged copies when pushing color
managed images to the window surface.

Bug: skia:
Change-Id: I59e9340900b047d5217eb8a9f63f20a1d638227d
Reviewed-on: https://skia-review.googlesource.com/c/172960
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-26 19:38:16 +00:00
Florin Malita
f7d6ac1f0d [sksg] Expose SkFont::Edging in TextNode
(instead of SkPaint flags)

TBR=
Change-Id: I31566f29d7922b26898234c357d8d249ebc1e094
Reviewed-on: https://skia-review.googlesource.com/c/172504
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-11-21 22:48:00 +00:00
Florin Malita
a8316554cb [skottie] Make animated image support generally available
Consolidate some helpers under skottie_utils, and update all related
tools to support animated images.

TBR=
Change-Id: If08e97143a11d9a414f3230a49ab4284c508b9d0
Reviewed-on: https://skia-review.googlesource.com/c/169342
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-11-10 19:52:19 +00:00
Mike Reed
9edbf42e75 Revert[4] "hide nested hinting enum"
This reverts commit 8e12cc6dfe.

Bug: skia:
Change-Id: Ice5e3480adad75ab77d97f7366495015f36b15a6
Reviewed-on: https://skia-review.googlesource.com/c/169520
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-08 16:33:04 +00:00
Mike Klein
8e12cc6dfe Reland "Revert "hide nested hinting enum""
This reverts commit f49563bf92.

Reason for revert: Google3 also.

Original change's description:
> Revert "Revert "hide nested hinting enum""
> 
> This reverts commit 6bd19df9fa.
> 
> Restores original CL, but adds guards for flutter.
> 
> Bug: skia:
> Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
> Reviewed-on: https://skia-review.googlesource.com/c/169345
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I26a07555df56ce92e86b114ecf4ab64643e71ed1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/169441
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 23:56:24 +00:00
Mike Reed
f49563bf92 Revert "Revert "hide nested hinting enum""
This reverts commit 6bd19df9fa.

Restores original CL, but adds guards for flutter.

Bug: skia:
Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
Reviewed-on: https://skia-review.googlesource.com/c/169345
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-11-07 22:47:53 +00:00
Mike Reed
6bd19df9fa Revert "hide nested hinting enum"
This reverts commit fbebecee0e.

Reason for revert: need staging guard for flutter

Original change's description:
> hide nested hinting enum
> 
> Bug: skia:2664
> Bug: skia:8527
> Change-Id: I8f4b832d5524fb792bcc608d6bd515229881b048
> Reviewed-on: https://skia-review.googlesource.com/c/168270
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I19496daa059932574f36ac47061068a81d5524c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:2664, skia:8527
Reviewed-on: https://skia-review.googlesource.com/c/169344
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-07 22:06:01 +00:00
Mike Reed
fbebecee0e hide nested hinting enum
Bug: skia:2664
Bug: skia:8527
Change-Id: I8f4b832d5524fb792bcc608d6bd515229881b048
Reviewed-on: https://skia-review.googlesource.com/c/168270
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-11-07 21:42:28 +00:00
Chris Dalton
89305751ba Call GrContext::performDeferredCleanup from viewer
Bug: skia:
Change-Id: I723c5efdd746d6182dee0511795f7eca3b6066d3
Reviewed-on: https://skia-review.googlesource.com/c/167180
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2018-11-01 17:30:25 +00:00
Kevin Lubick
d969932474 Refactor Nima code
There were two copies of a Nima "player" and this moves them out of
samplecode/ and viewer/ to experimental/ where it is a bit more
accessible (e.g. for WebAssembly).

Bug: skia:
Change-Id: I05419a352f0d13d16b462a374578107513eb1243
Reviewed-on: https://skia-review.googlesource.com/c/166441
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-30 19:32:52 +00:00
Mike Reed
3a42ec0ee7 hide the SkPaint::Align enum entirely
Bug: skia:2664
Change-Id: I080b015dbcb3a3cd73bb6847f3243a996d5f7b7d
Reviewed-on: https://skia-review.googlesource.com/c/166282
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-10-30 17:26:47 +00:00
Mike Reed
c88cc779ef remove (unused) vertical-text
Bug: skia:8487
Change-Id: Ia6715346a0214b0db2fc67294e45b5e04c1c24d8
Reviewed-on: https://skia-review.googlesource.com/c/163889
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2018-10-23 16:33:02 +00:00
Mike Klein
4429a4f82c re-precate SkMatrix44::SkMatrix44()
It's been driving me nuts that I can't just write `SkMatrix44 m;`,
and I often don't care whether it's initialized or not.  The default
identity constructor would be nice to use, but it's deprecated.

By tagging this constructor deprecated, we're only hurting ourselves;
our big clients disable warnings about deprecated routines and use it
freely.

A quick tally in Skia shows we mostly use the uninitialized constructor,
but sometimes the identity constructor, and there is a spread of all
three in Chromium.  So I've left the two explicit calls available.

I switched a bunch of calls in Skia to use the less verbose constructor
where it was clear that it didn't matter if the matrix was initialized.
Literally zero of the kUninitialized constructor calls looked important
for performance, so the only place I've kept is its lone unit test.

A few places read clearer with an explicit "identity" to read.

Change-Id: I0573cb6201f5a36f3b43070fb111f7d9af92736f
Reviewed-on: https://skia-review.googlesource.com/c/159480
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-04 14:01:11 +00:00
Florin Malita
57b9d4071b [skottie] External logger support
Add a skottie::Logger interface, allowing clients to register for log events
from the animation builder.

Convert existing log messages to the new machinery.

Change-Id: If9083f89b27f197bfc0d8d81860bbacb6b764be3
Reviewed-on: https://skia-review.googlesource.com/c/158580
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-02 18:17:35 +00:00
Ben Wagner
41e404746d Filter TextBlob paints in Viewer.
In particular this allows subpixel positioning to be forced for
drawing.

Change-Id: I2c88311f075944fef66fe5ba0237804aa5755800
Reviewed-on: https://skia-review.googlesource.com/156370
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-09-24 20:04:24 +00:00
Hal Canary
8a00144035 test,tools: whitespace changes for clang-format
Change-Id: I67529f6c0ac26da603f60af22c620f8f603d8a19
Reviewed-on: https://skia-review.googlesource.com/155564
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2018-09-19 17:50:51 +00:00
Brian Salomon
343553a1fe Don't use MEM_MOVE=true with SkTArrays of sk_sp
The code generated from std::move()ing them should be fine.

Bug: skia:8355
Change-Id: I63ef650b5fbcf9fb6356006190eae5e0977ae642
Reviewed-on: https://skia-review.googlesource.com/151982
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-09-05 20:11:07 +00:00
Ben Wagner
211511237f Make Slide::getDimensions pure virtual.
The default behavior is to not let the user move the slide to the top or
left. Implement for SampleSlide and stub out for NIMASlide (which isn't
so easy to implement).

Change-Id: I16074e704f4086199932d83e28c28d1ee39fbd9d
Reviewed-on: https://skia-review.googlesource.com/151600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-09-05 15:05:14 +00:00
Florin Malita
40c37426b3 [skottie] Plumb external SkFontMgr
Allow embedders to pass a font manager.

In order to avoid excessive factory API clutter, introduce an
Animation::Builder helper to wrap factory options.

Also clean up various bits:

  * hoist scene parsing out of the Animation ctor
  * store the animation duration explicitly (instead of unused fps)
  * plumb const SkFontMgr& internally (instead of a ref)

Change-Id: I3e180dfa85ba18c8462cfeb5a7385bef985ed6c4
Reviewed-on: https://skia-review.googlesource.com/148800
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-23 13:13:30 +00:00
Ruiqi Mao
c97a339cd6 added optimizations to speed up skinning
Docs-Preview: https://skia.org/?cl=145148
Bug: skia:
Change-Id: If27722105a1e8999f6440b6fd4044cc1f327827e
Reviewed-on: https://skia-review.googlesource.com/145148
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-08-15 15:52:29 +00:00
Jim Van Verth
b35c655378 Fix viewer assert in onResize
Bug: skia:
Change-Id: I99f938c76aa08a43bdc2e0fa2ad2bb04f103d2fb
Reviewed-on: https://skia-review.googlesource.com/146941
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-08-13 15:52:09 +00:00
Ben Wagner
897dfa2530 Subpixel in Viewer from -1 to 1.
Change the Subpixel positioning in Viewer from 0 to 1 to -1 to 1, with
the origin at the center of the drag area. This allows for observing
what happens when rolling over integer boundaries. Since it is no longer
simple to reset to the origin, closing the collapsing header resets the
drag point to the origin.

Change-Id: I88d4fd489c3bfb914fb843fa261d4097fef3671a
Reviewed-on: https://skia-review.googlesource.com/146643
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-08-10 15:30:12 +00:00
Ben Wagner
a191597a96 Viewer to resize Samples with window resize.
This adds onResize to sk_app::Window::Layer and uses it to resize
samples in Viewer.

Change-Id: Ia5ec5cf6dc74fbdf712291b9ba8707b076cb625d
Reviewed-on: https://skia-review.googlesource.com/146642
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-08-09 21:03:11 +00:00
Ben Wagner
b2c4ea6219 Move Views into Sample and Viewer.
What is left of the SkView system is used only by samples or viewer.
As a result, move it out of the Skia source tree and re-organize so it
is a bit easier to understand and use more shared code.

Move samplecode/ClockFaceView.cpp to samplecode/SampleTextEffects.cpp,
sice that's what's actually in it.

Move SkAnimTimer.h to tools/timer, since it's actually shared between gm
and samples.

Change-Id: I55dafd94c64e4f930ddbd19168e0f812af86c455
Reviewed-on: https://skia-review.googlesource.com/146161
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-08-09 15:25:32 +00:00
Florin Malita
c0132ffa64 [skottie] Optimize opacity layerization
- plumb a RenderContext RenderNode::render() argument to track pending
    opacity

  - defer opacity application until we can determine whether a layer is
    required (group with multiple children) or the opacity can be pushed
    onto the draw paint (for single/atomic draws)

Bug: skia:
Change-Id: I962ba08bad780395d5d738307bde986e9efa502b
Reviewed-on: https://skia-review.googlesource.com/146445
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-09 14:48:02 +00:00
Mike Reed
5edcd31f2c migrating SkTDArray towards std::vector api
fix for https://skia-review.googlesource.com/c/skia/+/146140

Change from original was to include <initializer_list>

Bug: skia:
Change-Id: Ie36426fcf7ce778a95e2b656ce80a9a394a8307c
Reviewed-on: https://skia-review.googlesource.com/146160
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-08-08 15:51:44 +00:00
Mike Reed
f9ecb4e67e Revert "migrating SkTDArray towards std::vector api"
This reverts commit 79884be809.

Reason for revert: broke flutter build -- initializer_list?

Original change's description:
> migrating SkTDArray towards std::vector api
> 
> push -> push_back
> add some aliases to match std::vector: count, reserve, ...
> 
> Bug: skia:
> Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
> Reviewed-on: https://skia-review.googlesource.com/145884
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib6132b725aaed7c01287e3e8c2b5a14da3d3d7e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/146140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 15:14:37 +00:00
Mike Reed
79884be809 migrating SkTDArray towards std::vector api
push -> push_back
add some aliases to match std::vector: count, reserve, ...

Bug: skia:
Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
Reviewed-on: https://skia-review.googlesource.com/145884
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 14:43:28 +00:00
Jim Van Verth
234e5a2b57 Improve touch support for iOS viewer
Adds pinch-zoom and swipe to change slides.

Bug: skia:
Change-Id: I0860c933208c8cf83027675a9de11b3f782de8e3
Reviewed-on: https://skia-review.googlesource.com/142898
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-08-07 17:04:55 +00:00
Brian Osman
ffee60f859 Fix GUI windows not appearing on first key in viewer
After the last update to ImGui, windows delayed visibility for one
frame, to get properly sized. We would detect that no windows were
"active" (really, visible) and not re-paint, so we never got the second
frame when the window finally showed up.

Omar put a fix to the stats in ImGui for this, so that Active windows
are tracked separately from Visible. This pulls that change in, and
updates the test to correctly redraw when the GUI requires it.

Change-Id: Iaa61f11fcc226917e3e2b31039055a7fa1961e45
Reviewed-on: https://skia-review.googlesource.com/145361
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2018-08-03 18:21:32 +00:00
Brian Osman
61fb4bb64b Clean up code for custom slide GUIs
Bailing out early caused controls to flicker on/off if one was being
interacted with. No need to rebuild the window (paramsChanged), the GUI
is up, so we're already repainting.

Change-Id: I0751271962075dff22b19f60f4d1dc81c9232f58
Reviewed-on: https://skia-review.googlesource.com/145335
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-08-03 16:24:13 +00:00
Hal Canary
972eba3c5c sk_tool::Registry: make an iterator.
Change-Id: Icf4e31b50bbd91b7ea330a1300f736d6dfd0a41c
Reviewed-on: https://skia-review.googlesource.com/144500
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2018-08-01 16:59:19 +00:00
Florin Malita
5d3ff438fe Fix !defined(SK_XML) builds
Add guards for dependent code.

TBR=
Change-Id: I49c0c90a2defc6f39589721f95562e9e0f17db13
Reviewed-on: https://skia-review.googlesource.com/144610
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-01 14:28:56 +00:00
Mike Reed
6cfa297382 remove conditional flags for sksg -- not needed for a module
Bug: skia:
Change-Id: I1b73379bd8a1ba2cd4293180052ba7ad59dfe96f
Reviewed-on: https://skia-review.googlesource.com/144642
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-07-31 22:27:20 +00:00
Brian Osman
b63f6005c1 Add 'u' to zoom stats display on high DPI devices
Still need to connect this to ImGui, but this is already useful

Bug: skia:
Change-Id: I925c7a9d6236cb2d865d45d6a68a5709bf2e3df7
Reviewed-on: https://skia-review.googlesource.com/143158
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-07-30 15:00:25 +00:00
Mike Klein
48b649060c remove SkThreadedBMPDevice and friends
It is unused, is becoming a maintainence burden and source of bugs,
and takes up a lot of time on the *SAN bots.

Change-Id: If383eb6e4838ca23140f9e16d518b1bfc655fa12
Reviewed-on: https://skia-review.googlesource.com/143307
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2018-07-25 18:17:26 +00:00
Ruiqi Mao
46656e298b added options to enable caching and draw bounds in NIMA slide
Bug: skia:
Change-Id: I30fed2c0587f36aeccd5e366b823a8b044a371ea
Reviewed-on: https://skia-review.googlesource.com/142164
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-07-20 18:47:26 +00:00
Eric Boren
8c172ba397 [infra] Add infra support for Lottie
Bug: skia:8136
Change-Id: I18c4ad549c52346ebfe23d172597d5da205e5c4d
Reviewed-on: https://skia-review.googlesource.com/142105
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
2018-07-19 17:53:25 +00:00
Brian Osman
1994f20d79 Merge "All" and "Default" path renderer options in viewer
This removes a confusing pair of radio buttons that were always in sync

Change-Id: I9bb2d4b944c1bba67f29f71e51c070c20b10d0ef
Reviewed-on: https://skia-review.googlesource.com/140242
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-07-10 20:03:45 +00:00
Ruiqi Mao
9a6e42ff18 added caching of SkVertices
SkVertices can now be "volatile", meaning they should not be cached.
SkVertices is volatile by default if the argument is not given.

Pulled from reverted CL: https://skia-review.googlesource.com/c/skia/+/138596

Docs-Preview: https://skia.org/?cl=139545
Bug: skia:
Change-Id: I92cf832efe1c0aaa8f432eedde2678582dd2454e
Reviewed-on: https://skia-review.googlesource.com/139545
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
2018-07-09 20:31:28 +00:00
Ruiqi Mao
c05aa7d163 Revert "added skeletal animation support to GPU backend"
This reverts commit b6307340e8.

Reason for revert: patch/atlas failing in gold

Original change's description:
> added skeletal animation support to GPU backend
> 
> added caching of SkVertices
> 
> Docs-Preview: https://skia.org/?cl=138596
> Bug: skia:
> Change-Id: Ia750f55f5f6d0de250d9e9c5619f4d1ac856f9f5
> Reviewed-on: https://skia-review.googlesource.com/138596
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Ruiqi Mao <ruiqimao@google.com>

TBR=robertphillips@google.com,brianosman@google.com,reed@google.com,ruiqimao@google.com

Change-Id: Idfaf016a7ff4cdd8af2543d510706f489d04417a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/139281
Reviewed-by: Ruiqi Mao <ruiqimao@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
2018-07-03 21:18:18 +00:00
Ruiqi Mao
b6307340e8 added skeletal animation support to GPU backend
added caching of SkVertices

Docs-Preview: https://skia.org/?cl=138596
Bug: skia:
Change-Id: Ia750f55f5f6d0de250d9e9c5619f4d1ac856f9f5
Reviewed-on: https://skia-review.googlesource.com/138596
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
2018-07-03 16:07:44 +00:00
Ruiqi Mao
f510149da8 skeletal animation support added to API and software backend
SkCanvas::drawVertices now supports overloads that take an array of bone deformation matrices.
SkVertices::MakeCopy and SkVertices::Builder now support two additional optional attributes, boneIndices and boneWeights.

Bug: skia:
Change-Id: I30a3b11691e7cdb13924907cc1401ff86d127aea
Reviewed-on: https://skia-review.googlesource.com/137221
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
2018-06-29 19:34:28 +00:00
Brian Osman
7197e05eae Update ImGui to v1.62 (June 22, 2018)
He's been steadily adding features and fixing bugs, figured it was time
to fetch a new version.

Change-Id: I496aefc0a1b60c3be5c89a0e58dc64811fccc77e
Reviewed-on: https://skia-review.googlesource.com/138591
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-06-29 18:58:57 +00:00
Ben Wagner
3627d2ebbb Add subpixel offset to Viewer app.
This adds a two dimensional location dragger to drag the origin across a
pixel. Also makes the perspective dragger hidden when perspective is
off. Also adds 'Z' to toggle the zoom window mouse follow.

Change-Id: Ic75d16c95848b392608770c8ed0d4db23733242f
Reviewed-on: https://skia-review.googlesource.com/137701
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-06-26 19:14:43 +00:00
Florin Malita
b632df701d Use SkJSONWriter for viewer UI serialization
+ drop JsonCPP dependency.

Bug: skia:
Change-Id: I81539cea6e495fe6d55d155ae49e7ac4a79faad6
Reviewed-on: https://skia-review.googlesource.com/135628
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-06-19 13:53:00 +00:00
Ben Wagner
f08d1d0ce1 Stop using SkTSwap.
Use std::swap instead. It does not appear that any external user
specializes SkTSwap, but some may still use it. This removes all use in
Skia so that SkTSwap can later be removed in a smaller CL. After that
the <utility> include can be removed from SkTypes.h.

Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753
Reviewed-on: https://skia-review.googlesource.com/135578
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-06-19 02:06:31 +00:00
Hal Canary
c640d0dc96 Revert "Revert "SkTypes: extract SkTo""
This reverts commit fdcfb8b7c2.

> Original change's description:
> > SkTypes: extract SkTo
> >
> > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> > Reviewed-on: https://skia-review.googlesource.com/133620
> > Reviewed-by: Mike Klein <mtklein@google.com>

Change-Id: Ida74fbc5c21248a724a5edbf9fae18a33bcb23aa
Reviewed-on: https://skia-review.googlesource.com/134506
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-06-14 14:55:17 +00:00
Hal Canary
fdcfb8b7c2 Revert "SkTypes: extract SkTo"
This reverts commit 2a2f675926.

Reason for revert: this appears to be what is holding up the Chrome roll.

Original change's description:
> SkTypes: extract SkTo
>
> Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> Reviewed-on: https://skia-review.googlesource.com/133620
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,halcanary@google.com

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae
Reviewed-on: https://skia-review.googlesource.com/134504
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-06-13 13:45:47 +00:00
Hal Canary
2a2f675926 SkTypes: extract SkTo
Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
Reviewed-on: https://skia-review.googlesource.com/133620
Reviewed-by: Mike Klein <mtklein@google.com>
2018-06-12 15:03:21 +00:00
Ben Wagner
d2ae4df90d Add text size override to Viewer.
In some cases issues only happen when the actual requested text size on
a paint is a particular size. Allow overriding the text size on the
paint for such testing.

Change-Id: Ic719ea36ba9d624725d443cbd563283628606f2d
Reviewed-on: https://skia-review.googlesource.com/133446
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-06-08 18:49:04 +00:00
Florin Malita
911ae4066e [skottie] Remove inPoint/outPoint/frameRate from public API
TBR=
Change-Id: Ice4de3abe350c4570c22e859a36dbd445527fa41
Reviewed-on: https://skia-review.googlesource.com/131300
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-06-01 13:10:15 +00:00
Florin Malita
a33447dab9 [skottie] Animation::animationTick() -> Animation::seek()
Replace poorly defined animationTick() with a normalized seek() method.

TBR=
Change-Id: Id2ea17bb426fe86fede0d6c8a3d93236902f10af
Reviewed-on: https://skia-review.googlesource.com/130508
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-29 18:58:16 +00:00
Florin Malita
3d856bdeee [skottie] Relocate to modules/skottie
TBR=
Change-Id: I218d251ca56578a3a7fd4fb86cba9abdc10fb3bd
Reviewed-on: https://skia-review.googlesource.com/130322
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-27 02:21:33 +00:00
Florin Malita
3b526b05d6 "Modularize" SkSG
* relocate all SkSG-related files under modules/sksg/
* fix various tidbits to make non-sksg builds possible
* drop obsolete SampleSGInval.cpp

Change-Id: I54e6c5bb1a09f45030fa8d607b3eb3f7cba78957
Reviewed-on: https://skia-review.googlesource.com/130025
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-05-25 17:11:52 +00:00
Brian Osman
e19e23fa0c Clip to perspective quad in viewer
For GMs that draw content outside the window, this ensures that fake
and real perspective look more similar.

Change-Id: I5fd2372a21a0b6c04cb33ddef4ff53aebda1c43d
Reviewed-on: https://skia-review.googlesource.com/129454
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-05-22 21:26:15 +00:00
Mike Reed
81f60ecd9c Allow slides/gms to extend the UI
Bug: skia:
Change-Id: Ia5971d827e6e05ab6cc30af3105b3b32ee691a34
Reviewed-on: https://skia-review.googlesource.com/128321
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-05-15 14:29:43 +00:00
Brian Salomon
c7fe0f708c Make GrCaps and GrShaderCaps private.
Moves getCaps() from GrContext to GrContextPriv and removes unused refCaps().

Change-Id: Ic6a8951b656c0d1b2773eae73bff8e88af819866
Reviewed-on: https://skia-review.googlesource.com/127389
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-05-11 14:47:27 +00:00
Ben Wagner
99a78dcb1a Add all SkPaint::Flags to Viewer app.
Originally a change to add just one more, turned into adding all of
them.

Change-Id: Ibd6b6cab75d5a018744661038cfccdb50470c234
Reviewed-on: https://skia-review.googlesource.com/127134
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-05-10 13:46:35 +00:00
Florin Malita
38792ce0f8 Add a single-file viewer option
Pass --file/-f to open a single file for viewing.

Change-Id: Ida168765ed6a5c7d76df1a8298bfe658d39d0196
Reviewed-on: https://skia-review.googlesource.com/126761
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-08 15:58:44 +00:00
Florin Malita
4e9e325725 [viewer] Avoid per-frame json UI updates
The reason we push Json updates for every frame is to support the
Android FPS meter - which happens to require the native FPS meter for
updates.

Instead of supporting two meters:

1) scale up the native FPS widget on Android (1.5x)

2) remove the Android widget

3) stop calling updateUIState() from onPaint()

Change-Id: Ica8109869035b2f885743a7e38b50688b69fa5e4
Reviewed-on: https://skia-review.googlesource.com/126621
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-07 21:30:27 +00:00
Ben Wagner
cb1393585e Allow finer rotation in Viewer app.
It turns out the ImGui sliders don't use the format string just for
display but also to modify the potential values. Change the format
string for rotation to three decimal places to match zoom.

Change-Id: I5f8d675a18687d67c2f19b03aa4c19c3ae094415
Reviewed-on: https://skia-review.googlesource.com/125960
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-05-04 19:09:08 +00:00
Florin Malita
87ccf33f15 [skottie] Disable on Android Framework builds
Make Skottie truly optional (own flag), and disable in framework builds
(to unblock landing the RapidJson refactoring).

Change-Id: I4611f915e43fe11c1f6754ab4a9f63e45af2f8d3
Reviewed-on: https://skia-review.googlesource.com/125872
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-05-04 18:36:03 +00:00
Brian Osman
805a727d26 Add toggle for 'real' vs. 'fake' perspective in Viewer
Real perspective draws content with perspective applied. Fake
perspective rasterizes in ortho, then stretches the image by the
perspective matrix.

Change-Id: I738cd379f9a58b965469ef8a57fb2dfd597fda10
Reviewed-on: https://skia-review.googlesource.com/125442
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-05-02 20:09:38 +00:00
Herb Derby
efe39bcfb8 Take sk_sp<SkDevice> instead of SkDevice*
Change-Id: I0b296bf5b80adc19758a3dc99160be9d2ed05680
Reviewed-on: https://skia-review.googlesource.com/125160
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Herb Derby <herb@google.com>
2018-05-02 14:46:17 +00:00
Florin Malita
6eb85a1cf1 [skottie] Show load stats in SkottieSlide
TBR=
Change-Id: Ie3a1036d9a90cb16d2795134c453759aeff06e3c
Reviewed-on: https://skia-review.googlesource.com/124461
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-30 15:19:03 +00:00
Brian Osman
bdaf97bdb8 Rotate about the slide center, and before perspective
This causes rotation to happen in the perspective plane, which is
more (?) interesting/useful.

Change-Id: If57a81de6662591be67cb68f0278f71038ac8d40
Reviewed-on: https://skia-review.googlesource.com/124160
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-04-26 20:52:43 +00:00
Brian Osman
9bb47cf0ff Add perspective support (rect to rect) to Viewer
Change-Id: I312d5b3e6b7f37a3a7bfd5561bcdb31b43e207b8
Reviewed-on: https://skia-review.googlesource.com/123934
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2018-04-26 20:21:23 +00:00
Chris Dalton
218c29453f Remove the MSAA path renderer
Bug: skia:
Change-Id: Ib18bede613c8d27fd6326f655dc2d638e35870ff
Reviewed-on: https://skia-review.googlesource.com/123726
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2018-04-25 19:59:59 +00:00
Ben Wagner
d02a74d649 Add Transform section to viewer tools window.
This adds sliders for Zoom and Rotate.

Change-Id: Ie568e5381d76bd5a457760e2d6224e42e64c7f16
Reviewed-on: https://skia-review.googlesource.com/123027
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-04-23 17:21:30 +00:00
Ben Wagner
7a3c6748f3 Backspace opens slide picker (not paint) in viewer.
A recent change added the "Paint" section to the viewer tools window. The
code around forcing the slide picker open when the backspace key was
pressed was inadvertantly separated from the slide picker section, so
now the paint section is confusingly held open instead. This changes the
logic so that the slide picker is once again the target of backspace.

Change-Id: Ibfcb78bb0a1e2bdbb2ccce54b38e8206e0303753
Reviewed-on: https://skia-review.googlesource.com/122949
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-04-23 14:57:00 +00:00
Ben Wagner
a580fb3f9e Add paint flags to viewer GUI.
Overriding bits of the paint was added with keyboard bindings but
without being reflected in the GUI. This adds these flags to the GUI.

Change-Id: I633801fb776248952afe7cbe8857676ef8b57135
Reviewed-on: https://skia-review.googlesource.com/121796
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-04-17 16:10:14 +00:00
Ben Wagner
37c5403890 Add pixel geometry and dft selection to viewer app.
Change-Id: I2fea84793383c44b102fa97b23f59235ef302ff9
Reviewed-on: https://skia-review.googlesource.com/121581
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2018-04-16 22:46:50 +00:00
Florin Malita
6127c4c660 Clip SlideDir slides to their declared dimensions
(to avoid spilling cell content)

TBR=
Change-Id: I7bbbbf004d35faab5f264d9914bcd24d2bb8eaeb
Reviewed-on: https://skia-review.googlesource.com/118984
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-05 19:47:48 +00:00
Florin Malita
0ffa322ecd [viewer] Consolidate external slide loading
Handle all external slides (.skp, .jpg, .json, .svg) consistently:

  * support both single-file/directory flags
  * add "directory" slides for all types

Change-Id: I4881c51f597ed4cb2a5b4c61706a168c754a5a8f
Reviewed-on: https://skia-review.googlesource.com/119020
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-05 19:05:28 +00:00
Florin Malita
c659c2c30d Viewer SVG support
Change-Id: I93ee61271ebe960063bec16ba472b3fd243ee149
Reviewed-on: https://skia-review.googlesource.com/118885
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-05 16:34:22 +00:00
Yuqian Li
755778cda0 Update trans limit after zoom changes in viewer
Previously, the trans limit assumes that only touch gesture can
change the zoom level. That's not true on desktops so we need this
fix. Otherwise, we won't be able to translate when we zoomed in.

Bug: skia:
Change-Id: I5901600a0044639a47514ab76b7e1914f04137a2
Reviewed-on: https://skia-review.googlesource.com/116987
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2018-03-28 20:51:44 +00:00
Ben Wagner
aa5da735fa Check that paint is not null in OveridePaintFilterCanvas.
SkCanvas::drawPicture may provide nullptr for a paint.

BUG=skia:7756

Change-Id: I46651f7e8f0d859a7e75206d93ed1f3b3c0a4bac
Reviewed-on: https://skia-review.googlesource.com/116902
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-03-28 18:02:24 +00:00
Hal Canary
0f66681ff1 BUILD: build when !skia_use_expat
Change-Id: I17a695c64be0e2081ad4937b23038b7ce88ae293
Reviewed-on: https://skia-review.googlesource.com/115988
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-03-22 20:28:45 +00:00
Florin Malita
1022f74375 [skottie] Nested animation support
Extend composition layers to support referencing external .json
animations ("$"<PATH> syntax).

This is a custom extension (not supported in BM/Lottie).

Also make skottie::Animation ref-counted, to facilitate sharing.

TBR=

Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684
Reviewed-on: https://skia-review.googlesource.com/109806
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-23 19:15:26 +00:00
Florin Malita
83286a0df2 Don't consume mouse events in SkottieSlide
We want to togle inval display on click, but if we always consume the
event we disable pan/zoom in viewer.

TBR=

Change-Id: I1f785883252c4f4a09fd35d4a05485849bf7e8ef
Reviewed-on: https://skia-review.googlesource.com/109084
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-21 18:25:26 +00:00
Ben Wagner
483c772cfd Add nativeFonts flag to Viewer.
This moves DMFontMgr and several related files which are tightly related
to fonts into tools/fonts, moves some flags around to prevent
duplication, and adds the nativeFonts handling to Viewer.

Change-Id: Id1bdad708a6b74319ac5ac9adfe21025db4ca0b2
Reviewed-on: https://skia-review.googlesource.com/108904
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2018-02-21 03:31:14 +00:00
Florin Malita
60d3bfcef5 [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>
2018-02-20 22:12:43 +00:00
Chris Dalton
2d18f41858 Resurrect pathfinder in viewer and rename to "bisect"
Bug: skia:
Change-Id: If8d2f46b8f27fefc3a0f983eb649654e0fb4afcb
Reviewed-on: https://skia-review.googlesource.com/108685
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-02-20 20:44:33 +00:00
Florin Malita
eb420457fd Add SkRect::contains(SkScalar x, SkScalar y)
Similar to its SkIRect counterpart.

Change-Id: I6872694d8602ed4181a1a15b4cd1c2c32aeab3f9
Reviewed-on: https://skia-review.googlesource.com/108506
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 17:57:53 +00:00
Florin Malita
97b3d2bcdb [sksg] Add 'plane' geometry node
SG geometry corresponding to SkCanvas::drawPaint().

TBR=

Change-Id: I3b368adda187fb92f524756496a3694c03a3113d
Reviewed-on: https://skia-review.googlesource.com/108562
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 17:08:53 +00:00
Florin Malita
836f822ec0 SlideDir focus tweaks
* cubic-map animation
 * shade the background scene when focused
 * unfocus on click outside focus rect

TBR=

Bug: skia:
Change-Id: I0ef8751b111b3b55c3fc36126c2ca1bc8ff6d33a
Reviewed-on: https://skia-review.googlesource.com/108501
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 15:51:33 +00:00
Florin Malita
7d910d4a29 Delete SkottieSlide2
Now superseded by the generic SlideDir.

TBR=

Change-Id: Ia9adfc54dcb86ebb0cd50d2e1f4739896279de8f
Reviewed-on: https://skia-review.googlesource.com/108503
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 15:50:13 +00:00
Florin Malita
cefc1b9740 Pass Viewer touch events to slides
Change-Id: Ia7b097c22e497e4e84be45108ac9796d89305ef3
Reviewed-on: https://skia-review.googlesource.com/108363
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 14:54:13 +00:00
Florin Malita
65fce9edc4 SlideDir focus w/ animation
Add an animated "focus" mode for SlideDir.

Clicking a cell focuses.  SPACE unfocuses.

When a slide is focused, mouse and key events are passed through.

TBR=
Change-Id: Iec47e2327e3b21bd626846bb0d3f9107bf680b1b
Reviewed-on: https://skia-review.googlesource.com/108101
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-02-19 18:43:44 +00:00
Florin Malita
76a076bbdf Generic "directory" viewer slide
This is a generalization of "skottie-dir", based on SkSG and operating
at the Slide API level.

For now it is only instantiated for Json slides, but could be used for
other slide "directories" in the future.

TBR=
NOTRY=true
Change-Id: If12429084bddeb172b234344f23eabcdadedcceb
Reviewed-on: https://skia-review.googlesource.com/108002
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-02-16 14:40:45 +00:00
Ben Wagner
abdcc5f5b4 Add text rendering related overrides to Viewer.
This combines the AAA and DAA settings into one Antialias setting which
also exposes alias and normal settings. It also fixes restoring the AAA
and DAA global state when not overriding.

This adds hinting, subpixel positioning, and subpixel rendering
tri-state toggles as well.

Change-Id: I845fa5be1fed4142e82796e6ef417b276fa76111
Reviewed-on: https://skia-review.googlesource.com/106761
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-02-12 22:38:43 +00:00
Florin Malita
c378fdcad8 [skottie] Fix viewer slide sizing on Android
TBR=

Change-Id: Ibbf4d22ba01e39b80c1f76d9af6bef647454996f
Reviewed-on: https://skia-review.googlesource.com/106160
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-09 16:40:41 +00:00
Florin Malita
8deb295ca7 Map Viewer mouse events to Slide space.
There isn't much Slide can do with Window-space mouse events.

Change-Id: I36509d4aa1b2ed510b8d8739d39cf5204ad486cc
Reviewed-on: https://skia-review.googlesource.com/102149
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-05 15:53:26 +00:00
Brian Salomon
bdecacfbe4 Revert "Revert "Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""""
This reverts commit 3a2cc2c2ec.

Fix code with samplecnt=0 that slipped in between trybots/CQ and landing of previous version

Change-Id: Iab19f2e8d1e9901601c8c76244d7a88c5d707fab
Reviewed-on: https://skia-review.googlesource.com/103181
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-03 01:59:59 +00:00
Brian Salomon
3a2cc2c2ec Revert "Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""""
This reverts commit 5bb82cbecd.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
> 
> This reverts commit 18c52a7b52.
> 
> Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
> 
> 
> Bug: skia:
> Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
> Reviewed-on: https://skia-review.googlesource.com/102940
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Idee23be2f1719f0bdc9305043e95a2d589bee8d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/103220
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-03 00:25:20 +00:00
Brian Salomon
5bb82cbecd Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
This reverts commit 18c52a7b52.

Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"


Bug: skia:
Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
Reviewed-on: https://skia-review.googlesource.com/102940
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-02 23:37:59 +00:00
Brian Salomon
18c52a7b52 Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""
This reverts commit d0d7270fcc.

Revert "More sample count cleanup:"

This reverts commit d653cac70e.

Revert "Add new GrContext queries for imagability, surfacability, and max sample count of color types"

This reverts commit 85ae7159c9.


Need to understand NVPR perf changes before relanding

Change-Id: I0db075fb42438ef2a1f9885df184dce52892ac4b
Reviewed-on: https://skia-review.googlesource.com/102780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-02 12:19:52 +00:00
Brian Salomon
d0d7270fcc Revert "Revert "Redefine the meaning of sample counts in GPU backend.""
Fixes gpu config default samples to be 1 and updates config parsing test accordingly.

This reverts commit c1ce2f7966.

Bug: skia:
Change-Id: I456973b1f52ced85a2011ea10fc49449bfc5846f
Reviewed-on: https://skia-review.googlesource.com/102147
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-01 21:15:39 +00:00
Brian Salomon
c1ce2f7966 Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad.

Reason for revert: nanobench

Original change's description:
> Redefine the meaning of sample counts in GPU backend.
> 
> Old: 0  -> nonMSAA
>      1+ -> MSAA
> 
> New:
>      0  -> error/unsupported
>      1  -> nonMSAA
>      2+ -> MSAA
> 
> We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:
> 
> 1) SkSurface factories
> 2) GrBackendRenderTarget constructors
> 3) GrCaps::getSampleCnt()'s requestedCount parameter
> 
> However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.
> 
> This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.
> 
> 
> Bug: skia:
> Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
> Reviewed-on: https://skia-review.googlesource.com/101560
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/102662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-01 18:34:40 +00:00
Brian Salomon
48825b11ad Redefine the meaning of sample counts in GPU backend.
Old: 0  -> nonMSAA
     1+ -> MSAA

New:
     0  -> error/unsupported
     1  -> nonMSAA
     2+ -> MSAA

We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:

1) SkSurface factories
2) GrBackendRenderTarget constructors
3) GrCaps::getSampleCnt()'s requestedCount parameter

However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.

This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.


Bug: skia:
Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
Reviewed-on: https://skia-review.googlesource.com/101560
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-01 18:16:58 +00:00
Florin Malita
22c528dcce [skottie] Convert SkottieSlide2 to SkSceneGraph animators.
Instead of dispatching ticks explicitly, bind Animations to the Scene
using ForwardingAnimator adaptors.

TBR=

Change-Id: I9faffed5c96157c781cc96729395b52d3f841e2b
Reviewed-on: https://skia-review.googlesource.com/102500
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-01 00:28:32 +00:00
Florin Malita
51012ce332 [sksg] Initial text support
Use the new node type for SkottieSlide2 labels.

TBR=

Change-Id: Icd6a4faf1c281bd83a2331c0072d1a6ed71acc09
Reviewed-on: https://skia-review.googlesource.com/102441
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:36:05 +00:00
Florin Malita
bcd07230eb [skottie] Convert (most of) SkottieSlide2 to SkSceneGraph
Each Skottie animation is now a transformed sksg node.

TBR=

Change-Id: Ib5c153e8279e1a74a242b0eb193c4463898b09ea
Reviewed-on: https://skia-review.googlesource.com/102201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 19:15:45 +00:00
Jim Van Verth
0848fb0b3e Fix startup for SampleSlide
When we start up Viewer with a SampleSlide as the first slide, nothing
gets rendered because SampleSlide depends on the backend being
initialized before setting its dimensions. This pushes the first slide's
initialization after the backend creation.

Change-Id: I8f83fe7b3973c40234104f1a83c0a60750694311
Reviewed-on: https://skia-review.googlesource.com/98161
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-01-22 19:24:47 +00:00