Skip to content

Commit 601eefb

Browse files
committed
UI: Fixed using POINT to retrieve IMAGE data
1 parent 6aa079b commit 601eefb

File tree

8 files changed

+19
-24
lines changed

8 files changed

+19
-24
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Fixed capslock handling
2525
Added file manager to main shell program
2626
Fixed issues with TRY/CATCH
27+
Fixed using POINT to retrieve IMAGE data
2728

2829
2016-02-11
2930
Added export to mobile command (SDL)

ide/android/assets/main.bas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ sub do_okay_button()
5656
button.x = xmax / 2
5757
button.y = -1
5858
button.label = "Close"
59-
button.backgroundColor = "blue"
59+
button.backgroundColor = "green"
6060
button.color = "white"
6161
frm.inputs << button
6262
frm = form(frm)
@@ -66,7 +66,7 @@ end
6666

6767
sub do_about()
6868
cls
69-
color 2,0
69+
color 7,0
7070
print " __ _ ___ _"
7171
print "(_ ._ _ _.|||_) /\ (_ |/ "
7272
print "__)| | |(_||||_)/--\__)|\_"

src/common/blib_graph.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void cmd_window() {
102102
// PSET [STEP] x, y [, color | COLOR color]
103103
//
104104
void cmd_pset() {
105-
int32_t color = dev_fgcolor, step1 = 0;
105+
long color = dev_fgcolor;
106+
int32_t step1 = 0;
106107
ipt_t pt;
107108

108109
/*

src/ui/ansiwidget.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct AnsiWidget {
5151
int getColor() { return _back->_fg; }
5252
int getFontSize() { return _fontSize; }
5353
FormInput *getNextField(FormInput *field) { return _back->getNextField(field); }
54-
int getPixel(int x, int y) { return _back->getPixel(x, y); }
5554
int getScreenWidth() { return _back->_width; }
5655
void getScroll(int &x, int &y) { _back->getScroll(x, y); }
5756
int getHeight() { return _height; }

src/ui/graphics.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ void Graphics::getImageData(Canvas *canvas, uint8_t *image,
307307

308308
int Graphics::getPixel(Canvas *canvas, int posX, int posY) {
309309
int result = 0;
310+
if (canvas == HANDLE_SCREEN) {
311+
canvas = _screen;
312+
}
310313
if (canvas
311314
&& posX > -1
312315
&& posY > -1

src/ui/screen.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -509,22 +509,6 @@ void GraphicScreen::drawRectFilled(int x1, int y1, int x2, int y2) {
509509
maFillRect(x1, y1, x2 - x1, y2 - y1);
510510
}
511511

512-
// returns the color of the pixel at the given xy location
513-
int GraphicScreen::getPixel(int x, int y) {
514-
MARect rc;
515-
rc.left = x;
516-
rc.top = y;
517-
rc.width = 1;
518-
rc.height = 1;
519-
520-
int data[1];
521-
int result;
522-
523-
maGetImageData(_image, &data, &rc, 1);
524-
result = -(data[0] & 0x00FFFFFF);
525-
return result;
526-
}
527-
528512
// extend the image to allow for additional content on the newline
529513
void GraphicScreen::imageAppend(MAHandle newImage) {
530514
MARect srcRect;

src/ui/screen.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct Screen : public Shape {
3636
virtual void drawLine(int x1, int y1, int x2, int y2) = 0;
3737
virtual void drawRect(int x1, int y1, int x2, int y2) = 0;
3838
virtual void drawRectFilled(int x1, int y1, int x2, int y2) = 0;
39-
virtual int getPixel(int x, int y) = 0;
4039
virtual void newLine(int lineHeight) = 0;
4140
virtual int print(const char *p, int lineHeight, bool allChars=false);
4241
virtual bool setGraphicsRendition(const char c, int escValue, int lineHeight) = 0;
@@ -111,7 +110,6 @@ struct GraphicScreen : public Screen {
111110
void resize(int newWidth, int newHeight, int oldWidth,
112111
int oldHeight, int lineHeight);
113112
void updateFont(int size);
114-
int getPixel(int x, int y);
115113
int getMaxHScroll() { return 0; }
116114

117115
MAHandle _image;
@@ -319,7 +317,6 @@ struct TextScreen : public Screen {
319317
void drawLine(int x1, int y1, int x2, int y2);
320318
void drawRect(int x1, int y1, int x2, int y2);
321319
void drawRectFilled(int x1, int y1, int x2, int y2);
322-
int getPixel(int x, int y) { return 0; }
323320
void inset(int x, int y, int w, int h, Screen *over);
324321
void newLine(int lineHeight);
325322
int print(const char *p, int lineHeight, bool allChars=false);

src/ui/system.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,17 @@ int osd_getpen(int mode) {
10721072
}
10731073

10741074
long osd_getpixel(int x, int y) {
1075-
return g_system->getOutput()->getPixel(x, y);
1075+
g_system->getOutput()->redraw();
1076+
1077+
MARect rc;
1078+
int data[1];
1079+
rc.left = x;
1080+
rc.top = y;
1081+
rc.width = 1;
1082+
rc.height = 1;
1083+
maGetImageData(HANDLE_SCREEN, &data, &rc, 1);
1084+
int result = -(data[0] & 0x00FFFFFF);
1085+
return result;
10761086
}
10771087

10781088
int osd_getx(void) {

0 commit comments

Comments
 (0)