Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: components/exo/wayland/clients/motion_events.cc

Issue 2693423004: SkScalarMul is deprecated (Closed)
Patch Set: undo the ImageGenerator flag change Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | skia/config/SkUserConfig.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | skia/config/SkUserConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698