Skip to content

Releases: Tencent/tgfx

v2.1.1

26 Sep 14:46
6fa1670

Choose a tag to compare

What's Changed

New Features

  • Introduce RuntimeEffect::NextProgramID() to prevent programID conflicts between RuntimeEffect subclasses.
  • Prioritize larger Tiles over closer ones in DisplayList for improved rendering quality.
  • Use nearest-neighbor sampling for textures to address blurriness in path and text drawing.
  • Export FilterImage and PictureImage as bitmaps in SVGs, rather than SVG elements.

Performance Improvements

  • Implement HardwareBuffer texture support for text atlases.
  • Cache viewport, scissor, program, binding states, and blend states to minimize redundant GL calls.
  • Exclude layers outside the visible area in Layer::draw for improved rendering efficiency.
  • Set the minimum decoded image size to 1/8 of the original to optimize memory usage.
  • Avoid drawing layers to the background context when no background blur is needed.
  • Add support for drawScale arguments in the Gaussian blur filter to enable rendering at reduced sizes.
  • Fix performance issue caused by deleting tile caches before checking for zoom blur reuse.

Bug Fixes

  • Fixed a crash by ensuring each atlas cell buffer is aligned to a 4-byte boundary.
  • Fixed a memory leak by properly releasing hardware buffer references.
  • Fixed an issue where italic text was not rendering correctly.
  • Fix drop shadow offset calculation error in PDF export.
  • Fix issue where RRect cannot be drawn when DeviceBounds are needed but LocalBounds are not.
  • Fix macro definition conflicts caused by Qt5 on Windows.
  • Correct shader code generation for blend modes.
  • Fix issue where TiledTextureEffect does not add Subset when using ClampToBorderNearest.
  • Fix issue where Image::lockTextureProxy may obtain a TextureProxy with inconsistent backingFit.
  • Fix dirty region calculation issues when Layer has LayerStyle or Filter.
  • Fixed incorrect stroke width by properly applying shape matrix scaling.
  • Fix infinite loop in DisplayList::getFallbackDrawTasks().
  • Add [NSOpenGLContext clearCurrentContext] to properly release OpenGL context.
  • Fix precision errors caused by float calculations for backingSize.
  • Fix issue where syncCpu in Context::submit may not work in certain cases.
  • Resolve shader compilation failure due to incorrect OES texture extension string with GLES 3.0.
  • Fix compilation issue for unused code in Web platform Release build.

v2.1.0

18 Aug 06:24
6095b90

Choose a tag to compare

What's Changed

This major update introduces several key enhancements: PDF export support; full adoption of SIMD technology for faster mathematical computations; automatic downscaling cache and asynchronous scaling/decoding for 4K and larger images; filters now generate minimal offscreen textures on demand in local cropping and high-zoom scenarios, reducing memory and rendering load; new text atlas rendering and optimized bounding box calculations boost text performance by up to 20×; the layer module introduces partial refresh and tiled rendering modes, automatically updating only changed regions—combined with an efficient dirty marking system and fast culling, this enables smooth zooming and fast movement even on massive canvases with up to 200,000 layers.

New Features

  • Introduced a new module API that enables PDF export functionality.
  • Exposed SVG path parsing methods and added additional documentation to SVGLengthContext.
  • Added a static ReleaseThreads() method to the Task class for releasing internal thread resources.
  • Implemented filterBounds() in the LayerFilter class to calculate bounds after applying a filter.
  • Added an option to specify task priority when invoking Task::Run().
  • Introduced a Luma() method in ColorFilter to create filters that convert input colors to luminance.
  • Added drawImageRect() methods to the Canvas class.
  • Implemented weak reference caching for tgfx::Image and ImageCodec instances sharing the same file path.
  • Added Context::setResourceExpirationFrames() to control the number of frames GPU resources persist before expiration.
  • Introduced a FillModifier interface for modifying fill properties during picture playback.
  • Added a scale parameter to Shape::MakeFrom(TextBlob) and enabled partial glyph outline support when creating shapes from text blobs.
  • Added hitTestPoint() and getTightBounds() to the Picture class.
  • Introduced addRRect() in Path to support rounded rectangles with distinct corner radii.
  • Added a parameter to Canvas::drawImageRect to constrain sampling points within a subset rectangle.
  • Added HardwareBufferGetSize() to retrieve the size of hardware buffers, including YUV formats.
  • Implemented makeScaled() in Image and removed scale and sampling options from Image::makeRasterized().
  • Enabled direct image resizing in ImageCodec::readPixels() and in certain Image::makeScaled() methods.
  • Added a TGFX_BUILD_FRAMEWORK option to CMakeLists.txt for building the library as a framework on Apple platforms.
  • Introduced LayerMaskType enum to control layer mask application.
  • Added zoomScale() and contentOffset() to DisplayList to control layer tree transformations.
  • Introduced renderMode() in DisplayList to specify rendering mode (e.g., RenderMode::Direct, RenderMode::Partial, RenderMode::Tiled).
  • Implemented RenderMode::Partial to render only changed regions of the DisplayList, enhancing performance for large layer trees.
  • Implemented RenderMode::Tiled to enable tiled rendering for improved performance with large layer trees and zoom/scroll.
  • Added Display::allowZoomBlur() property to allow tile cache sharing across different zoom scales.
  • Added setMaxTilesRefinedPerFrame() to better manage tile caches at multiple zoom levels.
  • Added hasContentChanged() to DisplayList and removed contentVersion() from Surface.
  • Implemented dirty region calculation in DisplayList.
  • Added showDirtyRegions() to DisplayList to enable/disable dirty region highlighting.
  • Enabled zoom and scroll support for Hello2D demos across all platforms.

Performance Improvements

  • Added bounds caching for Picture and GlyphRunList.
  • Implemented text atlas rendering for improved text rendering performance.
  • Enabled viewport clipping for glyph run rendering, skipping glyphs outside the clip bounds.
  • Enabled direct GPU-based drawing of RRect strokes, eliminating the need for rasterization.
  • Replaced the custom lock-free queue with the concurrentqueue library to enhance performance.
  • Texture cache size now snaps to the nearest power of two based on draw scale for memory efficiency.
  • Deferred creation of most textures and render targets to maximize resource reuse.
  • Enabled creation of textures larger than necessary to facilitate better reuse.
  • Integrated SIMD vectors into the Matrix class for enhanced computational performance.
  • Optimized BoxFilterDownsample using SIMD instructions.
  • Reduced excessive texture usage by improving dropShadow and innerShadow handling.
  • Images are now read directly from the canvas, eliminating the need for an intermediate canvas on web platforms.
  • Layers outside the screen rectangle are skipped during display list rendering.

Breaking Changes

  • Removed isLine(), isRect(), isOval(), and isRRect() from the Shape class.
  • Changed the return type of getImage() in GlyphFace and Font from Image to ImageCodec.
  • Layer now inherits from std::enable_shared_from_this; Layer::parent() now returns a raw pointer.
  • Removed Stroke::applyToBound() from public APIs.
  • Set the default MipmapMode to Linear and removed Canvas::drawImage(image, matrix, paint).
  • Removed Layer::setContent() and the LayerContent class from public APIs; Layer now uses Picture as its content directly.
  • Removed the GlyphFace class; introduced CustomTypefaceBuilder for custom typeface creation.
  • Removed the UniqueType class; added RuntimeEffect::programID() for unique program identification.
  • Removed Rect::intersects() to avoid confusion with Rect::intersect(); use the static Rect::Intersects() instead.
  • Removed Mask from public APIs, as glyph rendering now uses an internal atlas cache.
  • Removed HardwareBufferGetPixelFormat() from public APIs.
  • Moved the MakeFrom() method for wrapping existing pixel data from ImageBuffer to ImageCodec.
  • Removed glSync() from BackendSemaphore.
  • Moved ImageReader from core/ to platform/ and removed its functionality from Bitmap.
  • Removed getMipLevelCount() from Caps and moved its implementation to internal GPUTextureDescriptor.
  • Changed the default value of Layer::rasterizationScale() to 0.0f, so layers rasterize at their drawn size.
  • Limited the number of threads for low-priority tasks to prevent starvation of high-priority tasks.
  • Replaced the typeface's getBytes() method with openStream().
  • Removed all code related to FastBlur; only GaussianBlur is now supported.

Bug Fixes

  • Added missing OpenGL APIs to WebGLProcGetter and EGLProcGetter.
  • Fixed an issue where generated Xcode project scripts could not access the Homebrew path.
  • Changed memory ordering to std::memory_order_acquire when reading data to prevent multithreading issues.
  • Corrected a bug in SVGAttributeParser constructor where a temporary string was assigned to a char* member.
  • Fixed an issue where idle threads could access tgfx resources after they had been released.
  • Resolved compatibility issues with the latest Emscripten version.
  • Fixed incorrect rendering when using specific blend modes (e.g., SRC) with paths and text.
  • Fixed memory out-of-bounds crash when parsing VP8L chunk sizes in WebP images.
  • Excluded excessively small segments during dash pattern processing to prevent downstream bugs.
  • Fixed incorrect clip application when the clip is a rectangle matching the render target's bounds.
  • Fixed a crash in the shadow filter caused by image make subset returning a null pointer.
  • Fixed a potential infinite loop in layers when backgroundBlur is enabled.
  • Fixed an issue where Picture->asImage() erroneously returned true when the image contained alpha.
  • Fixed a blocking issue where images with cached textures were repeatedly decoded.
  • Updated pathkit to fix rounded corners being rendered as straight lines when using the round corner effect.
  • Fixed redundant image decoding caused by unnecessary use of RenderFlags::DisableCache in RasterizedImage.
  • Fixed incorrect behavior of innerShadowStyle under tileMode.
  • Fixed a rendering issue caused by not clearing pending operations in OpsCompositor::flushOpendingOps().
  • Fixed incorrect use of intersects in the getBounds function of MergeShape.
  • Fixed repeated creation of IndexBuffer for RRect.
  • Fixed std::optional::value() compilation error with the SVG module on iOS 12.
  • Fixed an issue where solid-color WebP images failed to preview on Mac.

v2.0.1

24 Apr 02:49

Choose a tag to compare

What's Changed

  • Resolve a data race issue caused by the out-of-order updates of the head and tail positions in LockFreeQueue.
  • Fix a data race crash where PlacementPtrs in Tasks are destroyed after BlockBuffer.clear().
  • Remove the Task::cancelOrWait() method and integrate its functionality into cancel().

v2.0.0

16 Apr 09:47
0d7ac58

Choose a tag to compare

What's Changed

This major update brings significant improvements and new features, including a 10x performance boost for basic graphics rendering (e.g., Rect) compared to version 1.2. We’ve added SVG import/export, support for the WGL rendering backend, and many other enhancements. The release also introduces a brand-new layer rendering tree module, comparable to iOS’s Core Animation, with plans to add partial rendering and advanced animation capabilities in the future. Additionally, PDF export support is coming soon.

New Features

  • Added optional Layers and SVG modules, enabled via TGFX_BUILD_LAYERS and TGFX_BUILD_SVG.
  • Introduced the TGFX_USE_THREADS build option to enable or disable multithreaded rendering.
  • Added the TGFX_USE_ASYNC_PROMISE compile option to replace the WebCodec API.
  • Added a TGFX_USE_FASTER_BLUR option to a faster blur algorithm instead of the standard Gaussian blur.
  • Added WGL support on the Windows platform.
  • Added a drawTextBlob() method to the Canvas class.
  • Introduced the drawPaint() method in Canvas.
  • Added a saveLayer() method to Canvas, enabling image filters for all drawing methods.
  • Added support for drawing inverse paths and shapes.
  • Renamed FillStyle to Fill and embedded it into the Paint class.
  • Added a PlusDarker blend mode.
  • Added a RuntimeEffect class for creating custom image filters with backend GPU shaders.
  • Supported creating image filters from color filters.
  • Added an AlphaThresholdColorFilter to convert translucent colors to opaque.
  • Introduced an InnerShadowFilter.
  • Allowed the blurriness of BlurImageFilter to be infinitely large.
  • Enabled disabling anti-aliasing when rasterizing paths and texts.
  • Added support for creating an Image from a given Picture.
  • Supported CMYK color space for JPG images and fixed related crashes.
  • Added filterBounds() and MakeTrim() methods to the PathEffect class.
  • Introduced applyToPath() for the Stroke class.
  • Added an isSame() method to Path for fast comparisons.
  • Introduced a Shape class to defer Path computation and enable parallel execution.
  • Added a PathProvider interface for deferred creation of Path objects.
  • Added support for creating adaptive dashed lines.
  • Added a hasOutlines() method to the Typeface class.
  • Introduced a GlyphFace interface for custom fonts.
  • Added default constructors for Matrix, Color, Rect, Point, and Size.
  • Added an external injection interface for Stream.
  • Introduced a WriteStream interface for dynamic data writing.

Performance Improvements

  • Improved performance with mimalloc when building with EMSCRIPTEN_PTHREADS enabled.
  • Add a lock-free queue class for scheduling multi-threads tasks.
  • Optimized drawing performance by removing unnecessary clipLocalBounds calculations.
  • Merged all temporary vertices into a shared vertex buffer.
  • Increased the maximum number of mergeable AA and non-AA quads.
  • Reduced the frequency of Surface::contentVersion() changes.
  • Optimized draw call merging by skipping unnecessary drawAsClear calls.
  • Added a PlacementBuffer to minimize allocation overhead when creating small objects.
  • Avoided generating colors in RRectsVertexProvider if all rrects share the same color.
  • Improved hardware buffer write performance on the OHOS platform.
  • Disabled vsync on Android for non-blocking buffer swapping.
  • Enabled MSAA and textureRedSupport for WebGL2.

Breaking Changes

  • Renamed Sweep gradient to Conic gradient for platform consistency.
  • Renamed Plus blend mode to PlusLighter.
  • Removed the PathEffect::MakeStroke() method, use the Stroke class instead.
  • Renamed PathEffect's applyTo() method to filterPath().
  • Removed the GLResource class from public APIs.
  • Replaced SurfaceOptions with RenderFlags.
  • Removed ColorFilter::Luma() in favor of ColorFilter::Matrix().
  • Removed Surface methods flush() and wait() in favor of those in Context.
  • Adjusted the directory structure of public APIs.

Bug Fixes

  • Fixed rendering errors when drawing subset images with tile modes.
  • Fixed clipping issues when drawing anti-aliased paths.
  • Corrected path results for the addArc() method.
  • Resolved blur artifacts caused by rotation or rectangle texture sampling.
  • Fixed issues with Surface::makeImageSnapshot() for MSAA-enabled surfaces.
  • Removed the initial clip for Surface and fixed rendering issues with inverse fill paths.
  • Resolved the issue where ScalerContext could be null during font initialization.
  • Fixed excessive time consumption when reading invisible characters on the web platform.
  • Fixed color space issues in image decoding on Android.
  • Fixed resizing issues with EGLSurface created by ANGLE.
  • Addressed non-functional Typeface::MakeFromData() for Core Graphics backend.
  • Resolved rendering problems when reading binary data streams from JPG CMYK files.
  • Fixed Android JNI exception checks.
  • Fixed incorrect emoji detection in WebTypeface.
  • Fixed memory leaks on macOS by adding autorelease pools.

v1.2.1

13 Dec 16:18

Choose a tag to compare

What's Changed

  • Fix an issue where the Path’s triangle cache was incorrectly purged from the resource cache.

v1.2.0

11 Nov 04:59

Choose a tag to compare

What's Changed

  • Optimize the performance of BlurImageFilter by reducing one unnecessary offscreen rendering pass.
  • Add a clipRect() method to the Canvas class.
  • Remove Image::isRGBAAA() and make Image::makeTextureImage() create a new image source if the image size doesn't match its source size.
  • Remove the ImageSource class and merge the code into the ResourceImage class.
  • Renmae EncodedOrigin to Orientation.
  • Allow Image::getBackendTexture() to return the associated ImageOrigin.
  • Add a makeWithFilter method to the Image class.
  • Optimze the DropShadowImageFilter by enabling direct drawing to the surface.
  • Simplify the generated shaders by removing an unnecessary ConstColorProcessor.
  • Add a makeRasterized() method to the Image class.
  • Force the newly created GPU resources to stay alive until the next flush() for reuse.
  • Improve performance by enabling multi-threading for the built-in freetype library.
  • Cache the ScalerContext instance in the Font class instead of creating it repeatedly.
  • Rename Image::isLazyGenerated() to Image::isFullyDecoded().
  • Fix the issue of missing multiplication of the input alpha in gradient shaders.
  • Merge Shader::makeWithPreLocalMatrix() and Shader::makeWithPostLocalMatrix() into Shader::makeWithMatrix().
  • Remove the cropRect member from the ImageFilter class.
  • Add a clipRect parameter to the Image::makeWithFilter() method.
  • Optimize performance by enabling glScissor whenever possible.
  • Remove the Shape class and add cache support directly for the Path class.
  • Fix the aliasing issue on the edges of RRect when drawn with scaling.
  • Fix the TriangulatingPathOp for proper rendering with gradient shaders.
  • Add bounds cache for the Path class.
  • Remove setAlpha() and setBlendMode() from Canvas and add some convenient methods for drawing paths and manipulating matrices.
  • Remove the Canvas::flush() method and add a Paint parameter to the Canvas::drawAtlas() method.
  • Add a setAntiAlias() method to the Paint class to toggle anti-aliasing.
  • Add a asColor() method to the Shader class.
  • Improve clip path performance by caching a texture instead of a surface to reduce draw calls.
  • Make ImageBuffer::MakeFrom(ImageInfo, Data) return nullptr if the ImageInfo isn't suitable for direct texture upload.
  • Optimze color emoji drawing performance by deferring glyph image decoding.
  • Add a isOval method to the Path class and rename asRect / asRRect to isRect / isRRect.
  • Fix building errors with gcc 13.
  • Add a matrix parameter to TextBlob::getBounds().
  • Fix the NPR issue when Font.getTypeface() returns nullptr.
  • Fix the rendering issue with the drop shadow filter that happens when drawing exceeds image bounds.
  • Implement the ImageFilter::Compose() method.
  • Implement the ColorFilter::Compose() method.
  • Implement the Picture and Recorder classes.
  • Add a simple OpenGL demo for the HarmonyOS platform.
  • Add the hardware buffer support for the OHOS platform.
  • Add support for printing logs on the OHOS platform.
  • Add support for creating a texture from a yuv NativeBuffer on the OHOS platform.
  • Improve performance when repeatedly writing to the hardware buffer on the OHOS platform.
  • Fix PNG decoder error handling.
  • Fix the random pixels outside the clip by adding a clear op before the draw op.

v1.1.2

21 Mar 12:14

Choose a tag to compare

What's Changed

  • Fix the out-of-bounds memory access issue in the FTMask class.

v1.1.1

30 Jan 02:18

Choose a tag to compare

What's Changed

  • Fix the performance issue of mistakenly deleting all purgeable resources, even when the maximum byte limit is not reached.

v1.1.0

15 Jan 04:54
d864aee

Choose a tag to compare

What's Changed

  • Allow EGLSurface to be nullptr in EGLDevice::Current() when the 'EGL_KHR_surfaceless_context' extension is available.
  • Delay the acquisition of textures, render targets, and gpu buffers until context is flushed.
  • Optimize performance by deferring the rasterization of paths and executing them concurrently.
  • Refactor the cache system of Resources to avoid crashes when releasing resources across multiple threads.
  • Fix the ANR caused by TaskGroup::exit() when app is exiting.
  • Make all ResouceProxy classes immutable and generate resource creation tasks to the Context instead.
  • Remove unnecessary flush() calls in Surface, like makeImageSnapshot() and drawing with image filters.
  • Fix the issue where HardwareBufferAllocate() returns a buffer even when HardwareBufferAvailable() is false on apple platforms.
  • Upgrade the pathkit library and add a non-aa method to the PathTriangulator class for path tessellation.
  • Enable the -Wconversion warning option by default and fix all conversion warnings.
  • Add a GLResource class and hide the Resource related classes from the public APIs.
  • Move the flags in the SurfaceOptions class to the RenderFlags class.

v1.0.1

17 Dec 05:40
9060855

Choose a tag to compare

What's Changed

  • Add demo projects for multiple platforms: iOS, Android, Web, Windows, Linux, and QT.
  • Add support for building with all NDK versions starting from 19 and above.
  • Add the x86_x64 architecture support on the Android platform.
  • Add support for building with the Qt 6.0 SDK.
  • Fix the crash in QGLWindow when rendering with multiple threads.
  • Remove the 'shareContext' parameter from QGLWindow::MakeFrom(). Fetch it automatically within QGLWindow instead.
  • Upgrade the skcms library to version 'm120'.
  • Replace all 'MakeAdpoted()' with 'MakeFrom()' in the Device classes as the term 'adopted' is incorrectly used.
  • Allow surfaces to be cached on the Window class, replacing createSurface() with getSurface(), freeSurface(), and invalidateSize().