Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2011 Intel Corporation |
| 3 | * |
Bryce Harrington | a0bbfea | 2015-06-11 15:35:43 -0700 | [diff] [blame] | 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files (the |
| 6 | * "Software"), to deal in the Software without restriction, including |
| 7 | * without limitation the rights to use, copy, modify, merge, publish, |
| 8 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 9 | * permit persons to whom the Software is furnished to do so, subject to |
| 10 | * the following conditions: |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 11 | * |
Bryce Harrington | a0bbfea | 2015-06-11 15:35:43 -0700 | [diff] [blame] | 12 | * The above copyright notice and this permission notice (including the |
| 13 | * next paragraph) shall be included in all copies or substantial |
| 14 | * portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | * SOFTWARE. |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 24 | */ |
| 25 | |
Jussi Kukkonen | 649bbce | 2016-07-19 14:16:27 +0300 | [diff] [blame] | 26 | #include <stdint.h> |
| 27 | |
Daniel Stone | 8e7a8bd | 2013-08-15 01:10:24 +0100 | [diff] [blame] | 28 | #include "config.h" |
| 29 | |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 30 | #include "compositor.h" |
| 31 | |
| 32 | WL_EXPORT void |
Jason Ekstrand | a7af704 | 2013-10-12 22:38:11 -0500 | [diff] [blame] | 33 | weston_view_geometry_dirty(struct weston_view *view) |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 34 | { |
| 35 | } |
| 36 | |
| 37 | WL_EXPORT int |
| 38 | weston_log(const char *fmt, ...) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | WL_EXPORT void |
Jason Ekstrand | a7af704 | 2013-10-12 22:38:11 -0500 | [diff] [blame] | 44 | weston_view_schedule_repaint(struct weston_view *view) |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 45 | { |
| 46 | } |
| 47 | |
Jonny Lamb | f8bfd05 | 2014-05-22 22:41:33 +0200 | [diff] [blame] | 48 | WL_EXPORT void |
| 49 | weston_compositor_schedule_repaint(struct weston_compositor *compositor) |
| 50 | { |
| 51 | } |
| 52 | |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 53 | int |
| 54 | main(int argc, char *argv[]) |
| 55 | { |
| 56 | const double k = 300.0; |
Kristian Høgsberg | 1cfd406 | 2013-06-17 11:08:11 -0400 | [diff] [blame] | 57 | const double current = 0.5; |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 58 | const double target = 1.0; |
| 59 | const double friction = 1400; |
| 60 | |
| 61 | struct weston_spring spring; |
| 62 | uint32_t time = 0; |
| 63 | |
| 64 | weston_spring_init(&spring, k, current, target); |
| 65 | spring.friction = friction; |
Kristian Høgsberg | 1cfd406 | 2013-06-17 11:08:11 -0400 | [diff] [blame] | 66 | spring.previous = 0.48; |
Kristian Høgsberg | 08d8c68 | 2013-06-17 08:48:57 -0400 | [diff] [blame] | 67 | spring.timestamp = 0; |
| 68 | |
| 69 | while (!weston_spring_done(&spring)) { |
| 70 | printf("\t%d\t%f\n", time, spring.current); |
| 71 | weston_spring_update(&spring, time); |
| 72 | time += 16; |
| 73 | } |
| 74 | |
| 75 | return 0; |
| 76 | } |