Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
ba804d16
Commit
ba804d16
authored
7 years ago
by
Alexey Kudravtsev
Browse files
Options
Download
Email Patches
Plain Diff
cleanup
parent
24fc5da5
Branches unavailable
Tags unavailable
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
platform/core-api/src/com/intellij/ui/LayeredIcon.java
+11
-15
platform/core-api/src/com/intellij/ui/LayeredIcon.java
platform/platform-impl/src/com/intellij/ide/actions/NonEmptyActionGroup.java
+1
-0
...mpl/src/com/intellij/ide/actions/NonEmptyActionGroup.java
platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java
+0
-6
...openapi/progress/impl/BackgroundableProcessIndicator.java
platform/util/src/com/intellij/openapi/util/IconLoader.java
+8
-9
platform/util/src/com/intellij/openapi/util/IconLoader.java
with
20 additions
and
30 deletions
+20
-30
platform/core-api/src/com/intellij/ui/LayeredIcon.java
+
11
-
15
View file @
ba804d16
...
...
@@ -18,6 +18,7 @@ package com.intellij.ui;
import
com.intellij.openapi.diagnostic.Logger
;
import
com.intellij.openapi.util.ScalableIcon
;
import
com.intellij.util.ArrayUtil
;
import
com.intellij.util.ui.JBUI
;
import
com.intellij.util.ui.JBUI.CachingScalableJBIcon
;
import
org.intellij.lang.annotations.MagicConstant
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -26,11 +27,6 @@ import javax.swing.*;
import
java.awt.*
;
import
java.util.Arrays
;
import
static
com
.
intellij
.
util
.
ui
.
JBUI
.
ScaleType
.
OBJ_SCALE
;
import
static
com
.
intellij
.
util
.
ui
.
JBUI
.
ScaleType
.
USR_SCALE
;
import
static
java
.
lang
.
Math
.
ceil
;
import
static
java
.
lang
.
Math
.
floor
;
public
class
LayeredIcon
extends
CachingScalableJBIcon
<
LayeredIcon
>
{
private
static
final
Logger
LOG
=
Logger
.
getInstance
(
"#com.intellij.ui.LayeredIcon"
);
private
final
Icon
[]
myIcons
;
...
...
@@ -46,7 +42,7 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
private
int
myHeight
;
{
getScaleContext
().
addUpdateListener
(
()
->
updateSize
()
);
getScaleContext
().
addUpdateListener
(
this
::
updateSize
);
setAutoUpdateScaleContext
(
false
);
}
...
...
@@ -233,8 +229,8 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
for
(
int
i
=
0
;
i
<
icons
.
length
;
i
++)
{
Icon
icon
=
icons
[
i
];
if
(
icon
==
null
||
myDisabledLayers
[
i
])
continue
;
int
xOffset
=
(
int
)
floor
(
x
+
scaleVal
(
myXShift
+
myHShifts
(
i
),
OBJ_SCALE
));
int
yOffset
=
(
int
)
floor
(
y
+
scaleVal
(
myYShift
+
myVShifts
(
i
),
OBJ_SCALE
));
int
xOffset
=
(
int
)
Math
.
floor
(
x
+
scaleVal
(
myXShift
+
myHShifts
(
i
),
JBUI
.
ScaleType
.
OBJ_SCALE
));
int
yOffset
=
(
int
)
Math
.
floor
(
y
+
scaleVal
(
myYShift
+
myVShifts
(
i
),
JBUI
.
ScaleType
.
OBJ_SCALE
));
icon
.
paintIcon
(
c
,
g
,
xOffset
,
yOffset
);
}
}
...
...
@@ -252,7 +248,7 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
getScaleContext
().
update
();
if
(
myWidth
<=
1
)
updateSize
();
return
(
int
)
ceil
(
scaleVal
(
myWidth
,
OBJ_SCALE
));
return
(
int
)
Math
.
ceil
(
scaleVal
(
myWidth
,
JBUI
.
ScaleType
.
OBJ_SCALE
));
}
@Override
...
...
@@ -260,15 +256,15 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
getScaleContext
().
update
();
if
(
myHeight
<=
1
)
updateSize
();
return
(
int
)
ceil
(
scaleVal
(
myHeight
,
OBJ_SCALE
));
return
(
int
)
Math
.
ceil
(
scaleVal
(
myHeight
,
JBUI
.
ScaleType
.
OBJ_SCALE
));
}
private
int
myHShifts
(
int
i
)
{
return
(
int
)
floor
(
scaleVal
(
myHShifts
[
i
],
USR_SCALE
));
return
(
int
)
Math
.
floor
(
scaleVal
(
myHShifts
[
i
],
JBUI
.
ScaleType
.
USR_SCALE
));
}
private
int
myVShifts
(
int
i
)
{
return
(
int
)
floor
(
scaleVal
(
myVShifts
[
i
],
USR_SCALE
));
return
(
int
)
Math
.
floor
(
scaleVal
(
myVShifts
[
i
],
JBUI
.
ScaleType
.
USR_SCALE
));
}
protected
void
updateSize
()
{
...
...
@@ -276,11 +272,11 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
int
maxX
=
Integer
.
MIN_VALUE
;
int
minY
=
Integer
.
MAX_VALUE
;
int
maxY
=
Integer
.
MIN_VALUE
;
boolean
hasNotNullIcons
=
fals
e
;
boolean
allIconsAreNull
=
tru
e
;
for
(
int
i
=
0
;
i
<
myIcons
.
length
;
i
++)
{
Icon
icon
=
myIcons
[
i
];
if
(
icon
==
null
)
continue
;
hasNotNullIcons
=
tru
e
;
allIconsAreNull
=
fals
e
;
int
hShift
=
myHShifts
(
i
);
int
vShift
=
myVShifts
(
i
);
minX
=
Math
.
min
(
minX
,
hShift
);
...
...
@@ -288,7 +284,7 @@ public class LayeredIcon extends CachingScalableJBIcon<LayeredIcon> {
minY
=
Math
.
min
(
minY
,
vShift
);
maxY
=
Math
.
max
(
maxY
,
vShift
+
icon
.
getIconHeight
());
}
if
(
!
hasNotNullIcons
)
return
;
if
(
allIconsAreNull
)
return
;
myWidth
=
maxX
-
minX
;
myHeight
=
maxY
-
minY
;
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/ide/actions/NonEmptyActionGroup.java
+
1
-
0
View file @
ba804d16
...
...
@@ -36,6 +36,7 @@ public class NonEmptyActionGroup extends DefaultActionGroup implements DumbAware
presentation
.
setVisible
(
getChildrenCount
()
>
0
);
}
@Override
public
boolean
hideIfNoVisibleChildren
()
{
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java
+
0
-
6
View file @
ba804d16
...
...
@@ -32,8 +32,6 @@ import org.jetbrains.annotations.Nullable;
public
class
BackgroundableProcessIndicator
extends
ProgressWindow
{
protected
StatusBarEx
myStatusBar
;
@SuppressWarnings
({
"FieldAccessedSynchronizedAndUnsynchronized"
})
private
PerformInBackgroundOption
myOption
;
private
TaskInfo
myInfo
;
...
...
@@ -51,10 +49,6 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
public
void
enteredDumbMode
()
{
cancel
();
}
@Override
public
void
exitDumbMode
()
{
}
});
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/util/src/com/intellij/openapi/util/IconLoader.java
+
8
-
9
View file @
ba804d16
...
...
@@ -78,7 +78,7 @@ public final class IconLoader {
private
IconLoader
()
{
}
public
static
void
installPathPatcher
(
IconPathPatcher
patcher
)
{
public
static
void
installPathPatcher
(
@NotNull
IconPathPatcher
patcher
)
{
ourPatchers
.
add
(
patcher
);
clearCache
();
}
...
...
@@ -346,7 +346,6 @@ public final class IconLoader {
public
static
Icon
getTransparentIcon
(
@NotNull
final
Icon
icon
,
final
float
alpha
)
{
return
new
RetrievableIcon
()
{
@Nullable
@Override
public
Icon
retrieveIcon
()
{
return
icon
;
...
...
@@ -396,7 +395,7 @@ public final class IconLoader {
icon
=
((
LazyIcon
)
icon
).
getOrComputeIcon
();
}
if
(
icon
instanceof
CachedImageIcon
)
{
Image
img
=
((
CachedImageIcon
)
icon
).
loadFromUrl
(
ScaleContext
.
create
(
USR_SCALE
.
of
(
1
d
),
SYS_SCALE
.
of
(
1
d
)));
Image
img
=
((
CachedImageIcon
)
icon
).
loadFromUrl
(
ScaleContext
.
create
(
USR_SCALE
.
of
(
1
),
SYS_SCALE
.
of
(
1
)));
if
(
img
!=
null
)
{
icon
=
new
ImageIcon
(
img
);
}
...
...
@@ -412,7 +411,7 @@ public final class IconLoader {
private
URL
myUrl
;
private
volatile
boolean
dark
;
private
volatile
int
numberOfPatchers
=
ourPatchers
.
size
();
private
boolean
svg
;
private
final
boolean
svg
;
private
boolean
useCacheOnLoad
=
true
;
private
ImageFilter
[]
myFilters
;
...
...
@@ -436,7 +435,7 @@ public final class IconLoader {
dark
=
icon
.
dark
;
numberOfPatchers
=
icon
.
numberOfPatchers
;
myFilters
=
icon
.
myFilters
;
svg
=
myOriginalPath
!=
null
?
myOriginalPath
.
toLowerCase
().
endsWith
(
"svg"
)
:
false
;
svg
=
myOriginalPath
!=
null
&&
myOriginalPath
.
toLowerCase
().
endsWith
(
"svg"
);
useCacheOnLoad
=
icon
.
useCacheOnLoad
;
}
...
...
@@ -575,7 +574,7 @@ public final class IconLoader {
private
static
final
int
SCALED_ICONS_CACHE_LIMIT
=
5
;
// Map {pixel scale -> icon}
private
Map
<
Double
,
SoftReference
<
ImageIcon
>>
scaledIconsCache
=
Collections
.
synchronizedMap
(
new
LinkedHashMap
<
Double
,
SoftReference
<
ImageIcon
>>(
SCALED_ICONS_CACHE_LIMIT
)
{
private
final
Map
<
Double
,
SoftReference
<
ImageIcon
>>
scaledIconsCache
=
Collections
.
synchronizedMap
(
new
LinkedHashMap
<
Double
,
SoftReference
<
ImageIcon
>>(
SCALED_ICONS_CACHE_LIMIT
)
{
@Override
public
boolean
removeEldestEntry
(
Map
.
Entry
<
Double
,
SoftReference
<
ImageIcon
>>
entry
)
{
return
size
()
>
SCALED_ICONS_CACHE_LIMIT
;
...
...
@@ -585,7 +584,7 @@ public final class IconLoader {
/**
* Retrieves the orig icon scaled by the provided scale.
*/
public
ImageIcon
getOrScaleIcon
(
final
float
scale
)
{
ImageIcon
getOrScaleIcon
(
final
float
scale
)
{
updateScale
(
OBJ_SCALE
.
of
(
scale
));
ImageIcon
icon
=
SoftReference
.
dereference
(
scaledIconsCache
.
get
(
getScale
(
PIX_SCALE
)));
...
...
@@ -606,8 +605,8 @@ public final class IconLoader {
}
icon
=
checkIcon
(
image
,
myUrl
);
if
(
icon
!=
null
&&
(
icon
.
getIconWidth
()
*
icon
.
getIconHeight
()
*
4
)
<
ImageLoader
.
CACHED_IMAGE_MAX_SIZE
)
{
scaledIconsCache
.
put
(
getScale
(
PIX_SCALE
),
new
SoftReference
<
ImageIcon
>(
icon
));
if
(
icon
!=
null
&&
icon
.
getIconWidth
()
*
icon
.
getIconHeight
()
*
4
<
ImageLoader
.
CACHED_IMAGE_MAX_SIZE
)
{
scaledIconsCache
.
put
(
(
double
)
getScale
(
PIX_SCALE
),
new
SoftReference
<
ImageIcon
>(
icon
));
}
return
icon
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help