Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Implement report for canvas bit depth information

Dmitry Kazakov8b4e81dc070f
diff --git a/libs/ui/canvas/kis_abstract_canvas_widget.h b/libs/ui/canvas/kis_abstract_canvas_widget.h
index b4144640a5..78f6633f65 100644
--- a/libs/ui/canvas/kis_abstract_canvas_widget.h
+++ b/libs/ui/canvas/kis_abstract_canvas_widget.h
@@ -97,6 +97,8 @@ public:
virtual void setLodResetInProgress(bool value) = 0;
virtual BitDepthMode currentBitDepthMode() const = 0;
+
+ virtual QString currentBitDepthUserReport() const = 0;
};
#endif // _KIS_ABSTRACT_CANVAS_WIDGET_
diff --git a/libs/ui/canvas/kis_canvas2.cpp b/libs/ui/canvas/kis_canvas2.cpp
index 9260fbadf9..c6bf277c14 100644
--- a/libs/ui/canvas/kis_canvas2.cpp
+++ b/libs/ui/canvas/kis_canvas2.cpp
@@ -1601,9 +1601,24 @@ KisInputActionGroupsMaskInterface::SharedInterface KisCanvas2::inputActionGroups
QString KisCanvas2::colorManagementReport() const
{
#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
- return m_d->surfaceColorManager ?
- m_d->surfaceColorManager->colorManagementReport() :
- QString("Surface color management is not supported on this platform\n");
+ QString report;
+ QDebug str(&report);
+
+ if (m_d->canvasWidget) {
+ str << "(canvas bit depth report)" << Qt::endl;
+ str << Qt::endl;
+ str.noquote().nospace() << m_d->canvasWidget->currentBitDepthUserReport();
+ }
+
+ str << Qt::endl;
+
+ if (m_d->surfaceColorManager) {
+ str.noquote().nospace() << m_d->surfaceColorManager->colorManagementReport();
+ } else {
+ str.noquote().nospace() << QString("Surface color management is not supported on this platform\n");
+ }
+
+ return report;
#else
return "Surface color management is disabled\n";
#endif
diff --git a/libs/ui/canvas/kis_canvas_widget_base.cpp b/libs/ui/canvas/kis_canvas_widget_base.cpp
index 9f42375877..5106af6eac 100644
--- a/libs/ui/canvas/kis_canvas_widget_base.cpp
+++ b/libs/ui/canvas/kis_canvas_widget_base.cpp
@@ -252,3 +252,8 @@ KisAbstractCanvasWidget::BitDepthMode KisCanvasWidgetBase::currentBitDepthMode()
{
return BitDepthMode::Depth8Bit;
}
+
+QString KisCanvasWidgetBase::currentBitDepthUserReport() const
+{
+ return QString("Canvas bit depth management is not supported\n");
+}
diff --git a/libs/ui/canvas/kis_canvas_widget_base.h b/libs/ui/canvas/kis_canvas_widget_base.h
index 8c244c5716..d86f44662f 100644
--- a/libs/ui/canvas/kis_canvas_widget_base.h
+++ b/libs/ui/canvas/kis_canvas_widget_base.h
@@ -70,6 +70,7 @@ public: // KisAbstractCanvasWidget
using KisAbstractCanvasWidget::updateCanvasProjection;
BitDepthMode currentBitDepthMode() const override;
+ QString currentBitDepthUserReport() const override;
protected:
KisCanvas2 *canvas() const;
diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp
index 3cf665e49d..763f24486c 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.cpp
+++ b/libs/ui/opengl/kis_opengl_canvas2.cpp
@@ -493,3 +493,48 @@ KisOpenGLCanvas2::BitDepthMode KisOpenGLCanvas2::currentBitDepthMode() const
BitDepthMode::Depth10Bit :
BitDepthMode::Depth8Bit;
}
+
+QString KisOpenGLCanvas2::currentBitDepthUserReport() const {
+ QString report;
+ QDebug str(&report);
+
+ str << "Texture Format: " << Qt::hex << Qt::showbase << textureFormat() << Qt::reset;
+
+ switch (textureFormat()) {
+ case GL_RGB10_A2:
+ str << " (" << "GL_RGB10_A2" << ")";
+ break;
+ case GL_RGB10:
+ str << " (" << "GL_RGB10" << ")";
+ break;
+ case GL_RGB12:
+ str << " (" << "GL_RGB12" << ")";
+ break;
+ case GL_RGBA16:
+ str << " (" << "GL_RGBA16" << ")";
+ break;
+ case GL_RGB16:
+ str << " (" << "GL_RGB16" << ")";
+ break;
+ case GL_RGBA16F:
+ str << " (" << "GL_RGBA16F" << ")";
+ break;
+ case GL_RGB8:
+ str << " (" << "GL_RGB8" << ")";
+ break;
+ case GL_RGBA8:
+ str << " (" << "GL_RGBA8" << ")";
+ break;
+ default:
+ str << " (" << "<unknown>" << ")";
+ break;
+ }
+ str << Qt::endl;
+
+ str << "Red Buffer Size: " << format().redBufferSize() << Qt::endl;
+ str << "Green Buffer Size: " << format().greenBufferSize() << Qt::endl;
+ str << "Blue Buffer Size: " << format().blueBufferSize() << Qt::endl;
+ str << "Alpha Buffer Size: " << format().alphaBufferSize() << Qt::endl;
+
+ return report;
+}
\ No newline at end of file
diff --git a/libs/ui/opengl/kis_opengl_canvas2.h b/libs/ui/opengl/kis_opengl_canvas2.h
index 70805d423c..d799213eea 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.h
+++ b/libs/ui/opengl/kis_opengl_canvas2.h
@@ -98,6 +98,7 @@ public: // Implement kis_abstract_canvas_widget interface
KisOpenGLImageTexturesSP openGLImageTextures() const;
BitDepthMode currentBitDepthMode() const override;
+ QString currentBitDepthUserReport() const override;
public Q_SLOTS:
void slotConfigChanged();