Skip to content

Commit

Permalink
cleanup for 1.2.5 rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentWei committed Nov 1, 2017
1 parent 4f49f76 commit 9ab1928
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 46 deletions.
7 changes: 5 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
*******************************************************************************
What's new in tunck
2017/10/26. CLEANUP: merge from rel-3-0
What's new in trunck

11/01. CLEANUP: merge from rel-3-0 manually.

10/26-2017. CLEANUP: merge from rel-3-0
* svn merge -r 1207:1246 ^/branches/rel-3-0

*******************************************************************************
Expand Down
2 changes: 0 additions & 2 deletions NEWS

This file was deleted.

7 changes: 1 addition & 6 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
mGPlus - A MiniGUI component which provides support for advanced 2D graphics
functions like path, gradient, anti-aliase stretch, and color combination.

This is mGPlus V1.2.x for MiniGUI V3.0.x or later.

Copyright (C) 2008 ~ 2017, Beijing FMSoft Technologies Co., Ltd.
Please refer to README.md.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mGPlus - A MiniGUI component which provides support for advanced 2D graphics
functions like path, gradient, anti-aliase stretch, and color combination.

This is mGPlus V1.2.x for MiniGUI V3.0.x or later.
This is the mainline release of mGPlus V1.2.x for MiniGUI V3.0.x or later.

Copyright (C) 2008 ~ 2017, Beijing FMSoft Technologies Co., Ltd.

17 changes: 17 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Release Notes

## Version 1.2.5

The MiniGUI development team announces the availability of mGPlus 1.2.5 RC1.
This release is the first Release Candidate for 1.2.5. All users of MiniGUI are
encouraged to test this version carefully, and report any bugs and incompatibilities
in [the bug tracking system](http://bugs.minigui.org) (see soon).

### What's new in this version

* The autoconf/automake config scripts are cleaned up.
* Fix some bugs.

### API changes

(none).
1 change: 1 addition & 0 deletions build/buildlib-linux-pc-mstudio
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
rm config.cache config.status -f

./configure \
$prefix_config \
--disable-static \
--with-targetname=mstudio \
--with-libsuffix=msd
Expand Down
28 changes: 20 additions & 8 deletions include/mgplus.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ extern "C" {

#ifndef MGPLUS_MAJOR_VERSION
# ifdef __MGPLUS_LIB__
# if defined(__CMAKE_PROJECT__) || defined(WIN32)
# include "mgplusconfig.h"
# else
# include "../mgplusconfig.h"
# endif
# else
# include "mgplusconfig.h"
# undef PACKAGE
Expand Down Expand Up @@ -1702,8 +1706,7 @@ MGPLUS_EXPORT MPStatus MGPlusGraphicLoadBitmapFromFile (HGRAPHICS graphics,
*
* \sa MGPlusGraphicLoadBitmap
*/
MPStatus
MGPlusGraphicUnLoadBitmap (HGRAPHICS graphics, int n_index);
MGPLUS_EXPORT MPStatus MGPlusGraphicUnLoadBitmap (HGRAPHICS graphics, int n_index);

/**
* \fn MPStatus MGPlusGraphicUnLoadBitmap (HGRAPHICS graphics,
Expand All @@ -1720,8 +1723,7 @@ MGPlusGraphicUnLoadBitmap (HGRAPHICS graphics, int n_index);
*
* \sa MGPlusGraphicLoadBitmap
*/
PBITMAP
MGPlusGraphicGetBitmap (HGRAPHICS graphics, int n_index);
MGPLUS_EXPORT PBITMAP MGPlusGraphicGetBitmap (HGRAPHICS graphics, int n_index);

/**
* \fn MPStatus MGPlusSetImageAlpha (HGRAPHICS graphics, int alpha)
Expand Down Expand Up @@ -2115,13 +2117,23 @@ MGPLUS_EXPORT MPStatus MGPlusPathAddRoundRectEx (HPATH path, int x, int y,
* \fn MPStatus MPStatus MGPlusPathArcto (HPATH path, double x1,
* double y1, double x2, double y2, double radius);
*
* \brief Add a arc to a path and two tangent line through
* subpath last vectors, (x1, y1), (x2, y2).
* \brief Add a arc to a path and two tangent line of arc.
*
* This function add a arc to a path and two tangent line through
* subpath last vectors, (x1, y1), (x2, y2),
* This function add a arc to a path and two tangent line of arc,
* first line through subpath last vectors to (x1, y1), second line
* through one arc point to (x2, y2).
* supported by mGPlus V1.2.1 or upper.
*
* ---------(last vector) ---- (x1,y1) ---- (point of tangent).
*
* arc
*
* |(point of tangent).
* |
* |
* (x2,y2)
*
*
* \param path The path pointer.
* \param x1 The x coordinat of first point .
* \param y1 The y coordinat of first point .
Expand Down
26 changes: 16 additions & 10 deletions src/agg/agg_platform_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
//----------------------------------------------------------------------------

#include <string.h>
//#include "SDL.h"
//#include "SDL_byteorder.h"

extern "C" {
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
}

#include "agg_platform_support.h"

namespace agg
Expand Down Expand Up @@ -213,7 +213,9 @@ namespace agg
{
if(m_surf_img[i])
{
#ifndef _MG_MINIMALGDI
UnloadBitmap(m_surf_img[i]);
#endif
free(m_surf_img[i]);
m_surf_img[i]=NULL;
}
Expand Down Expand Up @@ -372,10 +374,12 @@ namespace agg
{
int ret = FALSE;

#ifndef _MG_MINIMALGDI
if(m_specific->m_surf_img[idx])
UnloadBitmap(m_specific->m_surf_img[idx]);
else
m_specific->m_surf_img[idx] = (PBITMAP)calloc(1, sizeof(BITMAP));
#endif

HDC tmpdc = CreateCompatibleDC(m_specific->m_surf_window);
HDC tmpdc2 = CreateCompatibleDC(HDC_SCREEN);
Expand Down Expand Up @@ -416,10 +420,12 @@ namespace agg
{
if(idx < max_images)
{
#ifndef _MG_MINIMALGDI
if(m_specific->m_surf_img[idx])
UnloadBitmap(m_specific->m_surf_img[idx]);
else
m_specific->m_surf_img[idx] = (PBITMAP)calloc(1, sizeof(BITMAP));
#endif

#if 0
if (LoadBitmapFromMem(m_specific->m_surf_window,
Expand Down Expand Up @@ -471,6 +477,7 @@ namespace agg
{
if(idx < max_images) {

#ifndef _MG_MINIMALGDI
if(m_specific->m_surf_img[idx])
UnloadBitmap(m_specific->m_surf_img[idx]);
else
Expand All @@ -479,6 +486,7 @@ namespace agg
if (LoadBitmapFromFile(m_specific->m_surf_window,
m_specific->m_surf_img[idx], file) != 0)
return false;
#endif
#if 0
FillBoxWithBitmap(m_specific->m_surf_window, 0, 0, 0, 0,
m_specific->m_surf_img[idx]);
Expand Down Expand Up @@ -534,13 +542,19 @@ namespace agg
//------------------------------------------------------------------------
void platform_support::start_timer()
{
#ifndef _MG_MINIMALGDI
m_specific->m_sw_start = GetTickCount();
#endif
}

//------------------------------------------------------------------------
double platform_support::elapsed_time() const
{
#ifndef _MG_MINIMALGDI
int stop = GetTickCount();
#else
int stop = 0;
#endif
return double(stop - m_specific->m_sw_start);
}

Expand Down Expand Up @@ -573,11 +587,3 @@ namespace agg
void platform_support::on_draw() {}
void platform_support::on_post_draw(void* raw_handler) {}
}
#if 0
int agg_main(int argc, char* argv[]);
int main(int argc, char* argv[])
{
return agg_main(argc, argv);
//return MiniGUIMain(argc, argv);
}
#endif
2 changes: 1 addition & 1 deletion src/api/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ HDR_FILES = path.h graphics.h pen.h brush.h self_stroke.h
libapi_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
LIB_NAME=libapi

EXTRA_DIST=$(SRC_FILES) opt_basic.cpp
EXTRA_DIST = $(SRC_FILES) opt_basic.cpp
53 changes: 48 additions & 5 deletions src/api/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
#include "agg_span_gradient.h"
#include "agg_platform_support.h"
#include "agg_gamma_ctrl.h"
#include <math.h>
#include <assert.h>
#ifndef _MGRM_THREADS
#include <pthread.h>
#endif
#include <math.h>
#include <assert.h>


#define DRAW_GRAPHIC(hdc, rgn, pctx, cb) do {\
Expand Down Expand Up @@ -147,9 +147,9 @@ static agg_draw_op* get_pixfmt_op(HDC hdc)

for(i = 0; i < TABLESIZE(pixfmt_op); i++) {
if (pixfmt_op[i].rmask == rmask &&
pixfmt_op[i].gmask == gmask &&
pixfmt_op[i].bmask == bmask &&
pixfmt_op[i].bpp == bpp)
pixfmt_op[i].gmask == gmask &&
pixfmt_op[i].bmask == bmask &&
pixfmt_op[i].bpp == bpp)
return pixfmt_op[i].op;
}
return NULL;
Expand Down Expand Up @@ -430,6 +430,18 @@ static inline BYTE* _mem_set_pixel (BYTE* dst, int bpp, Uint32 pixel)
return dst + bpp;
}

#define direct_graphic_save_copy_pixel do{\
Uint8 *dst_pixel, *src_pixel;\
gal_pixel pixel;\
Uint8 r, g, b, a;\
dst_pixel = dst + (dst_rc->left + step) * dst_bytes_per_pixel;\
src_pixel = src + step * ctxt->src_bytes_per_pixel;\
pixel = _mem_get_pixel(src_pixel, ctxt->src_bytes_per_pixel);\
Pixel2RGBA(ctxt->pg->hdc, pixel, &r, &g, &b, &a);\
pixel = RGBA2Pixel(dst_hdc, r, g, b, a);\
_mem_set_pixel(dst_pixel, dst_bytes_per_pixel, pixel);\
step++;} while(0)

static void
direct_graphic_save (HDC dst_hdc, Uint8* dst_pixels,
int dst_pitch, int dst_bytes_per_pixel, const RECT* dst_rc, void* content)
Expand All @@ -445,6 +457,27 @@ direct_graphic_save (HDC dst_hdc, Uint8* dst_pixels,
(ctxt->sx+ off_x) * ctxt->src_bytes_per_pixel;
while ( height-- ) {
int step = 0;
#ifdef WIN32
DUFFS_LOOP(direct_graphic_save_copy_pixel
/*
(
{
Uint8 *dst_pixel, *src_pixel;
gal_pixel pixel;
Uint8 r, g, b, a;
dst_pixel = dst + (dst_rc->left + step) * dst_bytes_per_pixel;
src_pixel = src + step * ctxt->src_bytes_per_pixel;
pixel = _mem_get_pixel(src_pixel, ctxt->src_bytes_per_pixel);
Pixel2RGBA(ctxt->pg->hdc, pixel, &r, &g, &b, &a);
pixel = RGBA2Pixel(dst_hdc, r, g, b, a);
_mem_set_pixel(dst_pixel, dst_bytes_per_pixel, pixel);
step++;
}
)*/,
width);
#else
DUFFS_LOOP(
(
{
Expand All @@ -463,6 +496,7 @@ direct_graphic_save (HDC dst_hdc, Uint8* dst_pixels,
}
),
width);
#endif

src += ctxt->src_pitch;
dst += dst_pitch;
Expand Down Expand Up @@ -641,6 +675,7 @@ MGPlusGraphicDelete (HGRAPHICS graphics)
}
i ++;
}

if (pg->clip_ras.buf) {
delete [] pg->clip_ras.buf;
}
Expand Down Expand Up @@ -1483,10 +1518,12 @@ MGPlusGraphicUnLoadBitmap (HGRAPHICS graphics, int n_index)
if (n_index > MAX_BMP_NUM || n_index < 0)
return MP_INDEX_NOT_MATCH;

#ifndef _MG_MINIMALGDI
if (pgs->surf_img [n_index]) {
UnloadBitmap(pgs->surf_img[n_index]);
}
return MP_OK;
#endif
}

PBITMAP
Expand All @@ -1507,6 +1544,7 @@ MGPlusGraphicGetBitmap (HGRAPHICS graphics, int n_index)
MPStatus
MGPlusGraphicLoadBitmapFromFile(HGRAPHICS graphics, int n_index, char* file)
{
#ifndef _MG_MINIMALGDI
MPGraphics *pgs = (MPGraphics *)graphics;
HDC hdc;

Expand All @@ -1532,6 +1570,9 @@ MGPlusGraphicLoadBitmapFromFile(HGRAPHICS graphics, int n_index, char* file)
pgs->surf_img [n_index]->bmPitch);

return MP_OK;
#else
return MP_GENERIC_ERROR;
#endif
}

#ifdef _MGPLUS_FONT_FT2
Expand Down Expand Up @@ -1667,7 +1708,9 @@ int MGPlusSaveHG (HGRAPHICS hg)
hg_state->next = NULL;
hg_state->prev = NULL;

#ifndef _MG_MINIMALGDI
pthread_once(&once_control, init_routine);
#endif
LOCK (&lock);

nr_hg_states ++;
Expand Down
Loading

0 comments on commit 9ab1928

Please sign in to comment.