diff options
author | Chris Craik <ccraik@google.com> | 2014-08-14 17:26:21 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-08-15 00:41:09 +0000 |
commit | 47d86230823de5d372688dff2b6e363a607009a8 (patch) | |
tree | 206ec39f118a5b89ba42cfc3b4c318ea6b8da616 /tools/aapt | |
parent | 1e1a01b0e44ab7a948265a78070937d2022d7abd (diff) | |
download | frameworks_base-47d86230823de5d372688dff2b6e363a607009a8.zip frameworks_base-47d86230823de5d372688dff2b6e363a607009a8.tar.gz frameworks_base-47d86230823de5d372688dff2b6e363a607009a8.tar.bz2 |
Fix nine patch outline radius computation
bug:16852714
Change-Id: I475154c0f324fd2e2c8991415e0d8240c75663d8
Diffstat (limited to 'tools/aapt')
-rw-r--r-- | tools/aapt/Images.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp index cf3dd0a..137c85c 100644 --- a/tools/aapt/Images.cpp +++ b/tools/aapt/Images.cpp @@ -485,9 +485,13 @@ static void get_outline(image_info* image) find_max_opacity(image->rows, innerStartX, innerStartY, innerMidX, innerMidY, 1, 1, &diagonalInset); - // Determine source radius based upon inset - // radius = 1 / (sqrt(2) - 1) * inset - image->outlineRadius = 2.4142f * diagonalInset; + /* Determine source radius based upon inset: + * sqrt(r^2 + r^2) = sqrt(i^2 + i^2) + r + * sqrt(2) * r = sqrt(2) * i + r + * (sqrt(2) - 1) * r = sqrt(2) * i + * r = sqrt(2) / (sqrt(2) - 1) * i + */ + image->outlineRadius = 3.4142f * diagonalInset; NOISY(printf("outline insets %d %d %d %d, rad %f, alpha %x\n", image->outlineInsetsLeft, |