diff --git a/graphics/Makefile b/graphics/Makefile index 6b39cd6764..fc258d997c 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -63,6 +63,31 @@ BIN = libgraphics$(LIBEXT) VPATH = nxglib:nx all: $(BIN) +.PHONY : depend clean distclean gensources gen1bppsources gen2bppsource gen4bppsource \ + gen8bppsource gen16bppsource gen24bppsource gen32bppsources + +gen1bppsources: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=1 + +gen2bppsource: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=2 + +gen4bppsource: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=4 + +gen8bppsource: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=8 + +gen16bppsource: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 + +gen24bppsource: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 + +gen32bppsources: + @make -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 + +gensources: gen1bppsources gen2bppsource gen4bppsource gen8bppsource gen16bppsource gen24bppsource gen32bppsources $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -70,22 +95,24 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -$(BIN): $(OBJS) +$(BIN): gensources $(OBJS) @( for obj in $(OBJS) ; do \ $(call ARCHIVE, $@, $${obj}); \ done ; ) -.depend: Makefile $(SRCS) +.depend: gensources Makefile $(SRCS) @$(MKDEP) $(DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: + @make -C nxglib -f Makefile.sources clean TOPDIR=$(TOPDIR) @rm -f $(BIN) *~ .*.swp $(call CLEAN) distclean: clean + @make -C nxglib -f Makefile.sources distclean TOPDIR=$(TOPDIR) @rm -f Make.dep .depend -include Make.dep diff --git a/graphics/nxglib/Make.defs b/graphics/nxglib/Make.defs index 274e1a1ac6..bf7c2bef86 100644 --- a/graphics/nxglib/Make.defs +++ b/graphics/nxglib/Make.defs @@ -33,6 +33,11 @@ # ############################################################################ -NXGLIB_ASRCS = -NXGLIB_CSRCS = nxglib_rgb2yuv.c nxglib_yuv2rgb.c +NXGLIB_ASRCS = + +#FILL_CSRCS1 = nxglib_fillrectangle_1bpp.c nxglib_fillrectangle_2bpp.c \ +# nxglib_fillrectangle_4bpp.c +FILL_CSRCS2 = nxglib_fillrectangle_8bpp.c nxglib_fillrectangle_16bpp.c \ + nxglib_fillrectangle_24bpp.c nxglib_fillrectangle_32bpp.c +NXGLIB_CSRCS = nxglib_rgb2yuv.c nxglib_yuv2rgb.c $(FILL_CSRCS1) $(FILL_CSRCS2) diff --git a/graphics/nxglib/Makefile.sources b/graphics/nxglib/Makefile.sources index a624488ccf..2d38547a29 100644 --- a/graphics/nxglib/Makefile.sources +++ b/graphics/nxglib/Makefile.sources @@ -51,24 +51,35 @@ endif ifeq ($(NXGLIB_BITSPERPIXEL),16) NXGLIB_SUFFIX := _16bpp endif -ifeq ($(NXGLIB_BITSPERPIXEL),2) -NXGLIB_SUFFIX := _32bpp +ifeq ($(NXGLIB_BITSPERPIXEL),24) +NXGLIB_SUFFIX := _24bpp endif -ifeq ($(NXGLIB_BITSPERPIXEL),2) -NXGLIB_SUFFIX := _64bpp +ifeq ($(NXGLIB_BITSPERPIXEL),32) +NXGLIB_SUFFIX := _32bpp endif CPPFLAGS += -DNXGLIB_BITSPERPIXEL=$(NXGLIB_BITSPERPIXEL) CPPFLAGS += -DNXGLIB_SUFFIX=$(NXGLIB_SUFFIX) -FILL_CSRC = nxglib_fillrectangle$(NXGLIB_SUFFIX).c -GEN_CSRCS = $(FILL_CSRC) +FILL1_CSRCS = nxglib_fillrectangle_1bpp.c nxglib_fillrectangle_2bpp.c \ + nxglib_fillrectangle_4bpp.c +FILL2_CSRCS = nxglib_fillrectangle_8bpp.c nxglib_fillrectangle_16bpp.c \ + nxglib_fillrectangle_24bpp.c nxglib_fillrectangle_32bpp.c + +GEN_CSRCS = $(FILL1_CSRCS) $(FILL2_CSRCS) all: $(GEN_CSRCS) -.PHONY : clean distclean $(GEN_CSRCS) +.PHONY : clean distclean -$(FILL_CSRC) : nxglib_fillrectangle.c nxglib_bitblit.h - $(call PREPROCESS, $<, $@) +$(FILL1_CSRCS) : nxglib_fillrectangle.c nxglib_bitblit.h +ifneq ($(NXGLIB_BITSPERPIXEL),) + $(call PREPROCESS, nxglib_fillrectangle.c, $@) +endif + +$(FILL2_CSRCS) : nxglib_fillrectangle.c nxglib_bitblit.h +ifneq ($(NXGLIB_BITSPERPIXEL),) + $(call PREPROCESS, nxglib_fillrectangle.c, $@) +endif clean: @rm -f *~ .*.swp diff --git a/graphics/nxglib/nxglib_bitblit.h b/graphics/nxglib/nxglib_bitblit.h index 6ebb97c2b5..b327204bdc 100644 --- a/graphics/nxglib/nxglib_bitblit.h +++ b/graphics/nxglib/nxglib_bitblit.h @@ -122,8 +122,8 @@ # define NXGL_MEMSET(dest,value,width) \ { \ - FAR uybte *_ptr = (FAR ubyte*)dest; \ - int nbytes = NX_SCALEX(width)); \ + FAR ubyte *_ptr = (FAR ubyte*)dest; \ + int nbytes = NX_SCALEX(width); \ while (nbytes--) \ { \ *_ptr++ = value; \ @@ -133,7 +133,7 @@ { \ FAR ubyte *_dptr = (FAR ubyte*)dest; \ FAR ubyte *_sptr = (FAR ubyte*)src; \ - int nbytes = NX_SCALEX(width)); \ + int nbytes = NX_SCALEX(width); \ while (npixels--) \ { \ *_dptr++ = *_sptr++; \ @@ -143,7 +143,7 @@ #elif NXGLIB_BITSPERPIXEL == 24 # define NXGL_MEMSET(dest,value,width) \ { \ - FAR uybte *_ptr = (FAR ubyte*)dest; \ + FAR ubyte *_ptr = (FAR ubyte*)dest; \ while (width--) \ { \ *_ptr++ = value; \ @@ -182,6 +182,11 @@ } #endif +/* Form a function name by concatenating two strings */ + +#define _NXGL_FUNCNAME(a,b) a ## b +#define NXGL_FUNCNAME(a,b) _NXGL_FUNCNAME(a,b) + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/graphics/nxglib/nxglib_fillrectangle.c b/graphics/nxglib/nxglib_fillrectangle.c index d8550dd7ee..3da969c4aa 100644 --- a/graphics/nxglib/nxglib_fillrectangle.c +++ b/graphics/nxglib/nxglib_fillrectangle.c @@ -81,11 +81,8 @@ * ****************************************************************************/ -void nxgl_fillrectangle##NXGLIB_SUFFIX -( - FAR struct fb_planeinfo_s *pinfo, - FAR const struct nxgl_rect_s *rect, NX_PIXEL_T color -) +void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) +(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, NX_PIXEL_T color) { ubyte *line; unsigned int width; @@ -98,12 +95,12 @@ void nxgl_fillrectangle##NXGLIB_SUFFIX /* Get the dimensions of the rectange to fill in pixels */ - width = rect.pt2.x - rect.pt1.x; - rows = rect.pt2.y - rect.pt1.y; + width = rect->pt2.x - rect->pt1.x; + rows = rect->pt2.y - rect->pt1.y; /* Get the address of the first byte in the first line to write */ - line = pinfo->fbmem + rect.pt1.y * stride + NX_SCALEX(rect.pt1.x); + line = pinfo->fbmem + rect->pt1.y * stride + NX_SCALEX(rect->pt1.x); /* Then fill the rectangle line-by-line */