gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] What to do when a dynamic cast fail in librender?


From: Petter Reinholdtsen
Subject: Re: [Gnash-dev] What to do when a dynamic cast fail in librender?
Date: Sun, 20 Apr 2014 19:23:34 +0200
User-agent: Mutt/1.5.20 (2009-12-10)

[Bastiaan Jacques]
> So far as I can tell, all CachedBitmap objects are created by the
> renderer (in createCachedBitmap()), and because that function always
> returns a bitmap_info_cairo, a dynamic_cast does not seem to be
> required.  You can just replace it with a static_cast instead of
> checking the dynamic_cast.

Right.  I tried, and ran the test suite, and did not discover any new
failures.  But I am not sure if the test suite test the relevant code,
and dare not commit this myself, as I am unsure about the
consequences.

This is the patch I used.

diff --git a/librender/cairo/Renderer_cairo.cpp 
b/librender/cairo/Renderer_cairo.cpp
index c597dd4..846dc55 100644
--- a/librender/cairo/Renderer_cairo.cpp
+++ b/librender/cairo/Renderer_cairo.cpp
@@ -297,8 +297,7 @@ struct StyleHandler : 
boost::static_visitor<cairo_pattern_t*>
             return pattern;
         }
 
-        const bitmap_info_cairo* binfo =
-            dynamic_cast<const bitmap_info_cairo*>(bm);
+        const bitmap_info_cairo* binfo = static_cast<const 
bitmap_info_cairo*>(bm);
       
         cairo_matrix_t mat;
         init_cairo_matrix(&mat, m);       

-- 
Happy hacking
Petter Reinholdtsen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]