aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/slides.lua
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-11-02 19:19:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-02 19:19:34 -0800
commitde330ffc5632b91a1025235e4633a1ddbb846aa4 (patch)
tree5bbec02eeef39f527441496f55b7f76bec6f0bc7 /resources/slides.lua
parent181093939cf6e6d07fda0d441bad7abbbd6e71cb (diff)
add code-style for slides
BUG=skia: TBR= Review URL: https://codereview.chromium.org/697923002
Diffstat (limited to 'resources/slides.lua')
-rw-r--r--resources/slides.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/resources/slides.lua b/resources/slides.lua
index 06bb81056f..057d213b85 100644
--- a/resources/slides.lua
+++ b/resources/slides.lua
@@ -10,7 +10,7 @@ end
load_file("slides_utils")
-gSlides = parse_file(io.open("/skia/trunk/resources/slides_content.lua", "r"))
+gSlides = parse_file(io.open("/skia/trunk/resources/slides_content2.lua", "r"))
function make_rect(l, t, r, b)
return { left = l, top = t, right = r, bottom = b }
@@ -26,12 +26,26 @@ function make_paint(typefacename, stylebits, size, color)
return paint
end
-function drawSlide(canvas, slide, template)
- template = template.slide -- need to sniff the slide to know if we're title or slide
+function drawSlide(canvas, slide, master_template)
+ template = master_template.slide -- need to sniff the slide to know if we're title or slide
local x = template.margin_x
local y = template.margin_y
+ if slide.blockstyle == "code" then
+ local paint = master_template.codePaint
+ local fm = paint:getFontMetrics()
+ local height = #slide * (fm.descent - fm.ascent)
+ y = (480 - height) / 2
+ for i = 1, #slide do
+ local node = slide[i]
+ y = y - fm.ascent
+ canvas:drawText(node.text, x, y, paint)
+ y = y + fm.descent
+ end
+ return
+ end
+
local scale = 1.25
for i = 1, #slide do
local node = slide[i]
@@ -72,6 +86,7 @@ function SkiaPoint_make_template()
return {
title = title,
slide = slide,
+ codePaint = make_paint("Courier", 0, 24, { a=1, r=.9, g=.9, b=.9 }),
}
end