Commit b86f3dec authored by Paul Asmuth's avatar Paul Asmuth
Browse files

rename PageElement -> DrawCommand

parent 2e8a328c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ ReturnCode arrow_draw_default(
    const Measure& size,
    const Color& color,
    const Page& page,
    PageElementList* page_elements) {
    DrawCommandList* drawlist) {
  auto direction = normalize(sub(to, from));
  auto ortho = vec2{direction.y, direction.x * -1};

@@ -45,8 +45,8 @@ ReturnCode arrow_draw_default(
  FillStyle fill_style;
  fill_style.color = color;

  page_add_line(page_elements, from, to, line_style);
  page_add_path(page_elements, head_path, {}, fill_style);
  draw_line(drawlist, from, to, line_style);
  draw_path(drawlist, head_path, {}, fill_style);

  return OK;
}
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <optional>

#include "graphics/color.h"
#include "graphics/page_description.h"
#include "graphics/draw.h"
#include "graphics/geometry.h"
#include "return_code.h"
#include "sexpr.h"
@@ -30,7 +30,7 @@ using Arrow = std::function<
        const Measure& size,
        const Color& color,
        const Page& page,
        PageElementList* page_elements)>;
        DrawCommandList* drawlist)>;

Arrow arrow_create_default();

+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <memory>
#include <string>
#include <functional>
#include "graphics/page_description.h"
#include "graphics/draw.h"
#include "sexpr.h"
#include "return_code.h"

@@ -37,7 +37,7 @@ using ElementDrawFn = std::function<
    ReturnCode (
        const LayoutInfo& layout,
        const Page& page,
        PageElementList* page_elements)>;
        DrawCommandList* drawlist)>;

using ElementSizeHintFn = std::function<
    ReturnCode (
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#include <memory>
#include "return_code.h"
#include "color_palette.h"
#include "graphics/page_description.h"
#include "graphics/draw.h"
#include "graphics/measure.h"
#include "graphics/color.h"
#include "graphics/text.h"
+7 −6
Original line number Diff line number Diff line
@@ -12,8 +12,8 @@
 * limitations under the License.
 */
#include "eval.h"
#include "graphics/page_export_image.h"
#include "graphics/page_export_svg.h"
#include "graphics/export_image.h"
#include "graphics/export_svg.h"
#include "layout.h"
#include "sexpr_parser.h"

@@ -58,9 +58,10 @@ ReturnCode eval(
    return rc;
  }

  // draw all elements
  // execute draw commands
  DrawCommandList drawlist;
  for (const auto& e : roots) {
    if (auto rc = e->draw(layout, page, &page.elements); !rc) {
    if (auto rc = e->draw(layout, page, &drawlist); !rc) {
      return rc;
    }
  }
@@ -69,10 +70,10 @@ ReturnCode eval(
  ReturnCode export_rc;
  switch (output_format) {
    case OutputFormat::SVG:
      export_rc = page_export_svg(page, output_buffer);
      export_rc = page_export_svg(page, drawlist, output_buffer);
      break;
    case OutputFormat::PNG:
      export_rc = page_export_png(page, output_buffer);
      export_rc = page_export_png(page, drawlist, output_buffer);
      break;
  }

Loading