summaryrefslogtreecommitdiffstats
path: root/views/window/window_shape.cc
blob: 692602db2584595599586ef521aece78ecb59973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "views/window/window_shape.h"

#include "gfx/path.h"
#include "gfx/size.h"

namespace views {

void GetDefaultWindowMask(const gfx::Size &size, gfx::Path *window_mask) {
  // Redefine the window visible region for the new size.
  window_mask->moveTo(0, 3);
  window_mask->lineTo(1, 2);
  window_mask->lineTo(1, 1);
  window_mask->lineTo(2, 1);
  window_mask->lineTo(3, 0);

  window_mask->lineTo(SkIntToScalar(size.width() - 3), 0);
  window_mask->lineTo(SkIntToScalar(size.width() - 2), 1);
  window_mask->lineTo(SkIntToScalar(size.width() - 1), 1);
  window_mask->lineTo(SkIntToScalar(size.width() - 1), 2);
  window_mask->lineTo(SkIntToScalar(size.width()), 3);

  window_mask->lineTo(SkIntToScalar(size.width()),
                      SkIntToScalar(size.height() - 3));
  window_mask->lineTo(SkIntToScalar(size.width() - 1),
                      SkIntToScalar(size.height() - 3));
  window_mask->lineTo(SkIntToScalar(size.width() - 1),
                      SkIntToScalar(size.height() - 1));
  window_mask->lineTo(SkIntToScalar(size.width() - 3),
                      SkIntToScalar(size.height() - 2));
  window_mask->lineTo(SkIntToScalar(size.width() - 3),
                      SkIntToScalar(size.height()));

  window_mask->lineTo(3, SkIntToScalar(size.height()));
  window_mask->lineTo(2, SkIntToScalar(size.height() - 2));
  window_mask->lineTo(1, SkIntToScalar(size.height() - 1));
  window_mask->lineTo(1, SkIntToScalar(size.height() - 3));
  window_mask->lineTo(0, SkIntToScalar(size.height() - 3));

  window_mask->close();
}

} // namespace views