Bug 194108 Don't PaintBackgroundColor when tiled image is opaque and fully covering. r=caillon sr=roc+moz
git-svn-id: svn://10.0.0.236/trunk@138993 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
17b4467f60
commit
fd2e96c27b
@ -55,6 +55,7 @@
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "gfxIImageFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsCSSColorUtils.h"
|
||||
#include "nsIPrintContext.h"
|
||||
@ -2976,7 +2977,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
// on the dirty rect before accounting for the background-position.
|
||||
nscoord tileWidth = imageSize.width;
|
||||
nscoord tileHeight = imageSize.height;
|
||||
PRBool needBackgroundColor = PR_TRUE;
|
||||
PRBool needBackgroundColor = !(aColor.mBackgroundFlags &
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
PRIntn repeat = aColor.mBackgroundRepeat;
|
||||
nscoord xDistance, yDistance;
|
||||
|
||||
@ -2992,8 +2994,20 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
case NS_STYLE_BG_REPEAT_XY:
|
||||
xDistance = dirtyRect.width;
|
||||
yDistance = dirtyRect.height;
|
||||
// We need to render the background color if the image is transparent
|
||||
//needBackgroundColor = image->GetHasAlphaMask();
|
||||
if (needBackgroundColor) {
|
||||
// If the image is completely opaque, we do not need to paint the
|
||||
// background color
|
||||
nsCOMPtr<gfxIImageFrame> gfxImgFrame;
|
||||
image->GetCurrentFrame(getter_AddRefs(gfxImgFrame));
|
||||
if (gfxImgFrame) {
|
||||
gfx_format frameFormat;
|
||||
gfxImgFrame->GetFormat(&frameFormat);
|
||||
NS_ASSERTION(frameFormat >= 0 && frameFormat <= 7,
|
||||
"Unknown gfxIFormats value");
|
||||
needBackgroundColor = frameFormat != gfxIFormats::RGB &&
|
||||
frameFormat != gfxIFormats::BGR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_BG_REPEAT_OFF:
|
||||
default:
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "gfxIImageFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsCSSColorUtils.h"
|
||||
#include "nsIPrintContext.h"
|
||||
@ -2976,7 +2977,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
// on the dirty rect before accounting for the background-position.
|
||||
nscoord tileWidth = imageSize.width;
|
||||
nscoord tileHeight = imageSize.height;
|
||||
PRBool needBackgroundColor = PR_TRUE;
|
||||
PRBool needBackgroundColor = !(aColor.mBackgroundFlags &
|
||||
NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
PRIntn repeat = aColor.mBackgroundRepeat;
|
||||
nscoord xDistance, yDistance;
|
||||
|
||||
@ -2992,8 +2994,20 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
|
||||
case NS_STYLE_BG_REPEAT_XY:
|
||||
xDistance = dirtyRect.width;
|
||||
yDistance = dirtyRect.height;
|
||||
// We need to render the background color if the image is transparent
|
||||
//needBackgroundColor = image->GetHasAlphaMask();
|
||||
if (needBackgroundColor) {
|
||||
// If the image is completely opaque, we do not need to paint the
|
||||
// background color
|
||||
nsCOMPtr<gfxIImageFrame> gfxImgFrame;
|
||||
image->GetCurrentFrame(getter_AddRefs(gfxImgFrame));
|
||||
if (gfxImgFrame) {
|
||||
gfx_format frameFormat;
|
||||
gfxImgFrame->GetFormat(&frameFormat);
|
||||
NS_ASSERTION(frameFormat >= 0 && frameFormat <= 7,
|
||||
"Unknown gfxIFormats value");
|
||||
needBackgroundColor = frameFormat != gfxIFormats::RGB &&
|
||||
frameFormat != gfxIFormats::BGR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_BG_REPEAT_OFF:
|
||||
default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user