Use ._NAME for identifying oocairo surfaces

image:type() was removed from oocairo, because the ._NAME property already
exists and there's no need for two functions doing the same job.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-01-21 19:54:27 +01:00
parent 4ee86fc5e4
commit 40958f9d21
1 changed files with 2 additions and 0 deletions

View File

@ -24,6 +24,8 @@ function new(args)
img_release = capi.oocairo.image_surface_create_from_png(args.image) img_release = capi.oocairo.image_surface_create_from_png(args.image)
elseif type(args.image) == "userdata" and args.image.type and args.image:type() == "cairo_surface_t" then elseif type(args.image) == "userdata" and args.image.type and args.image:type() == "cairo_surface_t" then
img_release = args.image img_release = args.image
elseif type(args.image) == "userdata" and args.image._NAME and args.image._NAME == "cairo surface object" then
img_release = args.image
end end
local img_press = capi.oocairo.image_surface_create("argb32", img_release:get_width(), img_release:get_height()) local img_press = capi.oocairo.image_surface_create("argb32", img_release:get_width(), img_release:get_height())
local cr = capi.oocairo.context_create(img_press) local cr = capi.oocairo.context_create(img_press)