OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 context->translate(rect.x(), rect.y()); | 543 context->translate(rect.x(), rect.y()); |
544 context->scale(zoomFactor, zoomFactor); | 544 context->scale(zoomFactor, zoomFactor); |
545 context->translate(-rect.x(), -rect.y()); | 545 context->translate(-rect.x(), -rect.y()); |
546 } | 546 } |
547 CGRect bounds(rect); | 547 CGRect bounds(rect); |
548 CGRect backgroundBounds; | 548 CGRect backgroundBounds; |
549 HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); | 549 HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); |
550 // Center the stepper rectangle in the specified area. | 550 // Center the stepper rectangle in the specified area. |
551 backgroundBounds.origin.x = bounds.origin.x + (bounds.size.width - backgroun
dBounds.size.width) / 2; | 551 backgroundBounds.origin.x = bounds.origin.x + (bounds.size.width - backgroun
dBounds.size.width) / 2; |
552 if (backgroundBounds.size.height < bounds.size.height) { | 552 if (backgroundBounds.size.height < bounds.size.height) { |
553 int heightDiff = clampToInteger(bounds.size.height - backgroundBounds.si
ze.height); | 553 int heightDiff = clampTo<int>(bounds.size.height - backgroundBounds.size
.height); |
554 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; | 554 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; |
555 } | 555 } |
556 | 556 |
557 LocalCurrentGraphicsContext localContext(context, rect); | 557 LocalCurrentGraphicsContext localContext(context, rect); |
558 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), kH
IThemeOrientationNormal, 0); | 558 HIThemeDrawButton(&backgroundBounds, &drawInfo, localContext.cgContext(), kH
IThemeOrientationNormal, 0); |
559 } | 559 } |
560 | 560 |
561 // This will ensure that we always return a valid NSView, even if ScrollView doe
sn't have an associated document NSView. | 561 // This will ensure that we always return a valid NSView, even if ScrollView doe
sn't have an associated document NSView. |
562 // If the ScrollView doesn't have an NSView, we will return a fake NSView whose
sole purpose is to tell AppKit that it's flipped. | 562 // If the ScrollView doesn't have an NSView, we will return a fake NSView whose
sole purpose is to tell AppKit that it's flipped. |
563 NSView *ThemeMac::ensuredView(ScrollView* scrollView) | 563 NSView *ThemeMac::ensuredView(ScrollView* scrollView) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 break; | 737 break; |
738 case InnerSpinButtonPart: | 738 case InnerSpinButtonPart: |
739 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); | 739 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); |
740 break; | 740 break; |
741 default: | 741 default: |
742 break; | 742 break; |
743 } | 743 } |
744 } | 744 } |
745 | 745 |
746 } | 746 } |
OLD | NEW |