Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Archive
Alchemy Viewer
Commits
47ae78f8
Commit
47ae78f8
authored
7 years ago
by
andreykproductengine
Browse files
Options
Downloads
Patches
Plain Diff
MAINT-7461 Fixed images not showing at correct proportions when opened for the first time
parent
95d0da56
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/llpreviewtexture.cpp
+41
-23
41 additions, 23 deletions
indra/newview/llpreviewtexture.cpp
indra/newview/llpreviewtexture.h
+1
-0
1 addition, 0 deletions
indra/newview/llpreviewtexture.h
with
42 additions
and
23 deletions
indra/newview/llpreviewtexture.cpp
+
41
−
23
View file @
47ae78f8
...
@@ -100,6 +100,29 @@ LLPreviewTexture::~LLPreviewTexture()
...
@@ -100,6 +100,29 @@ LLPreviewTexture::~LLPreviewTexture()
}
}
}
}
void
LLPreviewTexture
::
populateRatioList
()
{
// Fill in ratios list with common aspect ratio values
mRatiosList
.
clear
();
mRatiosList
.
push_back
(
LLTrans
::
getString
(
"Unconstrained"
));
mRatiosList
.
push_back
(
"1:1"
);
mRatiosList
.
push_back
(
"4:3"
);
mRatiosList
.
push_back
(
"10:7"
);
mRatiosList
.
push_back
(
"3:2"
);
mRatiosList
.
push_back
(
"16:10"
);
mRatiosList
.
push_back
(
"16:9"
);
mRatiosList
.
push_back
(
"2:1"
);
// Now fill combo box with provided list
LLComboBox
*
combo
=
getChild
<
LLComboBox
>
(
"combo_aspect_ratio"
);
combo
->
removeall
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
mRatiosList
.
begin
();
it
!=
mRatiosList
.
end
();
++
it
)
{
combo
->
add
(
*
it
);
}
}
// virtual
// virtual
BOOL
LLPreviewTexture
::
postBuild
()
BOOL
LLPreviewTexture
::
postBuild
()
{
{
...
@@ -140,27 +163,12 @@ BOOL LLPreviewTexture::postBuild()
...
@@ -140,27 +163,12 @@ BOOL LLPreviewTexture::postBuild()
}
}
}
}
// Fill in ratios list with common aspect ratio values
// Fill in ratios list and combo box with common aspect ratio values
mRatiosList
.
clear
();
populateRatioList
();
mRatiosList
.
push_back
(
LLTrans
::
getString
(
"Unconstrained"
));
mRatiosList
.
push_back
(
"1:1"
);
mRatiosList
.
push_back
(
"4:3"
);
mRatiosList
.
push_back
(
"10:7"
);
mRatiosList
.
push_back
(
"3:2"
);
mRatiosList
.
push_back
(
"16:10"
);
mRatiosList
.
push_back
(
"16:9"
);
mRatiosList
.
push_back
(
"2:1"
);
// Now fill combo box with provided list
LLComboBox
*
combo
=
getChild
<
LLComboBox
>
(
"combo_aspect_ratio"
);
combo
->
removeall
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
mRatiosList
.
begin
();
it
!=
mRatiosList
.
end
();
++
it
)
{
combo
->
add
(
*
it
);
}
childSetCommitCallback
(
"combo_aspect_ratio"
,
onAspectRatioCommit
,
this
);
childSetCommitCallback
(
"combo_aspect_ratio"
,
onAspectRatioCommit
,
this
);
LLComboBox
*
combo
=
getChild
<
LLComboBox
>
(
"combo_aspect_ratio"
);
combo
->
setCurrentByIndex
(
0
);
combo
->
setCurrentByIndex
(
0
);
return
LLPreview
::
postBuild
();
return
LLPreview
::
postBuild
();
...
@@ -446,16 +454,25 @@ void LLPreviewTexture::updateDimensions()
...
@@ -446,16 +454,25 @@ void LLPreviewTexture::updateDimensions()
return
;
return
;
}
}
if
(
mAssetStatus
!=
PREVIEW_ASSET_LOADED
)
S32
img_width
=
mImage
->
getFullWidth
();
S32
img_height
=
mImage
->
getFullHeight
();
if
(
mAssetStatus
!=
PREVIEW_ASSET_LOADED
||
mLastWidth
!=
img_width
||
mLastHeight
!=
img_height
)
{
{
mAssetStatus
=
PREVIEW_ASSET_LOADED
;
mAssetStatus
=
PREVIEW_ASSET_LOADED
;
// Asset has been fully loaded, adjust aspect ratio
// Asset has been fully loaded, adjust aspect ratio
adjustAspectRatio
();
adjustAspectRatio
();
}
}
// Update the width/height display every time
// Update the width/height display every time
getChild
<
LLUICtrl
>
(
"dimensions"
)
->
setTextArg
(
"[WIDTH]"
,
llformat
(
"%d"
,
mImage
->
getFullWidth
()));
getChild
<
LLUICtrl
>
(
"dimensions"
)
->
setTextArg
(
"[WIDTH]"
,
llformat
(
"%d"
,
img_width
));
getChild
<
LLUICtrl
>
(
"dimensions"
)
->
setTextArg
(
"[HEIGHT]"
,
llformat
(
"%d"
,
mImage
->
getFullHeight
()));
getChild
<
LLUICtrl
>
(
"dimensions"
)
->
setTextArg
(
"[HEIGHT]"
,
llformat
(
"%d"
,
img_height
));
mLastHeight
=
img_height
;
mLastWidth
=
img_width
;
// Reshape the floater only when required
// Reshape the floater only when required
if
(
mUpdateDimensions
)
if
(
mUpdateDimensions
)
...
@@ -582,6 +599,7 @@ void LLPreviewTexture::adjustAspectRatio()
...
@@ -582,6 +599,7 @@ void LLPreviewTexture::adjustAspectRatio()
if
(
found
==
mRatiosList
.
end
())
if
(
found
==
mRatiosList
.
end
())
{
{
// No existing ratio found, create an element that will show image at original ratio
// No existing ratio found, create an element that will show image at original ratio
populateRatioList
();
// makes sure previous custom ratio is cleared
std
::
string
ratio
=
boost
::
lexical_cast
<
std
::
string
>
(
num
)
+
":"
+
boost
::
lexical_cast
<
std
::
string
>
(
denom
);
std
::
string
ratio
=
boost
::
lexical_cast
<
std
::
string
>
(
num
)
+
":"
+
boost
::
lexical_cast
<
std
::
string
>
(
denom
);
mRatiosList
.
push_back
(
ratio
);
mRatiosList
.
push_back
(
ratio
);
combo
->
add
(
ratio
);
combo
->
add
(
ratio
);
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llpreviewtexture.h
+
1
−
0
View file @
47ae78f8
...
@@ -67,6 +67,7 @@ public:
...
@@ -67,6 +67,7 @@ public:
/*virtual*/
void
setObjectID
(
const
LLUUID
&
object_id
);
/*virtual*/
void
setObjectID
(
const
LLUUID
&
object_id
);
protected:
protected:
void
init
();
void
init
();
void
populateRatioList
();
/* virtual */
BOOL
postBuild
();
/* virtual */
BOOL
postBuild
();
bool
setAspectRatio
(
const
F32
width
,
const
F32
height
);
bool
setAspectRatio
(
const
F32
width
,
const
F32
height
);
static
void
onAspectRatioCommit
(
LLUICtrl
*
,
void
*
userdata
);
static
void
onAspectRatioCommit
(
LLUICtrl
*
,
void
*
userdata
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment