From 106fd13da17c61551f47c21ad2f796a0f2936f47 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 24 Apr 2019 12:56:23 +0200 Subject: [PATCH] [platform] JNA 5.3.0 GitOrigin-RevId: 7b283fad91647a7389344d78a63af54718520c46 --- .idea/libraries/jna.xml | 10 ++++---- .../build/CommunityLibraryLicenses.groovy | 2 +- .../intellij/ui/picker/MacColorPipette.java | 24 ++++--------------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.idea/libraries/jna.xml b/.idea/libraries/jna.xml index f349847f4d4f..a6880c33a2ff 100644 --- a/.idea/libraries/jna.xml +++ b/.idea/libraries/jna.xml @@ -1,14 +1,14 @@ - + - - + + - - + + \ No newline at end of file diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy index 559a326a75b8..12199cf6225c 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy @@ -292,7 +292,7 @@ class CommunityLibraryLicenses { licenseUrl: "https://opensource.org/licenses/bsd-license.html"), new LibraryLicense(name: "jgraphx", libraryName: "jgraphx", version: "3.4.1.3", license: "BSD", url: "https://github.com/jgraph/jgraphx"), - new LibraryLicense(name: "JNA", libraryName: "jna", version: "4.5.0", license: "LGPL 2.1", + new LibraryLicense(name: "JNA", libraryName: "jna", version: "5.3.0", license: "LGPL 2.1", url: "https://github.com/java-native-access/jna", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1.php"), new LibraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.53", license: "BSD", url: "http://www.jcraft.com/jsch/", diff --git a/platform/platform-impl/src/com/intellij/ui/picker/MacColorPipette.java b/platform/platform-impl/src/com/intellij/ui/picker/MacColorPipette.java index 932c37455d6e..28e4cd0dd3b9 100644 --- a/platform/platform-impl/src/com/intellij/ui/picker/MacColorPipette.java +++ b/platform/platform-impl/src/com/intellij/ui/picker/MacColorPipette.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.picker; import com.intellij.openapi.diagnostic.Logger; @@ -25,7 +11,7 @@ import com.intellij.ui.mac.foundation.ID; import com.intellij.ui.mac.foundation.MacUtil; import com.intellij.util.BitUtil; import com.intellij.util.ui.UIUtil; -import com.sun.jna.Native; +import com.sun.jna.Pointer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -135,7 +121,7 @@ public class MacColorPipette extends ColorPipetteBase { pickerDialog.add(label); pickerDialog.setSize(DIALOG_SIZE, DIALOG_SIZE); pickerDialog.setBackground(myTransparentColor); - + BufferedImage emptyImage = UIUtil.createImage(pickerDialog, 1, 1, Transparency.TRANSLUCENT); pickerDialog.setCursor(myParent.getToolkit().createCustomCursor(emptyImage, new Point(0, 0), "ColorPicker")); } @@ -158,7 +144,7 @@ public class MacColorPipette extends ColorPipetteBase { int width = SIZE / 2; int height = SIZE / 8; graphics.fillRoundRect(x, y, width, height, 10, 10); - + graphics.setColor(Gray._255); String colorString = currentColor.getRed() + " " + currentColor.getGreen() + " " + currentColor.getBlue(); FontMetrics metrics = graphics.getFontMetrics(); @@ -211,7 +197,7 @@ public class MacColorPipette extends ColorPipetteBase { ID data = Foundation.invoke(nsImage, "TIFFRepresentation"); ID bytes = Foundation.invoke(data, "bytes"); ID length = Foundation.invoke(data, "length"); - ByteBuffer byteBuffer = Native.getDirectByteBuffer(bytes.longValue(), length.longValue()); + ByteBuffer byteBuffer = new Pointer(bytes.longValue()).getByteBuffer(0, length.longValue()); Foundation.invoke(nsImage, "release"); byte[] b = new byte[byteBuffer.remaining()]; byteBuffer.get(b);