You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2013/04/27 09:04:07 UTC

Can someone test if this patch fixes FLEX-33523

Hi,

Here a patch to BitmapImage that mean it scales correctly (based on runtimeDPI/applicationDPI) multSourceBitmaps that are repeated or cropped.

(see https://issues.apache.org/jira/browse/FLEX-33523 for more info).

@@ -221,6 +221,7 @@ public class BitmapImage extends GraphicElement
     private var previousUnscaledHeight:Number;
     private var sourceInvalid:Boolean;
     private var loadFailed:Boolean;
+       private var dpiScale:Number = 1;
 
     //----------------------------------
     //  bitmapData
@@ -949,7 +950,6 @@ public class BitmapImage extends GraphicElement
      */
     override protected function measure():void
     {
-        var dpiScale:Number = 1;
         var app:Object = FlexGlobals.topLevelApplication;
         if ("applicationDPI" in app && "runtimeDPI" in app && source is MultiDPIBitmapSource)
             dpiScale = app.runtimeDPI / app.applicationDPI;
@@ -1107,8 +1107,8 @@ public class BitmapImage extends GraphicElement
 
         g.lineStyle();
         var repeatBitmap:Boolean = false;
-        var fillScaleX:Number = 1;
-        var fillScaleY:Number = 1;
+        var fillScaleX:Number = 1/dpiScale;
+        var fillScaleY:Number = 1/dpiScale;
         var roundedDrawX:Number = Math.round(drawX);
         var roundedDrawY:Number = Math.round(drawY);
         var fillWidth:Number = adjustedWidth;

Anyone see anything there might have side effects?

Thanks,
Justin

Re: Can someone test if this patch fixes FLEX-33523

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Has this been committed already?  
No it's not been committed. 

I've check it in a simple test I have (and it fixes the issue) but not run mustella tests or done any other testing.

I didn't want to check something in that could have the potential to break suff badly.

There also seem to be a bit of duplication with the mx_internal method densityScale in SystemManger and the code in BitmapImage not sure if that needs to be resolved as well.

Thanks,
Justin

Re: Can someone test if this patch fixes FLEX-33523

Posted by Nicholas Kwiatkowski <ni...@spoon.as>.
Has this been committed already?  If so, I can run it through some of my
"real world tests" and see if it effects anything.  Just looking at the
patch, it seems ok.

-Nick


On Sat, Apr 27, 2013 at 3:04 AM, Justin Mclean <ju...@classsoftware.com>wrote:

> Hi,
>
> Here a patch to BitmapImage that mean it scales correctly (based on
> runtimeDPI/applicationDPI) multSourceBitmaps that are repeated or cropped.
>
> (see https://issues.apache.org/jira/browse/FLEX-33523 for more info).
>
> @@ -221,6 +221,7 @@ public class BitmapImage extends GraphicElement
>      private var previousUnscaledHeight:Number;
>      private var sourceInvalid:Boolean;
>      private var loadFailed:Boolean;
> +       private var dpiScale:Number = 1;
>
>      //----------------------------------
>      //  bitmapData
> @@ -949,7 +950,6 @@ public class BitmapImage extends GraphicElement
>       */
>      override protected function measure():void
>      {
> -        var dpiScale:Number = 1;
>          var app:Object = FlexGlobals.topLevelApplication;
>          if ("applicationDPI" in app && "runtimeDPI" in app && source is
> MultiDPIBitmapSource)
>              dpiScale = app.runtimeDPI / app.applicationDPI;
> @@ -1107,8 +1107,8 @@ public class BitmapImage extends GraphicElement
>
>          g.lineStyle();
>          var repeatBitmap:Boolean = false;
> -        var fillScaleX:Number = 1;
> -        var fillScaleY:Number = 1;
> +        var fillScaleX:Number = 1/dpiScale;
> +        var fillScaleY:Number = 1/dpiScale;
>          var roundedDrawX:Number = Math.round(drawX);
>          var roundedDrawY:Number = Math.round(drawY);
>          var fillWidth:Number = adjustedWidth;
>
> Anyone see anything there might have side effects?
>
> Thanks,
> Justin