Compare commits

..

No commits in common. "55f37fd284b9aa9588c7fbc08e8f0b7518f70d05" and "099b957bf746a84d561c9f55528d83427dca9696" have entirely different histories.

5 changed files with 15 additions and 92 deletions

View File

@ -38,17 +38,3 @@ QPainterPath GroupElement::getPaintObject() const
else else
return QPainterPath(); return QPainterPath();
} }
void BitmapPath::applyTransformation(QTransform& transformation)
{
}
QImage FolderBitmapPath::getStylesAppliedCache() const
{
return QImage();
}
QImage ComposedPainterPath::getStylesAppliedCache() const
{
return QImage();
}

View File

@ -3,29 +3,21 @@
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
#include <QPainterPath> #include <QPainterPath>
#include <QImage>
#include <string> #include <string>
#include "../Renderer/Painting/ElementStyle.h"
class LayerWrapper; class LayerWrapper;
class LeafLayerWrapper; class LeafLayerWrapper;
class FolderLayerWrapper; class FolderLayerWrapper;
class ComposedPainterPath;
class GraphicElement class GraphicElement
{ {
public: public:
QString name=""; QString name="";
// TODO: 改为BitmapPath
virtual QPainterPath getPaintObject() const = 0; virtual QPainterPath getPaintObject() const = 0;
}; };
class SimpleElement : public GraphicElement class SimpleElement : public GraphicElement
{ {
private: private:
QJsonObject jsonSource; QJsonObject jsonSource;
// TODO: 改为ComposedPainterPath
QPainterPath painterPath; QPainterPath painterPath;
void loadSvgFile(const QString& filePath); void loadSvgFile(const QString& filePath);
@ -34,7 +26,6 @@ public:
~SimpleElement() = default; ~SimpleElement() = default;
QPainterPath getPaintObject() const override; QPainterPath getPaintObject() const override;
}; };
class GroupElement : public GraphicElement class GroupElement : public GraphicElement
{ {
public: public:
@ -47,48 +38,3 @@ public:
QPainterPath getPaintObject() const override; QPainterPath getPaintObject() const override;
void setSourceLayer(FolderLayerWrapper *sourceLayer); void setSourceLayer(FolderLayerWrapper *sourceLayer);
}; };
//******************************** BitmapPath ********************************//
using std::vector;
using std::shared_ptr;
class BitmapPath
{
protected:
QRectF boundingRect;
QImage stylesAppliedCache;
void applyTransformation(QTransform &transformation);
public:
/**
* painterQImage
*/
virtual void paint(QPainter* painter) const = 0;
virtual QImage getStylesAppliedCache() const = 0;
};
class FolderBitmapPath : public BitmapPath
{
public:
const vector<BitmapPath*> children;
virtual QImage getStylesAppliedCache() const override;
};
/**
* cacheRender
*/
class ComposedPainterPath : public BitmapPath
{
public:
/**
* ElementStylezealedStylePath
*/
struct SinglePath {
shared_ptr<QPainterPath> path;
bool zealed;
};
const vector<SinglePath> paths;
virtual QImage getStylesAppliedCache() const override;
};

View File

@ -12,8 +12,6 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "../Renderer/Painting/ElementStyle.h"
using std::shared_ptr; using std::shared_ptr;
using std::vector; using std::vector;
class GraphicElement; class GraphicElement;
@ -27,8 +25,7 @@ class LayerWrapper
protected: protected:
shared_ptr<LayerWrapper> parent; shared_ptr<LayerWrapper> parent;
QPointF referencePoint; QPointF referencePoint;
// vector<LayerStyle> styles; vector<LayerStyle> styles;
// TODO: 将cache移到子类对Leaf用ComposedPainterPath对Folder用FolderBitmapPath
QPainterPath cache; QPainterPath cache;
public: public:
@ -41,12 +38,10 @@ class LayerWrapper
double rotation = 0; double rotation = 0;
bool flipHorizontally = 0; bool flipHorizontally = 0;
bool flipVertically = 0; bool flipVertically = 0;
// TODO: 将QPainterPath改为BitmapPath
void apply(QPainterPath &cache) const; void apply(QPainterPath &cache) const;
} property; } property;
void setParent(LayerWrapper *newParent); void setParent(LayerWrapper *newParent);
virtual void refresh(); virtual void refresh();
// TODO: 将QPainterPath改为BitmapPath/QImage或者直接将其删除绘制时直接使用BitmapPath的paint方法
QPainterPath getCache(); QPainterPath getCache();
LayerWrapper *getParent() const; // invoke by manager, then invoke parent's applyStyles LayerWrapper *getParent() const; // invoke by manager, then invoke parent's applyStyles
LayerWrapper(QJsonObject json, LayerWrapper *parent); LayerWrapper(QJsonObject json, LayerWrapper *parent);
@ -76,7 +71,6 @@ class LeafLayerWrapper : public LayerWrapper
{ {
public: public:
GraphicElement *wrappedElement; GraphicElement *wrappedElement;
const vector<Renderer::ElementStyle> styles;
public: public:
void refresh() override; void refresh() override;

View File

@ -43,13 +43,11 @@ std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
break; break;
case QPainterPath::LineToElement: case QPainterPath::LineToElement:
qDebug() << "LineToElement"; qDebug() << "LineToElement";
{
glm::vec2 end = glm::vec2(element.x, element.y); glm::vec2 end = glm::vec2(element.x, element.y);
glm::vec2 mid = (pathBuffer.back() + end) / 2.f; glm::vec2 mid = (pathBuffer.back() + end) / 2.f;
pathBuffer.push_back(mid); pathBuffer.push_back(mid);
pathBuffer.push_back(mid); pathBuffer.push_back(mid);
pathBuffer.push_back(end); pathBuffer.push_back(end);
}
break; break;
case QPainterPath::CurveToElement: case QPainterPath::CurveToElement:
qDebug() << "CurveToElement"; qDebug() << "CurveToElement";

View File

@ -21,7 +21,6 @@ int main(int argc, char* argv[])
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication a(argc, argv); QApplication a(argc, argv);
FramelessHelper::Core::setApplicationOSThemeAware(); FramelessHelper::Core::setApplicationOSThemeAware();
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
MainWindow w; MainWindow w;