Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Office
Calligra
Commits
4d4980e8
Commit
4d4980e8
authored
Dec 24, 2013
by
Dmitry Kazakov
Browse files
Fix openGL texture buffers on non RGB8 color spaces
We should prepare a proper pixel size when creating a buffer BUG:328998
parent
148bc356
Changes
2
Hide whitespace changes
Inline
Side-by-side
krita/ui/opengl/kis_opengl_image_textures.cpp
View file @
4d4980e8
...
...
@@ -154,7 +154,7 @@ void KisOpenGLImageTextures::createImageTextureTiles()
m_numCols
=
lastCol
+
1
;
// Default color is transparent black
const
int
pixelSize
=
4
;
const
int
pixelSize
=
tilesColorSpace
()
->
pixelSize
()
;
QByteArray
emptyTileData
((
m_texturesInfo
.
width
)
*
(
m_texturesInfo
.
height
)
*
pixelSize
,
0
);
KisConfig
config
;
...
...
@@ -243,6 +243,32 @@ KisOpenGLUpdateInfoSP KisOpenGLImageTextures::updateCache(const QRect& rect)
return
info
;
}
const
KoColorSpace
*
KisOpenGLImageTextures
::
tilesColorSpace
()
const
{
const
KoColorSpace
*
dstCS
=
0
;
switch
(
m_texturesInfo
.
type
)
{
case
GL_UNSIGNED_BYTE
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
rgb8
(
m_monitorProfile
);
break
;
case
GL_UNSIGNED_SHORT
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
rgb16
(
m_monitorProfile
);
break
;
#if defined(HAVE_OPENEXR)
case
GL_HALF_FLOAT_ARB
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
colorSpace
(
"RGBA"
,
"F16"
,
0
);
break
;
#endif
case
GL_FLOAT
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
colorSpace
(
"RGBA"
,
"F32"
,
0
);
break
;
default:
qFatal
(
"Unknown m_imageTextureType"
);
}
return
dstCS
;
}
void
KisOpenGLImageTextures
::
recalculateCache
(
KisUpdateInfoSP
info
)
{
KisOpenGLUpdateInfoSP
glInfo
=
dynamic_cast
<
KisOpenGLUpdateInfo
*>
(
info
.
data
());
...
...
@@ -251,29 +277,10 @@ void KisOpenGLImageTextures::recalculateCache(KisUpdateInfoSP info)
KisOpenGL
::
makeContextCurrent
();
KIS_OPENGL_CLEAR_ERROR
();
const
KoColorSpace
*
dstCS
=
tilesColorSpace
();
KisTextureTileUpdateInfo
tileInfo
;
foreach
(
tileInfo
,
glInfo
->
tileList
)
{
const
KoColorSpace
*
dstCS
=
0
;
switch
(
m_texturesInfo
.
type
)
{
case
GL_UNSIGNED_BYTE
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
rgb8
(
m_monitorProfile
);
break
;
case
GL_UNSIGNED_SHORT
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
rgb16
(
m_monitorProfile
);
break
;
#if defined(HAVE_OPENEXR)
case
GL_HALF_FLOAT_ARB
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
colorSpace
(
"RGBA"
,
"F16"
,
0
);
break
;
#endif
case
GL_FLOAT
:
dstCS
=
KoColorSpaceRegistry
::
instance
()
->
colorSpace
(
"RGBA"
,
"F32"
,
0
);
break
;
default:
qFatal
(
"Unknown m_imageTextureType"
);
}
foreach
(
tileInfo
,
glInfo
->
tileList
)
{
tileInfo
.
convertTo
(
dstCS
,
m_renderingIntent
,
m_conversionFlags
);
KisTextureTile
*
tile
=
getTextureTileCR
(
tileInfo
.
tileCol
(),
tileInfo
.
tileRow
());
KIS_ASSERT_RECOVER_RETURN
(
tile
);
...
...
krita/ui/opengl/kis_opengl_image_textures.h
View file @
4d4980e8
...
...
@@ -145,6 +145,7 @@ private:
static
void
getTextureSize
(
KisGLTexturesInfo
*
texturesInfo
);
void
updateTextureFormat
();
const
KoColorSpace
*
tilesColorSpace
()
const
;
private:
KisImageWSP
m_image
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment