Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shai-almog committed Feb 15, 2018
2 parents a182f0a + 1e195d0 commit 64d6c09
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 22 deletions.
1 change: 1 addition & 0 deletions CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ private Image createTargetImage(Component c, int w, int h, boolean fast) {
byte bgt = c.getStyle().getBgTransparency();
if(bgt != 0) {
tg.setAlpha(bgt &0xff);
tg.setColor(s.getBgColor());
tg.fillShape(gp);
}
if(this.stroke != null && strokeOpacity > 0 && strokeThickness > 0) {
Expand Down
7 changes: 7 additions & 0 deletions Ports/iOSPort/nativeSources/CodenameOne_GLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,20 @@ int isIPad() {
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

int cn1IsIOS8 = -1;
int cn1IsIOS8_2 = -1;

BOOL isIOS8() {
if (cn1IsIOS8 < 0) {
cn1IsIOS8 = !SYSTEM_VERSION_LESS_THAN(@"8.0") ? 1:0;
}
return cn1IsIOS8 > 0;
}
BOOL isIOS8_2() {
if (cn1IsIOS8_2 < 0) {
cn1IsIOS8_2 = !SYSTEM_VERSION_LESS_THAN(@"8.2") ? 1:0;
}
return cn1IsIOS8_2 > 0;
}

BOOL isVKBAlwaysOpen() {
if(vkbAlwaysOpen) {
Expand Down
3 changes: 2 additions & 1 deletion Ports/iOSPort/nativeSources/IOSNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ JAVA_OBJECT fromNSString(NSString* str)
extern int isIPad();
extern int isIOS7();
extern int isIOS8();
extern int isIOS8_2();

NSString* fixFilePath(NSString* ns) {
if([ns hasPrefix:@"file:"]) {
Expand Down Expand Up @@ -4906,7 +4907,7 @@ JAVA_LONG com_codename1_impl_ios_IOSNative_createTruetypeFont___java_lang_String
NSString* str = toNSString(CN1_THREAD_STATE_PASS_ARG name);

UIFont* fnt;
if([str hasPrefix:@"HelveticaNeue"]) {
if(isIOS8_2() && [str hasPrefix:@"HelveticaNeue"]) {
if([str isEqualToString:@"HelveticaNeue-UltraLight"]) {
fnt = [UIFont systemFontOfSize:pSize weight:UIFontWeightUltraLight];
} else {
Expand Down
37 changes: 19 additions & 18 deletions vm/ByteCodeTranslator/src/cn1_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,27 +535,28 @@ if(SP[-1].type == CN1_TYPE_LONG || SP[-1].type == CN1_TYPE_DOUBLE) {\
SP++; \
}

struct elementStruct* BC_DUP2_X2_DD(struct elementStruct* SP);
struct elementStruct* BC_DUP2_X2_DSS(struct elementStruct* SP);
struct elementStruct* BC_DUP2_X2_SSD(struct elementStruct* SP);
struct elementStruct* BC_DUP2_X2_SSSS(struct elementStruct* SP);
struct elementStruct* BC_DUP_X2_SD(struct elementStruct* SP);
struct elementStruct* BC_DUP_X2_SSS(struct elementStruct* SP);

#define IS_DOUBLE_WORD(offset) (SP[offset].type == CN1_TYPE_LONG || SP[offset].type == CN1_TYPE_DOUBLE)

#define BC_DUP_X2() {\
if (IS_DOUBLE_WORD(-2)) SP=BC_DUP_X2_SD(SP);\
else SP=BC_DUP_X2_SSS(SP);\
}

#define BC_DUP2_X2() { \
if (SP[-2].type == CN1_TYPE_LONG || SP[-2].type == CN1_TYPE_DOUBLE) {\
(*SP).data.l = SP[-1].data.l; \
SP[-1].data.l = SP[-2].data.l; \
SP[-2].data.l = (*SP).data.l; \
(*SP).type = SP[-1].type; \
SP[-1].type = SP[-2].type; \
SP[-2].type = (*SP).type; \
} else {\
(*SP).data.l = SP[-1].data.l; \
SP[-1].data.l = SP[-2].data.l; \
SP[-2].data.l = SP[-3].data.l; \
SP[-3].data.l = (*SP).data.l; \
(*SP).type = SP[-1].type; \
SP[-1].type = SP[-2].type; \
SP[-2].type = SP[-3].type; \
SP[-3].type = (*SP).type; \
}\
SP++; \
if (IS_DOUBLE_WORD(-2)) SP=BC_DUP2_X2_DD(SP);\
else if (IS_DOUBLE_WORD(-1)) SP=BC_DUP2_X2_DSS(SP);\
else if (IS_DOUBLE_WORD(-3)) SP=BC_DUP2_X2_SSD(SP);\
else SP=BC_DUP2_X2_SSSS(SP);\
}


#define BC_I2B() SP[-1].data.i = ((SP[-1].data.i << 24) >> 24)

#define BC_I2S() SP[-1].data.i = ((SP[-1].data.i << 16) >> 16)
Expand Down
72 changes: 72 additions & 0 deletions vm/ByteCodeTranslator/src/cn1_globals.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,78 @@ void popMany(CODENAME_ONE_THREAD_STATE, int count, struct elementStruct** SP) {

JAVA_OBJECT* constantPoolObjects = 0;

struct elementStruct* BC_DUP2_X2_DD(struct elementStruct* SP) {
(*SP).data.l = SP[-1].data.l;
SP[-1].data.l = SP[-2].data.l;
SP[-2].data.l = (*SP).data.l;
(*SP).type = SP[-1].type;
SP[-1].type = SP[-2].type;
SP[-2].type = (*SP).type;
return (struct elementStruct*)(SP+1);
}
struct elementStruct* BC_DUP2_X2_DSS(struct elementStruct* SP) {
SP[0].data.l = SP[-1].data.l;
SP[-1].data.l = SP[-2].data.l;
SP[-2].data.l = SP[-3].data.l;
SP[-3].data.l = SP[0].data.l;
SP[0].type = SP[-1].type;
SP[-1].type = SP[-2].type;
SP[-2].type = SP[-3].type;
SP[-3].type = SP[0].type;
return SP+1;
}
struct elementStruct* BC_DUP2_X2_SSD(struct elementStruct* SP) {
SP[1].data.l = SP[-1].data.l;
SP[0].data.l = SP[-2].data.l;
SP[-1].data.l = SP[-3].data.l;
SP[-2].data.l = SP[1].data.l;
SP[-3].data.l = SP[0].data.l;
SP[1].type = SP[-1].type;
SP[0].type = SP[-2].type;
SP[-1].type = SP[-3].type;
SP[-2].type = SP[1].type;
SP[-3].type = SP[0].type;
return SP+2;
}
struct elementStruct* BC_DUP2_X2_SSSS(struct elementStruct* SP) {
SP[1].data.l = SP[-1].data.l;
SP[0].data.l = SP[-2].data.l;
SP[-1].data.l = SP[-3].data.l;
SP[-2].data.l = SP[-4].data.l;
SP[-3].data.l = SP[1].data.l;
SP[-4].data.l = SP[0].data.l;
SP[1].type = SP[-1].type;
SP[0].type = SP[-2].type;
SP[-1].type = SP[-3].type;
SP[-2].type = SP[-4].type;
SP[-3].type = SP[1].type;
SP[-4].type = SP[0].type;
return SP+2;
}

struct elementStruct* BC_DUP_X2_SD(struct elementStruct* SP) {
SP[0].data.l = SP[-1].data.l;
SP[-1].data.l = SP[-2].data.l;
SP[-2].data.l = SP[0].data.l;
SP[0].type = SP[-1].type;
SP[-1].type = SP[-2].type;
SP[-2].type = SP[0].type;
return SP+1;
}

struct elementStruct* BC_DUP_X2_SSS(struct elementStruct* SP) {
SP[0].data.l = SP[-1].data.l;
SP[-1].data.l = SP[-2].data.l;
SP[-2].data.l = SP[-3].data.l;
SP[-3].data.l = SP[0].data.l;
SP[0].type = SP[-1].type;
SP[-1].type = SP[-2].type;
SP[-2].type = SP[-3].type;
SP[-3].type = SP[0].type;
return SP+1;
}


int instanceofFunction(int sourceClass, int destId) {
if(sourceClass == destId) {
return JAVA_TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ private static String encodeStringSlashU(String str) {
char[] chr = str.toCharArray();
for(int iter = 0 ; iter < len ; iter++) {
char c = chr[iter];
if(c > 127) {
if(c > 127 || c < 32) {
// needs encoding... Verify there are no more characters to encode
StringBuilder d = new StringBuilder();
for(int internal = 0 ; internal < len ; internal++) {
c = chr[internal];
if(c > 127) {
if(c > 127 || c < 32) {
d.append("~~u");
d.append(fourChars(Integer.toHexString(c)));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void appendInstruction(StringBuilder b, List<Instruction> instructions) {
break;

case Opcodes.DUP_X2:
b.append(" BC_DUP2_X2(); /* DUP_X2 */\n");
b.append(" BC_DUP_X2(); /* DUP_X2 */\n");
break;

case Opcodes.DUP2_X2:
Expand Down

0 comments on commit 64d6c09

Please sign in to comment.