aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-10-09 15:45:33 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-09 21:20:34 +0000
commit63fd760a37905c45d26fc3d49cac261fad1b4808 (patch)
tree279aa7293ea1773ac60230790868fe0e1fc725b0 /experimental
parenta49909aa24a370d6dff98d300d0c42ff8cd2c623 (diff)
Remove trailing whitespace.
Also adds a presubmit to prevent adding trailing whitespace to source code in the future. Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6 Reviewed-on: https://skia-review.googlesource.com/57380 Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/FileReaderApp/FileReaderWindow.mm18
-rw-r--r--experimental/GLFWTest/glfw_main.cpp42
-rw-r--r--experimental/SimpleiOSApp/iPad/AppDelegate_iPad.m8
-rw-r--r--experimental/SimpleiOSApp/iPhone/AppDelegate_iPhone.m10
-rw-r--r--experimental/iOSSampleApp/Shared/SkOptionListController.mm15
-rw-r--r--experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm94
-rw-r--r--experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm48
-rw-r--r--experimental/iOSSampleApp/Shared/skia_ios.mm4
-rw-r--r--experimental/iOSSampleApp/SkSampleUIView.mm88
-rwxr-xr-xexperimental/tools/mskp_parser.py2
10 files changed, 180 insertions, 149 deletions
diff --git a/experimental/FileReaderApp/FileReaderWindow.mm b/experimental/FileReaderApp/FileReaderWindow.mm
index 87b9ab18db..ed4585e140 100644
--- a/experimental/FileReaderApp/FileReaderWindow.mm
+++ b/experimental/FileReaderApp/FileReaderWindow.mm
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#import "FileReaderWindow.h"
#import "SkGradientShader.h"
@@ -9,7 +16,7 @@ static void init_effects() {
SkPoint pts[] = {p, q};
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
SkScalar pos[] = { 0, 1.0};
- SkGradientShader::CreateLinear(pts, colors, pos, 2,
+ SkGradientShader::CreateLinear(pts, colors, pos, 2,
SkShader::kMirror_TileMode);
}
}
@@ -23,13 +30,14 @@ static void init_effects() {
[fView addSkView:fReaderView];
[fView setNeedsDisplay:YES];
fReaderView->unref();
- //TODO - Temporary fix. Inval doesn't Seem to be working.
- [NSTimer scheduledTimerWithTimeInterval:0.01 target:self
- selector:@selector(redraw) userInfo:nil
+ //TODO - Temporary fix. Inval doesn't Seem to be working.
+ [NSTimer scheduledTimerWithTimeInterval:0.01 target:self
+ selector:@selector(redraw) userInfo:nil
repeats:YES];
}
- (void)redraw {
[fView setNeedsDisplay:YES];
}
-@end \ No newline at end of file
+@end
+
diff --git a/experimental/GLFWTest/glfw_main.cpp b/experimental/GLFWTest/glfw_main.cpp
index f0e3297e8a..26ed75b9c8 100644
--- a/experimental/GLFWTest/glfw_main.cpp
+++ b/experimental/GLFWTest/glfw_main.cpp
@@ -60,22 +60,22 @@ int main(void) {
if (!glfwInit()) {
exit(EXIT_FAILURE);
}
-
+
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_SRGB_CAPABLE, GL_TRUE);
-
+
window = glfwCreateWindow(kWidth, kHeight, "Simple example", NULL, NULL);
if (!window) {
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
-
+
init_skia(kWidth, kHeight);
-
+
sk_sp<SkImage> atlas;
SkRSXform xform[kGrid*kGrid+1];
SkRect tex[kGrid*kGrid+1];
@@ -87,13 +87,13 @@ int main(void) {
atlas.reset(SkImage::NewFromEncoded(imageData.get()));
if (!atlas) {
SkDebugf("\nCould not decode file ship.png\n");
-
+
cleanup_skia();
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_FAILURE);
}
-
+
SkScalar anchorX = atlas->width()*0.5f;
SkScalar anchorY = atlas->height()*0.5f;
int currIndex = 0;
@@ -101,7 +101,7 @@ int main(void) {
for (int y = 0; y < kGrid; y++) {
float xPos = (x / (kGrid - 1.0)) * kWidth;
float yPos = (y / (kGrid - 1.0)) * kWidth;
-
+
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
xPos, yPos, anchorX, anchorY);
@@ -111,12 +111,12 @@ int main(void) {
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
kWidth*0.5f, kHeight*0.5f, anchorX, anchorY);
-
+
currentTime = 0;
-
+
glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);
-
+
// Draw to the surface via its SkCanvas.
SkCanvas* canvas = sSurface->getCanvas(); // We don't manage this pointer's lifetime.
SkPaint paint;
@@ -129,9 +129,9 @@ int main(void) {
const float kSinDiff = 0.01745240643f;
timer.start();
-
+
glfwPollEvents();
-
+
float meanTime = 0.0f;
for (int i = 0; i < 32; ++i) {
meanTime += times[i];
@@ -140,39 +140,39 @@ int main(void) {
char outString[64];
float fps = 1000.f/meanTime;
sprintf(outString, "fps: %f ms: %f", fps, meanTime);
-
+
for (int i = 0; i < kGrid*kGrid+1; ++i) {
SkScalar c = xform[i].fSCos;
SkScalar s = xform[i].fSSin;
-
+
SkScalar dx = c*anchorX - s*anchorY;
SkScalar dy = s*anchorX + c*anchorY;
xform[i].fSCos = kCosDiff*c - kSinDiff*s;
xform[i].fSSin = kSinDiff*c + kCosDiff*s;
-
+
dx -= xform[i].fSCos*anchorX - xform[i].fSSin*anchorY;
dy -= xform[i].fSSin*anchorX + xform[i].fSCos*anchorY;
xform[i].fTx += dx;
xform[i].fTy += dy;
}
-
+
canvas->clear(SK_ColorBLACK);
canvas->drawAtlas(atlas, xform, tex, nullptr, kGrid*kGrid+1, SkXfermode::kSrcOver_Mode,
nullptr, &paint);
canvas->drawText(outString, strlen(outString), 100.f, 100.f, paint);
-
+
canvas->flush();
-
+
timer.end();
times[currentTime] = (float)(timer.fWall);
currentTime = (currentTime + 1) & 0x1f;
-
+
glfwSwapBuffers(window);
}
-
+
cleanup_skia();
-
+
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
diff --git a/experimental/SimpleiOSApp/iPad/AppDelegate_iPad.m b/experimental/SimpleiOSApp/iPad/AppDelegate_iPad.m
index 1792658b92..60619c567f 100644
--- a/experimental/SimpleiOSApp/iPad/AppDelegate_iPad.m
+++ b/experimental/SimpleiOSApp/iPad/AppDelegate_iPad.m
@@ -16,12 +16,12 @@
#pragma mark -
#pragma mark Application lifecycle
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
// Override point for customization after application launch.
-
+
[self.window makeKeyAndVisible];
-
+
return YES;
}
diff --git a/experimental/SimpleiOSApp/iPhone/AppDelegate_iPhone.m b/experimental/SimpleiOSApp/iPhone/AppDelegate_iPhone.m
index dcf14f21a8..11334281ca 100644
--- a/experimental/SimpleiOSApp/iPhone/AppDelegate_iPhone.m
+++ b/experimental/SimpleiOSApp/iPhone/AppDelegate_iPhone.m
@@ -16,12 +16,12 @@
#pragma mark -
#pragma mark Application lifecycle
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
// Override point for customization after application launch.
-
+
[self.window makeKeyAndVisible];
-
+
return YES;
}
@@ -36,7 +36,7 @@
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
- Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
}
diff --git a/experimental/iOSSampleApp/Shared/SkOptionListController.mm b/experimental/iOSSampleApp/Shared/SkOptionListController.mm
index d5241348b1..0f67a0bdb9 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionListController.mm
+++ b/experimental/iOSSampleApp/Shared/SkOptionListController.mm
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#import "SkOptionListController.h"
@implementation SkOptionListController
@@ -37,14 +44,14 @@
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
+
static NSString *CellIdentifier = @"Cell";
-
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
-
+
cell.textLabel.text = [fOptions objectAtIndex:indexPath.row];
if (indexPath.row == fSelectedIndex) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
@@ -52,7 +59,7 @@
}
else
cell.accessoryType = UITableViewCellAccessoryNone;
-
+
return cell;
}
diff --git a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
index e6adfd0bd1..a862030f2d 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
+++ b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#import "SkOptionsTableViewController.h"
#include "SkEvent.h"
#include "SkTArray.h"
@@ -52,8 +59,8 @@
}
- (void)updateMenu:(SkOSMenu*)menu {
- // the first menu is always assumed to be the static, the second is
- // repopulated every time over and over again
+ // the first menu is always assumed to be the static, the second is
+ // repopulated every time over and over again
int menuIndex = fMenus->find(menu);
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
NSUInteger first = 0;
@@ -72,14 +79,14 @@
for (int i = 0; i < menu->getCount(); ++i) {
const SkOSMenu::Item* item = menuitems[i];
NSString* title = [NSString stringWithUTF8String:item->getLabel()];
-
+
if (SkOSMenu::kList_Type == item->getType()) {
int value = 0;
SkOptionListItem* List = [[SkOptionListItem alloc] init];
List.fItem = item;
List.fOptions = [[SkOptionListController alloc] initWithStyle:UITableViewStyleGrouped];
-
+
int count = 0;
SkOSMenu::FindListItemCount(*item->getEvent(), &count);
SkTArray<SkString> options;
@@ -88,7 +95,7 @@
for (int i = 0; i < count; ++i)
[List.fOptions addOption:[NSString stringWithUTF8String:options[i].c_str()]];
SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value);
-
+
List.fOptions.fSelectedIndex = value;
List.fCell = [self createList:title
default:[List.fOptions getSelectedOption]];
@@ -99,7 +106,7 @@
else {
SkOptionItem* option = [[SkOptionItem alloc] init];
option.fItem = item;
-
+
bool state = false;
SkString str;
SkOSMenu::TriState tristate;
@@ -116,18 +123,18 @@
SkOSMenu::FindSliderValue(*item->getEvent(), item->getSlotName(), &value);
SkOSMenu::FindSliderMin(*item->getEvent(), &min);
SkOSMenu::FindSliderMax(*item->getEvent(), &max);
- option.fCell = [self createSlider:title
- min:min
+ option.fCell = [self createSlider:title
+ min:min
max:max
default:value];
- break;
+ break;
case SkOSMenu::kTriState_Type:
SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate);
option.fCell = [self createTriState:title default:(int)tristate];
break;
case SkOSMenu::kTextField_Type:
SkOSMenu::FindText(*item->getEvent(), item->getSlotName(), &str);
- option.fCell = [self createTextField:title
+ option.fCell = [self createTextField:title
default:[NSString stringWithUTF8String:str.c_str()]];
break;
default:
@@ -175,34 +182,34 @@
- (UITableViewCell*)createAction:(NSString*)title {
UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
return cell;
}
- (UITableViewCell*)createSwitch:(NSString*)title default:(BOOL)state {
- UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ UITableViewCell* cell = [[[UITableViewCell alloc]
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
UISwitch* switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
[switchView setOn:state animated:NO];
- [switchView addTarget:self
- action:@selector(valueChanged:)
+ [switchView addTarget:self
+ action:@selector(valueChanged:)
forControlEvents:UIControlEventValueChanged];
cell.accessoryView = switchView;
[switchView release];
return cell;
}
-- (UITableViewCell*)createSlider:(NSString*)title
- min:(float)min
- max:(float)max
+- (UITableViewCell*)createSlider:(NSString*)title
+ min:(float)min
+ max:(float)max
default:(float)value {
- UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ UITableViewCell* cell = [[[UITableViewCell alloc]
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -210,18 +217,18 @@
sliderView.value = value;
sliderView.minimumValue = min;
sliderView.maximumValue = max;
- [sliderView addTarget:self
- action:@selector(valueChanged:)
+ [sliderView addTarget:self
+ action:@selector(valueChanged:)
forControlEvents:UIControlEventValueChanged];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%1.1f", value];
- cell.accessoryView = sliderView;
+ cell.accessoryView = sliderView;
[sliderView release];
return cell;
}
- (UITableViewCell*)createTriState:(NSString*)title default:(int)index {
- UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ UITableViewCell* cell = [[[UITableViewCell alloc]
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -229,44 +236,44 @@
UISegmentedControl* segmented = [[UISegmentedControl alloc] initWithItems:items];
segmented.selectedSegmentIndex = (index == -1) ? 2 : index;
segmented.segmentedControlStyle = UISegmentedControlStyleBar;
- [segmented addTarget:self
- action:@selector(valueChanged:)
+ [segmented addTarget:self
+ action:@selector(valueChanged:)
forControlEvents:UIControlEventValueChanged];
cell.accessoryView = segmented;
[segmented release];
- return cell;
+ return cell;
}
-- (UITableViewCell*)createTextField:(NSString*)title
+- (UITableViewCell*)createTextField:(NSString*)title
default:(NSString*)value {
- UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ UITableViewCell* cell = [[[UITableViewCell alloc]
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
- UITextField* textField = [[UITextField alloc]
+ UITextField* textField = [[UITextField alloc]
initWithFrame:CGRectMake(0, 10, 150, 25)];
textField.adjustsFontSizeToFitWidth = YES;
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = cell.detailTextLabel.textColor;
textField.placeholder = value;
textField.returnKeyType = UIReturnKeyDone;
- [textField addTarget:self
- action:@selector(valueChanged:)
+ [textField addTarget:self
+ action:@selector(valueChanged:)
forControlEvents:UIControlEventEditingDidEndOnExit];
- cell.accessoryView = textField;
+ cell.accessoryView = textField;
[textField release];
return cell;
}
- (UITableViewCell*)createList:(NSString*)title default:(NSString*)value{
- UITableViewCell* cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleValue1
+ UITableViewCell* cell = [[[UITableViewCell alloc]
+ initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:nil] autorelease];
cell.textLabel.text = title;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = value;
- return cell;
+ return cell;
}
#pragma mark -
@@ -294,7 +301,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
id item = [fItems objectAtIndex:[self convertPathToIndex:indexPath]];
-
+
if ([item isKindOfClass:[SkOptionListItem class]]) {
SkOptionListItem* list = (SkOptionListItem*)item;
self.fCurrentList = list;
@@ -306,7 +313,7 @@
SkOptionItem* action = (SkOptionItem*)item;
action.fItem->postEvent();
}
- }
+ }
else{
NSLog(@"unknown");
}
@@ -317,8 +324,8 @@
#pragma mark -
#pragma mark Navigation controller delegate
-- (void)navigationController:(UINavigationController *)navigationController
- willShowViewController:(UIViewController *)viewController
+- (void)navigationController:(UINavigationController *)navigationController
+ willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
if (self == viewController) { //when a List option is popped, trigger event
NSString* selectedOption = [fCurrentList.fOptions getSelectedOption];
@@ -336,4 +343,5 @@
[super dealloc];
}
-@end \ No newline at end of file
+@end
+
diff --git a/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm b/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm
index 0ab71d9b1e..76ef7e13fd 100644
--- a/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm
+++ b/experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#import "SkUIDetailViewController.h"
#include "SampleApp.h"
#include "SkCGUtils.h"
@@ -11,43 +18,43 @@
[super viewDidLoad];
fSkUIView = (SkUIView*)self.view;
-
+
fWind = (SampleWindow*)fSkUIView.fWind;
fSkUIView.fTitleItem = self.navigationItem;
-
+
[self createButtons];
-
+
UISwipeGestureRecognizer* swipe = [[UISwipeGestureRecognizer alloc]
- initWithTarget:self
+ initWithTarget:self
action:@selector(handleSwipe:)];
[self.navigationController.navigationBar addGestureRecognizer:swipe];
[swipe release];
swipe = [[UISwipeGestureRecognizer alloc]
- initWithTarget:self
+ initWithTarget:self
action:@selector(handleSwipe:)];
swipe.direction = UISwipeGestureRecognizerDirectionLeft;
[self.navigationController.navigationBar addGestureRecognizer:swipe];
[swipe release];
-
- fOptionsController = [[SkOptionsTableViewController alloc]
+
+ fOptionsController = [[SkOptionsTableViewController alloc]
initWithStyle:UITableViewStyleGrouped];
fSkUIView.fOptionsDelegate = fOptionsController;
[fOptionsController registerMenus:fWind->getMenus()];
-
+
}
- (void)createButtons {
UIToolbar* toolbar = [[UIToolbar alloc]
initWithFrame:CGRectMake(0, 0, 125, 45)];
[toolbar setBarStyle: UIBarStyleBlackOpaque];
-
+
UIBarButtonItem* flexibleSpace = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
-
+
fOptionsButton = [[UIBarButtonItem alloc]
- initWithTitle:@"Options"
+ initWithTitle:@"Options"
style:UIBarButtonItemStylePlain
target:self
action:@selector(presentOptions)];
@@ -56,7 +63,7 @@
target:nil
action:nil];
fixedSpace.width = 10;
-
+
fPrintButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
@@ -65,7 +72,7 @@
[toolbar setItems:[NSArray arrayWithObjects:flexibleSpace, fOptionsButton, fixedSpace, fPrintButton, nil]
animated:NO];
-
+
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[flexibleSpace release];
@@ -140,20 +147,20 @@
- (void)presentOptions {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
if (nil == fPopOverController) {
- UINavigationController* navigation = [[UINavigationController alloc]
+ UINavigationController* navigation = [[UINavigationController alloc]
initWithRootViewController:fOptionsController];
navigation.navigationBar.topItem.title = @"Options";
fPopOverController = [[UIPopoverController alloc] initWithContentViewController:navigation];
[navigation release];
}
-
+
if (fPopOverController.isPopoverVisible)
[fPopOverController dismissPopoverAnimated:YES];
else
- [fPopOverController presentPopoverFromBarButtonItem:fOptionsButton
- permittedArrowDirections:UIPopoverArrowDirectionAny
+ [fPopOverController presentPopoverFromBarButtonItem:fOptionsButton
+ permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
-
+
} else {
UIBarButtonItem* backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
@@ -165,7 +172,7 @@
self.navigationController.navigationBar.topItem.title = @"Options";
}
}
-
+
//Popover Management
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:NO];
@@ -175,4 +182,5 @@
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
}
-@end \ No newline at end of file
+@end
+
diff --git a/experimental/iOSSampleApp/Shared/skia_ios.mm b/experimental/iOSSampleApp/Shared/skia_ios.mm
index b8680c40e9..6cfc349931 100644
--- a/experimental/iOSSampleApp/Shared/skia_ios.mm
+++ b/experimental/iOSSampleApp/Shared/skia_ios.mm
@@ -18,9 +18,9 @@ int main(int argc, char *argv[]) {
NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"];
const char *d = [resourceDir UTF8String];
- // change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
+ // change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
NSFileManager *filemgr = [NSFileManager defaultManager];
- int retVal = 99;
+ int retVal = 99;
if ([filemgr changeCurrentDirectoryPath: docsDir] == YES)
{
IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm
index 39eef5647c..65ddf4cb3c 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.mm
+++ b/experimental/iOSSampleApp/SkSampleUIView.mm
@@ -38,19 +38,19 @@ public:
#endif
fBackend = SkOSWindow::kNone_BackEndType;
}
-
+
virtual ~SkiOSDeviceManager() {
#if SK_SUPPORT_GPU
SkSafeUnref(fCurContext);
SkSafeUnref(fCurIntf);
#endif
}
-
+
void setUpBackend(SampleWindow* win, int msaaSampleCount, bool deepColor) override {
SkASSERT(SkOSWindow::kNone_BackEndType == fBackend);
-
+
fBackend = SkOSWindow::kNone_BackEndType;
-
+
#if SK_SUPPORT_GPU
switch (win->getDeviceType()) {
case SampleWindow::kRaster_DeviceType:
@@ -73,7 +73,7 @@ public:
fDeepColor = deepColor;
// Assume that we have at least 24-bit output, for backends that don't supply this data
fActualColorBits = SkTMax(info.fColorBits, 24);
-
+
SkASSERT(NULL == fCurIntf);
switch (win->getDeviceType()) {
case SampleWindow::kRaster_DeviceType:
@@ -86,12 +86,12 @@ public:
SkASSERT(false);
break;
}
-
+
SkASSERT(NULL == fCurContext);
if (SkOSWindow::kNone_BackEndType != fBackend) {
fCurContext = GrContext::MakeGL(fCurIntf).release();
}
-
+
if ((NULL == fCurContext || NULL == fCurIntf) &&
SkOSWindow::kNone_BackEndType != fBackend) {
// We need some context and interface to see results if we're using a GL backend
@@ -104,15 +104,15 @@ public:
// call windowSizeChanged to create the render target
this->windowSizeChanged(win);
}
-
+
void tearDownBackend(SampleWindow *win) override {
#if SK_SUPPORT_GPU
SkSafeUnref(fCurContext);
fCurContext = NULL;
-
+
SkSafeUnref(fCurIntf);
fCurIntf = NULL;
-
+
fGpuSurface = nullptr;
#endif
win->release();
@@ -197,9 +197,9 @@ private:
bool fDeepColor;
int fActualColorBits;
#endif
-
+
SkOSWindow::SkBackEndTypes fBackend;
-
+
typedef SampleWindow::DeviceManager INHERITED;
};
@@ -214,7 +214,7 @@ private:
struct FPSState {
static const int FRAME_COUNT = 60;
-
+
CFTimeInterval fNow0, fNow1;
CFTimeInterval fTime0, fTime1, fTotalTime;
int fFrameCounter;
@@ -223,25 +223,25 @@ struct FPSState {
fTime0 = fTime1 = fTotalTime = 0;
fFrameCounter = 0;
}
-
+
void startDraw() {
fNow0 = CACurrentMediaTime();
}
-
+
void endDraw() {
fNow1 = CACurrentMediaTime();
}
-
+
void flush(SkOSWindow* hwnd) {
CFTimeInterval now2 = CACurrentMediaTime();
-
+
fTime0 += fNow1 - fNow0;
fTime1 += now2 - fNow1;
-
+
if (++fFrameCounter == FRAME_COUNT) {
CFTimeInterval totalNow = CACurrentMediaTime();
fTotalTime = totalNow - fTotalTime;
-
+
//SkMSec ms0 = (int)(1000 * fTime0 / FRAME_COUNT);
//SkMSec msTotal = (int)(1000 * fTotalTime / FRAME_COUNT);
//str.printf(" ms: %d [%d], fps: %3.1f", msTotal, ms0,
@@ -267,32 +267,32 @@ static FPSState gFPS;
if (self = [super initWithDefaults]) {
fRedrawRequestPending = false;
fFPSState = new FPSState;
-
+
#ifdef USE_GL_1
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
#else
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
#endif
-
+
if (!fGL.fContext || ![EAGLContext setCurrentContext:fGL.fContext])
{
[self release];
return nil;
}
-
+
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffers(1, &fGL.fFramebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
-
+
glGenRenderbuffers(1, &fGL.fRenderbuffer);
glGenRenderbuffers(1, &fGL.fStencilbuffer);
-
+
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, fGL.fRenderbuffer);
-
+
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fGL.fStencilbuffer);
-
+
self.fGLLayer = [CAEAGLLayer layer];
fGLLayer.bounds = self.bounds;
fGLLayer.anchorPoint = CGPointMake(0, 0);
@@ -304,12 +304,12 @@ static FPSState gFPS;
SKGL_CONFIG,
kEAGLDrawablePropertyColorFormat,
nil];
-
+
self.fRasterLayer = [CALayer layer];
fRasterLayer.anchorPoint = CGPointMake(0, 0);
fRasterLayer.opaque = TRUE;
[self.layer addSublayer:fRasterLayer];
-
+
NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn",
[NSNull null], @"onOrderOut",
[NSNull null], @"sublayers",
@@ -319,7 +319,7 @@ static FPSState gFPS;
fGLLayer.actions = newActions;
fRasterLayer.actions = newActions;
[newActions release];
-
+
// rebuild argc and argv from process info
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
int argc = [arguments count];
@@ -330,12 +330,12 @@ static FPSState gFPS;
argv[i] = new char[strlen+1];
[arg getCString:argv[i] maxLength:strlen+1 encoding:NSUTF8StringEncoding];
}
-
+
fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer);
fWind = new SampleWindow(self, argc, argv, fDevManager);
fWind->resize(self.frame.size.width, self.frame.size.height);
-
+
for (int i = 0; i < argc; ++i) {
delete [] argv[i];
}
@@ -355,21 +355,21 @@ static FPSState gFPS;
- (void)layoutSubviews {
int W, H;
-
+
// Allocate color buffer backing based on the current layer size
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
[fGL.fContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:fGLLayer];
-
+
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &fGL.fWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &fGL.fHeight);
-
+
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, fGL.fWidth, fGL.fHeight);
-
+
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
}
-
+
if (fDevManager->isUsingGL()) {
W = fGL.fWidth;
H = fGL.fHeight;
@@ -382,7 +382,7 @@ static FPSState gFPS;
H = (int)CGRectGetHeight(rect);
fRasterLayer.bounds = rect;
}
-
+
printf("---- layoutSubviews %d %d\n", W, H);
fWind->resize(W, H);
fWind->inval(NULL);
@@ -405,11 +405,11 @@ static FPSState gFPS;
// This application only creates a single context which is already set current at this point.
// This call is redundant, but needed if dealing with multiple contexts.
[EAGLContext setCurrentContext:fGL.fContext];
-
+
// This application only creates a single default framebuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple framebuffers.
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
-
+
GLint scissorEnable;
glGetIntegerv(GL_SCISSOR_TEST, &scissorEnable);
glDisable(GL_SCISSOR_TEST);
@@ -419,8 +419,8 @@ static FPSState gFPS;
glEnable(GL_SCISSOR_TEST);
}
glViewport(0, 0, fGL.fWidth, fGL.fHeight);
-
-
+
+
sk_sp<SkSurface> surface(fWind->makeSurface());
SkCanvas* canvas = surface->getCanvas();
@@ -449,7 +449,7 @@ static FPSState gFPS;
- (void)forceRedraw {
if (fDevManager->isUsingGL())
[self drawInGL];
- else
+ else
[self drawInRaster];
}
@@ -459,9 +459,9 @@ static FPSState gFPS;
NSString* text = [NSString stringWithUTF8String:title];
if ([text length] > 0)
self.fTitle = text;
-
+
if (fTitleItem && fTitle) {
- fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
+ fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
[NSString stringWithUTF8String:fFPSState->str.c_str()]];
}
}
diff --git a/experimental/tools/mskp_parser.py b/experimental/tools/mskp_parser.py
index 051e579190..e9698f2288 100755
--- a/experimental/tools/mskp_parser.py
+++ b/experimental/tools/mskp_parser.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# Copyright 2016 Google Inc.
-#
+#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.