Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1251)

Unified Diff: resources/slides.lua

Issue 697923002: add code-style for slides (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | resources/slides_content.lua » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: resources/slides.lua
diff --git a/resources/slides.lua b/resources/slides.lua
index 06bb81056f5a88044ea998fa79ec80bd7462ed4a..057d213b856ed698ef04f16d70c15c3602c5e88c 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
« no previous file with comments | « no previous file | resources/slides_content.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698