@@ -665,15 +665,11 @@ bool RenderedTarget::touchingColor(const Value &color) const
665
665
return false ;
666
666
}
667
667
668
- QPointF point;
669
-
670
668
// Loop through the points of the union
671
669
for (int y = bounds.top (); y <= bounds.bottom (); y++) {
672
670
for (int x = bounds.left (); x <= bounds.right (); x++) {
673
671
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);
677
673
678
674
if (colorMatches (rgb, pixelColor))
679
675
return true ;
@@ -1046,7 +1042,7 @@ bool RenderedTarget::colorMatches(QRgb a, QRgb b)
1046
1042
return (qRed (a) & 0b11111000 ) == (qRed (b) & 0b11111000 ) && (qGreen (a) & 0b11111000 ) == (qGreen (b) & 0b11111000 ) && (qBlue (a) & 0b11110000 ) == (qBlue (b) & 0b11110000 );
1047
1043
}
1048
1044
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
1050
1046
{
1051
1047
// https://github.com/scratchfoundation/scratch-render/blob/0a04c2fb165f5c20406ec34ab2ea5682ae45d6e0/src/RenderWebGL.js#L1966-L1990
1052
1048
double blendAlpha = 1 ;
@@ -1059,7 +1055,7 @@ QRgb RenderedTarget::sampleColor3b(const QPointF &point, const std::vector<IRend
1059
1055
1060
1056
if ((i == targets.size () || targets[i]->stageModel ()) && !penLayerChecked) {
1061
1057
if (m_penLayer)
1062
- blendColor = m_penLayer->colorAtScratchPoint (point. x (), point. y () );
1058
+ blendColor = m_penLayer->colorAtScratchPoint (x, y );
1063
1059
else
1064
1060
blendColor = qRgba (0 , 0 , 0 , 0 );
1065
1061
@@ -1070,7 +1066,7 @@ QRgb RenderedTarget::sampleColor3b(const QPointF &point, const std::vector<IRend
1070
1066
} else if (i == targets.size ())
1071
1067
break ;
1072
1068
else
1073
- blendColor = targets[i]->colorAtScratchPoint (point. x (), point. y () );
1069
+ blendColor = targets[i]->colorAtScratchPoint (x, y );
1074
1070
1075
1071
r += qRed (blendColor) * blendAlpha;
1076
1072
g += qGreen (blendColor) * blendAlpha;
0 commit comments