diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/texmap/TextureMapper.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/platform/graphics/texmap/TextureMapper.h')
-rw-r--r-- | Source/WebCore/platform/graphics/texmap/TextureMapper.h | 101 |
1 files changed, 11 insertions, 90 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.h b/Source/WebCore/platform/graphics/texmap/TextureMapper.h index 681b24ea1..7233d0dcc 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.h @@ -20,13 +20,8 @@ #ifndef TextureMapper_h #define TextureMapper_h -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) - -#if (PLATFORM(GTK) || PLATFORM(EFL)) && USE(OPENGL_ES_2) -#define TEXMAP_OPENGL_ES_2 -#endif - -#include "GraphicsContext.h" +#include "BitmapTexture.h" +#include "Color.h" #include "IntRect.h" #include "IntSize.h" #include "TransformationMatrix.h" @@ -43,68 +38,9 @@ class GraphicsLayer; class TextureMapper; class FilterOperations; -// A 2D texture that can be the target of software or GL rendering. -class BitmapTexture : public RefCounted<BitmapTexture> { -public: - enum Flag { - NoFlag = 0, - SupportsAlpha = 0x01 - }; - - enum UpdateContentsFlag { - UpdateCanModifyOriginalImageData, - UpdateCannotModifyOriginalImageData - }; - - typedef unsigned Flags; - - BitmapTexture() - : m_flags(0) - { - } - - virtual ~BitmapTexture() { } - virtual bool isBackedByOpenGL() const { return false; } - - virtual IntSize size() const = 0; - virtual void updateContents(Image*, const IntRect&, const IntPoint& offset, UpdateContentsFlag) = 0; - virtual void updateContents(TextureMapper*, GraphicsLayer*, const IntRect& target, const IntPoint& offset, UpdateContentsFlag); - virtual void updateContents(const void*, const IntRect& target, const IntPoint& offset, int bytesPerLine, UpdateContentsFlag) = 0; - virtual bool isValid() const = 0; - inline Flags flags() const { return m_flags; } - - virtual int bpp() const { return 32; } - virtual bool canReuseWith(const IntSize& /* contentsSize */, Flags = 0) { return false; } - void reset(const IntSize& size, Flags flags = 0) - { - m_flags = flags; - m_contentSize = size; - didReset(); - } - virtual void didReset() { } - - inline IntSize contentSize() const { return m_contentSize; } - inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; } - inline bool isOpaque() const { return !(m_flags & SupportsAlpha); } - -#if ENABLE(CSS_FILTERS) - virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const FilterOperations&) { return this; } -#endif - -protected: - IntSize m_contentSize; - -private: - Flags m_flags; -}; - -// A "context" class used to encapsulate accelerated texture mapping functions: i.e. drawing a texture -// onto the screen or into another texture with a specified transform, opacity and mask. class TextureMapper { WTF_MAKE_FAST_ALLOCATED; - friend class BitmapTexture; public: - enum AccelerationMode { SoftwareMode, OpenGLMode }; enum PaintFlag { PaintingMirrored = 1 << 0, }; @@ -116,7 +52,9 @@ public: typedef unsigned PaintFlags; - static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode); + static std::unique_ptr<TextureMapper> create(); + + explicit TextureMapper(); virtual ~TextureMapper(); enum ExposedEdges { @@ -136,20 +74,11 @@ public: // makes a surface the target for the following drawTexture calls. virtual void bindSurface(BitmapTexture* surface) = 0; - void setGraphicsContext(GraphicsContext* context) { m_context = context; } - GraphicsContext* graphicsContext() { return m_context; } virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0; virtual void endClip() = 0; virtual IntRect clipBounds() = 0; virtual PassRefPtr<BitmapTexture> createTexture() = 0; - void setImageInterpolationQuality(InterpolationQuality quality) { m_interpolationQuality = quality; } - void setTextDrawingMode(TextDrawingModeFlags mode) { m_textDrawingMode = mode; } - - InterpolationQuality imageInterpolationQuality() const { return m_interpolationQuality; } - TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; } - AccelerationMode accelerationMode() const { return m_accelerationMode; } - virtual void beginPainting(PaintFlags = 0) { } virtual void endPainting() { } @@ -163,9 +92,7 @@ public: void setWrapMode(WrapMode m) { m_wrapMode = m; } protected: - explicit TextureMapper(AccelerationMode); - - GraphicsContext* m_context; + std::unique_ptr<BitmapTexturePool> m_texturePool; bool isInMaskMode() const { return m_isMaskMode; } WrapMode wrapMode() const { return m_wrapMode; } @@ -173,24 +100,18 @@ protected: private: #if USE(TEXTURE_MAPPER_GL) - static PassOwnPtr<TextureMapper> platformCreateAccelerated(); + static std::unique_ptr<TextureMapper> platformCreateAccelerated(); #else - static PassOwnPtr<TextureMapper> platformCreateAccelerated() + static std::unique_ptr<TextureMapper> platformCreateAccelerated() { - return PassOwnPtr<TextureMapper>(); + return nullptr; } #endif - InterpolationQuality m_interpolationQuality; - TextDrawingModeFlags m_textDrawingMode; - OwnPtr<BitmapTexturePool> m_texturePool; - AccelerationMode m_accelerationMode; - bool m_isMaskMode; + bool m_isMaskMode { false }; TransformationMatrix m_patternTransform; - WrapMode m_wrapMode; + WrapMode m_wrapMode { StretchWrap }; }; } #endif - -#endif |