| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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/cocoa/background_tile_view.h" |
| 6 |
| 7 @implementation BackgroundTileView |
| 8 @synthesize tileImage = tileImage_; |
| 9 |
| 10 - (void)setTileImage:(NSImage*)tileImage { |
| 11 [tileImage_ autorelease]; |
| 12 tileImage_ = [tileImage retain]; |
| 13 [self setNeedsDisplay:YES]; |
| 14 } |
| 15 |
| 16 - (void)drawRect:(NSRect)rect { |
| 17 // Tile within the view, so set the phase to start at the view bottom. |
| 18 NSPoint phase = NSMakePoint(0.0, NSMinY([self frame])); |
| 19 [[NSGraphicsContext currentContext] setPatternPhase:phase]; |
| 20 |
| 21 if (tileImage_) { |
| 22 NSColor *color = [NSColor colorWithPatternImage:tileImage_]; |
| 23 [color set]; |
| 24 } else { |
| 25 // Something to catch the missing image |
| 26 [[NSColor magentaColor] set]; |
| 27 } |
| 28 |
| 29 NSRectFill([self bounds]); |
| 30 } |
| 31 |
| 32 @end |
| OLD | NEW |