def paint_path(self, gstate, stroke, fill, evenodd, path):
shape = "<STR_LIT>".join(x[<NUM_LIT:0>] for x in path)<EOL>prev_split = <NUM_LIT:0><EOL>for i in range(len(shape)):<EOL><INDENT>if shape[i] == "<STR_LIT:m>" and prev_split != i:<EOL><INDENT>self.paint_single_path(<EOL>gstate, stroke, fill, evenodd, path[prev_split:i]<EOL>)<EOL>prev_split = i<EOL><DEDENT>if shape[i] == "<STR_LIT:h>":<EOL><INDENT>self.paint_single_path(<EOL>gstate, stroke, fill, evenodd, path[prev_split : i + <NUM_LIT:1>]<EOL>)<EOL>prev_split = i + <NUM_LIT:1><EOL><DEDENT><DEDENT>if prev_split < len(shape):<EOL><INDENT>self.paint_single_path(gstate, stroke, fill, evenodd, path[prev_split:])<EOL><DEDENT>
Converting long paths to small segments each time we m=Move
or h=ClosePath for polygon