Using correct internal formats for image uploading
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / pixel-manipulation.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 // CLASS HEADER
18 #include <dali/internal/imaging/common/pixel-manipulation.h>
19
20 // INTERNAL HEADERS
21 #include <dali/integration-api/debug.h>
22 #include <dali/public-api/images/pixel.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Adaptor
29 {
30 namespace
31 {
32 constexpr Channel ALPHA_CHANNEL_ONLY[]       = {ALPHA};
33 constexpr Channel LUMINANCE_CHANNEL_ONLY[]   = {LUMINANCE};
34 constexpr Channel LUMINANCE_ALPHA_CHANNELS[] = {LUMINANCE, ALPHA};
35 constexpr Channel RGB_CHANNELS[]             = {RED, GREEN, BLUE};
36 constexpr Channel BGR_CHANNELS[]             = {BLUE, GREEN, RED};
37 constexpr Channel RGBA_CHANNELS[]            = {RED, GREEN, BLUE, ALPHA};
38 constexpr Channel BGRA_CHANNELS[]            = {BLUE, GREEN, RED, ALPHA};
39
40 /**
41  * @brief Template to Read from a buffer with pixel formats that have one byte per channel.
42  *
43  * @tparam NumberOfChannels The number of channels to check
44  * @param pixelData The pixel data to retrieve the value from
45  * @param channel The channel we're after
46  * @param channels The array of channels in the pixel format
47  * @return The value of the required channel
48  */
49 template<size_t NumberOfChannels>
50 unsigned int ReadChannel(unsigned char* pixelData, Channel channel, const Channel (&channels)[NumberOfChannels])
51 {
52   auto num    = 0u;
53   auto retVal = 0u;
54   for(auto current : channels)
55   {
56     if(channel == current)
57     {
58       retVal = static_cast<unsigned int>(*(pixelData + num));
59       break;
60     }
61     ++num;
62   }
63   return retVal;
64 }
65
66 /**
67  * @brief Template to Write to a buffer with pixel formats that have one byte per channel.
68  *
69  * @tparam NumberOfChannels The number of channels to check
70  * @param pixelData The pixel data to write the value to
71  * @param channel The channel we're after
72  * @param channelValue The value of the channel to set
73  * @param channels The array of channels in the pixel format
74  */
75 template<size_t NumberOfChannels>
76 void WriteChannel(unsigned char* pixelData, Channel channel, unsigned int channelValue, const Channel (&channels)[NumberOfChannels])
77 {
78   auto num = 0u;
79   for(auto current : channels)
80   {
81     if(channel == current)
82     {
83       *(pixelData + num) = static_cast<unsigned char>(channelValue & 0xFF);
84       break;
85     }
86     ++num;
87   }
88 }
89
90 /**
91  * @brief Reads from buffers with a pixel format of 565.
92  *
93  * @param pixelData The pixel data to read from
94  * @param channel The channel we're after
95  * @param one The first channel of the pixel format
96  * @param two The second channel of the pixel format
97  * @param three The third channel of the pixel format
98  * @return The value of the required channel
99  */
100 unsigned int ReadChannel565(unsigned char* pixelData, Channel channel, Channel one, Channel two, Channel three)
101 {
102   if(channel == one)
103   {
104     return (static_cast<unsigned int>(*pixelData) & 0xF8) >> 3;
105   }
106   else if(channel == two)
107   {
108     return ((static_cast<unsigned int>(*pixelData) & 0x07) << 3) |
109            ((static_cast<unsigned int>(*(pixelData + 1)) & 0xE0) >> 5);
110   }
111   else if(channel == three)
112   {
113     return static_cast<unsigned int>(*(pixelData + 1)) & 0x1F;
114   }
115   return 0u;
116 }
117
118 /**
119  * @brief Writes to the buffer with a pixel format of 565.
120  *
121  * @param pixelData The pixel data to write to
122  * @param channel The channel we're after
123  * @param channelValue The value to write
124  * @param one The first channel of the pixel format
125  * @param two The second channel of the pixel format
126  * @param three The third channel of the pixel format
127  */
128 void WriteChannel565(unsigned char* pixelData, Channel channel, unsigned int channelValue, Channel one, Channel two, Channel three)
129 {
130   if(channel == one)
131   {
132     *pixelData &= static_cast<unsigned char>(~0xF8);
133     *pixelData |= static_cast<unsigned char>((channelValue << 3) & 0xF8);
134   }
135   else if(channel == two)
136   {
137     *pixelData &= static_cast<unsigned char>(~0x07);
138     *pixelData |= static_cast<unsigned char>((channelValue >> 3) & 0x07);
139
140     *(pixelData + 1) &= static_cast<unsigned char>(~0xE0);
141     *(pixelData + 1) |= static_cast<unsigned char>((channelValue << 5) & 0xE0);
142   }
143   else if(channel == three)
144   {
145     *(pixelData + 1) &= static_cast<unsigned char>(~0x1F);
146     *(pixelData + 1) |= static_cast<unsigned char>(channelValue & 0x1F);
147   }
148 }
149
150 /**
151  * @brief Reads from buffers with a pixel format of 4444.
152  *
153  * @param pixelData The pixel data to read from
154  * @param channel The channel we're after
155  * @param one The first channel of the pixel format
156  * @param two The second channel of the pixel format
157  * @param three The third channel of the pixel format
158  * @param four The fourth channel of the pixel format
159  * @return
160  */
161 unsigned int ReadChannel4444(unsigned char* pixelData, Channel channel, Channel one, Channel two, Channel three, Channel four)
162 {
163   if(channel == one)
164   {
165     return (static_cast<unsigned int>(*pixelData) & 0xF0) >> 4;
166   }
167   else if(channel == two)
168   {
169     return (static_cast<unsigned int>(*pixelData) & 0x0F);
170   }
171   else if(channel == three)
172   {
173     return (static_cast<unsigned int>(*(pixelData + 1)) & 0xF0) >> 4;
174   }
175   else if(channel == four)
176   {
177     return (static_cast<unsigned int>(*(pixelData + 1)) & 0x0F);
178   }
179   return 0u;
180 }
181
182 /**
183  * @brief Writes to the buffer with a pixel format of 565.
184  *
185  * @param pixelData The pixel data to write to
186  * @param channel The channel we're after
187  * @param channelValue The value to write
188  * @param one The first channel of the pixel format
189  * @param two The second channel of the pixel format
190  * @param three The third channel of the pixel format
191  * @param four The fourth channel of the pixel format
192  */
193 void WriteChannel4444(unsigned char* pixelData, Channel channel, unsigned int channelValue, Channel one, Channel two, Channel three, Channel four)
194 {
195   if(channel == one)
196   {
197     *pixelData &= static_cast<unsigned char>(~0xF0);
198     *pixelData |= static_cast<unsigned char>((channelValue << 4) & 0xF0);
199   }
200   else if(channel == two)
201   {
202     *pixelData &= static_cast<unsigned char>(~0x0F);
203     *pixelData |= static_cast<unsigned char>(channelValue & 0x0F);
204   }
205   else if(channel == three)
206   {
207     *(pixelData + 1) &= static_cast<unsigned char>(~0xF0);
208     *(pixelData + 1) |= static_cast<unsigned char>((channelValue << 4) & 0xF0);
209   }
210   else if(channel == four)
211   {
212     *(pixelData + 1) &= static_cast<unsigned char>(~0x0F);
213     *(pixelData + 1) |= static_cast<unsigned char>(channelValue & 0x0F);
214   }
215 }
216
217 /**
218  * @brief Reads from buffers with a pixel format of 5551.
219  *
220  * @param pixelData The pixel data to read from
221  * @param channel The channel we're after
222  * @param one The first channel of the pixel format
223  * @param two The second channel of the pixel format
224  * @param three The third channel of the pixel format
225  * @param four The fourth channel of the pixel format
226  * @return
227  */
228 unsigned int ReadChannel5551(unsigned char* pixelData, Channel channel, Channel one, Channel two, Channel three, Channel four)
229 {
230   if(channel == one)
231   {
232     return (static_cast<unsigned int>(*pixelData) & 0xF8) >> 3;
233   }
234   else if(channel == two)
235   {
236     return ((static_cast<unsigned int>(*pixelData) & 0x07) << 2) |
237            ((static_cast<unsigned int>(*(pixelData + 1)) & 0xC0) >> 6);
238   }
239   else if(channel == three)
240   {
241     return (static_cast<unsigned int>(*(pixelData + 1)) & 0x3E) >> 1;
242   }
243   else if(channel == four)
244   {
245     return static_cast<unsigned int>(*(pixelData + 1)) & 0x01;
246   }
247   return 0u;
248 }
249
250 /**
251  * @brief Writes to the buffer with a pixel format of 5551.
252  *
253  * @param pixelData The pixel data to write to
254  * @param channel The channel we're after
255  * @param channelValue The value to write
256  * @param one The first channel of the pixel format
257  * @param two The second channel of the pixel format
258  * @param three The third channel of the pixel format
259  * @param four The fourth channel of the pixel format
260  */
261 void WriteChannel5551(unsigned char* pixelData, Channel channel, unsigned int channelValue, Channel one, Channel two, Channel three, Channel four)
262 {
263   // 11111222 22333334
264   //    F8  7 C0  3E 1
265   if(channel == one)
266   {
267     *pixelData &= static_cast<unsigned char>(~0xF8);
268     *pixelData |= static_cast<unsigned char>((channelValue << 3) & 0xF8);
269   }
270   else if(channel == two)
271   {
272     *pixelData &= static_cast<unsigned char>(~0x07);
273     *pixelData |= static_cast<unsigned char>((channelValue >> 2) & 0x07);
274
275     *(pixelData + 1) &= static_cast<unsigned char>(~0xC0);
276     *(pixelData + 1) |= static_cast<unsigned char>((channelValue << 6) & 0xC0);
277   }
278   else if(channel == three)
279   {
280     *(pixelData + 1) &= static_cast<unsigned char>(~0x3E);
281     *(pixelData + 1) |= static_cast<unsigned char>((channelValue << 1) & 0x3E);
282   }
283   else if(channel == four)
284   {
285     *(pixelData + 1) &= static_cast<unsigned char>(~0x01);
286     *(pixelData + 1) |= static_cast<unsigned char>(channelValue & 0x01);
287   }
288 }
289
290 } // unnamed namespace
291
292 struct Location
293 {
294   unsigned int bitShift;
295   unsigned int bitMask;
296   bool         available;
297 };
298
299 struct Locations
300 {
301   Location luminance;
302   Location alpha;
303   Location red;
304   Location green;
305   Location blue;
306 };
307
308 bool HasChannel(Dali::Pixel::Format pixelFormat, Channel channel)
309 {
310   switch(pixelFormat)
311   {
312     case Dali::Pixel::A8:
313     {
314       return (channel == ALPHA);
315     }
316     case Dali::Pixel::L8:
317     {
318       return (channel == LUMINANCE);
319     }
320     case Dali::Pixel::LA88:
321     {
322       return (channel == LUMINANCE || channel == ALPHA);
323     }
324     case Dali::Pixel::RGB565:
325     case Dali::Pixel::BGR565:
326     case Dali::Pixel::RGB888:
327     case Dali::Pixel::RGB8888:
328     case Dali::Pixel::BGR8888:
329     case Dali::Pixel::RGB16F:
330     case Dali::Pixel::RGB32F:
331     case Dali::Pixel::R11G11B10F:
332     {
333       return (channel == RED || channel == GREEN || channel == BLUE);
334     }
335
336     case Dali::Pixel::RGBA8888:
337     case Dali::Pixel::BGRA8888:
338     case Dali::Pixel::RGBA4444:
339     case Dali::Pixel::BGRA4444:
340     case Dali::Pixel::RGBA5551:
341     case Dali::Pixel::BGRA5551:
342     {
343       return (channel == RED || channel == GREEN || channel == BLUE || channel == ALPHA);
344     }
345
346     case Dali::Pixel::DEPTH_UNSIGNED_INT:
347     case Dali::Pixel::DEPTH_FLOAT:
348     {
349       return (channel == DEPTH);
350     }
351
352     case Dali::Pixel::DEPTH_STENCIL:
353     {
354       return (channel == DEPTH || channel == STENCIL);
355     }
356
357     case Dali::Pixel::INVALID:
358     case Dali::Pixel::COMPRESSED_R11_EAC:
359     case Dali::Pixel::COMPRESSED_SIGNED_R11_EAC:
360     case Dali::Pixel::COMPRESSED_RG11_EAC:
361     case Dali::Pixel::COMPRESSED_SIGNED_RG11_EAC:
362     case Dali::Pixel::COMPRESSED_RGB8_ETC2:
363     case Dali::Pixel::COMPRESSED_SRGB8_ETC2:
364     case Dali::Pixel::COMPRESSED_RGB8_ETC1:
365     case Dali::Pixel::COMPRESSED_RGB_PVRTC_4BPPV1:
366     case Dali::Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
367     case Dali::Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
368     case Dali::Pixel::COMPRESSED_RGBA8_ETC2_EAC:
369     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
370     case Dali::Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR:
371     case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR:
372     case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR:
373     case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR:
374     case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR:
375     case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR:
376     case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR:
377     case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR:
378     case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR:
379     case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR:
380     case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR:
381     case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR:
382     case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR:
383     case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR:
384     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
385     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
386     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
387     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
388     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
389     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
390     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
391     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
392     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
393     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
394     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
395     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
396     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
397     case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
398     {
399       DALI_LOG_ERROR("Pixel formats for compressed images are not compatible with simple channels.\n");
400       break;
401     }
402   }
403
404   return false;
405 }
406
407 unsigned int ReadChannel(unsigned char*      pixelData,
408                          Dali::Pixel::Format pixelFormat,
409                          Channel             channel)
410 {
411   switch(pixelFormat)
412   {
413     case Dali::Pixel::A8:
414     {
415       return ReadChannel(pixelData, channel, ALPHA_CHANNEL_ONLY);
416     }
417     case Dali::Pixel::L8:
418     {
419       return ReadChannel(pixelData, channel, LUMINANCE_CHANNEL_ONLY);
420     }
421     case Dali::Pixel::LA88:
422     {
423       return ReadChannel(pixelData, channel, LUMINANCE_ALPHA_CHANNELS);
424     }
425     case Dali::Pixel::RGB565:
426     {
427       return ReadChannel565(pixelData, channel, RED, GREEN, BLUE);
428     }
429
430     case Dali::Pixel::BGR565:
431     {
432       return ReadChannel565(pixelData, channel, BLUE, GREEN, RED);
433     }
434
435     case Dali::Pixel::RGB888:
436     case Dali::Pixel::RGB8888:
437     {
438       return ReadChannel(pixelData, channel, RGB_CHANNELS);
439     }
440
441     case Dali::Pixel::BGR8888:
442     {
443       return ReadChannel(pixelData, channel, BGR_CHANNELS);
444     }
445
446     case Dali::Pixel::RGBA8888:
447     {
448       return ReadChannel(pixelData, channel, RGBA_CHANNELS);
449     }
450
451     case Dali::Pixel::BGRA8888:
452     {
453       return ReadChannel(pixelData, channel, BGRA_CHANNELS);
454     }
455
456     case Dali::Pixel::RGBA4444:
457     {
458       return ReadChannel4444(pixelData, channel, RED, GREEN, BLUE, ALPHA);
459     }
460
461     case Dali::Pixel::BGRA4444:
462     {
463       return ReadChannel4444(pixelData, channel, BLUE, GREEN, RED, ALPHA);
464     }
465
466     case Dali::Pixel::RGBA5551:
467     {
468       return ReadChannel5551(pixelData, channel, RED, GREEN, BLUE, ALPHA);
469     }
470
471     case Dali::Pixel::BGRA5551:
472     {
473       return ReadChannel5551(pixelData, channel, BLUE, GREEN, RED, ALPHA);
474     }
475
476     case Dali::Pixel::DEPTH_UNSIGNED_INT:
477     case Dali::Pixel::DEPTH_FLOAT:
478     case Dali::Pixel::DEPTH_STENCIL:
479     {
480       return 0u;
481     }
482
483     default:
484     {
485       return 0u;
486     }
487   }
488 }
489
490 void WriteChannel(unsigned char*      pixelData,
491                   Dali::Pixel::Format pixelFormat,
492                   Channel             channel,
493                   unsigned int        channelValue)
494 {
495   switch(pixelFormat)
496   {
497     case Dali::Pixel::A8:
498     {
499       WriteChannel(pixelData, channel, channelValue, ALPHA_CHANNEL_ONLY);
500       break;
501     }
502     case Dali::Pixel::L8:
503     {
504       WriteChannel(pixelData, channel, channelValue, LUMINANCE_CHANNEL_ONLY);
505       break;
506     }
507     case Dali::Pixel::LA88:
508     {
509       WriteChannel(pixelData, channel, channelValue, LUMINANCE_ALPHA_CHANNELS);
510       break;
511     }
512     case Dali::Pixel::RGB565:
513     {
514       WriteChannel565(pixelData, channel, channelValue, RED, GREEN, BLUE);
515       break;
516     }
517
518     case Dali::Pixel::BGR565:
519     {
520       WriteChannel565(pixelData, channel, channelValue, BLUE, GREEN, RED);
521       break;
522     }
523
524     case Dali::Pixel::RGB888:
525     case Dali::Pixel::RGB8888:
526     {
527       WriteChannel(pixelData, channel, channelValue, RGB_CHANNELS);
528       break;
529     }
530
531     case Dali::Pixel::BGR8888:
532     {
533       WriteChannel(pixelData, channel, channelValue, BGR_CHANNELS);
534       break;
535     }
536
537     case Dali::Pixel::RGBA8888:
538     {
539       WriteChannel(pixelData, channel, channelValue, RGBA_CHANNELS);
540       break;
541     }
542
543     case Dali::Pixel::BGRA8888:
544     {
545       WriteChannel(pixelData, channel, channelValue, BGRA_CHANNELS);
546       break;
547     }
548
549     case Dali::Pixel::RGBA4444:
550     {
551       WriteChannel4444(pixelData, channel, channelValue, RED, GREEN, BLUE, ALPHA);
552       break;
553     }
554
555     case Dali::Pixel::BGRA4444:
556     {
557       WriteChannel4444(pixelData, channel, channelValue, BLUE, GREEN, RED, ALPHA);
558       break;
559     }
560
561     case Dali::Pixel::RGBA5551:
562     {
563       WriteChannel5551(pixelData, channel, channelValue, RED, GREEN, BLUE, ALPHA);
564       break;
565     }
566
567     case Dali::Pixel::BGRA5551:
568     {
569       WriteChannel5551(pixelData, channel, channelValue, BLUE, GREEN, RED, ALPHA);
570       break;
571     }
572
573     case Dali::Pixel::DEPTH_UNSIGNED_INT:
574     case Dali::Pixel::DEPTH_FLOAT:
575     case Dali::Pixel::DEPTH_STENCIL:
576     {
577       break;
578     }
579
580     default:
581       break;
582   }
583 }
584
585 void ConvertColorChannelsToRGBA8888(
586   unsigned char* srcPixel, int srcOffset, Dali::Pixel::Format srcFormat, unsigned char* destPixel, int destOffset)
587 {
588   int red   = ReadChannel(srcPixel + srcOffset, srcFormat, RED);
589   int green = ReadChannel(srcPixel + srcOffset, srcFormat, GREEN);
590   int blue  = ReadChannel(srcPixel + srcOffset, srcFormat, BLUE);
591   switch(srcFormat)
592   {
593     case Dali::Pixel::RGB565:
594     case Dali::Pixel::BGR565:
595     {
596       red   = (red << 3) | (red & 0x07);
597       green = (green << 2) | (green & 0x03);
598       blue  = (blue << 3) | (blue & 0x07);
599       break;
600     }
601     case Dali::Pixel::RGBA4444:
602     case Dali::Pixel::BGRA4444:
603     {
604       red   = (red << 4) | (red & 0x0F);
605       green = (green << 4) | (green & 0x0F);
606       blue  = (blue << 4) | (blue & 0x0F);
607       break;
608     }
609     case Dali::Pixel::RGBA5551:
610     case Dali::Pixel::BGRA5551:
611     {
612       red   = (red << 3) | (red & 0x07);
613       green = (green << 3) | (green & 0x07);
614       blue  = (blue << 3) | (blue & 0x07);
615       break;
616     }
617     default:
618       break;
619   }
620   WriteChannel(destPixel + destOffset, Dali::Pixel::RGBA8888, RED, red);
621   WriteChannel(destPixel + destOffset, Dali::Pixel::RGBA8888, GREEN, green);
622   WriteChannel(destPixel + destOffset, Dali::Pixel::RGBA8888, BLUE, blue);
623 }
624
625 int ConvertAlphaChannelToA8(unsigned char* srcPixel, int srcOffset, Dali::Pixel::Format srcFormat)
626 {
627   int alpha     = ReadChannel(srcPixel + srcOffset, srcFormat, ALPHA);
628   int destAlpha = alpha;
629   switch(srcFormat)
630   {
631     case Pixel::RGBA5551:
632     case Pixel::BGRA5551:
633     {
634       destAlpha = (alpha == 0) ? 0 : 255;
635       break;
636     }
637     case Pixel::RGBA4444:
638     case Pixel::BGRA4444:
639     {
640       destAlpha = (alpha << 4) | (alpha & 0x0F);
641       break;
642     }
643     default:
644       break;
645   }
646   return destAlpha;
647 }
648
649 } // namespace Adaptor
650 } // namespace Internal
651 } // namespace Dali