Skip to content

Support HiDPI theme images with @2x/@3x variants#1528

Open
gaoxiaoliangz wants to merge 1 commit intofcitx:masterfrom
gaoxiaoliangz:master
Open

Support HiDPI theme images with @2x/@3x variants#1528
gaoxiaoliangz wants to merge 1 commit intofcitx:masterfrom
gaoxiaoliangz:master

Conversation

@gaoxiaoliangz
Copy link
Copy Markdown

Resolve #1215

  • Auto-detect @2x/@3x image variants (e.g. panel@2x.png) for 9-patch background images, using cairo_surface_set_device_scale for proper source sampling
  • Remove the intermediate logical-resolution surface in Theme::paint() so 9-patch renders directly on the scaled cairo context
  • Margin values remain in 1x logical pixels; source image cropping is automatically scaled by the device scale factor

Resolve fcitx#1215

- Auto-detect @2x/@3x image variants (e.g. panel@2x.png) for
  9-patch background images, using cairo_surface_set_device_scale
  for proper source sampling
- Remove the intermediate logical-resolution surface in
  Theme::paint() so 9-patch renders directly on the scaled
  cairo context
- Margin values remain in 1x logical pixels; source image
  cropping is automatically scaled by the device scale factor
@3x
Copy link
Copy Markdown

3x commented Mar 16, 2026

👀

Comment thread src/ui/classic/theme.cpp

void Theme::paint(cairo_t *c, const BackgroundImageConfig &cfg, int width,
int height, double alpha, double scale) {
int height, double alpha, double /*scale*/) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image should be using the closest scale, instead of fixed one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Background image is blurry on 2x display

3 participants