[jsui] Sketch.copypixels and FSAA

artm's icon

I have an impression that Sketch.copypixels(...) copies twice as much with FSAA on. The effect is only apparent when copying a portion of source picture to an antialiased sketch (e.g. jsui's own sketch).

I guess this is due to subsampling but then why it only affects width/height and not offset (either source or destination's)?

I have very similar problem with Sketch.glscissor() which is supposed to work with window coordinates, but with FSAA on I have to double all the paramters (my solution is to use the following):

Sketch.prototype.glscissor_m = function(x,y,w,h) {
  if (this.fsaa)
    this.glscissor(2*x,2*y,2*w,2*h);
  else
    this.glscissor(x,y,w,h);
}

(I guess I need to make a similar "patch" for copypixels...)

artm's icon

update:

Sketch.prototype.copypixels_m = function(src,dx,dy,sx,sy,w,h) {
  if (this.fsaa) { w /= 2; h /= 2; }
  this.copypixels(src,dx,dy,sx,sy,w,h);
}

I could also be more blunt and mask the original methods altogether, but I'm not so I don't...