Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm

Issue 637263004: fix some bit-rot in the ios port of sampleapp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #1 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | experimental/iOSSampleApp/SkSampleUIView.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #import "SkUIDetailViewController.h" 1 #import "SkUIDetailViewController.h"
2 #include "SampleApp.h" 2 #include "SampleApp.h"
3 #include "SkCGUtils.h" 3 #include "SkCGUtils.h"
4 #include "SkData.h" 4 #include "SkData.h"
5 #include "SkOSMenu.h" 5 #include "SkOSMenu.h"
6 @implementation SkUIDetailViewController 6 @implementation SkUIDetailViewController
7 @synthesize fPrintButton, fOptionsButton, fPopOverController, fOptionsController ; 7 @synthesize fPrintButton, fOptionsButton, fPopOverController, fOptionsController ;
8 8
9 //Overwritten from UIViewController 9 //Overwritten from UIViewController
10 - (void)viewDidLoad { 10 - (void)viewDidLoad {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 for (int i = 0; i < fWind->sampleCount(); ++i) { 97 for (int i = 0; i < fWind->sampleCount(); ++i) {
98 [rootVC addItem:[NSString stringWithUTF8String:fWind->getSampleTitle(i). c_str()]]; 98 [rootVC addItem:[NSString stringWithUTF8String:fWind->getSampleTitle(i). c_str()]];
99 } 99 }
100 } 100 }
101 101
102 - (void)goToItem:(NSUInteger)index { 102 - (void)goToItem:(NSUInteger)index {
103 fWind->goToSample(index); 103 fWind->goToSample(index);
104 } 104 }
105 105
106 - (void)printContent { 106 - (void)printContent {
107 /* comment out until we rev. this to use SkDocument
108
107 UIPrintInteractionController *controller = [UIPrintInteractionController sha redPrintController]; 109 UIPrintInteractionController *controller = [UIPrintInteractionController sha redPrintController];
108 UIPrintInfo *printInfo = [UIPrintInfo printInfo]; 110 UIPrintInfo *printInfo = [UIPrintInfo printInfo];
109 printInfo.jobName = @"Skia iOS SampleApp"; 111 printInfo.jobName = @"Skia iOS SampleApp";
110 printInfo.duplex = UIPrintInfoDuplexLongEdge; 112 printInfo.duplex = UIPrintInfoDuplexLongEdge;
111 printInfo.outputType = UIPrintInfoOutputGeneral; 113 printInfo.outputType = UIPrintInfoOutputGeneral;
112 fWind->saveToPdf(); 114 fWind->saveToPdf();
113 [fSkUIView forceRedraw]; 115 [fSkUIView forceRedraw];
114 fData = fWind->getPDFData(); 116 fData = fWind->getPDFData();
115 NSData* data = [NSData dataWithBytesNoCopy:(void*)fData->data() length:fData ->size()]; 117 NSData* data = [NSData dataWithBytesNoCopy:(void*)fData->data() length:fData ->size()];
116 controller.printInfo = printInfo; 118 controller.printInfo = printInfo;
117 controller.printingItem = data; 119 controller.printingItem = data;
118 //Add ref because data pointer retains a pointer to data 120 //Add ref because data pointer retains a pointer to data
119 fData->ref(); 121 fData->ref();
120 122
121 void (^SkCompletionHandler)(UIPrintInteractionController *, BOOL, NSError *) = 123 void (^SkCompletionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
122 ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { 124 ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
123 fData->unref(); 125 fData->unref();
124 if (!completed && error) 126 if (!completed && error)
125 NSLog(@"FAILED! due to error in domain %@ with error code %u", 127 NSLog(@"FAILED! due to error in domain %@ with error code %u",
126 error.domain, error.code); 128 error.domain, error.code);
127 }; 129 };
128 130
129 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 131 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
130 [controller presentFromBarButtonItem:fPrintButton animated:YES 132 [controller presentFromBarButtonItem:fPrintButton animated:YES
131 completionHandler:SkCompletionHandler]; 133 completionHandler:SkCompletionHandler];
132 } else { 134 } else {
133 [controller presentAnimated:YES completionHandler:SkCompletionHandler]; 135 [controller presentAnimated:YES completionHandler:SkCompletionHandler];
134 } 136 }
137 */
135 } 138 }
136 139
137 - (void)presentOptions { 140 - (void)presentOptions {
138 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 141 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
139 if (nil == fPopOverController) { 142 if (nil == fPopOverController) {
140 UINavigationController* navigation = [[UINavigationController alloc] 143 UINavigationController* navigation = [[UINavigationController alloc]
141 initWithRootViewController:fOp tionsController]; 144 initWithRootViewController:fOp tionsController];
142 navigation.navigationBar.topItem.title = @"Options"; 145 navigation.navigationBar.topItem.title = @"Options";
143 fPopOverController = [[UIPopoverController alloc] initWithContentVie wController:navigation]; 146 fPopOverController = [[UIPopoverController alloc] initWithContentVie wController:navigation];
144 [navigation release]; 147 [navigation release];
(...skipping 21 matching lines...) Expand all
166 //Popover Management 169 //Popover Management
167 - (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem { 170 - (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
168 [self.navigationItem setLeftBarButtonItem:barButtonItem animated:NO]; 171 [self.navigationItem setLeftBarButtonItem:barButtonItem animated:NO];
169 } 172 }
170 173
171 - (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem { 174 - (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
172 [self.navigationItem setLeftBarButtonItem:nil animated:NO]; 175 [self.navigationItem setLeftBarButtonItem:nil animated:NO];
173 } 176 }
174 177
175 @end 178 @end
OLDNEW
« no previous file with comments | « no previous file | experimental/iOSSampleApp/SkSampleUIView.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698