Skip to content

Commit

Permalink
Fix rendering bug with new engine and zoom out (canvas is not updated…
Browse files Browse the repository at this point in the history
… correctly)
  • Loading branch information
dacap committed Jun 11, 2019
1 parent 922505e commit 86ffa37
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/app/ui/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,20 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
}

if (tmp->nativeHandle()) {
if (newEngine) {
// Without doing something on the "tmp" surface before (like
// just drawing a pixel), we get a strange behavior where
// pixels are not updated correctly on the editor (e.g. when
// zoom < 100%). I didn't have enough time to investigate this
// issue yet, but this is a partial fix/hack.
//
// TODO review why do we need to do this, it looks like some
// internal state of a SkCanvas or SkBitmap thing is
// updated after this, because convert_image_to_surface()
// will overwrite these pixels anyway.
tmp->drawRect(gfx::rgba(0, 0, 0, 255), gfx::Rect(0, 0, 1, 1));
}

convert_image_to_surface(rendered.get(), m_sprite->palette(m_frame),
tmp, 0, 0, 0, 0, rc2.w, rc2.h);

Expand Down

0 comments on commit 86ffa37

Please sign in to comment.