mirror of https://github.com/buggins/dlangui.git
fix build error
D does not allow default constructor and to declare some constructors
for struct.
It is because that, unfortunately, your code does not be permitted in
D's structure.
Correct Code:
import std.stdio;
struct T{
this(int v = 2){
writeln(v);
}
}
void main(){
T s = T(1);
}
However, following code is not permitted.
import std.stdio;
struct T{
this(int v = 2){
writeln(v);
}
}
void main(){
T t; // <- This definition occur build error. This definition call
default constructor such as this() but T does not has this().
T s = T(30);
}
That's why your following code dose not permitted.
struct glyph_gamma_table(int maxv = 65)
{
this(double gammaValue = 1.0)
{
gamma = gammaValue;
}
//...
}
__gshared glyph_gamma_table!65 _gamma65;// <- calling this() !!!!!!
__gshared glyph_gamma_table!256 _gamma256;// <- calling this() !!!!!
By the way I might found your miss.
Your code is:
gamma = gammaValue;
But this is not properly in this place, I think.
I guess that you intended to write as follows.
gamma(gammaValue);
I fixed as above.
This commit is contained in:
parent
e8f9422d59
commit
3e51ebbfbb
|
|
@ -855,11 +855,11 @@ struct GlyphCache
|
|||
// maxv is 65 for win32 fonts, 256 for freetype
|
||||
import std.math;
|
||||
//---------------------------------
|
||||
struct glyph_gamma_table(int maxv = 65)
|
||||
class glyph_gamma_table(int maxv = 65)
|
||||
{
|
||||
this(double gammaValue = 1.0)
|
||||
{
|
||||
gamma = gammaValue;
|
||||
gamma(gammaValue);
|
||||
}
|
||||
@property double gamma() { return _gamma; }
|
||||
@property void gamma(double g) {
|
||||
|
|
@ -890,6 +890,6 @@ private:
|
|||
__gshared glyph_gamma_table!65 _gamma65;
|
||||
__gshared glyph_gamma_table!256 _gamma256;
|
||||
__gshared static this() {
|
||||
_gamma65 = glyph_gamma_table!65(1.0);
|
||||
_gamma256 = glyph_gamma_table!256(1.0);
|
||||
_gamma65 = new glyph_gamma_table!65(1.0);
|
||||
_gamma256 = new glyph_gamma_table!256(1.0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue