| 1870 | |
| 1871 | |
| 1872 | void Viewer::DrawBackground(float l, float r, float b, float t, float drawW, float drawH) |
| 1873 | { |
| 1874 | if (Config::Global.TransparentWorkArea) |
| 1875 | return; |
| 1876 | |
| 1877 | Config::ProfileData& profile = Config::GetProfileData(); |
| 1878 | Config::ProfileData::BackgroundStyleEnum style = profile.GetBackgroundStyle(); |
| 1879 | bool overrideBG = CurrImage && CurrImage->OverrideBackgroundColour; |
| 1880 | if (overrideBG) |
| 1881 | style = Config::ProfileData::BackgroundStyleEnum::SolidColour; |
| 1882 | |
| 1883 | switch (style) |
| 1884 | { |
| 1885 | case Config::ProfileData::BackgroundStyleEnum::None: |
| 1886 | return; |
| 1887 | |
| 1888 | case Config::ProfileData::BackgroundStyleEnum::Checkerboard: |
| 1889 | { |
| 1890 | // Semitransparent checkerboard background. |
| 1891 | float checkSize = float(profile.BackgroundCheckerboxSize); |
| 1892 | |
| 1893 | // This is for efficiency. Why draw checrboxes where we don'e have to (off screen)? |
| 1894 | // We cull in widths of 2*checkSize so the alternating checherbox colour works out. |
| 1895 | if (l < 0.0f) |
| 1896 | { |
| 1897 | int numXhidden = int((0.0f-l) / (2.0f*checkSize)); |
| 1898 | l += float(numXhidden)*(2.0f*checkSize); |
| 1899 | } |
| 1900 | if (r >= drawW) |
| 1901 | { |
| 1902 | int numXhidden = int((r-drawW) / (2.0f*checkSize)); |
| 1903 | r -= float(numXhidden)*(2.0f*checkSize); |
| 1904 | } |
| 1905 | |
| 1906 | if (b < 0.0f) |
| 1907 | { |
| 1908 | int numYhidden = int((0.0f-b) / (2.0f*checkSize)); |
| 1909 | b += float(numYhidden)*(2.0f*checkSize); |
| 1910 | } |
| 1911 | if (t >= drawH) |
| 1912 | { |
| 1913 | int numYhidden = int((t-drawH) / (2.0f*checkSize)); |
| 1914 | t -= float(numYhidden)*(2.0f*checkSize); |
| 1915 | } |
| 1916 | |
| 1917 | int x = 0; |
| 1918 | int y = 0; |
| 1919 | |
| 1920 | bool lineStartToggle = false; |
| 1921 | float bgH = t - b; |
| 1922 | float bgW = r - l; |
| 1923 | glBegin(GL_QUADS); |
| 1924 | |
| 1925 | int numCheckQuads = 0; |
| 1926 | while (y*checkSize < bgH) |
| 1927 | { |
| 1928 | bool colourToggle = lineStartToggle; |
| 1929 |
nothing calls this directly
no test coverage detected