这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions core_lib/src/graphics/bitmap/bitmapimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BitmapImage::BitmapImage(const QPoint& topLeft, const QImage& image)
{
mBounds = QRect(topLeft, image.size());
mMinBound = true;
mImage = image;
mImage = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}

BitmapImage::BitmapImage(const QPoint& topLeft, const QString& path)
Expand All @@ -70,7 +70,7 @@ BitmapImage::~BitmapImage()

void BitmapImage::setImage(QImage* img)
{
Q_ASSERT(img);
Q_ASSERT(img && img->format() == QImage::Format_ARGB32_Premultiplied);
mImage = *img;
mMinBound = false;

Expand Down Expand Up @@ -125,7 +125,7 @@ void BitmapImage::loadFile()
{
if (!fileName().isEmpty() && !isLoaded())
{
mImage = QImage(fileName());
mImage = QImage(fileName()).convertToFormat(QImage::Format_ARGB32_Premultiplied);
mBounds.setSize(mImage.size());
mMinBound = false;
}
Expand Down Expand Up @@ -182,13 +182,6 @@ BitmapImage BitmapImage::copy(QRect rectangle)

QRect intersection2 = rectangle.translated(-mBounds.topLeft());

// If the region goes out of bounds, make sure the image is formatted in ARGB
// so that the area beyond the image bounds is transparent.
if (!mBounds.contains(rectangle) && !image()->hasAlphaChannel())
{
mImage = mImage.convertToFormat(QImage::Format_ARGB32);
}

BitmapImage result(rectangle.topLeft(), image()->copy(intersection2));
return result;
}
Expand Down
8 changes: 6 additions & 2 deletions core_lib/src/managers/clipboardmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ void ClipboardManager::setFromSystemClipboard(const QPointF& pos, const Layer* l
{
// We intentially do not call resetStates here because we can only store image changes to the clipboard
// otherwise we break pasting for vector.
// Only bitmap is supported currently...
// Only update clipboard data if it was stored by other applications
if (layer->type() != Layer::BITMAP || mClipboard->ownsClipboard()) {
return;
}

QImage image = mClipboard->image(QClipboard::Clipboard);
// Only bitmap is supported currently...
if (layer->type() == Layer::BITMAP && !image.isNull()) {
if (!image.isNull()) {
mBitmapImage = BitmapImage(pos.toPoint()-QPoint(image.size().width()/2, image.size().height()/2), image);
}
}
Expand Down
2 changes: 0 additions & 2 deletions core_lib/src/structure/layercamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ QTransform LayerCamera::getViewAtFrame(int frameNumber) const
}

Camera* camera1 = static_cast<Camera*>(getLastKeyFrameAtPosition(frameNumber));
camera1->setEasingType(camera1->getEasingType());

int nextFrame = getNextKeyFramePosition(frameNumber);
Camera* camera2 = static_cast<Camera*>(getLastKeyFrameAtPosition(nextFrame));
camera2->setEasingType(camera2->getEasingType());

if (camera1 == nullptr && camera2 == nullptr)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/test_bitmapbucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST_CASE("BitmapBucket - Fill drag logic")

image->writeFile(resultsPath + "test1.png");

verifyPixels(pressPoint, image, fillColor.rgba());
verifyPixels(pressPoint, image, qPremultiply(fillColor.rgba()));
}

SECTION("FillTo: Layer below - reference: current layer")
Expand Down Expand Up @@ -133,6 +133,6 @@ TEST_CASE("BitmapBucket - Fill drag logic")

image->writeFile(resultsPath + "test4.png");

verifyPixels(pressPoint, image, fillColor.rgba());
verifyPixels(pressPoint, image, qPremultiply(fillColor.rgba()));
}
}