Commit a72d4cb4 by Jessica Hawkwell

Things compile now, mostly

1 parent a8cdaca5
[submodule "deps/resvg"] [submodule "deps/resvg"]
path = deps/resvg path = deps/resvg
url = https://github.com/RazrFalcon/resvg.git url = https://github.com/RazrFalcon/resvg.git
ignore = dirty
...@@ -22,3 +22,5 @@ if(NOT ${RESVG} OR NOT EXISTS ${RESVG}) ...@@ -22,3 +22,5 @@ if(NOT ${RESVG} OR NOT EXISTS ${RESVG})
install(FILES resvg/capi/include/resvg.h DESTINATION include) install(FILES resvg/capi/include/resvg.h DESTINATION include)
install(FILES resvg/capi/target/release/libresvg.so DESTINATION lib) install(FILES resvg/capi/target/release/libresvg.so DESTINATION lib)
endif() endif()
message("ReSVG: " ${RESVG})
# This patch file was generated by NetBeans IDE # This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines. # It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>resvg.h (<b>Today 12:46:25 AM</b>)</html> --- a/<html>resvg.h (<b>d3b63c8</b>)</html>
+++ b/<html><b>Current File</b></html> +++ b/<html><b>Current File</b></html>
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include <stdbool.h> #include <stdbool.h>
#ifdef RESVG_CAIRO_BACKEND #ifdef RESVG_CAIRO_BACKEND
-#include <cairo.h> -#include <cairo.h>
+#include <cairo/cairo.h> +#include <cairo/cairo.h>
#endif #endif
@@ -69,16 +69,6 @@
void resvg_init_log();
-void resvg_init_options(resvg_options *opt)
-{
- opt->path = NULL;
- opt->dpi = 96;
- opt->fit_to.type = RESVG_FIT_TO_ORIGINAL;
- opt->fit_to.value = 0;
- opt->draw_background = false;
- opt->keep_named_groups = false;
-}
-
/**
* @brief Creates <b>resvg_render_tree</b> from file.
*
...@@ -4,6 +4,8 @@ configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h) ...@@ -4,6 +4,8 @@ configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h)
find_package(X11) find_package(X11)
find_library(BoehmGC gc-threaded) find_library(BoehmGC gc-threaded)
find_library(Cairo cairo)
find_library(CairoMM cairomm)
add_library(${PROJECT_NAME} SHARED ntkMain.cpp add_library(${PROJECT_NAME} SHARED ntkMain.cpp
nitrogen/Object.cpp nitrogen/Object.cpp
...@@ -33,12 +35,11 @@ nitrogen/nwt/NWTEvent.cpp ...@@ -33,12 +35,11 @@ nitrogen/nwt/NWTEvent.cpp
nitrogen/nwt/NativeGraphics.cpp nitrogen/nwt/NativeGraphics.cpp
nitrogen/nwt/Point.cpp nitrogen/nwt/Point.cpp
nitrogen/nwt/Rectangle.cpp nitrogen/nwt/Rectangle.cpp
nitrogen/util/ComponentRenderer.cpp
) )
message("BoehmGC " ${BoehmGC}) target_link_libraries(${PROJECT_NAME} LINK_PUBLIC nde ${BoehmGC} ${X11_LIBRARIES} ${BoehmGC} ${RESVG} ${Cairo})
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC nde ${BoehmGC} ${RESVG})
target_include_directories (ntk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories (ntk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install(FILES ${PROJECT_NAME}.h DESTINATION include) install(FILES ${PROJECT_NAME}.h DESTINATION include)
......
...@@ -50,7 +50,7 @@ namespace nitrogen { ...@@ -50,7 +50,7 @@ namespace nitrogen {
parent = nullptr; parent = nullptr;
preferredSize = new Rectangle(0, 0); preferredSize = new Rectangle(0, 0);
renderer = new util::ComponentRenderer(new std::string("Component"), this); renderer = new nitrogen::util::ComponentRenderer(new std::string("Component"), this);
} }
Border* Component::getBorder() { Border* Component::getBorder() {
......
...@@ -51,16 +51,18 @@ ...@@ -51,16 +51,18 @@
#include <vector> #include <vector>
namespace nitrogen { namespace nitrogen {
namespace util {
}
namespace nwt { namespace nwt {
class Border; class Border;
//class ComponentRenderer; //class nitrogen::util::ComponentRenderer;
class Graphics; class Graphics;
class NWTEvent; class NWTEvent;
class MouseEvent; class MouseEvent;
class MouseListener; class MouseListener;
class Component : public Object { class Component : public Object {
friend class util::ComponentRenderer; friend class nitrogen::util::ComponentRenderer;
friend class Container; friend class Container;
public: public:
virtual Border* getBorder(); virtual Border* getBorder();
...@@ -108,7 +110,7 @@ namespace nitrogen { ...@@ -108,7 +110,7 @@ namespace nitrogen {
std::vector<MouseListener*>* ml_list; std::vector<MouseListener*>* ml_list;
Rectangle* preferredSize; Rectangle* preferredSize;
util::ComponentRenderer* renderer; nitrogen::util::ComponentRenderer* renderer;
Component(); Component();
virtual void processEvent(NWTEvent *e); virtual void processEvent(NWTEvent *e);
......
...@@ -78,8 +78,6 @@ namespace nitrogen { ...@@ -78,8 +78,6 @@ namespace nitrogen {
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
resvg_handle* svgh;
NativeGraphics(); NativeGraphics();
virtual void pDrawLine(int, int, int, int); virtual void pDrawLine(int, int, int, int);
virtual void pDrawPoint(int, int); virtual void pDrawPoint(int, int);
......
...@@ -43,7 +43,7 @@ namespace nitrogen { ...@@ -43,7 +43,7 @@ namespace nitrogen {
} }
ComponentRenderer::ComponentRenderer(std::string& componentName, nwt::Component* component) { ComponentRenderer::ComponentRenderer(std::string& componentName, nwt::Component* component) {
name = componentName; name = &componentName;
comp = component; comp = component;
init(); init();
} }
...@@ -71,14 +71,15 @@ namespace nitrogen { ...@@ -71,14 +71,15 @@ namespace nitrogen {
w = comp->getParent()->renderer->getWindow(); w = comp->getParent()->renderer->getWindow();
} }
window = XCreateSimpleWindow(nitrogen::disp, w, x, y, width, height, 0, nwt::Color::BLUE); window = XCreateSimpleWindow(nitrogen::disp, *w, x, y, width, height, 0, 0, nwt::Color::BLUE->getARGB());
XWindowAttributes attrs; XWindowAttributes attrs;
XGetWindowAttributes(nitrogen::disp, window, &attrs); XGetWindowAttributes(nitrogen::disp, window, &attrs);
XRenderPictFormat *pf = XRenderFindVisualFormat(nitrogen::disp, attrs.visual); XRenderPictFormat *pf = XRenderFindVisualFormat(nitrogen::disp, attrs.visual);
surface = cairo_xlib_surface_create_with_xrender_format(nitrogen::disp, window, attrs.screen, pf, width, height); surface = cairo_xlib_surface_create_with_xrender_format(nitrogen::disp, window, attrs.screen, pf, width, height);
cairo = cairo_create(surface);
svg_handle = resvg_init(); /*svg_handle = */resvg_init();
} }
std::string* ComponentRenderer::getName() { std::string* ComponentRenderer::getName() {
...@@ -96,14 +97,14 @@ namespace nitrogen { ...@@ -96,14 +97,14 @@ namespace nitrogen {
void ComponentRenderer::renderComponent() { void ComponentRenderer::renderComponent() {
//void resvg_cairo_render_to_canvas(const resvg_render_tree* rtree, const resvg_options* opt, resvg_size size, cairo_t* cr) //void resvg_cairo_render_to_canvas(const resvg_render_tree* rtree, const resvg_options* opt, resvg_size size, cairo_t* cr)
resvg_options ro; resvg_options ro;
ro.dpi = 96;
ro.draw_background = false; ro.draw_background = false;
ro.fit_to = resvg_fit_to_type.RESVG_FIT_TO_ZOOM; ro.fit_to.type = resvg_fit_to_type::RESVG_FIT_TO_ZOOM;
resvg_size rs; resvg_size rs;
rs.width = comp->getSize()->getWidth(); rs.width = comp->getSize()->getWidth();
rs.height = comp->getSize()->getWidth(); rs.height = comp->getSize()->getWidth();
resvg_cairo_render_to_canvas(svg_tree, ro, rs, surface); resvg_cairo_render_to_canvas(svg_tree, &ro, rs, cairo);
} }
} }
} }
...@@ -65,8 +65,9 @@ namespace nitrogen { ...@@ -65,8 +65,9 @@ namespace nitrogen {
std::string* name; std::string* name;
Window window; Window window;
nwt::Component* comp; nwt::Component* comp;
cairo_t* cairo;
cairo_surface_t* surface; cairo_surface_t* surface;
resvg_handle* svg_handle; //resvg_handle* svg_handle;
resvg_render_tree* svg_tree; resvg_render_tree* svg_tree;
void init(); void init();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!