2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2010-03-02 02:09:35 +03:00
|
|
|
|
|
|
|
#ifndef GFX_IMAGELAYER_H
|
|
|
|
#define GFX_IMAGELAYER_H
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "Layers.h" // for Layer, etc
|
|
|
|
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
2013-12-20 20:46:29 +04:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nscore.h" // for nsACString
|
|
|
|
|
2010-03-02 02:09:35 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2012-08-19 23:33:25 +04:00
|
|
|
class ImageContainer;
|
2010-03-02 02:09:35 +03:00
|
|
|
|
2014-07-28 00:32:00 +04:00
|
|
|
namespace layerscope {
|
|
|
|
class LayersPacket;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layerscope
|
2014-07-28 00:32:00 +04:00
|
|
|
|
2010-03-02 02:09:35 +03:00
|
|
|
/**
|
|
|
|
* A Layer which renders an Image.
|
|
|
|
*/
|
2013-05-30 01:59:24 +04:00
|
|
|
class ImageLayer : public Layer {
|
2010-03-02 02:09:35 +03:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* CONSTRUCTION PHASE ONLY
|
|
|
|
* Set the ImageContainer. aContainer must have the same layer manager
|
|
|
|
* as this layer.
|
|
|
|
*/
|
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
|
|
|
virtual void SetContainer(ImageContainer* aContainer);
|
2012-08-19 23:33:25 +04:00
|
|
|
|
2010-03-02 02:09:35 +03:00
|
|
|
/**
|
|
|
|
* CONSTRUCTION PHASE ONLY
|
|
|
|
* Set the filter used to resample this image if necessary.
|
|
|
|
*/
|
2016-05-25 19:01:18 +03:00
|
|
|
void SetSamplingFilter(gfx::SamplingFilter aSamplingFilter) {
|
|
|
|
if (mSamplingFilter != aSamplingFilter) {
|
2013-03-28 14:58:45 +04:00
|
|
|
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Filter", this));
|
2016-05-25 19:01:18 +03:00
|
|
|
mSamplingFilter = aSamplingFilter;
|
2013-03-28 14:58:45 +04:00
|
|
|
Mutated();
|
|
|
|
}
|
|
|
|
}
|
2010-03-02 02:09:35 +03:00
|
|
|
|
2012-03-13 05:41:29 +04:00
|
|
|
/**
|
|
|
|
* CONSTRUCTION PHASE ONLY
|
|
|
|
* Set the size to scale the image to and the mode at which to scale.
|
|
|
|
*/
|
2013-12-20 20:46:29 +04:00
|
|
|
void SetScaleToSize(const gfx::IntSize& aSize, ScaleMode aMode) {
|
2013-05-10 01:02:50 +04:00
|
|
|
if (mScaleToSize != aSize || mScaleMode != aMode) {
|
|
|
|
mScaleToSize = aSize;
|
|
|
|
mScaleMode = aMode;
|
|
|
|
Mutated();
|
|
|
|
}
|
2012-03-13 05:41:29 +04:00
|
|
|
}
|
|
|
|
|
2010-03-02 02:09:35 +03:00
|
|
|
ImageContainer* GetContainer() { return mContainer; }
|
2016-05-25 19:01:18 +03:00
|
|
|
gfx::SamplingFilter GetSamplingFilter() { return mSamplingFilter; }
|
2013-12-20 20:46:29 +04:00
|
|
|
const gfx::IntSize& GetScaleToSize() { return mScaleToSize; }
|
2012-08-29 09:47:18 +04:00
|
|
|
ScaleMode GetScaleMode() { return mScaleMode; }
|
2010-03-02 02:09:35 +03:00
|
|
|
|
2010-07-21 22:06:33 +04:00
|
|
|
MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
|
2010-07-02 05:01:09 +04:00
|
|
|
|
2019-04-11 15:36:51 +03:00
|
|
|
void ComputeEffectiveTransforms(
|
2015-03-21 19:28:04 +03:00
|
|
|
const gfx::Matrix4x4& aTransformToSurface) override;
|
2014-12-07 04:12:50 +03:00
|
|
|
|
2019-04-11 15:36:51 +03:00
|
|
|
const gfx::Matrix4x4& GetEffectiveTransformForBuffer() const override {
|
2014-12-07 04:12:50 +03:00
|
|
|
return mEffectiveTransformForBuffer;
|
|
|
|
}
|
2010-11-08 12:06:15 +03:00
|
|
|
|
2019-04-11 15:36:51 +03:00
|
|
|
ImageLayer* AsImageLayer() override { return this; }
|
2016-12-21 18:43:47 +03:00
|
|
|
|
2010-03-02 02:09:35 +03:00
|
|
|
protected:
|
2012-08-19 23:33:25 +04:00
|
|
|
ImageLayer(LayerManager* aManager, void* aImplData);
|
2019-04-11 15:36:51 +03:00
|
|
|
virtual ~ImageLayer();
|
|
|
|
void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
|
|
|
void DumpPacket(layerscope::LayersPacket* aPacket,
|
|
|
|
const void* aParent) override;
|
2012-03-13 05:41:29 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ImageContainer> mContainer;
|
2016-05-25 19:01:18 +03:00
|
|
|
gfx::SamplingFilter mSamplingFilter;
|
2013-12-20 20:46:29 +04:00
|
|
|
gfx::IntSize mScaleToSize;
|
2012-03-13 05:41:29 +04:00
|
|
|
ScaleMode mScaleMode;
|
2014-12-07 04:12:50 +03:00
|
|
|
gfx::Matrix4x4 mEffectiveTransformForBuffer;
|
2010-03-02 02:09:35 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2010-03-02 02:09:35 +03:00
|
|
|
|
|
|
|
#endif /* GFX_IMAGELAYER_H */
|