OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Implementation of a client that produces output in the form of RGBA | 5 // Implementation of a client that produces output in the form of RGBA |
6 // buffers when receiving pointer/touch events. RGB contains the lower | 6 // buffers when receiving pointer/touch events. RGB contains the lower |
7 // 24 bits of the event timestamp and A is 0xff. | 7 // 24 bits of the event timestamp and A is 0xff. |
8 | 8 |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <linux-dmabuf-unstable-v1-client-protocol.h> | 10 #include <linux-dmabuf-unstable-v1-client-protocol.h> |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 y += h; | 713 y += h; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 // Draw rotating rects. | 717 // Draw rotating rects. |
718 SkScalar half_width = SkScalarHalf(width_); | 718 SkScalar half_width = SkScalarHalf(width_); |
719 SkScalar half_height = SkScalarHalf(height_); | 719 SkScalar half_height = SkScalarHalf(height_); |
720 SkIRect rect = SkIRect::MakeXYWH(-SkScalarHalf(half_width), | 720 SkIRect rect = SkIRect::MakeXYWH(-SkScalarHalf(half_width), |
721 -SkScalarHalf(half_height), half_width, | 721 -SkScalarHalf(half_height), half_width, |
722 half_height); | 722 half_height); |
723 SkScalar rotation = SkScalarMulDiv(schedule.time, kRotationSpeed, 1000); | 723 SkScalar rotation = schedule.time * kRotationSpeed / 1000; |
724 canvas->save(); | 724 canvas->save(); |
725 canvas->translate(half_width, half_height); | 725 canvas->translate(half_width, half_height); |
726 for (size_t i = 0; i < num_rects_; ++i) { | 726 for (size_t i = 0; i < num_rects_; ++i) { |
727 const SkColor kColors[] = {SK_ColorBLUE, SK_ColorGREEN, | 727 const SkColor kColors[] = {SK_ColorBLUE, SK_ColorGREEN, |
728 SK_ColorRED, SK_ColorYELLOW, | 728 SK_ColorRED, SK_ColorYELLOW, |
729 SK_ColorCYAN, SK_ColorMAGENTA}; | 729 SK_ColorCYAN, SK_ColorMAGENTA}; |
730 SkPaint paint; | 730 SkPaint paint; |
731 paint.setColor(SkColorSetA(kColors[i % arraysize(kColors)], 0xA0)); | 731 paint.setColor(SkColorSetA(kColors[i % arraysize(kColors)], 0xA0)); |
732 canvas->rotate(rotation / num_rects_); | 732 canvas->rotate(rotation / num_rects_); |
733 canvas->drawIRect(rect, paint); | 733 canvas->drawIRect(rect, paint); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 new std::string(command_line->GetSwitchValueASCII(switches::kUseDrm))); | 994 new std::string(command_line->GetSwitchValueASCII(switches::kUseDrm))); |
995 } | 995 } |
996 | 996 |
997 exo::wayland::clients::MotionEvents client( | 997 exo::wayland::clients::MotionEvents client( |
998 width, height, scale, num_rects, max_frames_pending, | 998 width, height, scale, num_rects, max_frames_pending, |
999 command_line->HasSwitch(switches::kFullscreen), | 999 command_line->HasSwitch(switches::kFullscreen), |
1000 command_line->HasSwitch(switches::kShowFpsCounter), num_benchmark_runs, | 1000 command_line->HasSwitch(switches::kShowFpsCounter), num_benchmark_runs, |
1001 base::TimeDelta::FromMilliseconds(benchmark_interval_ms), use_drm.get()); | 1001 base::TimeDelta::FromMilliseconds(benchmark_interval_ms), use_drm.get()); |
1002 return client.Run(); | 1002 return client.Run(); |
1003 } | 1003 } |
OLD | NEW |