Lines 157-162
Link Here
|
157 |
#ifdef USE_WIN_SURFACE |
157 |
#ifdef USE_WIN_SURFACE |
158 |
, mIsDDBSurface(PR_FALSE) |
158 |
, mIsDDBSurface(PR_FALSE) |
159 |
#endif |
159 |
#endif |
|
|
160 |
, mLocked(PR_FALSE) |
160 |
{ |
161 |
{ |
161 |
static PRBool hasCheckedOptimize = PR_FALSE; |
162 |
static PRBool hasCheckedOptimize = PR_FALSE; |
162 |
if (!hasCheckedOptimize) { |
163 |
if (!hasCheckedOptimize) { |
Lines 418-425
Link Here
|
418 |
|
419 |
|
419 |
PRBool doTile = !imageRect.Contains(sourceRect); |
420 |
PRBool doTile = !imageRect.Contains(sourceRect); |
420 |
if (doPadding || doPartialDecode) { |
421 |
if (doPadding || doPartialDecode) { |
421 |
gfxRect available = gfxRect(mDecoded.x, mDecoded.y, mDecoded.width, mDecoded.height) + |
422 |
gfxRect available = gfxRect(mDecoded.x, mDecoded.y, mDecoded.width, mDecoded.height); |
422 |
gfxPoint(aPadding.left, aPadding.top); |
|
|
423 |
|
423 |
|
424 |
if (!doTile && !mSinglePixel) { |
424 |
if (!doTile && !mSinglePixel) { |
425 |
// Not tiling, and we have a surface, so we can account for |
425 |
// Not tiling, and we have a surface, so we can account for |
Lines 713-719
Link Here
|
713 |
|
713 |
|
714 |
// clamp to bounds, in case someone sends a bogus updateRect (I'm looking at |
714 |
// clamp to bounds, in case someone sends a bogus updateRect (I'm looking at |
715 |
// you, gif decoder) |
715 |
// you, gif decoder) |
716 |
nsIntRect boundsRect(0, 0, mSize.width, mSize.height); |
716 |
nsIntRect boundsRect(mOffset, mSize); |
717 |
mDecoded.IntersectRect(mDecoded, boundsRect); |
717 |
mDecoded.IntersectRect(mDecoded, boundsRect); |
718 |
|
718 |
|
719 |
#ifdef XP_MACOSX |
719 |
#ifdef XP_MACOSX |
Lines 811-817
Link Here
|
811 |
nsresult imgFrame::LockImageData() |
811 |
nsresult imgFrame::LockImageData() |
812 |
{ |
812 |
{ |
813 |
if (mPalettedImageData) |
813 |
if (mPalettedImageData) |
814 |
return NS_OK; |
814 |
return NS_ERROR_NOT_AVAILABLE; |
|
|
815 |
|
816 |
NS_ABORT_IF_FALSE(!mLocked, "Trying to lock already locked image data."); |
817 |
if (mLocked) { |
818 |
return NS_ERROR_FAILURE; |
819 |
} |
820 |
mLocked = PR_TRUE; |
815 |
|
821 |
|
816 |
if ((mOptSurface || mSinglePixel) && !mImageSurface) { |
822 |
if ((mOptSurface || mSinglePixel) && !mImageSurface) { |
817 |
// Recover the pixels |
823 |
// Recover the pixels |
Lines 837-849
Link Here
|
837 |
#endif |
843 |
#endif |
838 |
} |
844 |
} |
839 |
|
845 |
|
|
|
846 |
if (mImageSurface) |
847 |
mImageSurface->Flush(); |
848 |
|
840 |
return NS_OK; |
849 |
return NS_OK; |
841 |
} |
850 |
} |
842 |
|
851 |
|
843 |
nsresult imgFrame::UnlockImageData() |
852 |
nsresult imgFrame::UnlockImageData() |
844 |
{ |
853 |
{ |
845 |
if (mPalettedImageData) |
854 |
if (mPalettedImageData) |
846 |
return NS_OK; |
855 |
return NS_ERROR_NOT_AVAILABLE; |
|
|
856 |
|
857 |
NS_ABORT_IF_FALSE(mLocked, "Unlocking an unlocked image!"); |
858 |
if (!mLocked) { |
859 |
return NS_ERROR_FAILURE; |
860 |
} |
861 |
mLocked = PR_FALSE; |
862 |
|
863 |
if (mImageSurface) |
864 |
mImageSurface->MarkDirty(); |
847 |
|
865 |
|
848 |
#ifdef XP_MACOSX |
866 |
#ifdef XP_MACOSX |
849 |
if (mQuartzSurface) |
867 |
if (mQuartzSurface) |
Lines 900-906
Link Here
|
900 |
|
918 |
|
901 |
PRBool imgFrame::ImageComplete() const |
919 |
PRBool imgFrame::ImageComplete() const |
902 |
{ |
920 |
{ |
903 |
return mDecoded == nsIntRect(0, 0, mSize.width, mSize.height); |
921 |
return mDecoded == nsIntRect(mOffset, mSize); |
904 |
} |
922 |
} |
905 |
|
923 |
|
906 |
// A hint from the image decoders that this image has no alpha, even |
924 |
// A hint from the image decoders that this image has no alpha, even |