|
Krita Source Code Documentation
|
#include <kis_texture_tile.h>
Public Member Functions | |
| int | bindToActiveTexture (bool blockMipmapRegeneration) |
| QRectF | imageRectInTexturePixels (const QRect &imageRect) const |
| KisTextureTile (const QRect &imageRect, const KisGLTexturesInfo *texturesInfo, const QByteArray &fillData, KisOpenGL::FilterMode mode, KisOpenGLBufferCircularStorage *bufferStorage, int numMipmapLevels, QOpenGLFunctions *f) | |
| void | setBufferStorage (KisOpenGLBufferCircularStorage *bufferStorage) |
| void | setNumMipmapLevels (int num) |
| QRect | textureRectInImagePixels () |
| QRect | tileRectInImagePixels () |
| QRectF | tileRectInTexturePixels () |
| void | update (const KisTextureTileUpdateInfo &updateInfo, bool blockMipmapRegeneration) |
| ~KisTextureTile () | |
Private Member Functions | |
| void | regenerateMipmap () |
| void | restoreTextureParameters () |
| void | setNeedsMipmapRegeneration () |
| void | setPreparedLodPlane (int lod) |
| void | setTextureParameters () |
Private Attributes | |
| QOpenGLFunctions * | f |
| KisOpenGLBufferCircularStorage * | m_bufferStorage |
| KisOpenGL::FilterMode | m_filter |
| bool | m_mipmapHasBeenAllocated = false |
| bool | m_needsMipmapRegeneration |
| int | m_numMipmapLevels |
| int | m_preparedLodPlane |
| GLuint | m_textureId |
| QRect | m_textureRectInImagePixels |
| const KisGLTexturesInfo * | m_texturesInfo |
| QRect | m_tileRectInImagePixels |
| QRectF | m_tileRectInTexturePixels |
Definition at line 40 of file kis_texture_tile.h.
| KisTextureTile::KisTextureTile | ( | const QRect & | imageRect, |
| const KisGLTexturesInfo * | texturesInfo, | ||
| const QByteArray & | fillData, | ||
| KisOpenGL::FilterMode | mode, | ||
| KisOpenGLBufferCircularStorage * | bufferStorage, | ||
| int | numMipmapLevels, | ||
| QOpenGLFunctions * | f ) |
Definition at line 72 of file kis_texture_tile.cpp.
References KisGLTexturesInfo::border, f, fillData(), KisGLTexturesInfo::format, KisGLTexturesInfo::height, KisGLTexturesInfo::internalFormat, kisGrowRect(), m_bufferStorage, m_textureId, m_textureRectInImagePixels, m_texturesInfo, m_tileRectInImagePixels, m_tileRectInTexturePixels, relativeRect(), restoreTextureParameters(), setNeedsMipmapRegeneration(), setTextureParameters(), KisOpenGLBufferCircularStorage::size(), KisGLTexturesInfo::type, and KisGLTexturesInfo::width.
| KisTextureTile::~KisTextureTile | ( | ) |
Definition at line 115 of file kis_texture_tile.cpp.
References f, and m_textureId.
| int KisTextureTile::bindToActiveTexture | ( | bool | blockMipmapRegeneration | ) |
Binds the tile's texture to the current GL_TEXTURE_2D binding point, regenerates the mipmap if needed and returns the levelOfDetail that should be used for painting
Definition at line 120 of file kis_texture_tile.cpp.
References f, m_needsMipmapRegeneration, m_preparedLodPlane, m_textureId, regenerateMipmap(), and setPreparedLodPlane().
| QRectF KisTextureTile::imageRectInTexturePixels | ( | const QRect & | imageRect | ) | const |
Definition at line 378 of file kis_texture_tile.cpp.
References m_textureRectInImagePixels, m_texturesInfo, and relativeRect().
|
private |
Definition at line 147 of file kis_texture_tile.cpp.
References f, m_mipmapHasBeenAllocated, and m_needsMipmapRegeneration.
|
inlineprivate |
Definition at line 51 of file kis_texture_tile.cpp.
References f.
|
inline |
Definition at line 48 of file kis_texture_tile.h.
References m_bufferStorage.
|
private |
Definition at line 132 of file kis_texture_tile.cpp.
References KisOpenGL::HighQualityFiltering, m_filter, m_needsMipmapRegeneration, and KisOpenGL::TrilinearFilterMode.
|
inline |
Definition at line 52 of file kis_texture_tile.h.
References m_numMipmapLevels.
|
private |
Definition at line 141 of file kis_texture_tile.cpp.
References m_needsMipmapRegeneration, and m_preparedLodPlane.
|
inlineprivate |
Definition at line 26 of file kis_texture_tile.cpp.
References f, KisGLTexturesInfo::format, GL_CLAMP_TO_EDGE, GL_RGBA16_EXT, KisGLTexturesInfo::internalFormat, m_numMipmapLevels, and m_texturesInfo.
|
inline |
Definition at line 62 of file kis_texture_tile.h.
References m_textureRectInImagePixels.
|
inline |
Definition at line 58 of file kis_texture_tile.h.
References m_tileRectInImagePixels.
|
inline |
Definition at line 66 of file kis_texture_tile.h.
References m_tileRectInTexturePixels.
| void KisTextureTile::update | ( | const KisTextureTileUpdateInfo & | updateInfo, |
| bool | blockMipmapRegeneration ) |
In some special case, when the Lod0 stroke is cancelled the following situation is possible:
1) The stroke is cancelled, Lod0 update is issued by the image. LodN level of the openGL times is still dirty.
2) [here, ideally, the canvas should be re-rendered, so that the mipmap would be regenerated in bindToActiveTexture() call, by in some cases (if you cancel and paint to quickly), that doesn't have time to happen]
3) The new LodN stroke issues a partial update of a LodN plane of the tile. But the plane is still dirty! We update a part of it, but we cannot regenerate the mipmap anymore, because the Lod0 level is not known yet!
To avoid this issue, we should regenerate the dirty mipmap before doing anything with the low-resolution plane.
Another case is when the user has Bilinear or Nearest Neighbour filtering selected and tries to use LoD functionality in animation. glTexSubImage2D() and textureLod() are defined only when all the planes were explicitly initialized with glTexImage2D(), which doesn't happen in case of bilinear- or nn-filtering. In this case !m_mipmapHasBeenAllocated condition comes in.
On the boundaries of KisImage, there is a border-effect as well. So we just repeat the bounding pixels of the image to make bilinear interpolator happy.
WARN: The width of the stripes will be equal to the broader width of the tiles.
When in a mode that doesn't use mipmaps we should just switch back onto lod0 plane instead of requesting full mipmap regeneration.
Definition at line 154 of file kis_texture_tile.cpp.
References KisOpenGL::BilinearFilterMode, KisTextureTileUpdateInfo::data(), f, KisGLTexturesInfo::format, KisGLTexturesInfo::internalFormat, KisTextureTileUpdateInfo::isBottommost(), KisTextureTileUpdateInfo::isEntireTileUpdated(), KisTextureTileUpdateInfo::isLeftmost(), KisTextureTileUpdateInfo::isRightmost(), KisTextureTileUpdateInfo::isTopmost(), m_bufferStorage, m_filter, m_mipmapHasBeenAllocated, m_needsMipmapRegeneration, m_textureId, m_texturesInfo, KisOpenGL::NearestFilterMode, KisTextureTileUpdateInfo::patchLevelOfDetail(), KisTextureTileUpdateInfo::patchPixelsLength(), KisTextureTileUpdateInfo::pixelSize(), KisTextureTileUpdateInfo::realPatchOffset(), KisTextureTileUpdateInfo::realPatchSize(), KisTextureTileUpdateInfo::realTileSize(), regenerateMipmap(), restoreTextureParameters(), setNeedsMipmapRegeneration(), setPreparedLodPlane(), setTextureParameters(), and KisGLTexturesInfo::type.
|
private |
Definition at line 97 of file kis_texture_tile.h.
|
private |
Definition at line 98 of file kis_texture_tile.h.
|
private |
Definition at line 92 of file kis_texture_tile.h.
|
private |
Definition at line 99 of file kis_texture_tile.h.
|
private |
Definition at line 94 of file kis_texture_tile.h.
|
private |
Definition at line 96 of file kis_texture_tile.h.
|
private |
Definition at line 95 of file kis_texture_tile.h.
|
private |
Definition at line 87 of file kis_texture_tile.h.
|
private |
Definition at line 91 of file kis_texture_tile.h.
|
private |
Definition at line 93 of file kis_texture_tile.h.
|
private |
Definition at line 89 of file kis_texture_tile.h.
|
private |
Definition at line 90 of file kis_texture_tile.h.