[vte/wip/sixels: 104/111] image: Code style fixes
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/sixels: 104/111] image: Code style fixes
- Date: Sat, 8 Aug 2020 18:43:03 +0000 (UTC)
commit 028f29d16994c9e692dff5d91147740c2dfcd971
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 8 20:42:49 2020 +0200
image: Code style fixes
src/image.cc | 15 ++++++++++-----
src/image.hh | 32 +++++++++++++++++++++++++-------
2 files changed, 35 insertions(+), 12 deletions(-)
---
diff --git a/src/image.cc b/src/image.cc
index 242fc6e3..35605c05 100644
--- a/src/image.cc
+++ b/src/image.cc
@@ -21,6 +21,7 @@
#include <glib.h>
#include <stdio.h>
#include "vteinternal.hh"
+
#include "image.hh"
namespace vte {
@@ -29,13 +30,17 @@ namespace image {
/* Paint the image with provided cairo context */
void
-Image::paint(cairo_t *cr, int offset_x, int offset_y, int cell_width, int cell_height) const noexcept
+Image::paint(cairo_t* cr,
+ int offset_x,
+ int offset_y,
+ int cell_width,
+ int cell_height) const noexcept
{
- double scale_x = 1.0, scale_y = 1.0;
- double real_offset_x, real_offset_y;
+ auto scale_x = 1.0d;
+ auto scale_y = 1.0d;
- real_offset_x = offset_x;
- real_offset_y = offset_y;
+ auto real_offset_x = double(offset_x);
+ auto real_offset_y = double(offset_y);
if (cell_width != m_cell_width || cell_height != m_cell_height) {
scale_x = cell_width / (double) m_cell_width;
diff --git a/src/image.hh b/src/image.hh
index a322bfa3..fa972c9b 100644
--- a/src/image.hh
+++ b/src/image.hh
@@ -25,7 +25,7 @@ namespace vte {
namespace image {
-struct Image {
+class Image {
private:
// Device-friendly Cairo surface
vte::cairo::Surface m_surface{};
@@ -48,9 +48,12 @@ private:
public:
Image(vte::cairo::Surface&& surface,
int priority,
- int width_pixels, int height_pixels,
- int col, int row,
- int cell_width, int cell_height) noexcept
+ int width_pixels,
+ int height_pixels,
+ int col,
+ int row,
+ int cell_width,
+ int cell_height) noexcept
: m_surface{std::move(surface)},
m_priority{priority},
m_width_pixels{width_pixels},
@@ -62,6 +65,13 @@ public:
{
}
+ ~Image() = default;
+
+ Image(Image const&) = delete;
+ Image(Image&&) = delete;
+ Image operator=(Image const&) = delete;
+ Image operator=(Image&&) = delete;
+
inline constexpr auto get_priority() const noexcept { return m_priority; }
inline constexpr auto get_left() const noexcept { return m_left_cells; }
inline auto get_top() const noexcept { return m_top_cells; }
@@ -69,15 +79,23 @@ public:
inline constexpr auto get_width() const noexcept { return (m_width_pixels + m_cell_width - 1) /
m_cell_width; }
inline constexpr auto get_height() const noexcept { return (m_height_pixels + m_cell_height - 1) /
m_cell_height; }
inline auto get_bottom() const noexcept { return m_top_cells + get_height() - 1; }
- inline auto resource_size() const noexcept {
+
+ inline auto resource_size() const noexcept
+ {
if (cairo_image_surface_get_stride(m_surface.get()) != 0)
return cairo_image_surface_get_stride(m_surface.get()) * m_height_pixels;
/* Not an image surface: Only the device knows for sure, so we guess */
return m_width_pixels * m_height_pixels * 4;
}
- void paint(cairo_t *cr, gint offset_x, gint offset_y, int cell_width, int cell_height) const
noexcept;
-};
+
+ void paint(cairo_t* cr,
+ int offset_x,
+ int offset_y,
+ int cell_width,
+ int cell_height) const noexcept;
+
+}; // class Image
} // namespace image
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]