Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 "chrome/browser/ui/tabs/tab_resources.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "ui/gfx/path.h" | |
| 9 | |
| 10 namespace { | |
| 11 | |
| 12 // Hit mask constants. | |
| 13 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.
| |
| 14 static const SkScalar kTabTopCurveWidth = 4; | |
| 15 static const SkScalar kTabBottomCurveWidth = 3; | |
| 16 | |
| 17 } // namespace | |
| 18 | |
| 19 // static | |
| 20 void TabResources::GetHitTestMask(int width, int height, gfx::Path* path) { | |
| 21 DCHECK(path); | |
| 22 | |
| 23 SkScalar h = SkIntToScalar(height); | |
| 24 SkScalar w = SkIntToScalar(width); | |
| 25 | |
| 26 path->moveTo(0, h); | |
| 27 | |
| 28 // Left end cap. | |
| 29 path->lineTo(kTabBottomCurveWidth, h - kTabBottomCurveWidth); | |
| 30 path->lineTo(kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth); | |
| 31 path->lineTo(kTabCapWidth, 0); | |
| 32 | |
| 33 // Connect to the right cap. | |
| 34 path->lineTo(w - kTabCapWidth, 0); | |
| 35 | |
| 36 // Right end cap. | |
| 37 path->lineTo(w - kTabCapWidth + kTabTopCurveWidth, kTabTopCurveWidth); | |
| 38 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); | |
| 39 path->lineTo(w, h); | |
| 40 | |
| 41 // Close out the path. | |
| 42 path->lineTo(0, h); | |
| 43 path->close(); | |
| 44 } | |
| OLD | NEW |