2012-06-29 10:01:34 +04:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
#include "BasicCanvasLayer.h"
|
2015-10-12 06:21:03 +03:00
|
|
|
#include "AsyncCanvasRenderer.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "basic/BasicLayers.h" // for BasicLayerManager
|
2014-02-27 20:56:48 +04:00
|
|
|
#include "basic/BasicLayersImpl.h" // for GetEffectiveOperator
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/mozalloc.h" // for operator new
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
|
2014-02-12 19:07:46 +04:00
|
|
|
#include "gfx2DGlue.h"
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class gfxContext;
|
2012-06-29 10:01:34 +04:00
|
|
|
|
|
|
|
using namespace mozilla::gfx;
|
2012-10-26 00:12:59 +04:00
|
|
|
using namespace mozilla::gl;
|
2012-06-29 10:01:34 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2012-07-10 19:06:42 +04:00
|
|
|
namespace layers {
|
|
|
|
|
2014-02-12 19:07:46 +04:00
|
|
|
void
|
2014-05-12 04:31:27 +04:00
|
|
|
BasicCanvasLayer::Paint(DrawTarget* aDT,
|
|
|
|
const Point& aDeviceOffset,
|
|
|
|
Layer* aMaskLayer)
|
2012-06-29 10:01:34 +04:00
|
|
|
{
|
|
|
|
if (IsHidden())
|
|
|
|
return;
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2014-10-09 02:18:28 +04:00
|
|
|
if (IsDirty()) {
|
|
|
|
Painted();
|
|
|
|
|
|
|
|
FirePreTransactionCallback();
|
2016-07-28 23:08:59 +03:00
|
|
|
UpdateTarget();
|
2014-10-09 02:18:28 +04:00
|
|
|
FireDidTransactionCallback();
|
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2016-07-28 23:08:59 +03:00
|
|
|
if (!mSurface) {
|
2014-04-07 12:57:27 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-18 04:02:19 +03:00
|
|
|
const bool needsYFlip = (mOriginPos == gl::OriginPos::BottomLeft);
|
|
|
|
|
2014-09-10 21:29:35 +04:00
|
|
|
Matrix oldTM;
|
2014-11-18 04:02:19 +03:00
|
|
|
if (needsYFlip) {
|
2014-09-10 21:29:35 +04:00
|
|
|
oldTM = aDT->GetTransform();
|
|
|
|
aDT->SetTransform(Matrix(oldTM).
|
|
|
|
PreTranslate(0.0f, mBounds.height).
|
|
|
|
PreScale(1.0f, -1.0f));
|
2014-04-01 08:02:09 +04:00
|
|
|
}
|
|
|
|
|
2014-05-12 04:31:27 +04:00
|
|
|
FillRectWithMask(aDT, aDeviceOffset,
|
2014-04-01 08:02:09 +04:00
|
|
|
Rect(0, 0, mBounds.width, mBounds.height),
|
2016-07-28 23:08:59 +03:00
|
|
|
mSurface, mSamplingFilter,
|
2014-04-01 08:02:09 +04:00
|
|
|
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
|
|
|
|
aMaskLayer);
|
|
|
|
|
2014-11-18 04:02:19 +03:00
|
|
|
if (needsYFlip) {
|
2014-09-10 21:29:35 +04:00
|
|
|
aDT->SetTransform(oldTM);
|
2014-04-01 08:02:09 +04:00
|
|
|
}
|
2012-06-29 10:01:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<CanvasLayer>
|
|
|
|
BasicLayerManager::CreateCanvasLayer()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CanvasLayer> layer = new BasicCanvasLayer(this);
|
2012-06-29 10:01:34 +04:00
|
|
|
return layer.forget();
|
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|