equal
deleted
inserted
replaced
1 /* Copyright (c) 2009-2010 The Khronos Group Inc. |
1 /* Copyright (c) 2009 The Khronos Group Inc. |
2 * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies) |
|
3 * |
2 * |
4 * Permission is hereby granted, free of charge, to any person obtaining a |
3 * Permission is hereby granted, free of charge, to any person obtaining a |
5 * copy of this software and/or associated documentation files (the |
4 * copy of this software and/or associated documentation files (the |
6 * "Materials"), to deal in the Materials without restriction, including |
5 * "Materials"), to deal in the Materials without restriction, including |
7 * without limitation the rights to use, copy, modify, merge, publish, |
6 * without limitation the rights to use, copy, modify, merge, publish, |
101 state->blendInfo.destination.rectangle = &state->dstRect; |
100 state->blendInfo.destination.rectangle = &state->dstRect; |
102 state->blendInfo.source.image = state->scaledSourceImage; |
101 state->blendInfo.source.image = state->scaledSourceImage; |
103 state->blendInfo.source.rectangle = &state->scaledSrcRect; |
102 state->blendInfo.source.rectangle = &state->scaledSrcRect; |
104 state->blendInfo.mask = state->originalMaskImage ? state->maskImage : NULL; |
103 state->blendInfo.mask = state->originalMaskImage ? state->maskImage : NULL; |
105 state->blendInfo.globalAlpha = state->globalAlpha; |
104 state->blendInfo.globalAlpha = state->globalAlpha; |
|
105 |
|
106 /* composition does not use these values ever */ |
|
107 state->blendInfo.tsColor = NULL; |
|
108 state->blendInfo.destinationFullyOpaque = OWF_FALSE; |
106 |
109 |
107 DPRINT((" globalAplha = %f", state->globalAlpha)); |
110 DPRINT((" globalAplha = %f", state->globalAlpha)); |
108 /* no need to check with OWF_ALPHA_MIN_VALUE as it is zero */ |
111 /* no need to check with OWF_ALPHA_MIN_VALUE as it is zero */ |
109 OWF_ASSERT(state->blendInfo.globalAlpha <= OWF_ALPHA_MAX_VALUE); |
112 OWF_ASSERT(state->blendInfo.globalAlpha <= OWF_ALPHA_MAX_VALUE); |
110 } |
113 } |
332 DPRINT((" element [%x] totally outside of target - skipped", |
335 DPRINT((" element [%x] totally outside of target - skipped", |
333 element ? element->handle : 0)); |
336 element ? element->handle : 0)); |
334 return NULL; |
337 return NULL; |
335 } |
338 } |
336 |
339 |
|
340 |
337 /* setup temporary images used in composition. since the original |
341 /* setup temporary images used in composition. since the original |
338 source data must not be altered, we must copy it to scratch buffer |
342 source data must not be altered, we must copy it to scratch buffer |
339 and work it there. another scratch buffer is needed for scaling |
343 and work it there. another scratch buffer is needed for scaling |
340 the image to its final size. same applies for masks; thus a grand total |
344 the image to its final size. same applies for masks; thus a grand total |
341 of 4 scratch buffers are needed. */ |
345 of 4 scratch buffers are needed. */ |
346 state->rotation = element->sourceRotation; |
350 state->rotation = element->sourceRotation; |
347 state->sourceFlip = element->sourceFlip; |
351 state->sourceFlip = element->sourceFlip; |
348 state->globalAlpha = element->globalAlpha; |
352 state->globalAlpha = element->globalAlpha; |
349 state->sourceScaleFilter = element->sourceScaleFilter; |
353 state->sourceScaleFilter = element->sourceScaleFilter; |
350 state->transparencyTypes = element->transparencyTypes; |
354 state->transparencyTypes = element->transparencyTypes; |
351 |
355 /* replicate the source viewport rectangle and target extent rectangle */ |
352 if (state->transparencyTypes & WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA) |
|
353 { |
|
354 if (state->globalAlpha == OWF_FULLY_TRANSPARENT) |
|
355 { |
|
356 /* Fully transparent element - no contribution. */ |
|
357 return NULL; |
|
358 } |
|
359 if (state->globalAlpha == OWF_FULLY_OPAQUE) |
|
360 { |
|
361 /* Fully opaque global alpha - global alpha can be ignored */ |
|
362 state->transparencyTypes &= ~WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA; |
|
363 } |
|
364 } |
|
365 |
|
366 /* replicate the source viewport rectangle and target extent rectangle */ |
|
367 for (x = 0; x < 4; x++) |
356 for (x = 0; x < 4; x++) |
368 { |
357 { |
369 state->sourceRect[x] = element->srcRect[x]; |
358 state->sourceRect[x] = element->srcRect[x]; |
370 state->destinationRect[x] = element->dstRect[x]; |
359 state->destinationRect[x] = element->dstRect[x]; |
371 } |
360 } |
600 DPRINT(("WFC_Context_ExecuteCropStage: context = %p, state = %p", |
589 DPRINT(("WFC_Context_ExecuteCropStage: context = %p, state = %p", |
601 context, state)); |
590 context, state)); |
602 } |
591 } |
603 else |
592 else |
604 { |
593 { |
|
594 |
605 /* Source rectangle */ |
595 /* Source rectangle */ |
606 OWF_Rect_Set(&sourceRect, |
596 OWF_Rect_Set(&sourceRect, |
607 state->oversizedCropRect.x, state->oversizedCropRect.y, |
597 state->oversizedCropRect.x, state->oversizedCropRect.y, |
608 state->oversizedCropRect.width, state->oversizedCropRect.height); |
598 state->oversizedCropRect.width, state->oversizedCropRect.height); |
609 |
599 |
625 *----------------------------------------------------------------------------*/ |
615 *----------------------------------------------------------------------------*/ |
626 OWF_API_CALL void |
616 OWF_API_CALL void |
627 WFC_Pipeline_ExecuteFlipStage(WFC_CONTEXT* context, WFC_ELEMENT_STATE* state) |
617 WFC_Pipeline_ExecuteFlipStage(WFC_CONTEXT* context, WFC_ELEMENT_STATE* state) |
628 { |
618 { |
629 OWF_FLIP_DIRECTION flipping; |
619 OWF_FLIP_DIRECTION flipping; |
630 |
620 |
631 if (NULL == context || NULL == state) |
621 if (NULL == context || NULL == state) |
632 { |
622 { |
633 DPRINT(("WFC_Context_ExecuteFlipStage: context = %p, state = %p", |
623 DPRINT(("WFC_Context_ExecuteFlipStage: context = %p, state = %p", |
634 context, state)); |
624 context, state)); |
635 } |
625 } |
636 else |
626 else |
637 { |
627 { |
|
628 OWF_ASSERT(state); |
638 flipping = state->sourceFlip > 0.0f ? OWF_FLIP_VERTICALLY |
629 flipping = state->sourceFlip > 0.0f ? OWF_FLIP_VERTICALLY |
639 : OWF_FLIP_NONE; |
630 : OWF_FLIP_NONE; |
640 |
631 |
641 OWF_Image_Flip(state->flippedSourceImage, flipping); |
632 OWF_Image_Flip(state->flippedSourceImage, flipping); |
642 } |
633 } |
653 { |
644 { |
654 OWF_ROTATION rot = OWF_ROTATION_0; |
645 OWF_ROTATION rot = OWF_ROTATION_0; |
655 OWF_RECTANGLE rect; |
646 OWF_RECTANGLE rect; |
656 WFCRotation rotation; |
647 WFCRotation rotation; |
657 |
648 |
|
649 |
658 if (NULL == context || NULL == state) |
650 if (NULL == context || NULL == state) |
659 { |
651 { |
660 DPRINT(("WFC_Context_ExecuteRotationStage: context = %p, state = %p", |
652 DPRINT(("WFC_Context_ExecuteRotationStage: context = %p, state = %p", |
661 context, state)); |
653 context, state)); |
662 return; |
654 return; |
663 } |
655 } |
|
656 OWF_ASSERT(state); |
664 |
657 |
665 rotation = state->rotation; |
658 rotation = state->rotation; |
666 DPRINT((" Element rotation = %d", rotation)); |
659 DPRINT((" Element rotation = %d", rotation)); |
667 |
660 |
668 switch (rotation) |
661 switch (rotation) |
728 { |
721 { |
729 OWF_RECTANGLE scaledRect, |
722 OWF_RECTANGLE scaledRect, |
730 cropRect; |
723 cropRect; |
731 OWF_FILTERING filteringMode = OWF_FILTER_POINT_SAMPLING; |
724 OWF_FILTERING filteringMode = OWF_FILTER_POINT_SAMPLING; |
732 WFCScaleFilter filter; |
725 WFCScaleFilter filter; |
733 |
726 |
734 DPRINT(("WFC_Context_ExecuteScalingStage(%p,%p)", context, state)); |
727 DPRINT(("WFC_Context_ExecuteScalingStage(%p,%p)", context, state)); |
735 |
728 |
736 if (NULL == context || NULL == state) |
729 if (NULL == context || NULL == state) |
737 { |
730 { |
738 DPRINT(("WFC_Context_ExecuteScalingStage: context = %p, state = %p", |
731 DPRINT(("WFC_Context_ExecuteScalingStage: context = %p, state = %p", |
739 context, state)); |
732 context, state)); |
740 return; |
733 return; |
741 } |
734 } |
|
735 |
|
736 OWF_ASSERT(state); |
742 |
737 |
743 filter = state->sourceScaleFilter; |
738 filter = state->sourceScaleFilter; |
744 |
739 |
745 switch (filter) |
740 switch (filter) |
746 { |
741 { |
803 OWF_API_CALL void |
798 OWF_API_CALL void |
804 WFC_Pipeline_ExecuteBlendingStage(WFC_CONTEXT* context, WFC_ELEMENT_STATE* state) |
799 WFC_Pipeline_ExecuteBlendingStage(WFC_CONTEXT* context, WFC_ELEMENT_STATE* state) |
805 { |
800 { |
806 OWF_TRANSPARENCY blendMode = OWF_TRANSPARENCY_NONE; |
801 OWF_TRANSPARENCY blendMode = OWF_TRANSPARENCY_NONE; |
807 WFCbitfield transparency = 0; |
802 WFCbitfield transparency = 0; |
808 |
803 |
809 DPRINT(("WFC_Pipeline_ExecuteBlendingStage")); |
804 DPRINT(("WFC_Pipeline_ExecuteBlendingStage")); |
810 |
805 |
811 if (NULL == context || NULL == state) |
806 if (NULL == context || NULL == state) |
812 { |
807 { |
813 return; |
808 return; |
814 } |
809 } |
815 |
810 |
816 DPRINT((" context = %d, state = %d", |
811 DPRINT((" context = %d, state = %d", |
817 context->handle, state)); |
812 context->handle, state)); |
818 |
813 |
|
814 OWF_ASSERT(state); |
|
815 |
819 transparency = state->transparencyTypes; |
816 transparency = state->transparencyTypes; |
820 blendMode = OWF_TRANSPARENCY_NONE; |
817 blendMode = OWF_TRANSPARENCY_NONE; |
821 |
818 |
822 if (transparency & WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA) |
819 if (transparency & WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA) |
823 { |
820 { |