@@ -665,15 +665,11 @@ bool RenderedTarget::touchingColor(const Value &color) const
665665 return false ;
666666 }
667667
668- QPointF point;
669-
670668 // Loop through the points of the union
671669 for (int y = bounds.top (); y <= bounds.bottom (); y++) {
672670 for (int x = bounds.left (); x <= bounds.right (); x++) {
673671 if (this ->containsScratchPoint (x, y)) {
674- point.setX (x);
675- point.setY (y);
676- QRgb pixelColor = sampleColor3b (point, candidates);
672+ QRgb pixelColor = sampleColor3b (x, y, candidates);
677673
678674 if (colorMatches (rgb, pixelColor))
679675 return true ;
@@ -1046,7 +1042,7 @@ bool RenderedTarget::colorMatches(QRgb a, QRgb b)
10461042 return (qRed (a) & 0b11111000 ) == (qRed (b) & 0b11111000 ) && (qGreen (a) & 0b11111000 ) == (qGreen (b) & 0b11111000 ) && (qBlue (a) & 0b11110000 ) == (qBlue (b) & 0b11110000 );
10471043}
10481044
1049- QRgb RenderedTarget::sampleColor3b (const QPointF &point , const std::vector<IRenderedTarget *> &targets) const
1045+ QRgb RenderedTarget::sampleColor3b (double x, double y , const std::vector<IRenderedTarget *> &targets) const
10501046{
10511047 // https://github.com/scratchfoundation/scratch-render/blob/0a04c2fb165f5c20406ec34ab2ea5682ae45d6e0/src/RenderWebGL.js#L1966-L1990
10521048 double blendAlpha = 1 ;
@@ -1059,7 +1055,7 @@ QRgb RenderedTarget::sampleColor3b(const QPointF &point, const std::vector<IRend
10591055
10601056 if ((i == targets.size () || targets[i]->stageModel ()) && !penLayerChecked) {
10611057 if (m_penLayer)
1062- blendColor = m_penLayer->colorAtScratchPoint (point. x (), point. y () );
1058+ blendColor = m_penLayer->colorAtScratchPoint (x, y );
10631059 else
10641060 blendColor = qRgba (0 , 0 , 0 , 0 );
10651061
@@ -1070,7 +1066,7 @@ QRgb RenderedTarget::sampleColor3b(const QPointF &point, const std::vector<IRend
10701066 } else if (i == targets.size ())
10711067 break ;
10721068 else
1073- blendColor = targets[i]->colorAtScratchPoint (point. x (), point. y () );
1069+ blendColor = targets[i]->colorAtScratchPoint (x, y );
10741070
10751071 r += qRed (blendColor) * blendAlpha;
10761072 g += qGreen (blendColor) * blendAlpha;
0 commit comments