summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib/bridge/src/android/graphics
Commit message (Collapse)AuthorAgeFilesLines
...
| * Switch from FloatMath -> Math and Math.hypot where possibleNeil Fuller2014-10-012-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation is an API change: FloatMath is going to be deprecated and/or removed. Performance is not the goal of this change. That said... Math is faster than FloatMath with AOT compilation. While making the change, occurances of: {Float}Math.sqrt(x * x + y * y) and {Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2)) have been replaced with: {(float)} Math.hypot(x, y) Right now there is no runtime intrinsic for hypot so is not faster in all cases for AOT compilation: Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with AOT, but all other combinations of FloatMath, use of pow() etc. are slower than hypot(). hypot() has the advantage of being self documenting and could be optimized in future. None of the behavior differences around NaN and rounding appear to be important for the cases looked at: they all assume results and arguments are in range and usually the results are cast to float. Different implementations measured on hammerhead / L: AOT compiled: [FloatMath.hypot(x, y)] benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials [FloatMath.sqrt(x*x + y*y)] benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials [FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))] benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials [(float) Math.hypot(x, y)] benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials [(float) Math.sqrt(x*x + y*y)] benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials [(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))] benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials Interpreter: benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials Bug: https://code.google.com/p/android/issues/detail?id=36199 Change-Id: I06c91f682095e627cb547d60d936ef87941be692
| * Optimize Blend composites.Deepanshu Gupta2014-07-071-147/+136
| | | | | | | | | | | | | | Removed redundant array allocations to improve performance for various blending modes. Change-Id: Iaba1d6ff3ad03eebdc859c599b610cc593370438
| * Add BlendComposite.javaDeepanshu Gupta2014-07-071-0/+772
| | | | | | | | | | | | | | | | The class is adapted from a demo tool for Blending Modes written by Romain Guy (romainguy@android.com). The tool is available at http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/ Change-Id: I8f7c7ca08d3078106056764a4e2f1ce95d990137
| * resolved conflicts for merge of c76345a3 to klp-dev-plus-aospDeepanshu Gupta2014-03-121-4/+4
| |\ | | | | | | | | | Change-Id: I54e14e1c6cd53cd10b38b34cf31989a2aa487b83
| | * Fix the delegate method signatures in LayoutLibDeepanshu Gupta2014-03-054-92/+24
| | | | | | | | | | | | Change-Id: I262c285c1047958afdb024724959d5afb3552802
| * | resolved conflicts for merge of cb7cdd50 to klp-dev-plus-aospBrian Carlstrom2014-03-063-3/+3
| |\ \ | | |/ | | | | | | Change-Id: Iba01a6617d4922ec2827b0465095695028c20681
| * | am 55542ee6: am 3e637042: Merge "Set default text style in layoutlib as ↵Xavier Ducrohet2014-02-201-0/+3
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | NORMAL [DO NOT MERGE]" into klp-dev * commit '55542ee6449bd580f61bc005726b5c87773fbe25': Set default text style in layoutlib as NORMAL [DO NOT MERGE]
| | * | Set default text style in layoutlib as NORMAL [DO NOT MERGE]Deepanshu Gupta2014-02-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a style doesn't specify text style (normal/bold/italic/bold-italic) then default to normal instead of throwing an error. Bug: http://b.android.com/61358 Change-Id: I0138c73807a5ff6e4d938a99ece3044333110aa1 (cherry picked from commit 0acfb16dcd95468fe032204f54618e86becfd1eb)
* | | | LayoutLib: support font weights.Deepanshu Gupta2014-09-103-60/+166
| | | | | | | | | | | | | | | | | | | | | | | | Also fixes a shader delegate method. Change-Id: I86be80ab55d04760084d5bf39235f2ee4de7be23
* | | | Whitelist fonts instead of blacklist.Deepanshu Gupta2014-08-121-16/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A list of all fonts bundled with the SDK is generated. Load this file to know which fonts are missing from the SDK. Change-Id: I1554f1baec842ccdde3b21a93008437e9bac9353
* | | | Don't show warnings for fonts not bundled.Deepanshu Gupta2014-08-114-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extended font set, used on Nexus 5, new Nexus 7 etc., uses OpenType CFF fonts which don't work well with Java. These fonts are deliberately excluded from the SDK build. This change skips the warnings for the missing fonts. However, we still show warnings for other fonts that failed to load. If the set of fonts bundled with the SDK changes, we will need to update the list of missing fonts in FontFamily_Delegate.java. Change-Id: I3197b5350d048daa09512e8024188909179b1799
* | | | Skip loading otf fonts on Java 6Deepanshu Gupta2014-08-052-3/+29
| | | | | | | | | | | | | | | | Change-Id: I9668b84812e9be333d10603657dd911024fc292d
* | | | Fix DelegatesDeepanshu Gupta2014-08-044-78/+31
| | | | | | | | | | | | | | | | Change-Id: I2b6a6b679b7a5b2532b76b723155bc2763b70768
* | | | Fix missing initial moveto in path definition.Deepanshu Gupta2014-07-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Path_Delegate was missing a moveTo call which resulted in IllegalPathStateException when rendering the ProgressBar. Change-Id: Ibdae5f90ffd0a71a3de4ba945238239faa0b18b2
* | | | Use BlendComposite for advanced PorterDuff Modes. [DO NOT MERGE]Deepanshu Gupta2014-07-163-63/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all PorterDuff modes are supported by Java's AlphaComposite. Use BlendComposite for such modes. Change-Id: I51486a40f09186cf8a87ce1e6a3d1cfcf39fb2d3 (cherry picked from commit b15709cd36d28c47660b0ae30918642bfd3d85f7)
* | | | Optimize Blend composites. [DO NOT MERGE]Deepanshu Gupta2014-07-161-147/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed redundant array allocations to improve performance for various blending modes. Change-Id: Iaba1d6ff3ad03eebdc859c599b610cc593370438 (cherry picked from commit 9ce074610413ce3a5dd0cef9295f0ae9061402b7)
* | | | Add BlendComposite.java [DO NOT MERGE]Deepanshu Gupta2014-07-161-0/+772
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The class is adapted from a demo tool for Blending Modes written by Romain Guy (romainguy@android.com). The tool is available at http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/ Change-Id: I8f7c7ca08d3078106056764a4e2f1ce95d990137 (cherry picked from commit 882e08759137a77090c3c7dff8cba425a3393474)
* | | | Update delegatesDeepanshu Gupta2014-07-112-62/+28
| | | | | | | | | | | | | | | | Change-Id: Icd93c31b4e8c8ee5ea242fb8295578937f48ff2a
* | | | am bdf7f8b0: Merge "Support Typeface.createFromFile()" into lmp-preview-devDeepanshu Gupta2014-07-022-47/+80
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | * commit 'bdf7f8b009ca9f276b5368a1cea037c1605f7261': Support Typeface.createFromFile()
| * | | | Support Typeface.createFromFile()Deepanshu Gupta2014-07-012-47/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for Typeface.createFromFile() for platform fonts. The feature existed in the KitKat LayoutLib but was dropped for the L preview. This change adds it back. Change-Id: Ib1abe67a32c28a1fb0e2a4f3061c358b55129434
* | | | | Update text rendering delegates.Deepanshu Gupta2014-07-013-85/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flags for RTL and LTR are simplified in commit 0a1d91862a3822dcbbb412bcd6d69b0f5f079f8b. This change follows up the same in LayoutLib. This also fixes the following bug which incorrectly computed runs with 'en-dash' (\u20132) as RTL. Bug: http://b.android.com/69432 Change-Id: Iaed62d13ce31f107773576ed2ef412be6037cd04
* | | | | Sort delegates in Canvas_DelegateDeepanshu Gupta2014-07-011-143/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The order of the methods match the order of the declaration in the Canvas file. This makes searching for the methods easier. Change-Id: I230621d3999024cb2ff42a1aacd60908c7f0b161
* | | | | Update LayoutLib delegates.Deepanshu Gupta2014-07-013-157/+82
| | | | | | | | | | | | | | | | | | | | Change-Id: I64828bfb963048effbc49a622f5f2aa0203665e6
* | | | | am ac626a67: Merge "Improve PorterDuff support." into lmp-preview-devDeepanshu Gupta2014-06-251-33/+50
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * commit 'ac626a6724bc239fcf3d5b2e207de02c59595c5a': Improve PorterDuff support.
| * | | | Improve PorterDuff support.Deepanshu Gupta2014-06-241-33/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Don't cache the src image used for applying the filter. The filter delegate is not always cleared. This probably results in slighly slower rendering, but doesn't run Studio out of memory. 2. Support more PorterDuff modes. 3. Fix a bug where the alpha was applied twice and thus the filter had less effect than it should have had. Change-Id: I2a481a64ba7f1ff8e9683bbc46ae110433e82ebc
* | | | | am 699f7221: Merge "Temporarily change PorterDuff mode MULTIPLY to SRC_IN" ↵Deepanshu Gupta2014-06-241-0/+5
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | into lmp-preview-dev * commit '699f7221dc0719b1ceb03a03183dc742a5bcdf3c': Temporarily change PorterDuff mode MULTIPLY to SRC_IN
| * | | | Temporarily change PorterDuff mode MULTIPLY to SRC_INDeepanshu Gupta2014-06-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overflow pop up dialog for action bar uses PorterDuff color filters in mode SRC_IN. The mode is not supported by AlphaComposite currently. So, in order to render something, we swap it out with SRC_IN. Change-Id: I987e101728ecb76b5e3d5cd91f831e6f63a4321f
* | | | | am 3a812f47: Merge "Fix NPE in Ninepatch creation." into lmp-preview-devDeepanshu Gupta2014-06-241-8/+11
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * commit '3a812f4755015a7384a8d28bbdeca445c87598b3': Fix NPE in Ninepatch creation.
| * | | | Fix NPE in Ninepatch creation.Deepanshu Gupta2014-06-231-8/+11
| | | | | | | | | | | | | | | | | | | | Change-Id: Icead69cd8503e90aeb54ff42f9ec297e7af2b518
* | | | | am e558d180: Merge "LayoutLib: Support PorterDuffColorFilter" into ↵Deepanshu Gupta2014-06-247-79/+108
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | lmp-preview-dev * commit 'e558d1806b29385aa14ba60f18e103e2c9aeef1b': LayoutLib: Support PorterDuffColorFilter
| * | | | LayoutLib: Support PorterDuffColorFilterDeepanshu Gupta2014-06-227-79/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for select modes for PorterDuffColorFilter. Change-Id: Ia7b4a6a92c326be977dd87a70f54c1f8954b546d
* | | | | am 3daec197: Merge "LayoutLib: Better support for compact/elegant fonts." ↵Deepanshu Gupta2014-06-212-13/+31
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | into lmp-preview-dev * commit '3daec1972493c1e867c6cac7f4a2a43a157d52b9': LayoutLib: Better support for compact/elegant fonts.
| * | | | LayoutLib: Better support for compact/elegant fonts.Deepanshu Gupta2014-06-122-13/+31
| | | | | | | | | | | | | | | | | | | | Change-Id: I67439924bc6323490ea0c7d7864985b400906f8c
* | | | | am ee001119: Merge "LayoutLib: Add assertions for typeface." into ↵Deepanshu Gupta2014-06-052-7/+22
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | lmp-preview-dev * commit 'ee0011198ff150f972c8afbc5dff695bce2af1f1': LayoutLib: Add assertions for typeface.
| * | | | LayoutLib: Add assertions for typeface.Deepanshu Gupta2014-06-052-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Framework passes typeface along with the paint object at many places. Paint_Delegate is supposed to have the typeface object with it. Add assertions to ensure that the two typefaces are indeed the same. Change-Id: I68193513c2d99f269c0458d6493f23025bbda385
* | | | | am 242dded6: Merge "LayoutLib: Font variants" into lmp-preview-devDeepanshu Gupta2014-06-053-54/+73
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * commit '242dded6e8b7e5851ad7b80a0c05e4883d2a9f42': LayoutLib: Font variants
| * | | | LayoutLib: Font variantsDeepanshu Gupta2014-06-053-54/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update to support font variants properly. Change-Id: Iabe37babd9ddce80a9ba9eca7e0e5a0ffb090646
* | | | | Merge "Add a native Canvas wrapper."Florin Malita2014-06-021-14/+14
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Add a native Canvas wrapper.Florin Malita2014-05-301-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of storing a direct SkCanvas reference, Canvas now tracks an opaque native wrapper class. The native wrapper can be used to store additional info for emulating deprecated Skia features (at this point it only stores a canvas). Some notes: * all native handle -> SkCanvas conversions are routed through a handful of native utility methods. * safeCanvasSwap() refactored as a lower level setNativeBitmp() - which is what clients need. * removed unused get_thread_msec() (Canvas.cpp) Change-Id: I715a5a6f1e1621c1cfc1e510ae4f2ea15cf11114
| * | | | Layoutlib fixes for LDeepanshu Gupta2014-05-226-190/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the new delegates that were missing. This starts the work on changes related to Minikin Fonts. There are some changes related to TypedArray that still need to be fixed. Change-Id: Ic2397b64aa3f1f48926e849b14689c47d9ee7f8c
* | | | | Merge "Layoutlib: Fix FontFamily_Delegate use after unref" into lmp-preview-devDeepanshu Gupta2014-05-292-6/+10
|\ \ \ \ \
| * | | | | Layoutlib: Fix FontFamily_Delegate use after unrefDeepanshu Gupta2014-05-282-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FontFamily_Delegate was being reused after the nUnref call. The issue is fixed by storing the reference to the FontFamily_Delegate directly in the Typeface_Delegate rather than storing the native pointer. Change-Id: I0db724a83c4be3d7b64ccba0989cd64129f2a785
* | | | | | Merge "Update delegates" into lmp-preview-devDeepanshu Gupta2014-05-296-67/+2
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Update delegatesDeepanshu Gupta2014-05-286-67/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update layoutlib delegates in response to commit a631a36de986acea2ef6fdfbaf3441a28b914b15 Change-Id: I897a7e3a61286bfae9054415d555febe16410106
* | | | | Layoutlib fixes for L [DO NOT MERGE]Deepanshu Gupta2014-05-276-190/+349
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the new delegates that were missing. This starts the work on changes related to Minikin Fonts. There are some changes related to TypedArray that still need to be fixed. Change-Id: Ic2397b64aa3f1f48926e849b14689c47d9ee7f8c (cherry picked from commit 7ca3612094270183243938e79337c84effea7ad0)
* | | | Layoutlib: Update delegates for LDeepanshu Gupta2014-05-153-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | Update delegate method signatures for L. Change-Id: Ie607293bcae60b2d3a61d1cad3ac5f04bda2a238
* | | | Encapsulate Canvas.mNativeCanvasFlorin Malita2014-05-061-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the native canvas is accessed/manipulated from several unrelated classes. In order to facilitate SaveFlags emulation, this CL encapsulates the field and refactors its external users. Two main changes: * new getNativeCanvas() getter for use in Java-level clients. * JNI canvas swappers (GraphicsBuffers, Surface, TextureView & AssetAtlasService) are refactored based on the exising/equivalent safeCanvasSwap() Canvas method. Change-Id: I966bd4898f0838fb3699e226d3d3d51e0224ea97
* | | | Update Matrix_Delegate native methods.Deepanshu Gupta2014-04-211-124/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the Matrix_Delegate native methods in layoutlib. The original change is I5cdcea827ebff587df0bbddc0965e3e0fbf48002. Change-Id: I2c94741fdaeb0c2279caefee0188f432267bb37d
* | | | Add isElegantHeight to LayoutlibDeepanshu Gupta2014-04-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Add the native stub methods for isElegantHeight in Paint. Change-Id: Iaddde36528fb452e5a150ab35687da781091d14c
* | | | Add native method delegates to layoutlibDeepanshu Gupta2014-03-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add delegates for Path.native_isConvex and ICU.getCurrencyNumericCode. The original methods were added in 5be83edd15e11420287cc0af93a95d5a6dfae68f and d627bd4525e41b0503f94c2887c3e01618c73105 respectively. TODO: Implement Path_Delegate.native_isConvex Change-Id: If1046467d3950ab6955c6b81383a60fd6bd03fd2