Commit Graph

581 Commits

Author SHA1 Message Date
Vincent Torri cfbdcdc9c8 Use extern after EAPI
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11961
2020-06-10 10:07:57 +02:00
Ali Alzyod 18218f5072 evas_common_font: release reallocated glyphs bitmaps data
Reviewers: woohyun, smohanty

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8743

Differential Revision: https://phab.enlightenment.org/D11945
2020-06-09 10:25:10 +09:00
Carsten Haitzler 6e460922bb tiler - add maxreg for newtiler - not used atm but matches current 2020-06-04 20:22:03 +01:00
Subhransu Mohanty 97f4f7127a evas/engine: Fix memory leak in generic cache.
Summary:
During shutdown we used to call engine_image_free() which was causing some deadlock.
as we have evas_cache which takes care of freeing all the images we just have to
delete the generic cache without freeing the image during shutdown.

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11915
2020-06-03 13:03:39 +09:00
Ali Alzyod 23e8715070 evas_text: reduce Video Memory & RAM needed for text textures (Color Glyphs)
Summary:
Texture created for bitmap font glyph, with a fixed size in the font, this size could be much bigger than the needed size in application.
Then a scale factor is applied to these textures when drawn.

Now, instead, we will create smaller bitmaps and create texture from them with reduced texture size (that is not needed).

** This will affect both Video Memory and Ram needed to store glyphs**

Open this file {F3883874} in terminology before and after applying the patch and notice the difference.

Test Plan:
**Notes**
- You need to scroll down to make all glyphs visible, then notice Video/Ram memory

|                      | Video | Ram
|----------------------|-------|-----
| Before (Font_size=50) |  360   |  300
| After (Font_size=50) |  40   | 100
| Ration After/before   |  11%  |  33%

**I notice speed up in text rendering for small font size**

```
#include <Elementary.h>

typedef struct _APP
{
  Evas_Object *tb1;
  Evas_Object *btnLoad;
} APP;

char *text = "<align=center><color=#4DE0FFFF underline=on underline_color=#4DE0FFFF><a href='tel:1234567890'>1234567890</a></color>😀😁😂🤣😃😄😅😆😉😊😋😎😍😘😗😙😚🙂🤗🤔😐😑😶🙄😏😣😥😮🤐😯😪😫😴😌🤓😛😜😝🤤😒😓😔😕🙃🤑😲🙁😖😞😟😤😢😭😦😧😨😩😬😰😱😳😵😡😠😇🤠🤡🤥😷🤒🤕🤢🤧😈👿👹👺💀👻👽👾🤖💩😺😸😹😻😼😽🙀😿😾🙈🙉🙊👦👧👨👩👵👶👼👨‍⚕️👩‍⚕️👨‍🎓👩‍🎓👨‍🏫👩‍🏫👨‍⚖👩‍⚖👨‍🌾👩‍🌾👨‍🍳👩‍🍳👨‍🔧👩‍🔧👨‍🏭👩‍🏭👨‍💼👩‍💼👨‍🔬👩‍🔬👨‍💻👩‍💻👨‍🎤👩‍🎤👨‍🎨👩‍🎨👨‍✈️👩‍✈️👨‍🚀👩‍🚀👨‍🚒👩‍🚒👮‍♂️👮‍♀️🕵️‍♂️🕵️‍♀️💂‍♂️💂‍♀️👷‍♂️👷‍♀️👳‍♂️👳‍♀️👱‍♂️👱‍♀️🎅🤶👸🤴👰🤵🤰👲🙍‍♂️🙍‍♀️🙎‍♂️🙎‍♀️🙅‍♂️🙅‍♀️🙆‍♂️🙆‍♀️💁‍♂️💁‍♀️🙋‍♂️🙋‍♀️🙇‍♂️🙇‍♀️🤦‍♂️🤦‍♀️🤷‍♂️🤷‍♀️💆‍♂️💆‍♀️💇‍♂️💇‍♀️🚶‍♂️🚶‍♀️🏃‍♂️🏃‍♀️💃🕺👯‍♂️👯‍♀️🕴🗣👤👥👫👬👭💏💑👪👨‍👩‍👧👨‍👩‍👧‍👦👨‍👩‍👦‍👦👨‍👩‍👧‍👧👨‍👦👨‍👦‍👦👨‍👧👨‍👧‍👦👨‍👧‍👧👩‍👦👩‍👦‍👦👩‍👧👩‍👧‍👦👩‍👧‍👧💪🤳👈👉☝️👆🖕👇🤞🖖🤘👊🖐👌👍👎👊🤛🤜🤚👋👏👐🙌🙏🤝💅👂👃👣👀👁👅👄💋💘💓💔💕💖💗💙💚💛💜🖤💝💞💟💌💤💢💣💥💦💨💫💬🗨🗯💭🕳👓🕶👔👕👖👗👘👙👚👛👜👝🛍🎒👞👟👠👡👢👑👒🎩🎓📿💄💍💎🐵🐒🦍🐶🐕🐩🐺🦊🐱🐈🦁🐯🐅🐆🐴🐎🦌🦄🐮🐂🐃🐄🐷🐖🐗🐽🐏🐑🐐🐪🐫🐘🦏🐭🐁🐀🐹🐰🐇🐿🦇🐻🐨🐼🐾🦃🐔🐓🐣🐤🐥🐦🐧🕊🦅🦆🦉🐸🐊🐢🦎🐍🐲🐉🐳🐋🐬🐟🐠🐡🦈🐙🐚🦀🦐🦑🦋🐌🐛🐜🐝🐞🕷🕸🦂💐🌸💮🏵🌹🥀🌺🌻🌼🌷🌱🌲🌳🌴🌵🌾🌿🍀🍁🍂🍃🍇🍈🍉🍊🍋🍌🍍🍎🍏🍐🍑🍒🍓🍅🥝🥑🍆🥔🥕🌽🌶🥒🍄🥜🌰🍞🥐🥖🥞🧀🍖🍗🥓🍔🍟🍕🌭🌮🌯🥙🥚🍳🥘🍲🥗🍿🍱🍘🍙🍚🍛🍜🍝🍠🍢🍣🍤🍥🍡🍦🍧🍨🍩🍪🎂🍰🍫🍬🍭🍮🍯🍼🥛🍵🍶🍾🍷🍸🍹🍺🍻🥂🍽🍴🥄🔪🏺🎃🎄🎆🎇🎈🎉🎊🎋🎍🎎🎏🎐🎑🎀🎁🎗🎟🎫🎖🏆🏅🥇🥈🥉🏀🏐🏈🏉🎾🎱🎳🏏🏑🏒🏓🏸🥊🥋🥅🎯🏌️‍♂️🏌️‍♀️🎣🎽🎿🏂🏄‍♂️🏄‍♀️🏇🏊‍♂️🏊‍♀️⛹️‍♂️⛹️‍♀️🏋️‍♂️🏋️‍♀️🚴‍♂️🚴‍♀️🚵‍♂️🚵‍♀️🏎🏍🤸‍♂️🤸‍♀️🤼‍♂️🤼‍♀️🤽‍♂️🤽‍♀️🤾‍♂️🤾‍♀️🤺🤹‍♂️🤹‍♀️🎮🕹🎲♠️♥️♦️♣️🃏🀄🎴🌍🌎🌏🌐🗺🏔⛰🌋🗻🏕🏖🏜🏝🏞🏟🏛🏗🏘🏙🏚🏠🏡🏢🏣🏤🏥🏦🏨🏩🏪🏫🏬🏭🏯🏰💒🗼🗽🕌🕍🕋🌁🌃🌄🌅🌆🌇🌉♨️🌌🎠🎡🎢💈🎪🎭🖼🎨🎰🚂🚃🚄🚅🚆🚇🚈🚉🚊🚝🚞🚋🚌🚍🚎🚐🚑🚒🚓🚔🚕🚖🚗🚘🚙🚚🚛🚜🚲🛴🛵🚏🛣🛤🚨🚥🚦🚧🛑🚣‍♂️🚣‍♀️🛶🚤🛳⛴🛥🚢✈🛩🛫🛬💺🚁🚟🚠🚡🚀🛰🛎🚪🛌🛏🛋🚽🚿🛀🛁⏱⏲🕰🕛🕧🕐🕜🕑🕝🕒🕞🕓🕟🕔🕠🕕🕡🕖🕢🕗🕣🕘🕤🕙🕥🕚🕦🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜🌡☀️🌝🌞🌟🌠☁️⛈🌤🌥🌦🌧🌨🌩🌪🌫🌬🌀🌈🌂☂️☃️🔥💧🌊🔇🔈🔉🔊📢📣📯🔔🔕🎼🎵🎶🎙🎚🎛🎤🎧📻🎷🎸🎹🎺🎻🥁📱📲☎️📞📟📠🔋🔌💻🖥🖨⌨🖱🖲💽💾💿📀🎥🎞📽🎬📺📷📸📹📼🔍🔎🔬🔭📡🕯💡🔦🏮📔📕📖📗📘📙📚📓📒📃📜📄📰🗞📑🔖🏷💰💴💵💶💷💸💳💱💲📧📨📩📤📥📦📫📪📬📭📮🗳✏✒🖋🖊🖌🖍📝💼📁📂🗂📅📆🗒🗓📇📈📉📊📋📌📍📎🖇📏📐✂️🗃🗄🗑🔒🔓🔏🔐🔑🗝🔨⛏⚒🛠🗡⚔🔫🏹🛡🔧🔩⚙🗜⚗⚖🔗💉💊🚬⚰⚱🗿🛢🔮🔮🏧🚮🚰🚹🚺🚻🚼🚾🛂🛃🛄🛅⚠️🚸🚫🚳🚭🚯🚱🚷📵🔞☢☣⬆️↗️➡️↘️⬇️↙️⬅️↖️↕️↔️↩↪⤴️⤵️🔃🔄🔙🔚🔛🔜🔝🛐⚛🕉✡☸☯️☦☮🕎🔯🔀🔁🔂▶️⏭⏯◀️🔼🔽⏸⏹⏺⏏🎦🔅🔆📶📳📴♻️📛🔰🔱☑✔✖♀️♂️〽✳✴❇⁉️🔟💯🔠🔡🔢🔣🔤🅰️🆎🅱️🆑🆒🆓️ℹ🆔Ⓜ️🆕🆖🅾️🆗🅿️🆘🆙🆚🈁🈂🈷🈶🈯🉐🈹🈚🈲🉑🈸🈴🈳㊗㊙🈺🈵▫️◻◼🔶🔷🔸🔹🔺🔻💠🔘🔲🔳🔴🔵🏁🚩🏴🏳🏳️‍🌈⚀⚁⚂⚃⚄⚅⛾♾🇦🇨🇦🇩🇦🇪🇦🇫🇦🇬🇦🇮🇦🇱🇦🇲🇦🇴🇦🇶🇦🇷🇦🇸🇦🇹🇦🇺🇦🇼🇦🇽🇦🇿🇧🇦🇧🇧🇧🇩🇧🇪🇧🇫🇧🇬🇧🇭🇧🇮🇧🇯🇧🇱🇧🇲🇧🇳🇧🇴🇧🇶🇧🇷🇧🇸🇧🇹🇧🇼🇧🇾🇧🇿🇨🇦🇨🇨🇨🇩🇨🇫🇨🇬🇨🇭🇨🇮🇨🇰🇨🇱🇨🇲🇨🇳🇨🇴🇨🇷🇨🇺🇨🇻🇨🇼🇨🇽🇨🇾🇨🇿🇩🇪🇩🇯🇩🇰🇩🇲🇩🇴🇩🇿🇪🇨🇪🇪🇪🇬🇪🇭🇪🇷🇪🇸🇪🇹🇪🇺🇫🇮🇫🇯🇫🇰🇫🇲🇫🇴🇫🇷🇬🇦🇬🇧🇬🇩🇬🇪🇬🇫🇬🇬🇬🇭🇬🇮🇬🇱🇬🇲🇬🇳🇬🇵🇬🇶🇬🇷🇬🇸🇬🇹🇬🇺🇬🇼🇬🇾🇭🇰🇭🇲🇭🇳🇭🇷🇭🇹🇭🇺🇮🇨🇮🇩🇮🇪🇮🇱🇮🇲🇮🇳🇮🇴🇮🇶🇮🇷🇮🇸🇮🇹🇯🇪🇯🇲🇯🇴🇯🇵🇰🇪🇰🇬🇰🇭🇰🇮🇰🇲🇰🇳🇰🇵🇰🇷🇰🇼🇰🇾🇰🇿🇱🇦🇱🇧🇱🇨🇱🇮🇱🇰🇱🇷🇱🇸🇱🇹🇱🇺🇱🇻🇱🇾🇲🇦🇲🇨🇲🇩🇲🇪🇲🇬🇲🇭🇲🇰🇲🇱🇲🇲🇲🇳🇲🇴🇲🇵🇲🇶🇲🇷🇲🇸🇲🇹🇲🇺🇲🇻🇲🇼🇲🇽🇲🇾🇲🇿🇳🇦🇳🇨🇳🇪🇳🇫🇳🇬🇳🇮🇳🇱🇳🇴🇳🇵🇳🇷🇳🇺🇳🇿🇴🇲🇵🇦🇵🇪🇵🇫🇵🇬🇵🇭🇵🇰🇵🇱🇵🇲🇵🇳🇵🇷🇵🇸🇵🇹🇵🇼🇵🇾🇶🇦🇷🇪🇷🇴🇷🇸🇷🇺🇷🇼🇸🇦🇸🇧🇸🇨🇸🇩🇸🇪🇸🇬🇸🇭🇸🇮🇸🇰🇸🇱🇸🇲🇸🇳🇸🇴🇸🇷🇸🇸🇸🇹🇸🇻🇸🇽🇸🇾🇸🇿🇹🇦🇹🇨🇹🇩🇹🇫🇹🇬🇹🇭🇹🇯🇹🇰🇹🇱🇹🇲🇹🇳🇹🇴🇹🇷🇹🇹🇹🇻🇹🇼🇹🇿🇺🇦🇺🇬🇺🇳🇺🇸🇺🇾🇺🇿🇻🇦🇻🇨🇻🇪🇻🇬🇻🇮🇻🇳🇻🇺🇼🇫🇼🇸🇽🇰🇾🇪🇾🇹🇿🇦🇿🇲🇿🇼8<br/><br/><br/><br/>Sent from my Samsung Galaxy smartphone.</align>";

int font_size = 100;
void _button_clicked(void *data, Evas_Object *obj, void *event_info)
{
   APP *app = data;
   font_size = font_size - font_size/5;
   char buffer[100] = {0};
   sprintf(buffer, "DEFAULT='font=NotoColorEmoji font_size=%i color=red ellipsis=-1.0 wrap=mixed'", font_size);

   Evas_Textblock_Style *style = evas_textblock_style_new();
   evas_textblock_style_set(style, buffer);
   evas_object_textblock_style_set(app->tb1, style);
   evas_textblock_style_free(style);

   sprintf(buffer, "font_size = %i",font_size);
   elm_object_text_set(app->btnLoad, buffer);

   style = NULL;
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
  APP *app = calloc(1, sizeof(APP));
  Evas_Object *win, *scroller1, *scroller2, *box;

  elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

  win = elm_win_util_standard_add("", "");
  elm_win_autodel_set(win, EINA_TRUE);

  box = elm_box_add(win);
  evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
  scroller1 = elm_scroller_add(win);
  evas_object_size_hint_weight_set(scroller1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  evas_object_size_hint_align_set(scroller1, EVAS_HINT_FILL, EVAS_HINT_FILL);

  //evas_text_cache_policy_set(EVAS_TEXT_CACHE_POLICY_TEXTURE ,EVAS_TEXT_CACHE_NONE);

  app->tb1 = evas_object_textblock_add(win);
  Evas_Textblock_Style *style = evas_textblock_style_new();
  char buffer[100] = {0};
  sprintf(buffer, "DEFAULT='font=NotoColorEmoji font_size=%i color=red ellipsis=-1.0 wrap=mixed'", font_size);
  evas_textblock_style_set(style, buffer);
  evas_object_textblock_style_set(app->tb1, style);
  evas_textblock_style_free(style);
  style = NULL;

  int w,h;
  evas_object_textblock_text_markup_set(app->tb1, "");
  evas_object_size_hint_min_set(app->tb1, 360, 720);
  elm_object_content_set(scroller1, app->tb1);
  elm_box_pack_end(box, scroller1);
  elm_object_content_set(win, box);

  app->btnLoad = elm_button_add(win);
  sprintf(buffer, "font_size = %i",font_size);
  elm_object_text_set(app->btnLoad, buffer);
  evas_object_smart_callback_add(app->btnLoad, "clicked", _button_clicked, app);
  evas_object_show(app->btnLoad);
  evas_object_move(app->btnLoad, 0, 20);
  evas_object_resize(app->btnLoad, 150, 20);

  evas_object_textblock_text_markup_set(app->tb1, text);
  evas_object_textblock_size_formatted_get(app->tb1, &w, &h);
  evas_object_size_hint_min_set(app->tb1, 800, w/800 + h + 150);

  evas_object_resize(win, 800, 800);
  evas_object_show(box);
  evas_object_show(scroller1);
  evas_object_show(scroller2);
  evas_object_show(win);
  elm_run();

  return 0;
}
ELM_MAIN()
```

Reviewers: raster, woohyun, bu5hm4n, zmike, Hermet, segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8712

Differential Revision: https://phab.enlightenment.org/D11814
2020-05-29 10:10:28 +01:00
Mike Blumenkrantz 235ba0e407 evas: resolve float compare warnings
Summary: Depends on D11792

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11793
2020-05-12 16:10:02 +02:00
Vincent Torri d135957ffa Use __func__ C99 identifier instead of __FUNCTION__ compiler extension
Summary: see http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf section 6.4.2.2 page 52

Test Plan: compilation

Reviewers: raster, devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11785
2020-05-07 09:27:07 -04:00
Carsten Haitzler 3283a11a88 evas_textblock/evas_text/evas_textgrid: pick textrun fonts
Summary:
Picking font on textrun, will now give priority into font picked by the user, regardless of script type.
picking font due script can cause many inconvenient results

Example of wrong results:  (User font is **NotoColorEmoji**)
{F3847118} -> add 'a' at the end (notice how text render is wrong) {F3847119} -> add tab before 'a' (text rendering now is right) {F3847120}

After Change results: (User font is **NotoColorEmoji**)
{F3847118}  -> add 'a' at the end -> {F3847122}-> add tab before 'a' -> {F3847123}

Also now the following lines will be shown exactly the same, regardless of characters order
```
"가123A321"
"A321가123"
"123가A321"
"A가123321"
```

Test Plan:
```
#include <Elementary.h>
/*
gcc -o example test.c `pkg-config --cflags --libs elementary`
*/

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *en;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("", "");
   elm_win_autodel_set(win, EINA_TRUE);

   en = elm_entry_add(win);
   elm_entry_scrollable_set(en, EINA_TRUE);
   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_entry_text_style_user_push(en,"DEFAULT='font=NotoColorEmoji font_size=30 color=red'");
   elm_object_text_set(en, "&#x262a;123456a");

   evas_object_show(en);

   elm_object_content_set(win, en);
   evas_object_resize(win, 400, 200);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()
```

Reviewers: woohyun, bowonryu, tasn, raster, cedric

Reviewed By: tasn

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8556

Differential Revision: https://phab.enlightenment.org/D11302
2020-04-18 17:36:25 +01:00
Carsten Haitzler d9b9647a15 Revert "evas_textblock: pick textrun fonts"
This reverts commit 9b987c67e1.

this breaks color emoji in terminology (evas textgrid).
2020-04-17 19:20:26 +01:00
Ali Alzyod bab13de794 evas_textblock: remove special treat for variation sequence text run
Summary:
Now there are no need for special care for variation sequence text run break.
General method will care about all types of characters\

this is also related to D11096

Reviewers: woohyun, bowonryu

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11602
2020-04-17 14:26:14 +09:00
Ali Alzyod 9b987c67e1 evas_textblock: pick textrun fonts
Summary:
Picking font on textrun, will now give priority into font picked by the user, regardless of script type.
picking font due script can cause many inconvenient results

Example of wrong results:  (User font is **NotoColorEmoji**)
{F3847118} -> add 'a' at the end (notice how text render is wrong) {F3847119} -> add tab before 'a' (text rendering now is right) {F3847120}

After Change results: (User font is **NotoColorEmoji**)
{F3847118}  -> add 'a' at the end -> {F3847122}-> add tab before 'a' -> {F3847123}

Also now the following lines will be shown exactly the same, regardless of characters order
```
"가123A321"
"A321가123"
"123가A321"
"A가123321"
```

Test Plan:
```
#include <Elementary.h>
/*
gcc -o example test.c `pkg-config --cflags --libs elementary`
*/

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *en;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("", "");
   elm_win_autodel_set(win, EINA_TRUE);

   en = elm_entry_add(win);
   elm_entry_scrollable_set(en, EINA_TRUE);
   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_entry_text_style_user_push(en,"DEFAULT='font=NotoColorEmoji font_size=30 color=red'");
   elm_object_text_set(en, "&#x262a;123456a");

   evas_object_show(en);

   elm_object_content_set(win, en);
   evas_object_resize(win, 400, 200);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()
```

Reviewers: woohyun, bowonryu, tasn, raster, cedric

Reviewed By: tasn

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8556

Differential Revision: https://phab.enlightenment.org/D11302
2020-04-17 12:28:42 +09:00
Ali Alzyod ba1a326a57 evas_common: rgba32 to Y8 (Enhance Conversion)
Summary:
Made small change to expand mapping range by using celling values.
Now : rgb(255,255,255)   ->  y(255)
Now : rgb(1  , 1 ,1  )   ->  y(1)

Old : rgb(255,255,255)   ->  y(254)
Old : rgb(1  ,  1,  1)   ->  y(0)

It is important for white point convert to not loss any value

Test Plan:
```
#include <stdio.h>

int main()
{
    unsigned char r =255, g =255,b =255;
    unsigned int gry8_old = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16;
    unsigned int gry8_new = ((r * 19596) + (g * 38470) + (b * 7472)) >> 16;

    printf("gry_old=%i\n",gry8_old);
    printf("gry_new=%i\n",gry8_new);

    return 0;
}

```

Reviewers: cedric, raster, zmike, vtorri, Hermet, woohyun, bu5hm4n, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9490
2020-03-13 09:58:04 +01:00
Mike Blumenkrantz 7aec0565cb Revert "evas: remove unused function evas_common_load_image_from_file."
Summary:
This reverts commit 7672d1050e.
Depends on D11335

Reviewers: raster

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11336
2020-02-14 08:33:20 -05:00
Hermet Park 6684f41626 canvas font: correct wrong masking length.
the masking length should be x2 - x1 otherwise,
it will try to mask over regions with dirty pixels.

@fix
2020-02-13 16:50:21 +09:00
Ali Alzyod 8143b81dd6 evas_object_textblock: treat variation sequence as single run
Summary:
Variation sequence treated as a single run, if we found one, we keep looking adding to the same  run, but if it is not, then we need to start a new one.

Before:
{F3826735}

After:
{F3826736}

Test Plan:
```
#include <stdio.h>
#include <Elementary.h>
/*
gcc -o example test.c `pkg-config --cflags --libs elementary`
*/

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *en;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("emoji-example", "emoji-example");
   elm_win_autodel_set(win, EINA_TRUE);

   en = elm_entry_add(win);
   elm_entry_scrollable_set(en, EINA_TRUE);
   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_object_text_set(en, "<font_size=25>&#x262a;&#x262a;&#xfe0f;&#x262a;가</font_size>");

   evas_object_show(en);

   elm_object_content_set(win, en);
   evas_object_resize(win, 400, 200);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()
```

Reviewers: woohyun, bowonryu

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8542

Differential Revision: https://phab.enlightenment.org/D11096
2020-01-23 16:21:22 +09:00
Hermet Park dea448d40c evas map: ++Safety for range overflow.
This might fix this issue.

{T8199}
2020-01-03 20:54:26 +09:00
Hermet Park d5463dfb1a Revert "Revert "Revert "evas map: diable high quality texture mapping feature."""
This reverts commit 1cb7d11ea8.
2020-01-03 20:54:19 +09:00
Ali Alzyod 2d76224918 evas_object_textblock: add support for variation sequences
Summary: update font processing to handle variation sequences unicodes to select proper glypg in respect to variation seqences

Test Plan:
```
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Eina.h>
#include <Efl.h>
#include <Elementary.h>

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *textblock;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("Main", "");
   elm_win_autodel_set(win, EINA_TRUE);
   textblock = evas_object_textblock_add(win);
   efl_canvas_text_style_set(textblock,NULL,"DEFAULT='font=DejaVuSans font_fallbacks=SamsungColorEmoji color=#000 font_size=20'");
   evas_object_textblock_text_markup_set(textblock, "8&#xfe0f;&#x20E3;&#x262a;&#xfe0f;AAA&#x262a;&#xfe0E;1234567&#xfe0f;&#x20E3;");

   evas_object_size_hint_weight_set(textblock, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(textblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(textblock);
   evas_object_move(textblock, 0, 0);
   evas_object_resize(textblock, 320, 320);
   evas_object_resize(win, 320, 320);
   evas_object_show(win);
   elm_run();
   return 0;

}

ELM_MAIN()

```

Reviewers: woohyun, bowonryu, segfaultxavi, cedric, bu5hm4n

Reviewed By: woohyun, cedric

Subscribers: raster, bu5hm4n, subodh6129, herdsman, segfaultxavi, zmike, cedric, #committers, #reviewers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9053
2019-12-12 16:22:12 +09:00
Hermet Park 1cb7d11ea8 Revert "Revert "evas map: diable high quality texture mapping feature.""
This reverts commit 94c193e40b.
2019-12-02 20:41:14 +09:00
abdulleh Ghujeh f6caca1d70 Efl Canvas Text : Modify Style Property
Summary:
This patch defines the way style property will work at canvas_text object

1- Changing canvas_text style property using Font/Format/Style interfaces or with efl_canvas_text style property are the same.
     Example:

```
efl_text_font_set(tb, "Arial", 30);
//is same as
efl_canvas_text_style_set(tb, "font=Arial font_size=30");

//which means calling
char * font;
int size;
int font_size;
efl_text_font_get(tb, &font, &size);
// calling this after any of the top two functions will return same result
```

2- style_get_property
     Will return string that contains full details about all the current applied style at canvas_text  level.

3- style_set_property
     Will only override passed styles and leave everything else as it is

```
efl_canvas_text_style_set(tb, "font=Arial");  // overrider font name to Arial and leave everthing else
efl_canvas_text_style_set(tb, "font_size=30");  // overrider font size to 30 and leave everthing else (font name will stay arial)
```

Reviewers: ali.alzyod, woohyun, tasn, segfaultxavi, bu5hm4n, zmike

Reviewed By: woohyun

Subscribers: zmike, bu5hm4n, segfaultxavi, a.srour, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10607
2019-11-28 13:14:15 +09:00
Hermet Park 54217cda84 evas image cache: drop cache properly,
the default reference is 1,
thus we should drop it unless if it's more than 1,
2019-11-18 13:08:40 +09:00
Carsten Haitzler 80d317f20e evas - revert evas variation sequence support - out of bound accesses
This code is filled with out of bounds accesses now after the reverted
patch. All those base_char+1, itr+1 etc. in
evas_common_font_query_run_font_end_get() are accessing BEYOND
the end of the run. textgrid shows this instantly to fall over as it
uses single unicode codepoint chars with no nul terminator. As this
api takes an explicit run_len we should never access beyond the end of
the run_len.

Please revisit this code and keep in mind proper memory/bounds
accessing. If there was ano run_len and it assumed strings were
regular strings that had to be nul terminated... then it might be ok,
but not here.

of course if i put in guards for these +1's then it ends up in
infintie loops, so enough debugging and send it back for a rethink. :)

....

Revert "evas_object_textblock: add support for variation sequences"

This reverts commit 46f2d8acdc.
2019-10-31 12:31:52 +00:00
Ali Alzyod 46f2d8acdc evas_object_textblock: add support for variation sequences
Summary: update font processing to handle variation sequences unicodes to select proper glypg in respect to variation seqences

Test Plan:
```
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Eina.h>
#include <Efl.h>
#include <Elementary.h>

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *textblock;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("Main", "");
   elm_win_autodel_set(win, EINA_TRUE);
   textblock = evas_object_textblock_add(win);
   efl_canvas_text_style_set(textblock,NULL,"DEFAULT='font=DejaVuSans font_fallbacks=SamsungColorEmoji color=#000 font_size=20'");
   evas_object_textblock_text_markup_set(textblock, "8&#xfe0f;&#x20E3;&#x262a;&#xfe0f;AAA&#x262a;&#xfe0E;1234567&#xfe0f;&#x20E3;");

   evas_object_size_hint_weight_set(textblock, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(textblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(textblock);
   evas_object_move(textblock, 0, 0);
   evas_object_resize(textblock, 320, 320);
   evas_object_resize(win, 320, 320);
   evas_object_show(win);
   elm_run();
   return 0;

}

ELM_MAIN()

```

Reviewers: woohyun, bowonryu, segfaultxavi, cedric, bu5hm4n

Reviewed By: woohyun, cedric

Subscribers: bu5hm4n, subodh6129, herdsman, segfaultxavi, zmike, cedric, #committers, #reviewers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9053
2019-10-19 14:01:36 +09:00
Mike Blumenkrantz 3b161da0ce evas/language: #ifdef guard variable which is only used inside #ifdef
Summary:
this variable is already only changed inside an #ifdef, so declare and
free it only inside the same ifdef for clarity

ref 9d9aa8b6ae
CID 1400807

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10389
2019-10-18 13:28:41 -04:00
Mike Blumenkrantz 9d9aa8b6ae evas/language: #ifdef guard variable which is only used inside #ifdef
Summary:
this variable is already only changed inside an #ifdef, so declare and
free it only inside the same ifdef for clarity

CIDs 1401016, 1400807

Reviewers: cedric

Reviewed By: cedric

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10320
2019-10-11 10:03:17 -04:00
Hermet Park 94c193e40b Revert "evas map: diable high quality texture mapping feature."
This reverts commit 3787050515.

This patch should go on.
2019-10-02 11:43:32 +09:00
Hermet Park 3787050515 evas map: diable high quality texture mapping feature.
This is a little bit buggy, need to make it stablize further.

Temporarily diable this for 1.23 release.
2019-09-30 16:54:45 +09:00
Hermet Park 6f3841e4b4 evas mask: refactoring code.
This clearly separate the condition cases clear so that
the analizyer tool doesn't bother us anymore.

No logical changes.
2019-09-19 14:01:31 +09:00
Hermet Park aaa199e2d4 evas map: disable the anti_aliasing code which can't be reached.
This anti-aliasing is a little buggy, should be improved.

But just leaving to fix later when it's necessary.
2019-09-19 13:30:21 +09:00
Hermet Park c6b52d4f09 canvas map: remove logically dead code.
the value was overflow, reduce its size.
2019-08-26 19:30:06 +09:00
Hermet Park 42a7aae58c canvas map: code refactoring.
remove dead code that unreachable looping.
2019-08-26 19:23:43 +09:00
Carsten Haitzler 9f9cfe65a6 evas - scalecache - be a bit paranoid about images being set to null
this may address a bug, but i'm not sure as i can't reproduce it.
suffice to say it smells like a possible leak.
2019-08-25 10:28:08 +01:00
Carsten Haitzler 443677c7f9 scalecache - handle possible use after free with sci still in list
the sci may still be in the list then we free it because sci->im is
NULL .. it may always have been null. this should guard against that
and fix it.

@fix
2019-08-24 15:21:42 +01:00
Carsten Haitzler e15d9c86df eina file refs in edje/evas - audit them and plug holes where refs stay
in 1 situation at least we delete the eina file (close it) but keep
the ptr around (during destruction) which could cause issues with
callbaks and events on del and so on.... which may lead to multiple
closes where only one should happen ... which would explain my invalid
eina file ref problems i'm seeing. i carefully matched eina file
handle stores/opens/dups to closes in edje/evas and they seemed to all
match up so this audit with comments and fixes seems to have plugged
that now.

@fix
2019-08-21 20:02:24 +01:00
Carsten Haitzler 5f5e95e336 evas - font rendering - dont crash if we have color fonts and gl and sw
so if you use sw and gl enignes in a process and have color font
glyphs.. *BOOM* because the color glyph code used ext dat that was
intended for engines to extend with a gotcha of "only 1 engine can
extend this"... commented already.

so this unfortunately adds an extra ptr per glyph to store color data
explicitly. but now it both renders right and doesn't crash. we still
have a limit of 1 engine alone can extend glyphs with ext_dat though.

@fix
2019-08-21 20:02:23 +01:00
Ali Alzyod a821eb456a evas_common: parse color in rgb()/rgba() format
evas_common_format_color_parse: support rgb()/rgba() format

efl user can now specify colors in text formats and styles as rgb(0-255,0-255,0-255) &  rgba(0-255,0-255,0-255,0-255)  format.

This is related to task: T8068

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9309
2019-08-19 11:33:23 -07:00
Vincent Torri 01b987df59 make mman.h private
Summary:
integrate mman.h to make Evil private to the EFL, as mman.h does not exist on Windows. After a discussion with raster, i include sys/mman.h only on non Windows platform.

One issue, though, is that src/modules/emotion/generic/Emotion_Generic_Plugin.h has inlined functions using mmap()

Test Plan: compilation on Windows

Reviewers: cedric, raster, zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9542
2019-08-19 09:55:13 -04:00
Carsten Haitzler 21efff6d3e evas image - eina file - be paranoud about double closes
tracking some seemingly not so good asan hits on the eina file where
we're accessing an eina file already closed... so be extra paranoid
about it and set things to null after free/close...
2019-08-05 18:59:33 +01:00
Marcel Hollerbach 6883087ac7 Revert "evas_object_textblock: add support for variation sequences"
This reverts commit f7ce771e32.
2019-07-30 19:09:12 +02:00
Ali Alzyod f7ce771e32 evas_object_textblock: add support for variation sequences
update font processing to handle variation sequences unicodes to select proper glypg in respect to variation seqences

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9053
2019-07-29 11:17:35 -07:00
Cedric BAIL 6a93e2ef3d evas: add infrastructure to feed 9 patch information from file loader to image object.
This is just the plumbing that feed data provided along android 9 patch image for example
into Evas object image new stretch and content region infrastructure for rendering them
properly.

Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9102
2019-07-12 09:54:16 -07:00
Cedric BAIL ce076d1323 evas: break Image_Loader API to allow for getting property from the data field of an image.
Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9101
2019-07-12 09:54:14 -07:00
Cedric BAIL 9f35c74d9d evas: break Evas_Loader API and introduce a version numbering for Image_Loader.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hermet Park <hermetpark@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9099
2019-07-12 09:54:11 -07:00
Ali Alzyod 673bce2b91 evas_common_format_color_parse: support color names
Summary:
efl user can now specify colors by there names ( not only Hex RGB/RGBA values), which is very convenient specially for first time users (where user may think it is supported by default)

<color=#FF0000> == <color=red> == <color==RED>

there are two main types of color names and values ( X11, web colors), here we are using X11 color.

============
Update for documentation pages should be added like:
https://www.enlightenment.org/_legacy_embed/evas_textblock_style_page.html#evas_textblock_style_color

I do not know how to update it :(

Test Plan:
```
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1

#include <Eina.h>
#include <Elementary.h>
#include <Efl_Ui.h>

static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
   efl_exit(0);
}

static void
_gui_setup()
{
   Eo *win, *box;

   win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
                 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
                 efl_text_set(efl_added, "Hello World"),
                 efl_ui_win_autodel_set(efl_added, EINA_TRUE));

   // when the user clicks "close" on a window there is a request to delete
   efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);

   box = efl_add(EFL_UI_BOX_CLASS, win,
                efl_content_set(win, efl_added),
                efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));

   efl_add(EFL_UI_TEXT_CLASS, box,
           efl_text_markup_set(efl_added,
           "<color=red>this is red color line(color = red)<color><br>"
           "<color=#0000FF>this is blue color line (color = #0000FF)<color><br>"
           "<color=gray>this is gray color line (color = gray)<color><br>"),
           efl_gfx_hint_weight_set(efl_added, 1.0, 0.9),
           efl_gfx_hint_align_set(efl_added, 0.5, 0.5),
           efl_text_multiline_set(efl_added,EINA_TRUE),
           efl_pack(box, efl_added));

   efl_add(EFL_UI_BUTTON_CLASS, box,
           efl_text_set(efl_added, "Quit"),
           efl_gfx_hint_weight_set(efl_added, 1.0, 0.1),
           efl_pack(box, efl_added),
           efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
                                  _gui_quit_cb, efl_added));
}

EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
   _gui_setup();
}
EFL_MAIN()

```

Reviewers: woohyun, bowonryu, segfaultxavi, vtorri

Reviewed By: segfaultxavi, vtorri

Subscribers: vtorri, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9153
2019-06-25 19:28:12 +02:00
Ali Alzyod c25554c4f2 evas_common: use memcpy to copy pixel buffer
Summary: This function has no special processing when copy data, so using memcpy can enhance performance

Test Plan:
```
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

typedef unsigned int       DATA32;

static void
oldFunc(DATA32 *src, DATA32 *dst, size_t len)
{
   DATA32 *dst_end = dst + len;
   while (dst < dst_end)
      *dst++ = *src++;
}

static void
newFunc(DATA32 *src, DATA32 *dst, size_t len)
{
   memcpy(dst, src, len * sizeof(DATA32));
}

int main()
{

   int counter = 1000;
   srand(time(NULL));
   DATA32 src[50000] = {0};
   DATA32 dst[50000] = {0};

   for (int i = 0; i < 50000; i++)
      src[i] = rand();

   clock_t start, end;
   double total_Time1 = 0;
   int i;

   start = clock();
   for (i = 0; i < counter; i++)
      oldFunc(src, dst, 50000);
   end = clock();
   total_Time1 = ((double)(end - start)) / CLOCKS_PER_SEC;
   printf("original = %f \n", total_Time1);

   start = clock();
   for (i = 0; i < counter; i++)
      newFunc(src, dst, 50000);
   end = clock();
   total_Time1 = ((double)(end - start)) / CLOCKS_PER_SEC;
   printf("modified = %f \n", total_Time1);
}
```

Reviewers: raster, ManMower, woohyun, Hermet

Reviewed By: Hermet

Subscribers: Hermet, vtorri, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9155
2019-06-25 21:48:42 +09:00
Xavi Artigas 2b7d26790a Fix miscellaneous build warnings
Nothing serious, but they were driving me mad.
2019-06-19 10:19:49 +02:00
Xavi Artigas 3081d9b8ea evas/scale_sample: even more code deduplication
Summary:
how many times was this block of code copied around???

no functional changes
Depends on D8848

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl_rendering

Differential Revision: https://phab.enlightenment.org/D8849
2019-05-21 20:27:15 +02:00
Mike Blumenkrantz 7c78938689 evas/scale_sample: remove unnecessary clamping to mask geometry
Summary:
this is now handled entirely in the masking helper function

no functional changes
Depends on D8847

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl_rendering

Differential Revision: https://phab.enlightenment.org/D8848
2019-05-21 20:27:05 +02:00
Mike Blumenkrantz 6d0233afb8 evas/scale_sample: further deduplicate masking code
Summary:
by adding a couple extra params to existing functions, we can reuse
existing code instead of copying it around and adding more bugs

no functional changes

Depends on D8846

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl_rendering

Differential Revision: https://phab.enlightenment.org/D8847
2019-05-21 20:26:57 +02:00
Mike Blumenkrantz 4542cfcbea evas/scale_sample: deduplicate masking code
Summary:
these functions provide identical functionality to the inline blocks

no functional changes
Depends on D8841

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: Hermet, cedric, #reviewers, #committers

Tags: #efl_rendering

Differential Revision: https://phab.enlightenment.org/D8846
2019-05-21 20:26:45 +02:00