82
88
nux::ObjectPtr<nux::BaseTexture> right_texture_;
83
89
nux::ObjectPtr<nux::BaseTexture> right_texture_mask_;
84
90
nux::ObjectPtr<nux::BaseTexture> left_texture_;
85
nux::ObjectPtr<nux::BaseTexture> top_bottom_texture_;
91
nux::ObjectPtr<nux::BaseTexture> top_left_texture_;
92
nux::ObjectPtr<nux::BaseTexture> top_texture_;
93
nux::ObjectPtr<nux::BaseTexture> bottom_texture_;
87
95
nux::ObjectPtr<nux::BaseTexture> corner_;
88
96
nux::ObjectPtr<nux::BaseTexture> corner_mask_;
120
128
parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));
121
129
parent->owner_type.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));
122
130
Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures)));
123
Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));
124
131
dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures));
125
132
dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures));
133
140
double scale = parent->scale;
134
141
auto& style = dash::Style::Instance();
135
auto dash_position = dash::Position::LEFT;
137
if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM && parent->owner_type() == OverlayOwner::Dash)
138
dash_position = dash::Position::BOTTOM;
140
horizontal_texture_ = style.GetDashHorizontalTile(scale, dash_position);
141
horizontal_texture_mask_ = style.GetDashHorizontalTileMask(scale, dash_position);
143
horizontal_texture_ = style.GetDashHorizontalTile(scale);
144
horizontal_texture_mask_ = style.GetDashHorizontalTileMask(scale);
142
145
right_texture_ = style.GetDashRightTile(scale);
143
146
right_texture_mask_ = style.GetDashRightTileMask(scale);
147
top_left_texture_ = style.GetDashTopLeftTile(scale);
144
148
left_texture_ = style.GetDashLeftTile(scale);
145
top_bottom_texture_ = style.GetDashTopOrBottomTile(scale, dash_position);
149
top_texture_ = style.GetDashTopTile(scale);
147
corner_ = style.GetDashCorner(scale, dash_position);
148
corner_mask_ = style.GetDashCornerMask(scale, dash_position);
149
left_corner_ = style.GetDashLeftCorner(scale, dash_position);
150
left_corner_mask_ = style.GetDashLeftCornerMask(scale, dash_position);
151
right_corner_ = style.GetDashRightCorner(scale, dash_position);
152
right_corner_mask_ = style.GetDashRightCornerMask(scale, dash_position);
151
corner_ = style.GetDashCorner(scale);
152
corner_mask_ = style.GetDashCornerMask(scale);
153
left_corner_ = style.GetDashLeftCorner(scale);
154
left_corner_mask_ = style.GetDashLeftCornerMask(scale);
155
right_corner_ = style.GetDashRightCorner(scale);
156
right_corner_mask_ = style.GetDashRightCornerMask(scale);
155
159
void OverlayRendererImpl::OnBgColorChanged(nux::Color const& new_color)
611
615
if (settings.form_factor() != FormFactor::NETBOOK || force_edges)
613
int monitor = unity::UScreen::GetDefault()->GetMonitorWithMouse();
614
nux::Geometry const& monitor_geo = unity::UScreen::GetDefault()->GetMonitorGeometry(monitor);
617
int monitor = UScreen::GetDefault()->GetMonitorAtPosition(absolute_geo.x, absolute_geo.y);
618
auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor);
615
619
int launcher_size = Settings::Instance().LauncherSize(monitor);
616
620
int panel_height = panel::Style::Instance().PanelHeight(monitor);
618
auto dash_position = dash::Position::LEFT;
622
auto dash_position = OverlayPosition::LEFT;
619
623
int border_y = content_geo.y;
620
624
int border_height = larger_absolute_geo.height;
621
625
if (parent->owner_type() == OverlayOwner::Dash && settings.launcher_position() == LauncherPosition::BOTTOM)
623
627
border_y = panel_height;
624
628
border_height = monitor_geo.height - launcher_size;
625
dash_position = dash::Position::BOTTOM;
629
dash_position = OverlayPosition::BOTTOM;
628
632
nux::Geometry geo_border(content_geo.x, border_y, larger_absolute_geo.width - content_geo.x, border_height);
646
650
auto const& left_tile = left_texture_;
647
651
auto const& right_corner = right_corner_;
648
652
auto const& right_corner_mask = right_corner_mask_;
649
auto const& top_tile = top_bottom_texture_;
653
auto const& horizontal_tile = top_texture_;
655
if (dash_position == OverlayPosition::BOTTOM)
657
// Let's flip all the textures vertically
658
texxform.flip_v_coord = true;
651
661
int left_corner_offset = LEFT_CORNER_OFFSET.CP(scale);
652
662
int top_corner_offset = TOP_CORNER_OFFSET.CP(scale);
701
711
// Horizontal repeated texture
702
712
int real_width = geo.width - (left_corner_size.width - left_corner_offset) - corner_size.width;
703
int offset = real_width % horizontal->GetWidth();
704
713
int horizontal_y = geo.y + (geo.height - horizontal->GetHeight());
706
if (dash_position == dash::Position::BOTTOM)
715
if (dash_position == OverlayPosition::BOTTOM)
707
716
horizontal_y = geo.y - horizontal->GetHeight() + top_corner_offset;
709
718
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
710
719
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
712
721
// Selectively erase blur region in the curbe
713
gfx_context.QRP_ColorModTexAlpha(left_corner_size.width - left_corner_offset - offset,
722
gfx_context.QRP_ColorModTexAlpha(left_corner_size.width - left_corner_offset,
716
725
horizontal->GetHeight(),
717
726
horizontal_mask->GetDeviceTexture(),
747
756
texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
748
757
int left_corner_y = geo.y + (geo.height - left_corner_size.height);
750
if (dash_position == dash::Position::BOTTOM)
759
if (dash_position == OverlayPosition::BOTTOM)
751
760
left_corner_y = geo.y - left_corner_size.height + top_corner_offset;
753
if (dash_position == dash::Position::LEFT)
762
if (dash_position == OverlayPosition::LEFT)
755
764
// Selectively erase blur region in the curbe
756
765
gfx_context.QRP_ColorModTexAlpha(geo.x - left_corner_offset,
792
801
int offset = real_height % left_tile->GetHeight();
793
802
int left_texture_y = geo.y + geo.height;
795
if (dash_position == dash::Position::BOTTOM)
804
if (dash_position == OverlayPosition::BOTTOM)
797
left_texture_y = panel_height;
798
real_height = monitor_geo.height - launcher_size - content_geo.height - left_corner->GetHeight() - panel_height + top_corner_offset;
806
left_texture_y = panel_height + top_left_texture_->GetHeight();
807
real_height = monitor_geo.height - launcher_size - content_geo.height - left_corner->GetHeight() - panel_height + top_corner_offset - top_left_texture_->GetHeight();
800
809
else if (settings.launcher_position() == LauncherPosition::BOTTOM)
802
real_height -= launcher_size;
811
real_height -= launcher_size + top_left_texture_->GetWidth();
805
814
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
900
909
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
901
910
int y = geo.y - top_corner_offset;
903
if (dash_position == dash::Position::BOTTOM)
904
y = geo.y + content_geo.height - top_tile->GetHeight() + top_corner_offset;
912
if (dash_position == OverlayPosition::BOTTOM)
913
y = geo.y + content_geo.height - horizontal_tile->GetHeight() + top_corner_offset;
906
915
gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
907
916
gfx_context.QRP_1Tex(geo.x + geo.width,
909
918
geometry.width - (geo.x + geo.width),
910
top_tile->GetHeight(),
911
top_tile->GetDeviceTexture(),
919
horizontal_tile->GetHeight(),
920
horizontal_tile->GetDeviceTexture(),
913
922
nux::color::White);
924
if (dash_position == OverlayPosition::BOTTOM)
927
nux::TexCoordXForm top_texxform;
928
top_texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
929
top_texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
931
gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
932
gfx_context.QRP_1Tex(0,
934
top_left_texture_->GetWidth(),
935
top_left_texture_->GetHeight(),
936
top_left_texture_->GetDeviceTexture(),
940
top_texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
941
top_texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
942
gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
943
gfx_context.QRP_1Tex(top_left_texture_->GetWidth(),
944
panel_height - top_corner_offset,
945
monitor_geo.width - top_left_texture_->GetWidth(),
946
horizontal_tile->GetHeight(),
947
horizontal_tile->GetDeviceTexture(),
951
else if (settings.launcher_position() == LauncherPosition::BOTTOM)
953
int above_launcher_y = monitor_geo.height - panel_height - launcher_size;
954
bool was_flipped = texxform.flip_v_coord;
957
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
958
texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
959
texxform.flip_v_coord = true;
961
gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
962
gfx_context.QRP_1Tex(0,
963
above_launcher_y - top_left_texture_->GetWidth(),
964
top_left_texture_->GetWidth(),
965
top_left_texture_->GetHeight(),
966
top_left_texture_->GetDeviceTexture(),
971
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
972
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
974
gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
975
gfx_context.QRP_1Tex(top_left_texture_->GetHeight(),
976
above_launcher_y + top_corner_offset - horizontal_tile->GetHeight(),
977
monitor_geo.width - top_left_texture_->GetHeight(),
978
horizontal_tile->GetHeight(),
979
horizontal_tile->GetDeviceTexture(),
983
texxform.flip_v_coord = was_flipped;