Commit 8f744038 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Added icetClearImageTrueBackground.

Use it to correct some background correction problems with blank tiles.
parent 83288578
......@@ -112,5 +112,6 @@ not done automatically. icetSingleImageCollect does it for you, though.
Added internal state variables ICET_NEED_BACKGROUND_CORRECTION,
ICET_TRUE_BACKGROUND_COLOR, and ICET_TRUE_BACKGROUND_COLOR_WORD.
icetImageCorrectBackground, icetDecompressImageCorrectBackground, and
icetImageCorrectBackground, icetClearImageTrueBackground,
icetDecompressImageCorrectBackground, and
icetDecompressSubImageCorrectBackground functions.
......@@ -2275,6 +2275,28 @@ void icetImageCorrectBackground(IceTImage image)
icetTimingBlendEnd();
}
void icetClearImageTrueBackground(IceTImage image)
{
IceTFloat true_background[4];
IceTInt true_background_word;
IceTFloat original_background[4];
IceTInt original_background_word;
icetGetFloatv(ICET_TRUE_BACKGROUND_COLOR, true_background);
icetGetIntegerv(ICET_TRUE_BACKGROUND_COLOR_WORD, &true_background_word);
icetGetFloatv(ICET_BACKGROUND_COLOR, original_background);
icetGetIntegerv(ICET_BACKGROUND_COLOR_WORD, &original_background_word);
icetStateSetFloatv(ICET_BACKGROUND_COLOR, 4, true_background);
icetStateSetInteger(ICET_BACKGROUND_COLOR_WORD, true_background_word);
icetClearImage(image);
icetStateSetFloatv(ICET_BACKGROUND_COLOR, 4, original_background);
icetStateSetInteger(ICET_BACKGROUND_COLOR_WORD, original_background_word);
}
static IceTImage renderTile(int tile,
IceTInt *screen_viewport,
IceTInt *target_viewport,
......
......@@ -181,6 +181,7 @@ ICET_EXPORT void icetCompressedCompressedComposite(
IceTSparseImage dest_buffer);
ICET_EXPORT void icetImageCorrectBackground(IceTImage image);
ICET_EXPORT void icetClearImageTrueBackground(IceTImage image);
#define ICET_BLEND_UBYTE(front, back, dest) \
{ \
......
......@@ -71,21 +71,24 @@ IceTImage icetDirectCompose(void)
outSparseImage,
tile_image_dest);
if ((display_tile >= 0) && (num_contributors < 1)) {
/* Must be displaying a blank tile. */
const IceTInt *tile_viewports
= icetUnsafeStateGetInteger(ICET_TILE_VIEWPORTS);
const IceTInt *display_tile_viewport = tile_viewports + 4*display_tile;
IceTInt display_tile_width = display_tile_viewport[2];
IceTInt display_tile_height = display_tile_viewport[3];
icetRaiseDebug("Returning blank tile.");
icetImageSetDimensions(image, display_tile_width, display_tile_height);
icetClearImage(image);
}
if (display_tile >= 0) {
icetImageCorrectBackground(image);
if (num_contributors > 0) {
icetImageCorrectBackground(image);
} else {
/* Must be displaying a blank tile. */
const IceTInt *tile_viewports
= icetUnsafeStateGetInteger(ICET_TILE_VIEWPORTS);
const IceTInt *display_tile_viewport
= tile_viewports + 4*display_tile;
IceTInt display_tile_width = display_tile_viewport[2];
IceTInt display_tile_height = display_tile_viewport[3];
icetRaiseDebug("Returning blank tile.");
icetImageSetDimensions(image,
display_tile_width,
display_tile_height);
icetClearImageTrueBackground(image);
}
}
return image;
......
......@@ -515,7 +515,7 @@ IceTImage reduceCollect(const IceTSparseImage composited_image,
if ((tile_displayed >= 0) && (tile_displayed != compose_tile)) {
/* Return empty image if nothing in this tile. */
icetRaiseDebug("Clearing pixels");
icetClearImage(result_image);
icetClearImageTrueBackground(result_image);
}
return result_image;
......
......@@ -124,7 +124,7 @@ static void icetCollectImage(IceTImage imageFragment,
}
}
} else {
icetClearImage(fullImage);
icetClearImageTrueBackground(fullImage);
}
}
......@@ -202,7 +202,7 @@ IceTImage icetSplitCompose(void)
my_height = tile_viewports[4*tile_displayed + 3];
fullImage = icetGetStateBufferImage(SPLIT_FULL_IMAGE_BUFFER,
my_width, my_height);
icetClearImage(fullImage);
icetClearImageTrueBackground(fullImage);
}
return fullImage;
}
......
......@@ -226,13 +226,35 @@ IceTImage icetVtreeCompose(void)
/* Hacks for when "this" tile was not rendered. */
if ((tile_displayed >= 0) && (tile_displayed != tile_held)) {
if (all_contained_tmasks[rank*num_tiles + tile_displayed]) {
/* Only "this" node draws "this" tile. Because the image never */
/* needed to be transferred, it was never rendered above. Just */
/* render it now. */
/* Only "this" node draws "this" tile. Because the image never needed
to be transferred, it was never rendered above. Just render it
now. We might save some time by rendering with the true
background color rather than correcting it later. */
IceTFloat true_background[4];
IceTInt true_background_word;
IceTFloat original_background[4];
IceTInt original_background_word;
icetGetFloatv(ICET_TRUE_BACKGROUND_COLOR, true_background);
icetGetIntegerv(ICET_TRUE_BACKGROUND_COLOR_WORD,
&true_background_word);
icetGetFloatv(ICET_BACKGROUND_COLOR, original_background);
icetGetIntegerv(ICET_BACKGROUND_COLOR_WORD,
&original_background_word);
icetStateSetFloatv(ICET_BACKGROUND_COLOR, 4, true_background);
icetStateSetInteger(ICET_BACKGROUND_COLOR_WORD,
true_background_word);
icetRaiseDebug("Rendering tile to display.");
/* This may uncessarily read a buffer if not outputing an input
buffer */
icetGetTileImage(tile_displayed, image);
icetStateSetFloatv(ICET_BACKGROUND_COLOR, 4, original_background);
icetStateSetInteger(ICET_BACKGROUND_COLOR_WORD,
original_background_word);
} else {
/* "This" tile is blank. */
const IceTInt *display_tile_viewport
......@@ -243,11 +265,9 @@ IceTImage icetVtreeCompose(void)
icetRaiseDebug("Returning blank image.");
icetImageSetDimensions(
image, display_tile_width, display_tile_height);
icetClearImage(image);
icetClearImageTrueBackground(image);
}
}
if (tile_displayed >= 0) {
} else if (tile_displayed >= 0) {
icetImageCorrectBackground(image);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment