[niepce] Center the thumbnail in the cell.
- From: Hubert FiguiÃre <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Center the thumbnail in the cell.
- Date: Sat, 12 Nov 2011 06:15:45 +0000 (UTC)
commit ef5faa4bd165e44c30a31c19888180e101e0b527
Author: Hub Figuiere <hub figuiere net>
Date: Sat Oct 29 12:30:42 2011 -0700
Center the thumbnail in the cell.
src/niepce/ui/librarycellrenderer.cpp | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/niepce/ui/librarycellrenderer.cpp b/src/niepce/ui/librarycellrenderer.cpp
index f543a5b..01f127e 100644
--- a/src/niepce/ui/librarycellrenderer.cpp
+++ b/src/niepce/ui/librarycellrenderer.cpp
@@ -74,20 +74,13 @@ void LibraryCellRenderer::_drawThumbnail(const Cairo::RefPtr<Cairo::Context> & c
Glib::RefPtr<Gdk::Pixbuf> & pixbuf,
const GdkRectangle & r)
{
- double x, y;
- x = r.x + pad();
- y = r.y + pad();
int w = pixbuf->get_width();
int h = pixbuf->get_height();
- int min = std::min(w,h);
- int max = std::max(w,h);
- int offset = (max - min) / 2;
- if(w > h) {
- y += offset;
- }
- else {
- x += offset;
- }
+ int offset_x = (m_size - w) / 2;
+ int offset_y = (m_size - h) / 2;
+ double x, y;
+ x = r.x + pad() + offset_x;
+ y = r.y + pad() + offset_y;
// draw the shadow...
// cr->set_source_rgb(0.0, 0.0, 0.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]