⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 agg_renderer_base.h

📁 okular
💻 H
📖 第 1 页 / 共 2 页
字号:
            if(y > ymax()) return;            if(y < ymin()) return;            if(x < xmin())            {                int d = xmin() - x;                len -= d;                if(len <= 0) return;                if(covers) covers += d;                colors += d;                x = xmin();            }            if(x + len > xmax())            {                len = xmax() - x + 1;                if(len <= 0) return;            }            m_ren->blend_color_hspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_color_vspan(int x, int y, int len,                                const color_type* colors,                                const cover_type* covers,                               cover_type cover = cover_full)        {            if(x > xmax()) return;            if(x < xmin()) return;            if(y < ymin())            {                int d = ymin() - y;                len -= d;                if(len <= 0) return;                if(covers) covers += d;                colors += d;                y = ymin();            }            if(y + len > ymax())            {                len = ymax() - y + 1;                if(len <= 0) return;            }            m_ren->blend_color_vspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_opaque_color_hspan(int x, int y, int len,                                       const color_type* colors,                                       const cover_type* covers,                                      cover_type cover = cover_full)        {            if(y > ymax()) return;            if(y < ymin()) return;            if(x < xmin())            {                int d = xmin() - x;                len -= d;                if(len <= 0) return;                if(covers) covers += d;                colors += d;                x = xmin();            }            if(x + len > xmax())            {                len = xmax() - x + 1;                if(len <= 0) return;            }            m_ren->blend_opaque_color_hspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_opaque_color_vspan(int x, int y, int len,                                       const color_type* colors,                                       const cover_type* covers,                                      cover_type cover = cover_full)        {            if(x > xmax()) return;            if(x < xmin()) return;            if(y < ymin())            {                int d = ymin() - y;                len -= d;                if(len <= 0) return;                if(covers) covers += d;                colors += d;                y = ymin();            }            if(y + len > ymax())            {                len = ymax() - y + 1;                if(len <= 0) return;            }            m_ren->blend_opaque_color_vspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_color_hspan_no_clip(int x, int y, int len,                                        const color_type* colors,                                        const cover_type* covers,                                       cover_type cover = cover_full)        {            m_ren->blend_color_hspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_color_vspan_no_clip(int x, int y, int len,                                        const color_type* colors,                                        const cover_type* covers,                                       cover_type cover = cover_full)        {            m_ren->blend_color_vspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_opaque_color_hspan_no_clip(int x, int y, int len,                                               const color_type* colors,                                               const cover_type* covers,                                              cover_type cover = cover_full)        {            m_ren->blend_opaque_color_hspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        void blend_opaque_color_vspan_no_clip(int x, int y, int len,                                               const color_type* colors,                                               const cover_type* covers,                                              cover_type cover = cover_full)        {            m_ren->blend_opaque_color_vspan(x, y, len, colors, covers, cover);        }        //--------------------------------------------------------------------        rect clip_rect_area(rect& dst, rect& src, int wsrc, int hsrc) const        {            rect rc(0,0,0,0);            rect cb = clip_box();            ++cb.x2;            ++cb.y2;            if(src.x1 < 0)            {                dst.x1 -= src.x1;                src.x1 = 0;            }            if(src.y1 < 0)            {                dst.y1 -= src.y1;                src.y1 = 0;            }            if(src.x2 > wsrc) src.x2 = wsrc;            if(src.y2 > hsrc) src.y2 = hsrc;            if(dst.x1 < cb.x1)            {                src.x1 += cb.x1 - dst.x1;                dst.x1 = cb.x1;            }            if(dst.y1 < cb.y1)            {                src.y1 += cb.y1 - dst.y1;                dst.y1 = cb.y1;            }            if(dst.x2 > cb.x2) dst.x2 = cb.x2;            if(dst.y2 > cb.y2) dst.y2 = cb.y2;            rc.x2 = dst.x2 - dst.x1;            rc.y2 = dst.y2 - dst.y1;            if(rc.x2 > src.x2 - src.x1) rc.x2 = src.x2 - src.x1;            if(rc.y2 > src.y2 - src.y1) rc.y2 = src.y2 - src.y1;            return rc;        }        //--------------------------------------------------------------------        void copy_from(const rendering_buffer& src,                        const rect* rect_src_ptr = 0,                        int dx = 0,                        int dy = 0)        {            rect rsrc(0, 0, src.width(), src.height());            if(rect_src_ptr)            {                rsrc.x1 = rect_src_ptr->x1;                 rsrc.y1 = rect_src_ptr->y1;                rsrc.x2 = rect_src_ptr->x2 + 1;                rsrc.y2 = rect_src_ptr->y2 + 1;            }            // Version with xdst, ydst (absolute positioning)            //rect rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);            // Version with dx, dy (relative positioning)            rect rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);            rect rc = clip_rect_area(rdst, rsrc, src.width(), src.height());            if(rc.x2 > 0)            {                int incy = 1;                if(rdst.y1 > rsrc.y1)                {                    rsrc.y1 += rc.y2 - 1;                    rdst.y1 += rc.y2 - 1;                    incy = -1;                }                while(rc.y2 > 0)                {                    m_ren->copy_from(src,                                      rdst.x1, rdst.y1,                                     rsrc.x1, rsrc.y1,                                     rc.x2);                    rdst.y1 += incy;                    rsrc.y1 += incy;                    --rc.y2;                }            }        }        //--------------------------------------------------------------------        template<class SrcPixelFormatRenderer>        void blend_from(const SrcPixelFormatRenderer& src,                        const rect* rect_src_ptr = 0,                        int dx = 0,                        int dy = 0)        {            rect rsrc(0, 0, src.width(), src.height());            if(rect_src_ptr)            {                rsrc.x1 = rect_src_ptr->x1;                 rsrc.y1 = rect_src_ptr->y1;                rsrc.x2 = rect_src_ptr->x2 + 1;                rsrc.y2 = rect_src_ptr->y2 + 1;            }            // Version with xdst, ydst (absolute positioning)            //rect rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);            // Version with dx, dy (relative positioning)            rect rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);            rect rc = clip_rect_area(rdst, rsrc, src.width(), src.height());            if(rc.x2 > 0)            {                int incy = 1;                if(rdst.y1 > rsrc.y1)                {                    rsrc.y1 += rc.y2 - 1;                    rdst.y1 += rc.y2 - 1;                    incy = -1;                }                while(rc.y2 > 0)                {                    typename SrcPixelFormatRenderer::row_data span = src.span(rsrc.x1, rsrc.y1);                    if(span.ptr)                    {                        int x1src = rsrc.x1;                        int x1dst = rdst.x1;                        int len   = rc.x2;                        if(span.x1 > x1src)                        {                            x1dst += span.x1 - x1src;                            len   -= span.x1 - x1src;                            x1src = span.x1;                        }                        if(len > 0)                        {                            if(x1src + len-1 > span.x2)                            {                                len -= x1src + len - span.x2 - 1;                            }                            if(len > 0)                            {                                m_ren->blend_from(src, span.ptr,                                                  x1dst, rdst.y1,                                                  x1src, rsrc.y1,                                                  len);                            }                        }                    }                    rdst.y1 += incy;                    rsrc.y1 += incy;                    --rc.y2;                }            }        }    private:        pixfmt_type* m_ren;        rect         m_clip_box;    };}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -