diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt index b67552c..fb7b551 100644 --- a/graphics/CMakeLists.txt +++ b/graphics/CMakeLists.txt @@ -43,8 +43,11 @@ set(graphics_src shape/rectangle.h++ shape/rectangle.c++ size.h++ skia_canvas.h++ skia_canvas.c++ - skia_context.h++ skia_context.c++ - skia_util.h++ skia_util.c++ + skia_gl_context.h++ skia_gl_context.c++ + skia_raster_context.h++ skia_raster_context.c++ + skia_gl_canvas.h++ skia_gl_canvas.c++ + skia_raster_canvas.h++ skia_raster_canvas.c++ + skia_utility.h++ skia_utility.c++ ) # The library itself diff --git a/graphics/skia_canvas.c++ b/graphics/skia_canvas.c++ old mode 100644 new mode 100755 index e53ca83..ee8e91a --- a/graphics/skia_canvas.c++ +++ b/graphics/skia_canvas.c++ @@ -22,7 +22,7 @@ * THE SOFTWARE. **/ -#include "skia_canvas.h++" +#include "graphics/skia_canvas.h++" #include @@ -36,58 +36,24 @@ #include "graphics/shape/path.h++" #include "graphics/shape/rectangle.h++" -#include "graphics/skia_util.h++" - -#include - -#include -#include +#include "graphics/skia_utility.h++" #include #include #include +#include +#include namespace skui { namespace graphics { - namespace implementation - { - sk_sp create_surface(const pixel_size& size, - const GrGLInterface& gl_interface, - GrContext& gr_context) - { - // Wrap the frame buffer object attached to the screen in a Skia render target so Skia can - // render to it - GrBackendRenderTargetDesc desc; - desc.fWidth = static_cast(size.width); - desc.fHeight = static_cast(size.height); - desc.fConfig = kSkia8888_GrPixelConfig; - desc.fOrigin = kBottomLeft_GrSurfaceOrigin; - desc.fSampleCnt = 0; - desc.fStencilBits = 8; - GrGLint buffer; - gl_interface.fFunctions.fGetIntegerv(GL_FRAMEBUFFER_BINDING, &buffer); - desc.fRenderTargetHandle = buffer; - - // setup SkSurface - // To use distance field text, use commented out SkSurfaceProps instead - SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, // distance field text - SkSurfaceProps::kLegacyFontHost_InitType); - - return SkSurface::MakeFromBackendRenderTarget(&gr_context, desc, &props); - } - } - - skia_canvas::skia_canvas(const pixel_size& size, - const GrGLInterface& gr_gl_interface, + skia_canvas::skia_canvas(//sk_sp surface, canvas_flags flags) : canvas(flags) - , gr_context(GrContext::Create(kOpenGL_GrBackend, reinterpret_cast(&gr_gl_interface))) - , surface(implementation::create_surface(size, gr_gl_interface, *gr_context)) + , surface(nullptr/*surface*/) { - SkASSERT(gr_context); - SkASSERT(surface); + //SkASSERT(surface); } void skia_canvas::draw(const color& background_color) @@ -99,7 +65,6 @@ namespace skui void skia_canvas::draw(const rectangle& rectangle) { - auto canvas = surface->getCanvas(); const auto rect = SkRect::MakeXYWH(rectangle.position.x, @@ -112,32 +77,43 @@ namespace skui SkPath border; border.addRoundRect(rect, rectangle.border.radius, rectangle.border.radius); - canvas->drawRRect(rounded_rect, make_fill_paint(rectangle)); - canvas->drawRRect(rounded_rect, make_border_paint(rectangle)); + canvas->save(); + canvas->translate(.5f, .5f); + for(const auto& paint : {make_fill_paint(rectangle), make_border_paint(rectangle)}) + { + canvas->drawRRect(rounded_rect, paint); + } + canvas->restore(); } void skia_canvas::draw(const ellipse& ellipse) { auto canvas = surface->getCanvas(); + canvas->save(); + canvas->translate(.5f, .5f); for(const auto& paint : make_paint(ellipse)) { - canvas->drawOval(SkRect::MakeXYWH(ellipse.position.x, ellipse.position.y, - ellipse.axes.height, ellipse.axes.width), - paint); + canvas->drawOval(SkRect::MakeXYWH(ellipse.position.x, ellipse.position.y, + ellipse.axes.height, ellipse.axes.width), + paint); } + canvas->restore(); } void skia_canvas::draw(const label& label) { auto canvas = surface->getCanvas();; + canvas->save(); + canvas->translate(.5f, .5f); for(const auto& paint : make_paint(label)) { - canvas->drawText(label.text.c_str(), label.text.size(), - label.position.x, label.position.y, - paint); + canvas->drawText(label.text.c_str(), label.text.size(), + label.position.x, label.position.y, + paint); } + canvas->restore(); } void skia_canvas::draw(const path& path) @@ -148,8 +124,8 @@ namespace skui for(const auto& paint : make_paint(path)) { - canvas->drawPath(skia_path, - paint); + canvas->drawPath(skia_path, + paint); } } @@ -172,12 +148,11 @@ namespace skui paint.setStrokeWidth(shape.border.thickness); if(flags.test(canvas_flag::anti_alias)) - paint.setAntiAlias(true); + paint.setAntiAlias(true); return paint; } - SkPaint skia_canvas::make_fill_paint(const shape& shape) const { SkPaint paint; @@ -191,11 +166,11 @@ namespace skui if(shape.fill.gradient) { - set_gradient(paint, *shape.fill.gradient); + set_gradient(paint, *shape.fill.gradient); } if(flags.test(canvas_flag::anti_alias)) - paint.setAntiAlias(true); + paint.setAntiAlias(true); return paint; } @@ -204,53 +179,53 @@ namespace skui { switch(gradient.type) { - case gradient_type::linear: - { - const auto& linear = static_cast(gradient); - auto points = to_skia(linear.points); - auto colors = to_skia(linear.colors); - paint.setShader(SkGradientShader::MakeLinear(points.data(), - colors.data(), - nullptr, - static_cast(points.size()), - SkShader::TileMode::kMirror_TileMode)); - return; - } - case gradient_type::radial: - { - const auto& radial = static_cast(gradient); - paint.setShader(SkGradientShader::MakeRadial(to_skia(radial.center), - radial.radius, - to_skia(radial.colors).data(), - nullptr, - static_cast(radial.positions.size()), - SkShader::TileMode::kMirror_TileMode)); - return; - } - case gradient_type::two_point_conical: - { - const auto& conical = static_cast(gradient); - paint.setShader(SkGradientShader::MakeTwoPointConical(to_skia(conical.start), - conical.start_radius, - to_skia(conical.end), - conical.end_radius, - to_skia(conical.colors).data(), - nullptr, - static_cast(conical.colors.size()), - SkShader::TileMode::kMirror_TileMode)); - return; - } - case gradient_type::sweep: - { - const auto& sweep = static_cast(gradient); - const auto colors = to_skia(sweep.colors); - paint.setShader(SkGradientShader::MakeSweep(sweep.center.x, - sweep.center.y, - colors.data(), - nullptr, - static_cast(colors.size()))); - return; - } + case gradient_type::linear: + { + const auto& linear = static_cast(gradient); + auto points = to_skia(linear.points); + auto colors = to_skia(linear.colors); + paint.setShader(SkGradientShader::MakeLinear(points.data(), + colors.data(), + nullptr, + static_cast(points.size()), + SkShader::TileMode::kMirror_TileMode)); + return; + } + case gradient_type::radial: + { + const auto& radial = static_cast(gradient); + paint.setShader(SkGradientShader::MakeRadial(to_skia(radial.center), + radial.radius, + to_skia(radial.colors).data(), + nullptr, + static_cast(radial.positions.size()), + SkShader::TileMode::kMirror_TileMode)); + return; + } + case gradient_type::two_point_conical: + { + const auto& conical = static_cast(gradient); + paint.setShader(SkGradientShader::MakeTwoPointConical(to_skia(conical.start), + conical.start_radius, + to_skia(conical.end), + conical.end_radius, + to_skia(conical.colors).data(), + nullptr, + static_cast(conical.colors.size()), + SkShader::TileMode::kMirror_TileMode)); + return; + } + case gradient_type::sweep: + { + const auto& sweep = static_cast(gradient); + const auto colors = to_skia(sweep.colors); + paint.setShader(SkGradientShader::MakeSweep(sweep.center.x, + sweep.center.y, + colors.data(), + nullptr, + static_cast(colors.size()))); + return; + } } } } diff --git a/graphics/skia_canvas.h++ b/graphics/skia_canvas.h++ index edfd1e8..0ad27dd 100644 --- a/graphics/skia_canvas.h++ +++ b/graphics/skia_canvas.h++ @@ -29,11 +29,8 @@ #ifndef SKUI_GRAPHICS_SKIA_CANVAS_H #define SKUI_GRAPHICS_SKIA_CANVAS_H -#include - -#include "canvas.h++" - -#include "size.h++" +#include "graphics/canvas.h++" +#include "graphics/size.h++" #include @@ -45,16 +42,9 @@ namespace skui { namespace graphics { - namespace implementation - { - void set_gradient(SkPaint& paint, const gradient& gradient); - } class skia_canvas : public canvas { public: - skia_canvas(const pixel_size& size, - const GrGLInterface& gl_interface, - canvas_flags flags); ~skia_canvas() override = default; void draw(const color& background_color) override; @@ -63,15 +53,17 @@ namespace skui void draw(const label& label) override; void draw(const path& path) override; + protected: + skia_canvas(//sk_sp surface, + canvas_flags flags); + + sk_sp surface; + private: std::vector make_paint(const shape& shape) const; SkPaint make_border_paint(const shape& shape) const; SkPaint make_fill_paint(const shape& shape) const; void set_gradient(SkPaint& paint, const gradient& gradient) const; - - - sk_sp gr_context; - sk_sp surface; }; } } diff --git a/graphics/skia_gl_canvas.c++ b/graphics/skia_gl_canvas.c++ new file mode 100755 index 0000000..9765da4 --- /dev/null +++ b/graphics/skia_gl_canvas.c++ @@ -0,0 +1,78 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +#include "graphics/skia_gl_canvas.h++" + +#include +#include + +#include +#include +#include + +#include + +namespace skui +{ + namespace graphics + { + namespace implementation + { + sk_sp create_gl_surface(const pixel_size& size, + const GrGLInterface& gl_interface, + GrContext& gr_context) + { + // Wrap the frame buffer object attached to the screen in a Skia render target so Skia can + // render to it + GrBackendRenderTargetDesc desc; + desc.fWidth = static_cast(size.width); + desc.fHeight = static_cast(size.height); + desc.fConfig = kSkia8888_GrPixelConfig; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; + desc.fSampleCnt = 0; + desc.fStencilBits = 8; + GrGLint buffer; + gl_interface.fFunctions.fGetIntegerv(GL_FRAMEBUFFER_BINDING, &buffer); + desc.fRenderTargetHandle = buffer; + + // setup SkSurface + // To use distance field text, use commented out SkSurfaceProps instead + SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, // distance field text + SkSurfaceProps::kLegacyFontHost_InitType); + + return SkSurface::MakeFromBackendRenderTarget(&gr_context, desc, &props); + } + } + + skia_gl_canvas::skia_gl_canvas(const pixel_size& size, + const GrGLInterface& gr_gl_interface, + canvas_flags flags) + : skia_canvas(flags) + , gr_context(GrContext::Create(kOpenGL_GrBackend, reinterpret_cast(&gr_gl_interface))) + { + surface = implementation::create_gl_surface(size, gr_gl_interface, *gr_context); + SkASSERT(gr_context); + } + } +} diff --git a/graphics/skia_gl_canvas.h++ b/graphics/skia_gl_canvas.h++ new file mode 100644 index 0000000..12154c7 --- /dev/null +++ b/graphics/skia_gl_canvas.h++ @@ -0,0 +1,58 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +/* + * OpenGL-backed graphics canvas for Skia. + */ + +#ifndef SKUI_GRAPHICS_SKIA_GL_CANVAS_H +#define SKUI_GRAPHICS_SKIA_GL_CANVAS_H + +#include "graphics/skia_canvas.h++" + +#include + +#include + +#include + +namespace skui +{ + namespace graphics + { + class skia_gl_canvas : public skia_canvas + { + public: + skia_gl_canvas(const pixel_size& size, + const GrGLInterface& gl_interface, + canvas_flags flags); + ~skia_gl_canvas() override = default; + + private: + sk_sp gr_context; + }; + } +} + +#endif diff --git a/graphics/skia_context.c++ b/graphics/skia_gl_context.c++ similarity index 80% rename from graphics/skia_context.c++ rename to graphics/skia_gl_context.c++ index ea3c4f7..499fedb 100644 --- a/graphics/skia_context.c++ +++ b/graphics/skia_gl_context.c++ @@ -22,9 +22,9 @@ * THE SOFTWARE. **/ -#include "skia_context.h++" +#include "graphics/skia_gl_context.h++" -#include "skia_canvas.h++" +#include "graphics/skia_gl_canvas.h++" #include @@ -36,17 +36,16 @@ namespace skui { namespace graphics { - skia_context::skia_context() + skia_gl_context::skia_gl_context() : context() , gr_gl_interface(GrGLCreateNativeInterface()) { - core::debug_print("skia_context thread: ", std::this_thread::get_id(), '\n'); SkASSERT(gr_gl_interface); } - std::unique_ptr skia_context::create_canvas(const pixel_size& size) const + std::unique_ptr skia_gl_context::create_canvas(const pixel_size& size) const { - return std::make_unique(size, *gr_gl_interface, canvas_flag::anti_alias); + return std::make_unique(size, *gr_gl_interface, canvas_flag::anti_alias); } } } diff --git a/graphics/skia_gl_context.h++ b/graphics/skia_gl_context.h++ new file mode 100644 index 0000000..502bbf5 --- /dev/null +++ b/graphics/skia_gl_context.h++ @@ -0,0 +1,59 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +#ifndef SKUI_GRAPHICS_SKIA_GL_CONTEXT_H +#define SKUI_GRAPHICS_SKIA_GL_CONTEXT_H + +#include "context.h++" + +#include "size.h++" + +#include +#include + +#include + +class SkSurface; + +namespace skui +{ + namespace graphics + { + class canvas; + + class skia_gl_context : public context + { + public: + skia_gl_context(); + ~skia_gl_context() override = default; + + std::unique_ptr create_canvas(const pixel_size& size) const override; + + private: + sk_sp gr_gl_interface; + }; + } +} + +#endif diff --git a/graphics/skia_raster_canvas.c++ b/graphics/skia_raster_canvas.c++ new file mode 100755 index 0000000..782a9da --- /dev/null +++ b/graphics/skia_raster_canvas.c++ @@ -0,0 +1,37 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +#include "skia_raster_canvas.h++" + +namespace skui +{ + namespace graphics + { + skia_raster_canvas::skia_raster_canvas(const pixel_size&, + canvas_flags flags) + : skia_canvas(flags) + { + } + } +} diff --git a/graphics/skia_raster_canvas.h++ b/graphics/skia_raster_canvas.h++ new file mode 100644 index 0000000..c8dd387 --- /dev/null +++ b/graphics/skia_raster_canvas.h++ @@ -0,0 +1,54 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +/* + * Graphics canvas for Skia. + */ + +#ifndef SKUI_GRAPHICS_SKIA_RASTER_CANVAS_H +#define SKUI_GRAPHICS_SKIA_RASTER_CANVAS_H + +#include "graphics/skia_canvas.h++" + +#include "graphics/size.h++" + +#include + +#include + +namespace skui +{ + namespace graphics + { + class skia_raster_canvas : public skia_canvas + { + public: + skia_raster_canvas(const pixel_size& size, + canvas_flags flags); + ~skia_raster_canvas() override = default; + }; + } +} + +#endif diff --git a/graphics/skia_raster_context.c++ b/graphics/skia_raster_context.c++ new file mode 100644 index 0000000..45e4a2f --- /dev/null +++ b/graphics/skia_raster_context.c++ @@ -0,0 +1,42 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2017 Ruben Van Boxem + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ + +#include "graphics/skia_raster_context.h++" + +#include "graphics/skia_raster_canvas.h++" + +#include + +#include + +namespace skui +{ + namespace graphics + { + std::unique_ptr skia_raster_context::create_canvas(const pixel_size& size) const + { + return std::make_unique(size, canvas_flag::anti_alias); + } + } +} diff --git a/graphics/skia_context.h++ b/graphics/skia_raster_context.h++ similarity index 90% rename from graphics/skia_context.h++ rename to graphics/skia_raster_context.h++ index df531a6..6cfb7ac 100644 --- a/graphics/skia_context.h++ +++ b/graphics/skia_raster_context.h++ @@ -42,16 +42,13 @@ namespace skui { class canvas; - class skia_context : public context + class skia_raster_context : public context { public: - skia_context(); - ~skia_context() override = default; + skia_raster_context() = default; + ~skia_raster_context() override = default; std::unique_ptr create_canvas(const pixel_size& size) const override; - - private: - sk_sp gr_gl_interface; }; } } diff --git a/graphics/skia_util.c++ b/graphics/skia_utility.c++ similarity index 98% rename from graphics/skia_util.c++ rename to graphics/skia_utility.c++ index e75bf8f..dcd8ecd 100644 --- a/graphics/skia_util.c++ +++ b/graphics/skia_utility.c++ @@ -22,7 +22,7 @@ * THE SOFTWARE. **/ -#include "graphics/skia_util.h++" +#include "graphics/skia_utility.h++" namespace skui { diff --git a/graphics/skia_util.h++ b/graphics/skia_utility.h++ similarity index 95% rename from graphics/skia_util.h++ rename to graphics/skia_utility.h++ index 40816db..7f18191 100644 --- a/graphics/skia_util.h++ +++ b/graphics/skia_utility.h++ @@ -30,8 +30,8 @@ #error "This header contains implementation details and can only be included when building SkUI." #endif -#ifndef SKUI_GRAPHICS_SKIA_UTIL_H -#define SKUI_GRAPHICS_SKIA_UTIL_H +#ifndef SKUI_GRAPHICS_SKIA_UTILITY_H +#define SKUI_GRAPHICS_SKIA_UTIITYL_H #include "graphics/color.h++" #include "graphics/position.h++" diff --git a/gui/window.c++ b/gui/window.c++ index f9f4b59..4b55b4f 100644 --- a/gui/window.c++ +++ b/gui/window.c++ @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/gui/window_xcb.c++ b/gui/window_xcb.c++ index 9075aa0..582be6f 100644 --- a/gui/window_xcb.c++ +++ b/gui/window_xcb.c++ @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -157,7 +157,7 @@ namespace skui setup_graphics_backend(handle); - graphics_context = std::make_unique(); + graphics_context = std::make_unique(); // Ensure calling thread is waiting for draw_condition_variable std::unique_lock handle_lock(handle_mutex);