BREAKING - Change measure() api to remove need for MeasureOutput allocation
Summary: This is an API breaking change done to allow us to avoid an allocation during measurement. Instead we do the same trick as is done when passing measure results to C, we path them into a long. Reviewed By: splhack Differential Revision: D4081037 fbshipit-source-id: 28adbcdd160cbd3f59a0fdd4b9f1200ae18678f1
This commit is contained in:
committed by
Facebook Github Bot
parent
c34299edc9
commit
b59ce09109
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -11,7 +11,19 @@ namespace Facebook.CSSLayout
|
||||
{
|
||||
public class MeasureOutput
|
||||
{
|
||||
public float Width { get; set; }
|
||||
public float Height { get; set; }
|
||||
public static long Make(int width, int height)
|
||||
{
|
||||
return ((long) width) << 32 | ((long) height);
|
||||
}
|
||||
|
||||
public static int GetWidth(long measureOutput)
|
||||
{
|
||||
return (int) (0xFFFFFFFF & (measureOutput >> 32));
|
||||
}
|
||||
|
||||
public static int GetHeight(long measureOutput)
|
||||
{
|
||||
return (int) (0xFFFFFFFF & measureOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user