summaryrefslogtreecommitdiff
path: root/lockscreen
diff options
authorAndrea Azzarone <azzaronea@gmail.com>2014-02-13 13:26:54 +0100
committerAndrea Azzarone <azzaronea@gmail.com>2014-02-13 13:26:54 +0100
commit081ca2f52cb2115c576a8ebd7b3c30caf41feb71 (patch)
tree6cee7b896248bfb697b3a6bc268959f8012558c9 /lockscreen
parentb18ae0ad70c57ebc99704b7d5cfc4287bb362921 (diff)
Minor changes in BackgroundSettings
(bzr r3611.4.45)
Diffstat (limited to 'lockscreen')
-rw-r--r--lockscreen/BackgroundSettings.cpp25
-rw-r--r--lockscreen/BackgroundSettings.h4
2 files changed, 16 insertions, 13 deletions
diff --git a/lockscreen/BackgroundSettings.cpp b/lockscreen/BackgroundSettings.cpp
index 67c5065d8..dce2b4d76 100644
--- a/lockscreen/BackgroundSettings.cpp
+++ b/lockscreen/BackgroundSettings.cpp
@@ -41,14 +41,9 @@ BackgroundSettings::BackgroundSettings()
gnome_bg_load_from_preferences(gnome_bg_, settings);
}
-int get_grid_offset (int size)
-{
- return (size % Settings::GRID_SIZE) / 2;
-}
-
BaseTexturePtr BackgroundSettings::GetBackgroundTexture(nux::Size const& size,
- bool draw_grid,
- bool draw_logo)
+ bool draw_grid,
+ bool draw_logo)
{
cairo_surface_t* cairo_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(),
size.width, size.height, FALSE);
@@ -56,8 +51,8 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(nux::Size const& size,
if (draw_logo)
{
- int grid_x_offset = get_grid_offset(size.width);
- int grid_y_offset = get_grid_offset(size.height);
+ int grid_x_offset = GetGridOffset(size.width);
+ int grid_y_offset = GetGridOffset(size.height);
cairo_save(c);
@@ -77,8 +72,8 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(nux::Size const& size,
{
int width = size.width;
int height = size.height;
- int grid_x_offset = get_grid_offset(width);
- int grid_y_offset = get_grid_offset(height);
+ int grid_x_offset = GetGridOffset(width);
+ int grid_y_offset = GetGridOffset(height);
// overlay grid
cairo_surface_t* overlay_surface = cairo_surface_create_similar(cairo_surface,
@@ -114,7 +109,8 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(nux::Size const& size,
cairo_destroy(oc);
}
- GdkPixbuf* gdk_pixbuf = gdk_pixbuf_get_from_surface(cairo_surface, 0, 0,
+ GdkPixbuf* gdk_pixbuf = gdk_pixbuf_get_from_surface(cairo_surface,
+ 0, 0,
size.width, size.height);
cairo_destroy(c);
@@ -123,5 +119,10 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(nux::Size const& size,
return texture_ptr_from_gdk_graphics(nux::GdkGraphics(gdk_pixbuf));
}
+int BackgroundSettings::GetGridOffset(int size)
+{
+ return (size % Settings::GRID_SIZE) / 2;
+}
+
} // lockscreen
} // unity
diff --git a/lockscreen/BackgroundSettings.h b/lockscreen/BackgroundSettings.h
index b934487b3..c497c64b6 100644
--- a/lockscreen/BackgroundSettings.h
+++ b/lockscreen/BackgroundSettings.h
@@ -21,7 +21,7 @@
#define UNITY_BACKGROUND_SETTINGS_H
#include <NuxCore/Size.h>
-#include <NuxGraphics/GLTextureResourceManager.h>
+#include <NuxGraphics/GLTextureResourceManager.h> // for nux::BaseTexture
#include <UnityCore/GLibWrapper.h>
class _GnomeBG;
@@ -44,6 +44,8 @@ public:
bool draw_logo);
private:
+ static int GetGridOffset(int size);
+
glib::Object<_GnomeBG> gnome_bg_;
};