Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
14428fb3
Commit
14428fb3
authored
Jul 23, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: containsPoint for color and image value viewers. They used the wrong Rotation.
parent
f7bb6944
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
src/gfx/mask_image.cpp
src/gfx/mask_image.cpp
+1
-0
src/render/value/color.cpp
src/render/value/color.cpp
+10
-9
src/render/value/image.cpp
src/render/value/image.cpp
+2
-3
No files found.
src/gfx/mask_image.cpp
View file @
14428fb3
...
@@ -45,6 +45,7 @@ bool AlphaMask::isTransparent(int x, int y) const {
...
@@ -45,6 +45,7 @@ bool AlphaMask::isTransparent(int x, int y) const {
return
alpha
[
x
+
y
*
size
.
x
]
<
20
;
return
alpha
[
x
+
y
*
size
.
x
]
<
20
;
}
}
/// Do the points form a (counter??)clockwise angle?
bool
convex
(
const
wxPoint
&
p
,
const
wxPoint
&
q
,
const
wxPoint
&
r
)
{
bool
convex
(
const
wxPoint
&
p
,
const
wxPoint
&
q
,
const
wxPoint
&
r
)
{
return
p
.
y
*
q
.
x
-
p
.
x
*
q
.
y
-
p
.
y
*
r
.
x
+
q
.
y
*
r
.
x
+
p
.
x
*
r
.
y
-
q
.
x
*
r
.
y
>
0
;
return
p
.
y
*
q
.
x
-
p
.
x
*
q
.
y
-
p
.
y
*
r
.
x
+
q
.
y
*
r
.
x
+
p
.
x
*
r
.
y
-
q
.
x
*
r
.
y
>
0
;
}
}
...
...
src/render/value/color.cpp
View file @
14428fb3
...
@@ -48,7 +48,7 @@ void ColorValueViewer::draw(RotatedDC& dc) {
...
@@ -48,7 +48,7 @@ void ColorValueViewer::draw(RotatedDC& dc) {
Image
img
(
alpha_mask
->
size
.
x
,
alpha_mask
->
size
.
y
);
Image
img
(
alpha_mask
->
size
.
x
,
alpha_mask
->
size
.
y
);
fill_image
(
img
,
value
().
value
());
fill_image
(
img
,
value
().
value
());
alpha_mask
->
setAlpha
(
img
);
alpha_mask
->
setAlpha
(
img
);
dc
.
DrawImage
(
img
,
style
().
getPos
(
));
dc
.
DrawImage
(
img
,
RealPoint
(
0
,
0
));
}
else
{
}
else
{
// do we need clipping?
// do we need clipping?
bool
clip
=
style
().
left_width
<
style
().
width
&&
style
().
right_width
<
style
().
width
&&
bool
clip
=
style
().
left_width
<
style
().
width
&&
style
().
right_width
<
style
().
width
&&
...
@@ -74,16 +74,17 @@ bool ColorValueViewer::containsPoint(const RealPoint& p) const {
...
@@ -74,16 +74,17 @@ bool ColorValueViewer::containsPoint(const RealPoint& p) const {
// distance to each side
// distance to each side
double
left
=
p
.
x
,
right
=
style
().
width
-
p
.
x
-
1
;
double
left
=
p
.
x
,
right
=
style
().
width
-
p
.
x
-
1
;
double
top
=
p
.
y
,
bottom
=
style
().
height
-
p
.
y
-
1
;
double
top
=
p
.
y
,
bottom
=
style
().
height
-
p
.
y
-
1
;
if
(
left
<
0
||
right
<
0
||
top
<
0
||
bottom
<
0
||
// outside bounding box
if
(
left
<
0
||
right
<
0
||
top
<
0
||
bottom
<
0
)
return
false
;
// outside bounding box
(
left
>=
style
().
left_width
&&
right
>=
style
().
right_width
&&
// outside horizontal border
top
>=
style
().
top_width
&&
bottom
>=
style
().
bottom_width
))
{
// outside vertical border
return
false
;
}
// check against mask
// check against mask
if
(
!
style
().
mask_filename
().
empty
())
{
if
(
!
style
().
mask_filename
().
empty
())
loadMask
(
getRotation
());
loadMask
(
viewer
.
getRotation
());
if
(
alpha_mask
)
{
return
!
alpha_mask
||
!
alpha_mask
->
isTransparent
((
int
)
left
,
(
int
)
top
);
return
!
alpha_mask
->
isTransparent
((
int
)
left
,
(
int
)
top
);
}
else
{
}
else
{
// check against border
if
(
left
>=
style
().
left_width
&&
right
>=
style
().
right_width
&&
// outside horizontal border
top
>=
style
().
top_width
&&
bottom
>=
style
().
bottom_width
)
{
// outside vertical border
return
false
;
}
return
true
;
return
true
;
}
}
}
}
...
...
src/render/value/image.cpp
View file @
14428fb3
...
@@ -98,9 +98,8 @@ bool ImageValueViewer::containsPoint(const RealPoint& p) const {
...
@@ -98,9 +98,8 @@ bool ImageValueViewer::containsPoint(const RealPoint& p) const {
if
(
!
ValueViewer
::
containsPoint
(
p
))
return
false
;
if
(
!
ValueViewer
::
containsPoint
(
p
))
return
false
;
// check against mask
// check against mask
if
(
!
style
().
mask_filename
().
empty
())
{
if
(
!
style
().
mask_filename
().
empty
())
{
loadMask
(
viewer
.
getRotation
());
loadMask
(
getRotation
());
Rotation
rot
=
viewer
.
getRotation
();
return
!
alpha_mask
||
!
alpha_mask
->
isTransparent
((
int
)
p
.
x
,
(
int
)
p
.
y
);
return
!
alpha_mask
||
!
alpha_mask
->
isTransparent
((
int
)
rot
.
trX
(
p
.
x
),
(
int
)
rot
.
trY
(
p
.
y
));
}
else
{
}
else
{
return
true
;
return
true
;
}
}
...
...
Write
Preview
Markdown
is supported
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