internal override void Layout(LayoutBox box, Renderman renderer) { float width; float height; float top; float left; bool clip = true; if (renderer.ViewportBackground) { // Applying to whole background: BoxRegion viewport = renderer.Viewport; top = viewport.Y; left = viewport.X; width = viewport.Width; height = viewport.Height; renderer.ViewportBackground = false; clip = false; } else { // Get the top left inner corner (inside margin and border): width = box.PaddedWidth; height = box.PaddedHeight; top = box.Y + box.Border.Top; left = box.X + box.Border.Left; // Is it clipped? if (renderer.IsInvisible(left, top, width, height)) { // Totally not visible. return; } } // Ensure we have a batch (doesn't change graphics or font thus both nulls): renderer.SetupBatch(this, null, null); // Allocate the block: MeshBlock block = Add(renderer); // Using firstblock as our block here. // Set the UV to that of the solid block colour pixel: block.SetSolidColourUV(); // Set the (overlay) colour: block.SetColour(BaseColour * renderer.ColorOverlay); // And finally sort out the verts: if (clip) { block.SetClipped(renderer.ClippingBoundary, new BoxRegion(left, top, width, height), renderer, RenderData.computedStyle.ZIndex - 0.006f); } else { block.ApplyVertices(new BoxRegion(left, top, width, height), renderer, RenderData.computedStyle.ZIndex - 0.006f); } // Flush it: block.Done(renderer.Transform); }