mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[kandinsky/context] getPixel only if in the clipping rect
Fixes the redrawing of RoundCursorView when its frame overlaps the clipping rect.
This commit is contained in:
committed by
Léa Saviot
parent
7b8f7007c4
commit
8d3f86c77f
@@ -12,7 +12,7 @@ public:
|
|||||||
|
|
||||||
// Pixel manipulation
|
// Pixel manipulation
|
||||||
void setPixel(KDPoint p, KDColor c);
|
void setPixel(KDPoint p, KDColor c);
|
||||||
KDColor getPixel(KDPoint p);
|
void getPixel(KDPoint p, KDColor * pixel);
|
||||||
void getPixels(KDRect r, KDColor * pixels);
|
void getPixels(KDRect r, KDColor * pixels);
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
|
|||||||
@@ -7,14 +7,11 @@ void KDContext::setPixel(KDPoint p, KDColor c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KDColor KDContext::getPixel(KDPoint p) {
|
void KDContext::getPixel(KDPoint p, KDColor * pixel) {
|
||||||
KDPoint absolutePoint = p.translatedBy(m_origin);
|
KDPoint absolutePoint = p.translatedBy(m_origin);
|
||||||
if (m_clippingRect.contains(absolutePoint)) {
|
if (m_clippingRect.contains(absolutePoint)) {
|
||||||
KDColor result = KDColorBlack;
|
pullRect(KDRect(absolutePoint, 1, 1), pixel);
|
||||||
pullRect(KDRect(absolutePoint, 1, 1), &result);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return KDColorBlack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KDContext::getPixels(KDRect r, KDColor * pixels) {
|
void KDContext::getPixels(KDRect r, KDColor * pixels) {
|
||||||
@@ -28,7 +25,7 @@ void KDContext::getPixels(KDRect r, KDColor * pixels) {
|
|||||||
KDCoordinate xMax = r.x()+r.width();
|
KDCoordinate xMax = r.x()+r.width();
|
||||||
for (int y = r.y(); y < yMax; y++) {
|
for (int y = r.y(); y < yMax; y++) {
|
||||||
for (int x = r.x(); x < xMax; x++) {
|
for (int x = r.x(); x < xMax; x++) {
|
||||||
pixels[i++] = getPixel(KDPoint(x, y));
|
getPixel(KDPoint(x, y), pixels + (i++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ mp_obj_t modkandinsky_color(mp_obj_t red, mp_obj_t green, mp_obj_t blue) {
|
|||||||
|
|
||||||
mp_obj_t modkandinsky_get_pixel(mp_obj_t x, mp_obj_t y) {
|
mp_obj_t modkandinsky_get_pixel(mp_obj_t x, mp_obj_t y) {
|
||||||
KDPoint point(mp_obj_get_int(x), mp_obj_get_int(y));
|
KDPoint point(mp_obj_get_int(x), mp_obj_get_int(y));
|
||||||
KDColor c = KDIonContext::sharedContext()->getPixel(point);
|
KDColor c;
|
||||||
|
KDIonContext::sharedContext()->getPixel(point, &c);
|
||||||
return TupleForRGB(c.red(), c.green(), c.blue());
|
return TupleForRGB(c.red(), c.green(), c.blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user