Skip to content

Commit

Permalink
Fix typos and such
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Aug 30, 2023
1 parent cc359c1 commit dc638ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions core_lib/src/graphics/bitmap/bitmapbucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ BitmapBucket::BitmapBucket(Editor* editor,
mReferenceImage = singleLayerImage;
}
mStartReferenceColor = mReferenceImage.constScanLine(point.x(), point.y());
mUseFillToDrag = canUseFillToDrag(point, color, mProperties, singleLayerImage);
mUseDragToFill = canUseDragToFill(point, color, singleLayerImage);

mPixelCache = new QHash<QRgb, bool>();
}

bool BitmapBucket::canUseFillToDrag(const QPoint& fillPoint, const QColor& bucketColor, const Properties& properties, const BitmapImage& referenceImage)
bool BitmapBucket::canUseDragToFill(const QPoint& fillPoint, const QColor& bucketColor, const BitmapImage& referenceImage)
{
QRgb pressReferenceColorSingleLayer = referenceImage.constScanLine(fillPoint.x(), fillPoint.y());
QRgb startRef = qUnpremultiply(pressReferenceColorSingleLayer);

if (properties.fillMode == 0 && ((QColor(qRed(startRef), qGreen(startRef), qBlue(startRef)) == bucketColor.rgb() && qAlpha(startRef) == 255) || bucketColor.alpha() == 0)) {
if (mProperties.fillMode == 0 && ((QColor(qRed(startRef), qGreen(startRef), qBlue(startRef)) == bucketColor.rgb() && qAlpha(startRef) == 255) || bucketColor.alpha() == 0)) {
// In overlay mode: When the reference pixel matches the bucket color and the reference is fully opaque
// Otherwise when the bucket alpha is zero.
return false;
} else if (properties.fillMode == 2 && qAlpha(startRef) == 255) {
} else if (mProperties.fillMode == 2 && qAlpha(startRef) == 255) {
// In behind mode: When the reference pixel is already fully opaque, the output will be invisible.
return false;
}
Expand All @@ -89,12 +89,12 @@ bool BitmapBucket::allowFill(const QPoint& checkPoint, const QRgb& checkColor) c
return true;
}

return allowContinousFill(checkPoint, checkColor);
return allowContinuousFill(checkPoint, checkColor);
}

bool BitmapBucket::allowContinousFill(const QPoint& checkPoint, const QRgb& checkColor) const
bool BitmapBucket::allowContinuousFill(const QPoint& checkPoint, const QRgb& checkColor) const
{
if (!mUseFillToDrag) {
if (!mUseDragToFill) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions core_lib/src/graphics/bitmap/bitmapbucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class BitmapBucket
* @return True if you are allowed to fill, otherwise false
*/
bool allowFill(const QPoint& checkPoint, const QRgb& checkColor) const;
bool allowContinousFill(const QPoint& checkPoint, const QRgb& checkColor) const;
bool allowContinuousFill(const QPoint& checkPoint, const QRgb& checkColor) const;

/** Determines whether fill to drag feature can be used */
bool canUseFillToDrag(const QPoint& fillPoint, const QColor& bucketColor, const Properties& properties, const BitmapImage& referenceImage);
bool canUseDragToFill(const QPoint& fillPoint, const QColor& bucketColor, const BitmapImage& referenceImage);

BitmapImage flattenBitmapLayersToImage();

Expand All @@ -80,7 +80,7 @@ class BitmapBucket

int mTargetFillToLayerIndex = -1;
bool mFilledOnce = false;
bool mUseFillToDrag = false;
bool mUseDragToFill = false;

Properties mProperties;
};
Expand Down

0 comments on commit dc638ed

Please sign in to comment.