OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #import "chrome/browser/ui/cocoa/new_tab_button.h" | 5 #import "chrome/browser/ui/cocoa/new_tab_button.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | |
8 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
9 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
10 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
11 #include "chrome/browser/ui/cocoa/l10n_util.h" | 10 #include "chrome/browser/ui/cocoa/l10n_util.h" |
12 #include "chrome/browser/ui/cocoa/tabs/tab_view.h" | 11 #include "chrome/browser/ui/cocoa/tabs/tab_view.h" |
13 #include "chrome/grit/theme_resources.h" | 12 #include "chrome/grit/theme_resources.h" |
14 #include "ui/base/cocoa/nsgraphics_context_additions.h" | 13 #include "ui/base/cocoa/nsgraphics_context_additions.h" |
15 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
16 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/theme_provider.h" | 16 #include "ui/base/theme_provider.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 409 |
411 [bezierPath curveToPoint:NSMakePoint(62.2756294,30) | 410 [bezierPath curveToPoint:NSMakePoint(62.2756294,30) |
412 controlPoint1:NSMakePoint(64.0268555,28.5502144) | 411 controlPoint1:NSMakePoint(64.0268555,28.5502144) |
413 controlPoint2:NSMakePoint(63.227482,29.9977011)]; | 412 controlPoint2:NSMakePoint(63.227482,29.9977011)]; |
414 | 413 |
415 [bezierPath closePath]; | 414 [bezierPath closePath]; |
416 | 415 |
417 // The SVG path is flipped for some reason, so flip it back. However, in RTL, | 416 // The SVG path is flipped for some reason, so flip it back. However, in RTL, |
418 // we'd need to flip it again below, so when in RTL mode just leave the flip | 417 // we'd need to flip it again below, so when in RTL mode just leave the flip |
419 // out altogether. | 418 // out altogether. |
420 if (!cocoa_l10n_util::ExperimentalMacRTLIsEnabled() || !base::i18n::IsRTL()) { | 419 if (!cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { |
421 const CGFloat kSVGHeight = 32; | 420 const CGFloat kSVGHeight = 32; |
422 NSAffineTransformStruct flipStruct = {1, 0, 0, -1, 0, kSVGHeight}; | 421 NSAffineTransformStruct flipStruct = {1, 0, 0, -1, 0, kSVGHeight}; |
423 NSAffineTransform* flipTransform = [NSAffineTransform transform]; | 422 NSAffineTransform* flipTransform = [NSAffineTransform transform]; |
424 [flipTransform setTransformStruct:flipStruct]; | 423 [flipTransform setTransformStruct:flipStruct]; |
425 [bezierPath transformUsingAffineTransform:flipTransform]; | 424 [bezierPath transformUsingAffineTransform:flipTransform]; |
426 } | 425 } |
427 | 426 |
428 // The SVG data is for the 2x version so scale it down. | 427 // The SVG data is for the 2x version so scale it down. |
429 NSAffineTransform* scaleTransform = [NSAffineTransform transform]; | 428 NSAffineTransform* scaleTransform = [NSAffineTransform transform]; |
430 const CGFloat k50PercentScale = 0.5; | 429 const CGFloat k50PercentScale = 0.5; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 [fillColor set]; | 535 [fillColor set]; |
537 CGContextRef context = static_cast<CGContextRef>( | 536 CGContextRef context = static_cast<CGContextRef>( |
538 [[NSGraphicsContext currentContext] graphicsPort]); | 537 [[NSGraphicsContext currentContext] graphicsPort]); |
539 CGFloat lineWidth = LineWidthFromContext(context); | 538 CGFloat lineWidth = LineWidthFromContext(context); |
540 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill]; | 539 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill]; |
541 [image unlockFocus]; | 540 [image unlockFocus]; |
542 return image; | 541 return image; |
543 } | 542 } |
544 | 543 |
545 @end | 544 @end |
OLD | NEW |