diff options
| author | Michal Hruby <michal.mhr@gmail.com> | 2012-04-25 10:32:19 -0400 |
|---|---|---|
| committer | Tarmac <> | 2012-04-25 10:32:19 -0400 |
| commit | 5398de15f5b39a6298f26de10a6bcf7be6858b26 (patch) | |
| tree | f693598fde246337bd09d20d5b7f45a7080368b6 | |
| parent | c1913096aae0a6e74c6f7b2bb15108188d669745 (diff) | |
| parent | 73f9194c5d1a2846df49daaff14d248f871303c1 (diff) | |
Fix scale inversion when processing non-rect tile textures. Fixes: https://bugs.launchpad.net/bugs/988338. Approved by Gord Allott.
(bzr r2341)
| -rw-r--r-- | plugins/unityshell/src/ResultRendererTile.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/unityshell/src/ResultRendererTile.cpp b/plugins/unityshell/src/ResultRendererTile.cpp index 02cd12dec..0560838ab 100644 --- a/plugins/unityshell/src/ResultRendererTile.cpp +++ b/plugins/unityshell/src/ResultRendererTile.cpp @@ -323,7 +323,6 @@ nux::BaseTexture* ResultRendererTile::CreateTextureCallback(std::string const& t pixbuf_width = style.GetTileWidth() - (padding * 2); pixbuf_height = pixbuf_width * aspect; - if (pixbuf_height > height) { // scaled too big, scale down @@ -337,13 +336,19 @@ nux::BaseTexture* ResultRendererTile::CreateTextureCallback(std::string const& t pixbuf_width = pixbuf_height / aspect; } + if (gdk_pixbuf_get_height(pixbuf) == pixbuf_height) + { + // we changed our mind, fast path is good + return nux::CreateTexture2DFromPixbuf(pixbuf, true); + } + nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, pixbuf_width, pixbuf_height); cairo_t* cr = cairo_graphics.GetInternalContext(); cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); cairo_paint(cr); - float scale = gdk_pixbuf_get_height(pixbuf) / float(pixbuf_height); + float scale = float(pixbuf_height) / gdk_pixbuf_get_height(pixbuf); //cairo_translate(cr, // static_cast<int>((width - (pixbuf_width * scale)) * 0.5), |
