# Path: opc/utils/prof.py
# def timefunc(f, reference=False):
#     global records
# 
#     records[f.__name__] = Record(f.__name__, reference)
# 
#     @wraps(f)
#     def f_timer(*args, **kwargs):
#         global active
# 
#         if not active:
#             return f(*args, **kwargs)
# 
#         start = time.time()
#         result = f(*args, **kwargs)
#         end = time.time()
# 
#         records[f.__name__].addTime(end-start)
# 
#         return result
# 
#     return f_timer


from functools import reduce
from ..utils.prof import timefunc
import numpy as np
import operator



class Plot(object):

    @timefunc
    def _line(self, x1, y1, x2, y2):
        steep = abs(y2 - y1) > abs(x2 - x1)
        if steep:
            x1, y1 = y1, x1
            x2, y2 = y2, x2

        if x1 > x2:
            x1, x2 = x2, x1
            y1, y2 = y2, y1

        dx = x2 - x1
        dy = abs(y2 - y1)
        err = dx / 2

        if y1 < y2:
            ystep = 1
        else:
            ystep = -1


# Path: opc/utils/prof.py
# def timefunc(f, reference=False):
#     global records
# 
#     records[f.__name__] = Record(f.__name__, reference)
# 
#     @wraps(f)
#     def f_timer(*args, **kwargs):
#         global active
# 
#         if not active:
#             return f(*args, **kwargs)
# 
#         start = time.time()
#         result = f(*args, **kwargs)
#         end = time.time()
# 
#         records[f.__name__].addTime(end-start)
# 
#         return result
# 
#     return f_timer


# Path: opc/matrix/plot.py
from functools import reduce
from ..utils.prof import timefunc
import numpy as np
import operator




class Plot(object):

    @timefunc
    def _line(self, x1, y1, x2, y2):
        steep = abs(y2 - y1) > abs(x2 - x1)
        if steep:
            x1, y1 = y1, x1
            x2, y2 = y2, x2

        if x1 > x2:
            x1, x2 = x2, x1
            y1, y2 = y2, y1

        dx = x2 - x1
        dy = abs(y2 - y1)
        err = dx / 2

        if y1 < y2:
            ystep = 1
        else:
            ystep = -1


        points = []