Monday, September 17, 2012

Silverlight + Bitmapcache: can't get it to work

Silverlight + Bitmapcache: can't get it to work

I'm optimizing a silverlight application which uses a lot of images (GIS style, display tiled images, zoom/pan/etc.), and I was thinking of using the bitmapcaching functionality which should offload a bunch of things to the GPU.

However, I can't seem to get it to work. My host page contains the correct params (I think?):

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">         <param name="EnableCacheVisualization" value="true" />         <param name="EnableGPUAcceleration" value="true" />         <param name="EnableFramerateCounter" value="true" />       <param name="source" value="ClientBin/BitmapCaching.xap"/>       <param name="onError" value="onSilverlightError" />       <param name="background" value="white" />       <param name="minRuntimeVersion" value="5.0.61118.0" />       <param name="autoUpgrade" value="true" />       <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none">           <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>       </a>     </object> 

And my xaml should enable caching as well:

<UserControl x:Class="BitmapCaching.MainPage"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     mc:Ignorable="d"     d:DesignHeight="300" d:DesignWidth="400">      <Grid x:Name="LayoutRoot" Background="White" CacheMode="BitmapCache">         <Rectangle x:Name="img" Width="200" Height="200" Stroke="Black">             <Rectangle.Fill>                 <ImageBrush ImageSource="/BitmapCaching;component/download.jpg" />             </Rectangle.Fill>             <Rectangle.RenderTransform>                 <RotateTransform />             </Rectangle.RenderTransform>         </Rectangle>         <Button Content="Scale" Height="40" Width="100" Click="Button_Click" />     </Grid> </UserControl> 

(yes, I know it's not smart to put the cachemode on the root element)

However, when I launch the application, The complete application shows up with a red tinted overlay. This should indicate that there's nothing being cached.

I've read that you need a recent driver for your GFX card, but that should be fine. This machine has an ATI Radeon HD5450 videocard with recent drivers. I can't imagine that's not enough?

I'm stumped. If anyone knows how to solve this, please, save me from going insane!

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog