Mercurial > dwindows
comparison android/dw.cpp @ 2534:c4255630cade
Android: Fix the safety check in the dw_draw_*() functions.
So we can actually draw on pixmaps, not just on render widgets.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 11 May 2021 06:38:09 +0000 |
parents | 7c863a3a125f |
children | d862d9e4069b |
comparison
equal
deleted
inserted
replaced
2533:7c863a3a125f | 2534:c4255630cade |
---|---|
2478 */ | 2478 */ |
2479 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) | 2479 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
2480 { | 2480 { |
2481 JNIEnv *env; | 2481 JNIEnv *env; |
2482 | 2482 |
2483 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | 2483 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2484 { | 2484 { |
2485 // First get the class that contains the method you need to call | 2485 // First get the class that contains the method you need to call |
2486 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 2486 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2487 // Get the method that you want to call | 2487 // Get the method that you want to call |
2488 jmethodID drawPoint = env->GetMethodID(clazz, "drawPoint", | 2488 jmethodID drawPoint = env->GetMethodID(clazz, "drawPoint", |
2503 */ | 2503 */ |
2504 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) | 2504 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
2505 { | 2505 { |
2506 JNIEnv *env; | 2506 JNIEnv *env; |
2507 | 2507 |
2508 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | 2508 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2509 { | 2509 { |
2510 // First get the class that contains the method you need to call | 2510 // First get the class that contains the method you need to call |
2511 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 2511 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2512 // Get the method that you want to call | 2512 // Get the method that you want to call |
2513 jmethodID drawLine = env->GetMethodID(clazz, "drawLine", | 2513 jmethodID drawLine = env->GetMethodID(clazz, "drawLine", |
2566 */ | 2566 */ |
2567 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) | 2567 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) |
2568 { | 2568 { |
2569 JNIEnv *env; | 2569 JNIEnv *env; |
2570 | 2570 |
2571 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | 2571 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2572 { | 2572 { |
2573 // First get the class that contains the method you need to call | 2573 // First get the class that contains the method you need to call |
2574 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 2574 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2575 // Get the method that you want to call | 2575 // Get the method that you want to call |
2576 jmethodID drawLine = env->GetMethodID(clazz, "drawRect", | 2576 jmethodID drawLine = env->GetMethodID(clazz, "drawRect", |