Permalink
Browse files

Refactored TUIView to use NSImage

  • Loading branch information...
jspahrsummers committed Jul 25, 2012
1 parent 239b3c9 commit 163f7c96ef01fd974db91bcd86e3b916c9b92460
Showing with 3 additions and 8 deletions.
  1. +2 −5 lib/UIKit/TUIView+PasteboardDragging.m
  2. +1 −3 lib/UIKit/TUIView.m
@@ -16,7 +16,6 @@
#import "TUIView+PasteboardDragging.h"
#import "TUICGAdditions.h"
-#import "TUIImage.h"
#import "TUINSView.h"
@implementation TUIView (PasteboardDragging)
@@ -64,12 +63,10 @@ - (void)pasteboardDragMouseDragged:(NSEvent *)event
TUIView *dragView = [self handleForPasteboardDragView];
id<NSPasteboardWriting> pasteboardObject = [dragView representedPasteboardObject];
- TUIImage *dragImage = TUIGraphicsDrawAsImage(dragView.frame.size, ^{
- [TUIGraphicsGetImageForView(dragView) drawAtPoint:CGPointZero blendMode:kCGBlendModeNormal alpha:0.75];
+ NSImage *dragNSImage = TUIGraphicsDrawAsImage(dragView.frame.size, ^{
+ [TUIGraphicsGetImageForView(dragView) drawAtPoint:CGPointZero fromRect:CGRectZero operation:NSCompositeSourceOver fraction:0.75];
});
- NSImage *dragNSImage = [[NSImage alloc] initWithCGImage:dragImage.CGImage size:NSZeroSize];
-
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[pasteboard clearContents];
[pasteboard writeObjects:[NSArray arrayWithObject:pasteboardObject]];
View
@@ -18,7 +18,6 @@
#import <pthread.h>
#import "TUICGAdditions.h"
#import "TUIColor.h"
-#import "TUIImage.h"
#import "TUILayoutManager.h"
#import "TUINSView.h"
#import "TUINSWindow.h"
@@ -392,8 +391,7 @@ - (void)displayLayer:(CALayer *)layer
}
#endif
- TUIImage *image = TUIGraphicsGetImageFromCurrentImageContext();
- layer.contents = (id)image.CGImage;
+ layer.contents = TUIGraphicsGetImageFromCurrentImageContext();
CGContextScaleCTM(context, 1.0f / scale, 1.0f / scale);
TUIGraphicsPopContext();

0 comments on commit 163f7c9

Please sign in to comment.