wiki:SCENE_COMMONS_R1

Version 6 (modified by deni, 16 years ago) (diff)

--

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=SCENE_COMMONS_R1, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The goal of this task is to search for and implement some optimizations connected with the drawing of scenes.

Task requirements

  • Get acquainted with scene elements, element helpers, etc, seek for potential optimizations and implement them.
  • Use SimpleSceneDemoTest to measure how effective the potential optimisations are.

Task result

The result of this task is code.

Implementation idea

  • When drawing a scene element, we take into account the colours of all its ancestors. In the case of an image, this mean multiplying every pixel by the effective colour, which is a heavy operation. Since the effective colour changes much more rarely than the scene is redrawn, it is a good idea to cache the image multiplied by recently used effective colours.
  • If the user imports the same image in two or more frames, there is no need to load it twice. It might be a good idea to cache the recently imported images, too.
  • Try changing the preferred image type from BufferedImage.TYPE_INT_ARGB to BufferedImage.TYPE_INT_ARGB_PRE (the second format stores the values for red, green and blue divided by alpha, while the first one computes them on every step)

How to demo

Compare the performance of SimpleSceneDemoTest before and after this task.