Measure the top of the sliding glass door opening, between the two top corners, on the edge of the casing, using a measuring tape. Mark two lines on a piece of trim with that distance between them, using a pencil.
Set the trim on your miter saw, so it faces up. Position it so the lower edge of the trim faces toward the blade. Set one of the marks directly under the blade. Swivel the blade 45 degrees out, so it points toward the closest end of the trim. Cut it.
Slide the trim to put the other mark in front of the blade. Swivel the blade to 45 degrees in the opposite direction as before. Cut it.
Set the cut trim above the door opening, with the bottom edge of the trim sitting along the top edge of the doorway. Line up the two angled cuts at the ends so they flare up and out from the corners. Use your trim nailer to secure the piece, shooting nails every 10 to 12 inches along the upper and lower edges of the piece.
Do the same for the other two pieces of trim, for the two vertical sides, but cut only the upward-facing ends with the 45-degree angle. For the bottoms, make it a straight cut, so it will sit on the floor. Install the vertical sides with the angle top ends butted to the angled ends of the horizontal piece.