History log of /frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
28508735a5fb6527d3e87adffe6359cd4ab51a98 30-Nov-2017 Jerome Gaillard <jgaillard@google.com> nativeGetAllocationByteCount should return a positive int

Make sure Bitmap_Delegate.nativeGetAllocationByteCount always returns a
positive integer by returning Integer.MAX_VALUE if the the size of the
picture overflows the int. That is to prevent an exception coming from
passing a negative value to NativeAllocationRegistry.
The result is only passed to NativeAllocationRegistry that registers at
most Integer.MAX_VALUE, so that has no impact in layoutlib.

Test: layoutlib tests
Change-Id: I1e637a92df161c341a6ba07cbbe98bac6ec96fcd
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
6c050fc5ebba61fe6857b598a89fa9e9bc30aac2 10-Apr-2017 Jerome Gaillard <jgaillard@google.com> Update Bitmap_Delegate following Change I0092fe44

Test: Layoutlib tests
Change-Id: I3b1cfb460a6b7ccd6b63bd53194383154a68591c
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
ce2fcba587558e22a3f407b5ed07fcf97f091d41 08-Mar-2017 Jerome Gaillard <jgaillard@google.com> Ignore native color spaces following Change I0164a18f

Test: layoutlib tests
Change-Id: I2fc2f13621524142d00fb86c45e75ecdb250479a
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
0cd6c5b6bcaea7216a444a2729b728846878922e 02-Feb-2017 Diego Perez <diegoperez@google.com> Update native delegates

After changes 9ff994d98846, 6e3658a63843 and 18e9f9f37783
Test: Existing layoutlib tests

Change-Id: I8e39f26ccb0a8cb73a724f16734e66cf95c08656
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
6d60df19df21854a555f76ab46d73fa43a9af43f 04-Jan-2017 Jerome Gaillard <jgaillard@google.com> Implement delegate for new native method from Bitmap

The method Bitmap.nativeCopyPreserveInternalConfig was introduced by
Change Ic128dfed.

Test: Run layoutlib tests
Change-Id: I13da7deece9eb1d0d3e6a42203522fcf0b332ba9
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
7fa71f524c86d6224fb95b571d3a9e32edb32f22 11-Nov-2016 Jerome Gaillard <jgaillard@google.com> Rename native methods that were changed in the platform

This is following commits f22859757b, 94931bd87e, 4387190d8e
and caa08ff5e9.

Test: Run TestDelegates
Change-Id: If90028492c036fc5f69913e4dcad5a1a5fca4b55
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
a6897f8507f92267facb6cfe3f53989de35d2d62 26-Oct-2016 Diego Perez <diegoperez@google.com> Remove use of refSkPixelRef

Test: refactoring, existing tests pass
Change-Id: I4ea51f25b3a2e4cb6a3391d059fb1f0b74f0e90d
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
7b925a5e208edbbfe8d6ead8daa8999709a5dcba 29-Sep-2016 Romain Guy <romainguy@google.com> Linear blending, step 1

NOTE: Linear blending is currently disabled in this CL as the
feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
to disable linear blending. This is only for GLES 2.0 GPUs
with no hardware sRGB support. This flag is currently assumed
to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
of the source pixel. The asumption is that a bright pixel will be
blended on a dark background and the other way around. The source
alpha is gamma corrected to thicken dark on bright and thin
bright on dark to match the intended design of fonts. This also
matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
could not be sampled in sRGB without a yet-to-be-defined GL
extension
- The last column of color matrices is converted to linear space
because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
c6ab3686a244dfc9b05d281c6998652fcc115ce1 30-Sep-2016 sergeyv <sergeyv@google.com> Make bitmap backed by native memory instead of java byte array
Test: refactoring CL. Existing unit tests still pass.
bug:27762775

Change-Id: Ic4e914b3a941c3d545f8ce9e320e638973df0e91
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
74065acbaf49f180d061262237e70b92f339bf89 22-Apr-2016 Diego Perez <diegoperez@google.com> Add missing delegate in Bitmap_Delegate

New nativeCopyAshmemConfig

Change-Id: I8aedb0df827ac8d8091a9457bc341c1047b5a539
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
42b832b6c5d5bc57886626949f3ed9a219a5f800 14-Mar-2016 Diego Perez <diegoperez@google.com> Do not deallocate on Bitmap.recycle

Layoutlib only disposes the bitmap and doesn't recycle them. This causes
a double deallocation that triggers an assertion.
This change makes Bitmaps to be only freed when the finalizer is called.

Bug: http://b.android.com/203129
Change-Id: Ieabc1443544cfd2b4bf8ba9c8f9a4df8dd6e8220
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
fbe158f5e1f77cea2a335834a1c91fea1c4680aa 07-Oct-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib fixes for N

Moves LayoutLib to Java 8 - YAY!
Fix delegates

Change-Id: I098996e43e330e995d33f12df1c16355bbc02f0f
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
442aee6bc1abfb143dcfa1ba60d696e576d066c4 22-May-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Change nullity annotations.

Switch from using tools nullity annotations (com.android.annotations)
to android framework annotations (android.annotation).

A new sdk-common prebuilt is required for LayoutLib tests. The new
sdk-common requires an updated tools-common. The updated tools-common
doesn't have nullity annotations. So, instead of adding the annotation
dependency, just reuse the platform ones. This also paves the way to
include other platform annotations like IdRes etc.

Change-Id: I87b8f767d3681d914abe7d1329e26a87f49f50a7
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
b8275ed6b07d9a4568faee675101651710f8efc0 22-May-2015 Deepanshu Gupta <deepanshu@google.com> Add LayoutLibDelegate for new Bitmap method.

Original method added in: 721ae5fec5f1fd4f93aa2a361a0ac298e15ce353

Change-Id: Ie14d132459638cf103c390fae3f4c0c02bef2f34
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
9fe7fca9bcdceade9c654c6a8dcf0c48be16d78d 12-May-2015 Deepanshu Gupta <deepanshu@google.com> Add missing delegates for M preview.

- Remove ICU dependency (use the version bundled with platform).
- Restructure intelliJ project to move dependencies to module.
- Minor fixes to layoutlib tests.

TODO:
- Load ICU data.
- Hyphenator doesn't work.
- High quality line breaker not present.

Change-Id: I965e096e17bfc97ee995a649c3f4f6f64bb4f70d
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
bb3b0b6a5819e5d92f841fc5f2eb90743ffc9bcb 05-Mar-2015 John Reck <jreck@google.com> Cleanup Bitmap JNI attempt #2

Original version missed a spot

This reverts commit c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.

Change-Id: I56244ce10d709fcdef42a001fe4c6ba7b6bbb04d
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
c8460df6228766eaf9f1f6e15994f9ba84910a4d 04-Nov-2014 Deepanshu Gupta <deepanshu@google.com> Remove needlessly thrown IOException.

Change-Id: If34986367554c98f96f6f9a1088f5e25077a1be1
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
eeb44a29846ac0d36a1fad1b6869e932d1dc01ce 10-Jul-2014 Deepanshu Gupta <deepanshu@google.com> Update delegates

Change-Id: Icd93c31b4e8c8ee5ea242fb8295578937f48ff2a
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
f587825e94af5200aadc77a86e9f5084ac1a4e94 26-Jun-2014 Deepanshu Gupta <deepanshu@google.com> Update LayoutLib delegates.

Change-Id: I64828bfb963048effbc49a622f5f2aa0203665e6
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
cd0ed56f8a5f7788bcff050ab8aa42b0504e8535 29-Jan-2014 Deepanshu Gupta <deepanshu@google.com> Fix native method signatures

Some new methods have been added which are yet to be implemented.

Change-Id: Ie5a0657c7ccbe95200c270d5c15b516a385b083b
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
69fea4897f756b9cf489a92b7073554086e6d252 27-Jan-2014 Deepanshu Gupta <deepanshu@google.com> Manual merge of changes from klp-dev

Manually merged the following changes from klp-dev branch and fixed
merge conflicts:
78cfdf31b7c48589ea3a148ec1d6d573235bc06b
d0581d271e814670d81a6550aa7b1e86864d5710
1f92d7fc0ffa72d7db93244c29a1a6575bb4b318
0baec410c29206dc72d9f5afba5d45827e62c00c
24541255c312ee34f9bf17eb5852cdffd4807065

Change-Id: I426729bb90a26746bfff3a0e4a03ea9f37972528
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
ec4118922fa844ef31b73d16adc76f4da4c6c8e6 27-Jan-2014 Narayan Kamath <narayan@google.com> Track 64bit changes to android/graphics.

All pointers are now 64bits wide, so should be
represented as java longs and not ints.

Also changed DelegateManager and SparseWeakArray to
reflect the new world order.

Change-Id: Ic32b6b53818dbae9b949f03004c4fb6dae26cdbe
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
835e279c3960664c32b35aa7e3215b13c8fa3be4 09-Sep-2013 Deepanshu Gupta <deepanshu@google.com> Add isPremultiplied option to Bitmap_Delegate in LayoutLib

Change-Id: I2398af48913682ec698389b695aa256204c8aa47
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
ab775ecdd189b32e35b0d3f4a821502f88b03a4b 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java