Index: chrome/browser/ui/tabs/tab_resources.cc |
diff --git a/chrome/browser/ui/tabs/tab_resources.cc b/chrome/browser/ui/tabs/tab_resources.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94a8b243f051f46abeedb3b283397683fcc5ec04 |
--- /dev/null |
+++ b/chrome/browser/ui/tabs/tab_resources.cc |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2011 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 "chrome/browser/ui/tabs/tab_resources.h" |
+ |
+#include "base/logging.h" |
+#include "ui/gfx/path.h" |
+ |
+namespace { |
+ |
+// Hit mask constants. |
+static const SkScalar kTabCapWidth = 15; |
James Hawkins
2011/08/11 23:41:19
Remove static since they're already in an unnamed
mattm
2011/08/11 23:59:47
Done.
|
+static const SkScalar kTabTopCurveWidth = 4; |
+static const SkScalar kTabBottomCurveWidth = 3; |
+ |
+} // namespace |
+ |
+// static |
+void TabResources::GetHitTestMask(int width, int height, gfx::Path* path) { |
+ DCHECK(path); |
+ |
+ SkScalar h = SkIntToScalar(height); |
+ SkScalar w = SkIntToScalar(width); |
+ |
+ path->moveTo(0, h); |
+ |
+ // Left end cap. |
+ path->lineTo(kTabBottomCurveWidth, h - kTabBottomCurveWidth); |
+ path->lineTo(kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth); |
+ path->lineTo(kTabCapWidth, 0); |
+ |
+ // Connect to the right cap. |
+ path->lineTo(w - kTabCapWidth, 0); |
+ |
+ // Right end cap. |
+ path->lineTo(w - kTabCapWidth + kTabTopCurveWidth, kTabTopCurveWidth); |
+ path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); |
+ path->lineTo(w, h); |
+ |
+ // Close out the path. |
+ path->lineTo(0, h); |
+ path->close(); |
+} |