|
@@ -59,6 +59,7 @@ type
|
|
|
FSubPixel: boolean;
|
|
|
FOrigin: TFresnelPoint;
|
|
|
FTextShadows : TFresnelTextShadowArray;
|
|
|
+ FIntfRenderer: IFresnelRenderer;
|
|
|
protected
|
|
|
type
|
|
|
{ TBorderAndBackground }
|
|
@@ -115,7 +116,7 @@ type
|
|
|
//
|
|
|
// Put methods not part of IFresnelRenderer here
|
|
|
//
|
|
|
-
|
|
|
+ constructor Create(AOwner: TComponent); override;
|
|
|
// draw the given viewport.
|
|
|
procedure Draw(Viewport: TFresnelViewport); virtual;
|
|
|
// Round coordinates of given rectangle.
|
|
@@ -773,6 +774,12 @@ begin
|
|
|
Result:=S;
|
|
|
end;
|
|
|
|
|
|
+constructor TFresnelRenderer.Create(AOwner: TComponent);
|
|
|
+begin
|
|
|
+ inherited Create(AOwner);
|
|
|
+ FIntfRenderer:=Self;
|
|
|
+end;
|
|
|
+
|
|
|
function TFresnelRenderer.GetTextShadow(aIndex : Integer): PFresnelTextShadow;
|
|
|
begin
|
|
|
Result:=Nil;
|
|
@@ -1036,42 +1043,45 @@ begin
|
|
|
|
|
|
//writeln('TFresnelRenderer.DrawElement ',El.Name,' BorderBox=',El.UsedBorderBox.ToString,' ContentBox=',El.UsedContentBox.ToString,' Origin=',Origin.ToString);
|
|
|
|
|
|
- // background and border
|
|
|
- BorderParams:=CreateBorderAndBackground;
|
|
|
- try
|
|
|
- BorderParams.BoundingBox.Box:=aBorderBox;
|
|
|
- if not SubPixel then
|
|
|
- MathRoundRect(BorderParams.BoundingBox.Box);
|
|
|
-
|
|
|
- // border-width
|
|
|
- BorderParams.Width[ffsLeft]:=LNode.BorderLeft;
|
|
|
- BorderParams.Width[ffsTop]:=LNode.BorderTop;
|
|
|
- BorderParams.Width[ffsRight]:=LNode.BorderRight;
|
|
|
- BorderParams.Width[ffsBottom]:=LNode.BorderBottom;
|
|
|
-
|
|
|
- // background-color
|
|
|
- BorderParams.BackgroundColorFP:=El.GetComputedColor(fcaBackgroundColor,colTransparent);
|
|
|
-
|
|
|
- // border-color
|
|
|
- for s in TFresnelCSSSide do
|
|
|
- BorderParams.Color[s]:=El.GetComputedColor(TFresnelCSSAttribute(ord(fcaBorderTopColor)+ord(s)),colTransparent);
|
|
|
-
|
|
|
- // border-image
|
|
|
- BorderParams.BackgroundImage:=El.GetComputedImage(fcaBackgroundImage);
|
|
|
-
|
|
|
- // border-radius
|
|
|
- for Corner in TFresnelCSSCorner do
|
|
|
- BorderParams.BoundingBox.Radii[Corner]:=El.GetComputedBorderRadius(Corner);
|
|
|
- // Normalize
|
|
|
- if PrepareBackgroundBorder(El,BorderParams) then
|
|
|
- begin
|
|
|
- // Background
|
|
|
- DrawElBackground(El,BorderParams);
|
|
|
- // Border
|
|
|
- DrawElBorder(El,BorderParams);
|
|
|
- end;
|
|
|
- finally
|
|
|
- BorderParams.Free;
|
|
|
+ if El<>El.Viewport then
|
|
|
+ begin
|
|
|
+ // background and border
|
|
|
+ BorderParams:=CreateBorderAndBackground;
|
|
|
+ try
|
|
|
+ BorderParams.BoundingBox.Box:=aBorderBox;
|
|
|
+ if not SubPixel then
|
|
|
+ MathRoundRect(BorderParams.BoundingBox.Box);
|
|
|
+
|
|
|
+ // border-width
|
|
|
+ BorderParams.Width[ffsLeft]:=LNode.BorderLeft;
|
|
|
+ BorderParams.Width[ffsTop]:=LNode.BorderTop;
|
|
|
+ BorderParams.Width[ffsRight]:=LNode.BorderRight;
|
|
|
+ BorderParams.Width[ffsBottom]:=LNode.BorderBottom;
|
|
|
+
|
|
|
+ // background-color
|
|
|
+ BorderParams.BackgroundColorFP:=El.GetComputedColor(fcaBackgroundColor,colTransparent);
|
|
|
+
|
|
|
+ // border-color
|
|
|
+ for s in TFresnelCSSSide do
|
|
|
+ BorderParams.Color[s]:=El.GetComputedColor(TFresnelCSSAttribute(ord(fcaBorderTopColor)+ord(s)),colTransparent);
|
|
|
+
|
|
|
+ // border-image
|
|
|
+ BorderParams.BackgroundImage:=El.GetComputedImage(fcaBackgroundImage);
|
|
|
+
|
|
|
+ // border-radius
|
|
|
+ for Corner in TFresnelCSSCorner do
|
|
|
+ BorderParams.BoundingBox.Radii[Corner]:=El.GetComputedBorderRadius(Corner);
|
|
|
+ // Normalize
|
|
|
+ if PrepareBackgroundBorder(El,BorderParams) then
|
|
|
+ begin
|
|
|
+ // Background
|
|
|
+ DrawElBackground(El,BorderParams);
|
|
|
+ // Border
|
|
|
+ DrawElBorder(El,BorderParams);
|
|
|
+ end;
|
|
|
+ finally
|
|
|
+ BorderParams.Free;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
NeedRestore:=false;
|
|
@@ -1097,7 +1107,7 @@ begin
|
|
|
end;
|
|
|
try
|
|
|
// Give element a chance to draw itself (on top of background and border)
|
|
|
- aRenderable.Render(Self as IFresnelRenderer);
|
|
|
+ aRenderable.Render(FIntfRenderer);
|
|
|
|
|
|
DrawChildren(El);
|
|
|
|
|
@@ -1136,22 +1146,12 @@ end;
|
|
|
procedure TFresnelRenderer.Draw(Viewport: TFresnelViewport);
|
|
|
var
|
|
|
BackgroundColorFP: TFPColor;
|
|
|
- aRenderable: IFresnelRenderable;
|
|
|
begin
|
|
|
//debugln(['TFresnelRenderer.Draw Origin=',dbgs(Origin)]);
|
|
|
- aRenderable:=Viewport as IFresnelRenderable;
|
|
|
- aRenderable.BeforeRender;
|
|
|
- Viewport.Rendered:=true;
|
|
|
-
|
|
|
BackgroundColorFP:=Viewport.GetComputedColor(fcaBackgroundColor,colWhite);
|
|
|
FillRect(BackgroundColorFP,RectFre(0,0,Viewport.Width,Viewport.Height));
|
|
|
|
|
|
- // todo: draw scrollbars
|
|
|
-
|
|
|
- aRenderable.Render(Self as IFresnelRenderer);
|
|
|
- DrawChildren(Viewport);
|
|
|
-
|
|
|
- aRenderable.AfterRender;
|
|
|
+ DrawElement(Viewport);
|
|
|
end;
|
|
|
|
|
|
procedure TFresnelRenderer.ClearTextShadows;
|