| Index: Source/core/platform/graphics/Canvas2DImageBufferSurface.h
|
| diff --git a/Source/core/html/parser/HTMLSrcsetParser.h b/Source/core/platform/graphics/Canvas2DImageBufferSurface.h
|
| similarity index 55%
|
| copy from Source/core/html/parser/HTMLSrcsetParser.h
|
| copy to Source/core/platform/graphics/Canvas2DImageBufferSurface.h
|
| index 8964ffbcd5f61ee309ab67d2e4fe83855e89c736..406ba591d1f83431a6e0e9c24bff378e05812494 100644
|
| --- a/Source/core/html/parser/HTMLSrcsetParser.h
|
| +++ b/Source/core/platform/graphics/Canvas2DImageBufferSurface.h
|
| @@ -28,52 +28,38 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef HTMLSrcsetParser_h
|
| -#define HTMLSrcsetParser_h
|
| +#ifndef Canvas2DImageBufferSurface_h
|
| +#define Canvas2DImageBufferSurface_h
|
|
|
| -#include "wtf/text/WTFString.h"
|
| +#include "core/platform/graphics/Canvas2DLayerBridge.h"
|
| +#include "platform/graphics/ImageBufferSurface.h"
|
|
|
| namespace WebCore {
|
|
|
| -class ImageCandidate {
|
| +// This shim necessary because ImageBufferSurfaces are not allowed to be RefCounted
|
| +class Canvas2DImageBufferSurface : public ImageBufferSurface {
|
| public:
|
| - ImageCandidate()
|
| - : m_scaleFactor(1.0)
|
| + Canvas2DImageBufferSurface(const IntSize& size, OpacityMode opacityMode, float resolutionScale, int msaaSampleCount)
|
| + : ImageBufferSurface(size, opacityMode, resolutionScale)
|
| + , m_layerBridge(Canvas2DLayerBridge::create(size, opacityMode, msaaSampleCount))
|
| {
|
| + clear();
|
| }
|
|
|
| - ImageCandidate(const String& source, unsigned start, unsigned length, float scaleFactor)
|
| - : m_string(source.createView(start, length))
|
| - , m_scaleFactor(scaleFactor)
|
| - {
|
| - }
|
| + virtual ~Canvas2DImageBufferSurface() { m_layerBridge->destroy(); }
|
|
|
| - String toString() const
|
| - {
|
| - return m_string.toString();
|
| - }
|
| -
|
| - inline float scaleFactor() const
|
| - {
|
| - return m_scaleFactor;
|
| - }
|
| -
|
| - inline bool isEmpty() const
|
| - {
|
| - return m_string.isEmpty();
|
| - }
|
| + // ImageBufferSurface implementation
|
| + virtual void aboutToUse() OVERRIDE { m_layerBridge->aboutToUse(); }
|
| + virtual SkCanvas* canvas() const OVERRIDE { return m_layerBridge->canvas(); }
|
| + virtual bool isValid() const OVERRIDE { return m_layerBridge && m_layerBridge->isValid(); }
|
| + virtual blink::WebLayer* layer() const OVERRIDE { return m_layerBridge->layer(); }
|
| + virtual Platform3DObject getBackingTexture() const OVERRIDE { return m_layerBridge->getBackingTexture(); }
|
| + virtual bool isAccelerated() const { return m_layerBridge->isAccelerated(); }
|
|
|
| private:
|
| - StringView m_string;
|
| - float m_scaleFactor;
|
| + RefPtr<Canvas2DLayerBridge> m_layerBridge;
|
| };
|
|
|
| -ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const String& srcsetAttribute);
|
| -
|
| -ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute);
|
| -
|
| -String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate);
|
| -
|
| }
|
|
|
| #endif
|
|
|