[vte] draw: Move remaining class into new file



commit 39ea41b942f96d9e2e63f5ff8f86ad8b9a52e185
Author: Christian Persch <chpe src gnome org>
Date:   Mon Jun 1 22:48:43 2020 +0200

    draw: Move remaining class into new file

 src/{vtedraw.cc => drawing-cairo.cc} | 30 ++++++++----------------------
 src/{vtedraw.hh => drawing-cairo.hh} | 18 +++++++++---------
 src/meson.build                      |  4 ++--
 src/minifont.cc                      |  2 +-
 src/vte.cc                           |  1 -
 src/vteinternal.hh                   |  4 ++--
 6 files changed, 22 insertions(+), 37 deletions(-)
---
diff --git a/src/vtedraw.cc b/src/drawing-cairo.cc
similarity index 96%
rename from src/vtedraw.cc
rename to src/drawing-cairo.cc
index 99dda6ac..807a16fa 100644
--- a/src/vtedraw.cc
+++ b/src/drawing-cairo.cc
@@ -1,43 +1,29 @@
 /*
  * Copyright (C) 2003,2008 Red Hat, Inc.
- * Copyright © 2019 Christian Persch
+ * Copyright © 2019, 2020 Christian Persch
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
 
-#include <algorithm>
-#include <math.h>
+#include <cmath>
 
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include "attr.hh"
 #include "bidi.hh"
-#include "vtedraw.hh"
-#include "vtedefines.hh"
 #include "debug.h"
-
-#include <pango/pangocairo.h>
-
+#include "drawing-cairo.hh"
 #include "fonts-pangocairo.hh"
-#include "refptr.hh"
 
 #define VTE_DRAW_NORMAL 0
 #define VTE_DRAW_BOLD   1
@@ -63,13 +49,13 @@ guint _vte_draw_get_style(gboolean bold, gboolean italic) {
 static inline constexpr double
 _vte_draw_get_undercurl_rad(gint width)
 {
-        return width / 2. / sqrt(2);
+        return width / 2. / M_SQRT2;
 }
 
 static inline constexpr double
 _vte_draw_get_undercurl_arc_height(gint width)
 {
-        return _vte_draw_get_undercurl_rad(width) * (1. - sqrt(2) / 2.);
+        return _vte_draw_get_undercurl_rad(width) * (1. - M_SQRT2 / 2.);
 }
 
 double
diff --git a/src/vtedraw.hh b/src/drawing-cairo.hh
similarity index 96%
rename from src/vtedraw.hh
rename to src/drawing-cairo.hh
index 724c0bac..d5642487 100644
--- a/src/vtedraw.hh
+++ b/src/drawing-cairo.hh
@@ -12,29 +12,29 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #pragma once
 
-#include <array>
+#include <cstdint>
+
 #include <memory>
 
+#include <cairo.h>
+
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <cairo.h>
-#include "vteunistr.h"
-#include "vtetypes.hh"
 
+#include "fwd.hh"
 #include "minifont.hh"
+#include "vtetypes.hh"
+#include "vteunistr.h"
 
 namespace vte {
 namespace view {
 
-class FontInfo;
-
 class DrawingContext {
 public:
 
diff --git a/src/meson.build b/src/meson.build
index e778cc49..a23ea5bb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -104,6 +104,8 @@ libvte_common_sources = debug_sources + glib_glue_sources + libc_glue_sources +
   'chunk.hh',
   'color-triple.hh',
   'cxx-utils.hh',
+  'drawing-cairo.cc',
+  'drawing-cairo.hh',
   'fonts-pangocairo.cc',
   'fonts-pangocairo.hh',
   'gobject-glue.hh',
@@ -126,8 +128,6 @@ libvte_common_sources = debug_sources + glib_glue_sources + libc_glue_sources +
   'utf8.hh',
   'vte.cc',
   'vtedefines.hh',
-  'vtedraw.cc',
-  'vtedraw.hh',
   'vtegtk.cc',
   'vtegtk.hh',
   'vteinternal.hh',
diff --git a/src/minifont.cc b/src/minifont.cc
index 889fd261..c963f42b 100644
--- a/src/minifont.cc
+++ b/src/minifont.cc
@@ -22,8 +22,8 @@
 
 #include <cairo.h>
 
+#include "drawing-cairo.hh"
 #include "minifont.hh"
-#include "vtedraw.hh"
 
 /* pixman data must have stride 0 mod 4 */
 static unsigned char const hatching_pattern_lr_data[16] = {
diff --git a/src/vte.cc b/src/vte.cc
index 36713482..2f8c5ae2 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -39,7 +39,6 @@
 #include "bidi.hh"
 #include "buffer.h"
 #include "debug.h"
-#include "vtedraw.hh"
 #include "reaper.hh"
 #include "ring.hh"
 #include "ringview.hh"
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index c56edf06..e456359b 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -33,9 +33,9 @@
 #include <glib.h>
 #include "glib-glue.hh"
 
+#include "drawing-cairo.hh"
 #include "vtedefines.hh"
 #include "vtetypes.hh"
-#include "vtedraw.hh"
 #include "reaper.hh"
 #include "ring.hh"
 #include "ringview.hh"
@@ -853,7 +853,7 @@ public:
         /* First, the dimensions of ASCII characters are measured. The result
          * could probably be called char_{width,height} or font_{width,height}
          * but these aren't stored directly here, not to accidentally be confused
-         * with m_cell_{width_height}. The values are stored in vtedraw's font_info.
+         * with m_cell_{width_height}. The values are stored in FontInfo.
          *
          * Then in case of nondefault m_cell_{width,height}_scale an additional
          * m_char_padding is added, resulting in m_cell_{width,height} which are


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]