void fillEllipse(int color, int xc, int yc, int a, int b){
        /* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */
        int x = 0;
        int y = b;
        int width = 1;
        long a2 = (long)a*a;
        long b2 = (long)b*b;
        long crit1 = -(a2/4 + a%2 + b2);
        long crit2 = -(b2/4 + b%2 + a2);
        long crit3 = -(b2/4 + b%2);
        long t = -a2*y; /* e(x+1/2,y-1/2) - (a^2+b^2)/4 */
        long dxt = 2*b2*x;
        long dyt = -2*a2*y;
        long d2xt = 2*b2;
        long d2yt = 2*a2;
        
        while (y>=0 && x<=a) {
            if (t + b2*x <= crit1 /* e(x+1,y-1/2) <= 0 */ || t + a2*y <= crit3) /* e(x+1/2,y) <= 0 */  {
                x++;
                dxt += d2xt;
                t += dxt;
                width += 2;
            } else if (t - a2*y > crit2) { /* e(x+1/2,y-1) > 0 */
                paintRow(color, xc-x, yc-y, width);
                if (y!=0) {
                    paintRow(color, xc-x, yc+y, width);
                }
                y--;
                dyt += d2yt;
                t += dyt;
            } else {
                paintRow(color, xc-x, yc-y, width);
                if (y!=0) {
                    paintRow(color, xc-x, yc+y, width);
                }
                x++;
                dxt += d2xt;
                t += dxt;
                y--;
                dyt += d2yt;
                t += dyt;
                width += 2;
            }
        }
        if (b == 0) {
            paintRow(color, xc-a, yc, 2*a+1);
        }
    }