mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 23:13:18 +00:00
1c5959ee6e
- Bug 1125750 - Check the overflow region direction to avoid unnecesary reflow for scrollable frame. (6b5067631) - Bug 1125750 - Add auto test to detect error when using mOuter to check overflow area of a scrollable frame. (4e9c43e31) - override -> MOZ_OVERRIDE (ed1ecc151) - Bug 990907 - Don't add text-overflow markers while being actively scrolled by APZ. (523bc5a3e) - Bug 945584: Part 6 - Implementation of scroll snapping (v10 Patch) (bf64eb0f3) - Bug 945584: Part 7 - Implement Scroll Snapping for Autoscroll, - Triggering scroll snapping at the end of an autoscroll. - This enables text selection to be unencumbered by scroll snapping, while restoring the scroll position to a valid snapping position when the drag operation is completed. (db9ce9811) - Bug 945584: Part 8 - Implement Scroll Snapping for Middle Mouse Button Scrolls (v2 Patch) (06d1b733d) - some MacOS 10.5 Leopard support (6a37f6745) - Bug 945584: Part 9 - Tests for scroll snapping (v4 Patch) (f67175387) - Bug 1102427 - Ensure scroll parents of an active scrollframe are layerized. (910d43ec5) - Bug 1142731 followup. Check isInterpreted() before we call environment(), because of the asmjs lambdas. (29b2acdc7) - Bug 1161627 - part 1 - add move constructor and assignment operator for already_AddRefed&& to RefPtr; This change is prep work for future mass rewriting. (98416d45c) - Bug 1161627 - part 2 - machine-convert TemporaryRef<T> to already_AddRefed<T>; (336e96af7) - Bug 1161627 - part 3 - remove TemporaryRef<T> from RefPtr.h (6c3acdaed) - Bug 940273 - Part 3 - Service Worker Cache webidl. (4b6803d0a) - Bug 940273 - Part 4 - Initial implementation of Service Worker Cache. (74498c108) - Bug 1133861 - Bustage fix. (4a81437c2)
130 lines
3.9 KiB
C++
130 lines
3.9 KiB
C++
/* -*- Mode: C++; tab-width: 20; 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 "X11BasicCompositor.h"
|
|
#include "gfxPlatform.h"
|
|
#include "gfx2DGlue.h"
|
|
#include "gfxXlibSurface.h"
|
|
#include "gfxImageSurface.h"
|
|
#include "mozilla/X11Util.h"
|
|
|
|
namespace mozilla {
|
|
using namespace mozilla::gfx;
|
|
|
|
namespace layers {
|
|
|
|
bool
|
|
X11DataTextureSourceBasic::Update(gfx::DataSourceSurface* aSurface,
|
|
nsIntRegion* aDestRegion,
|
|
gfx::IntPoint* aSrcOffset)
|
|
{
|
|
// Reallocate our internal X11 surface if we don't have a DrawTarget yet,
|
|
// or if we changed surface size or format since last update.
|
|
if (!mBufferDrawTarget ||
|
|
(aSurface->GetSize() != mBufferDrawTarget->GetSize()) ||
|
|
(aSurface->GetFormat() != mBufferDrawTarget->GetFormat())) {
|
|
|
|
nsRefPtr<gfxASurface> surf;
|
|
gfxImageFormat imageFormat = SurfaceFormatToImageFormat(aSurface->GetFormat());
|
|
Display *display = DefaultXDisplay();
|
|
Screen *screen = DefaultScreenOfDisplay(display);
|
|
XRenderPictFormat *xrenderFormat =
|
|
gfxXlibSurface::FindRenderFormat(display, imageFormat);
|
|
|
|
if (xrenderFormat) {
|
|
surf = gfxXlibSurface::Create(screen, xrenderFormat,
|
|
ThebesIntSize(aSurface->GetSize()));
|
|
}
|
|
|
|
if (!surf) {
|
|
NS_WARNING("Couldn't create native surface, fallback to image surface");
|
|
surf = new gfxImageSurface(ThebesIntSize(aSurface->GetSize()), imageFormat);
|
|
}
|
|
|
|
mBufferDrawTarget = gfxPlatform::GetPlatform()->
|
|
CreateDrawTargetForSurface(surf, aSurface->GetSize());
|
|
}
|
|
|
|
// Image contents have changed, upload to our DrawTarget
|
|
// If aDestRegion is null, means we're updating the whole surface
|
|
// Note : Incremental update with a source offset is only used on Mac.
|
|
NS_ASSERTION(!aSrcOffset, "SrcOffset should not be used with linux OMTC basic");
|
|
|
|
if (aDestRegion) {
|
|
nsIntRegionRectIterator iter(*aDestRegion);
|
|
while (const nsIntRect* iterRect = iter.Next()) {
|
|
IntRect srcRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height);
|
|
IntPoint dstPoint(iterRect->x, iterRect->y);
|
|
|
|
// We're uploading regions to our buffer, so let's just copy contents over
|
|
mBufferDrawTarget->CopySurface(aSurface, srcRect, dstPoint);
|
|
}
|
|
} else {
|
|
// We're uploading the whole buffer, so let's just copy the full surface
|
|
IntSize size = aSurface->GetSize();
|
|
mBufferDrawTarget->CopySurface(aSurface, IntRect(0, 0, size.width, size.height),
|
|
IntPoint(0, 0));
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
TextureSourceBasic*
|
|
X11DataTextureSourceBasic::AsSourceBasic()
|
|
{
|
|
return this;
|
|
}
|
|
|
|
IntSize
|
|
X11DataTextureSourceBasic::GetSize() const
|
|
{
|
|
if (!mBufferDrawTarget) {
|
|
NS_WARNING("Trying to query the size of an uninitialized TextureSource");
|
|
return IntSize(0, 0);
|
|
} else {
|
|
return mBufferDrawTarget->GetSize();
|
|
}
|
|
}
|
|
|
|
gfx::SurfaceFormat
|
|
X11DataTextureSourceBasic::GetFormat() const
|
|
{
|
|
if (!mBufferDrawTarget) {
|
|
NS_WARNING("Trying to query the format of an uninitialized TextureSource");
|
|
return gfx::SurfaceFormat::UNKNOWN;
|
|
} else {
|
|
return mBufferDrawTarget->GetFormat();
|
|
}
|
|
}
|
|
|
|
SourceSurface*
|
|
X11DataTextureSourceBasic::GetSurface(DrawTarget* aTarget)
|
|
{
|
|
RefPtr<gfx::SourceSurface> surface;
|
|
if (mBufferDrawTarget) {
|
|
surface = mBufferDrawTarget->Snapshot();
|
|
return surface.get();
|
|
} else {
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
void
|
|
X11DataTextureSourceBasic::DeallocateDeviceData()
|
|
{
|
|
mBufferDrawTarget = nullptr;
|
|
}
|
|
|
|
already_AddRefed<DataTextureSource>
|
|
X11BasicCompositor::CreateDataTextureSource(TextureFlags aFlags)
|
|
{
|
|
RefPtr<DataTextureSource> result =
|
|
new X11DataTextureSourceBasic();
|
|
return result.forget();
|
|
}
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|