mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
aa93536920
- Bug 1208300 (part 1) - Remove unused default arguments from ClearThebesSurface. r=jwatt. (bcb2009a23) - Bug 1208300 (part 2) - Convert gfxRGBA uses to gfx::Color in CompositorBench.cpp. r=jwatt. (ea9b6e5e4e) - Bug 1208300 (part 3) - Convert gfxRGBA uses to gfx::Color in LayerScope.cpp. r=jwatt. (cdee85cd56) - Bg 1155249 - Prescale image with an intermediate surface if repeated often on OS X. r=mstange (de799a164a) - Bug 1181554 - Snap the spread radius for inset box shadows to device pixels. (af015ea088) - Bug 1137148. Fix painting of ridge/groove borders for border-collapsed tables. r=jwatt (702e4fbe9b) - Bug 1185636 - Part 4b - don't use a css border skirt when printing. r=mstange (2e66f01772) - Bug 1178575 - Intersect the clip rect with aDirtyRect. r=roc (88848e836a) - Bug 1193519 pt 1 - Update coordinate conversions in WritingModes.h to account for sideways-lr writing mode. r=dholbert (b89824bcb6) - Bug 1193519 pt 2 - Handle sideways-left orientation in gfx text-drawing code. r=dholbert (4cdc8e0c38) - Bug 1193519 pt 3 - Handle writing-mode:sideways-lr in nsTextFrame selection and rendering. r=dholbert (b774d26992) - Bug 1159729 - Use the adjusted |offset| value in GetTextDecorationRectInternal, instead of ignoring it. r=smontagu (b1c735a0b0) - Bug 1193519 pt 4 - Reverse the direction of text-decoration offsets in sideways-lr mode. r=dholbert (585bcf555a) - Bug 1205787 - Map the writing-mode values from SVG1.1 to their CSS equivalents. r=heycam (dd8e0d9767) - Bug 1193488 - Update values of writing-mode and text-orientation to reflect the CSS WG decision to revise them in the Writing Modes spec. r=dholbert (4399949445) - Bug 1193519 pt 5 - Expose the sideways-lr value for writing-mode to CSS. r=dholbert (ece6e331d1) - Bug 1193519 pt 6 - Adjust the position of the caret bidi indicator appropriately for sideways-lr mode. r=dholbert (b09478c428) - Bug 1205787 - Reftest using legacy SVG1.1 writing-mode values. r=heycam (062df44279) - Bug 1193519 pt 7 - Basic reftests for sideways-lr writing mode. r=dholbert (2c66b9e399) - Bug 1180528 - Reftest for table row progression in vertical-rl writing mode with ltr and rtl directionality. r=dholbert (e2a5c6cadb) - Bug 1193519 pt 8 - Reftests for table row and cell ordering in sideways-* writing modes. r=dholbert (6487fce57d) - Bug 1193519 pt 9 - Reftests with floats in writing-mode: sideways-lr. r=dholbert (9f51c048c6) - Bug 1193519 pt 10 - Clean up remaining mentions of 'sideways-left' in code comments. r=dholbert (8483886936) - Bug 1193519 pt 11 - Reftest for sideways-lr writing mode with text-decoration. r=dholbert (bcfd28b4e8) - Bug 1193519 followup - annotate test for antialiasing fuzz on OS X. (1b8a465d1f) - Bug 1155828 - Draw box-shadows using an approach inspired by border-image. r=mstange (744997a069) - Bug 1162824 - Change box shadow cache to cache the colored blurred box shadow. r=mstange (813107388f) - convert TemporaryRef to already_AddRefed (626bbcb2ec) - Bug 1179049. Properly null check for draw target in box shadow code. r=mstange (8f3c03253c) - Bug 1188075 - Speed up inner box-shadow drawing by using a border-image style approach. r=mstange (61e4564172) - Bug 1208345 - Remove gfxContext::GraphicsOperator. r=jwatt. (884be741db) - Bug 1199534. Only set TabChild canvas background for the background of root PresContexts. r=mats (9a37268f31) - remove special transparent case, not found in FF45/52 nor TFF (a2577d8a0c) - Bug 1202320 - Fall back to platform APZ enabled in PresShell. r=kats (5a62e3e058) - bug 1171131 - Make dom/plugins/ipc build for iOS. r=jimm (cba4193b6e) - Bug 1207741 - Remove gfxIntSize. r=nical. (13b99abb9c) - Bug 591600 - CSS gradients should work on premultiplied colors. r=mstange (b0c6e73961)
355 lines
7.5 KiB
C++
355 lines
7.5 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "DynamicImage.h"
|
|
#include "gfxPlatform.h"
|
|
#include "gfxUtils.h"
|
|
#include "mozilla/gfx/2D.h"
|
|
#include "mozilla/RefPtr.h"
|
|
#include "ImageRegion.h"
|
|
#include "Orientation.h"
|
|
#include "SVGImageContext.h"
|
|
|
|
#include "mozilla/MemoryReporting.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::gfx;
|
|
using mozilla::layers::LayerManager;
|
|
using mozilla::layers::ImageContainer;
|
|
|
|
namespace mozilla {
|
|
namespace image {
|
|
|
|
// Inherited methods from Image.
|
|
|
|
already_AddRefed<ProgressTracker>
|
|
DynamicImage::GetProgressTracker()
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
size_t
|
|
DynamicImage::SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void
|
|
DynamicImage::CollectSizeOfSurfaces(nsTArray<SurfaceMemoryCounter>& aCounters,
|
|
MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
// We can't report anything useful because gfxDrawable doesn't expose this
|
|
// information.
|
|
}
|
|
|
|
void
|
|
DynamicImage::IncrementAnimationConsumers()
|
|
{ }
|
|
|
|
void
|
|
DynamicImage::DecrementAnimationConsumers()
|
|
{ }
|
|
|
|
#ifdef DEBUG
|
|
uint32_t
|
|
DynamicImage::GetAnimationConsumers()
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
nsresult
|
|
DynamicImage::OnImageDataAvailable(nsIRequest* aRequest,
|
|
nsISupports* aContext,
|
|
nsIInputStream* aInStr,
|
|
uint64_t aSourceOffset,
|
|
uint32_t aCount)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
DynamicImage::OnImageDataComplete(nsIRequest* aRequest,
|
|
nsISupports* aContext,
|
|
nsresult aStatus,
|
|
bool aLastPart)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
DynamicImage::OnSurfaceDiscarded()
|
|
{ }
|
|
|
|
void
|
|
DynamicImage::SetInnerWindowID(uint64_t aInnerWindowId)
|
|
{ }
|
|
|
|
uint64_t
|
|
DynamicImage::InnerWindowID() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
bool
|
|
DynamicImage::HasError()
|
|
{
|
|
return !mDrawable;
|
|
}
|
|
|
|
void
|
|
DynamicImage::SetHasError()
|
|
{ }
|
|
|
|
ImageURL*
|
|
DynamicImage::GetURI()
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
// Methods inherited from XPCOM interfaces.
|
|
|
|
NS_IMPL_ISUPPORTS(DynamicImage, imgIContainer)
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetWidth(int32_t* aWidth)
|
|
{
|
|
*aWidth = mDrawable->Size().width;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetHeight(int32_t* aHeight)
|
|
{
|
|
*aHeight = mDrawable->Size().height;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetIntrinsicSize(nsSize* aSize)
|
|
{
|
|
IntSize intSize(mDrawable->Size());
|
|
*aSize = nsSize(intSize.width, intSize.height);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetIntrinsicRatio(nsSize* aSize)
|
|
{
|
|
IntSize intSize(mDrawable->Size());
|
|
*aSize = nsSize(intSize.width, intSize.height);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP_(Orientation)
|
|
DynamicImage::GetOrientation()
|
|
{
|
|
return Orientation();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetType(uint16_t* aType)
|
|
{
|
|
*aType = imgIContainer::TYPE_RASTER;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetAnimated(bool* aAnimated)
|
|
{
|
|
*aAnimated = false;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
|
DynamicImage::GetFrame(uint32_t aWhichFrame,
|
|
uint32_t aFlags)
|
|
{
|
|
IntSize size(mDrawable->Size());
|
|
return GetFrameAtSize(IntSize(size.width, size.height),
|
|
aWhichFrame,
|
|
aFlags);
|
|
}
|
|
|
|
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
|
DynamicImage::GetFrameAtSize(const IntSize& aSize,
|
|
uint32_t aWhichFrame,
|
|
uint32_t aFlags)
|
|
{
|
|
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->
|
|
CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8);
|
|
if (!dt) {
|
|
gfxWarning() <<
|
|
"DynamicImage::GetFrame failed in CreateOffscreenContentDrawTarget";
|
|
return nullptr;
|
|
}
|
|
nsRefPtr<gfxContext> context = new gfxContext(dt);
|
|
|
|
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
|
|
aWhichFrame, GraphicsFilter::FILTER_NEAREST,
|
|
Nothing(), aFlags);
|
|
|
|
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
|
|
}
|
|
|
|
NS_IMETHODIMP_(bool)
|
|
DynamicImage::IsOpaque()
|
|
{
|
|
// XXX(seth): For performance reasons it'd be better to return true here, but
|
|
// I'm not sure how we can guarantee it for an arbitrary gfxDrawable.
|
|
return false;
|
|
}
|
|
|
|
NS_IMETHODIMP_(bool)
|
|
DynamicImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
|
DynamicImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
NS_IMETHODIMP_(DrawResult)
|
|
DynamicImage::Draw(gfxContext* aContext,
|
|
const nsIntSize& aSize,
|
|
const ImageRegion& aRegion,
|
|
uint32_t aWhichFrame,
|
|
GraphicsFilter aFilter,
|
|
const Maybe<SVGImageContext>& aSVGContext,
|
|
uint32_t aFlags)
|
|
{
|
|
MOZ_ASSERT(!aSize.IsEmpty(), "Unexpected empty size");
|
|
|
|
IntSize drawableSize(mDrawable->Size());
|
|
|
|
if (aSize == drawableSize) {
|
|
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, aRegion,
|
|
SurfaceFormat::B8G8R8A8, aFilter);
|
|
return DrawResult::SUCCESS;
|
|
}
|
|
|
|
gfxSize scale(double(aSize.width) / drawableSize.width,
|
|
double(aSize.height) / drawableSize.height);
|
|
|
|
ImageRegion region(aRegion);
|
|
region.Scale(1.0 / scale.width, 1.0 / scale.height);
|
|
|
|
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
|
|
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
|
|
|
|
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, region,
|
|
SurfaceFormat::B8G8R8A8, aFilter);
|
|
return DrawResult::SUCCESS;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::RequestDecode()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::StartDecoding()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::LockImage()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::UnlockImage()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::RequestDiscard()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP_(void)
|
|
DynamicImage::RequestRefresh(const mozilla::TimeStamp& aTime)
|
|
{ }
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::GetAnimationMode(uint16_t* aAnimationMode)
|
|
{
|
|
*aAnimationMode = kNormalAnimMode;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::SetAnimationMode(uint16_t aAnimationMode)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
DynamicImage::ResetAnimation()
|
|
{
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP_(float)
|
|
DynamicImage::GetFrameIndex(uint32_t aWhichFrame)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
NS_IMETHODIMP_(int32_t)
|
|
DynamicImage::GetFirstFrameDelay()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
NS_IMETHODIMP_(void)
|
|
DynamicImage::SetAnimationStartTime(const mozilla::TimeStamp& aTime)
|
|
{ }
|
|
|
|
nsIntSize
|
|
DynamicImage::OptimalImageSizeForDest(const gfxSize& aDest,
|
|
uint32_t aWhichFrame,
|
|
GraphicsFilter aFilter, uint32_t aFlags)
|
|
{
|
|
IntSize size(mDrawable->Size());
|
|
return nsIntSize(size.width, size.height);
|
|
}
|
|
|
|
NS_IMETHODIMP_(nsIntRect)
|
|
DynamicImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect)
|
|
{
|
|
return aRect;
|
|
}
|
|
|
|
already_AddRefed<imgIContainer>
|
|
DynamicImage::Unwrap()
|
|
{
|
|
nsCOMPtr<imgIContainer> self(this);
|
|
return self.forget();
|
|
}
|
|
|
|
void
|
|
DynamicImage::PropagateUseCounters(nsIDocument*)
|
|
{
|
|
// No use counters.
|
|
}
|
|
|
|
} // namespace image
|
|
} // namespace mozilla
|