• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 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#import "ui/base/cocoa/nsgraphics_context_additions.h"
6
7@implementation NSGraphicsContext (CrAdditions)
8
9- (void)cr_setPatternPhase:(NSPoint)phase
10                   forView:(NSView*)view {
11  if ([view layer]) {
12    NSPoint bottomLeft = NSZeroPoint;
13    if ([view isFlipped])
14      bottomLeft.y = NSMaxY([view bounds]);
15    NSPoint offset = [view convertPoint:bottomLeft toView:nil];
16    phase.x -= offset.x;
17    phase.y -= offset.y;
18  }
19  [self setPatternPhase:phase];
20}
21
22@end
23