1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "ash/assistant/ui/logo_view/shape/shape.h"
6 
7 #include "third_party/skia/include/core/SkMatrix.h"
8 
9 namespace ash {
10 
Shape(float dot_size)11 Shape::Shape(float dot_size) : dot_size_(dot_size) {}
12 
13 Shape::~Shape() = default;
14 
Reset()15 void Shape::Reset() {
16   first_path_.reset();
17   second_path_.reset();
18   first_stroke_width_ = 0.0f;
19   second_stroke_width_ = 0.0f;
20   cap_ = cc::PaintFlags::kRound_Cap;
21 }
22 
Transform(float x,float y,float scale)23 void Shape::Transform(float x, float y, float scale) {
24   SkMatrix matrix;
25   matrix.reset();
26   matrix.preScale(scale, scale);
27   matrix.preTranslate(x, y);
28 
29   first_path_.transform(matrix);
30   second_path_.transform(matrix);
31 
32   first_stroke_width_ *= scale;
33   second_stroke_width_ *= scale;
34 }
35 
36 }  // namespace ash
37