2011-03-24 06:13:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
#ifndef CANVASIMAGECACHE_H_
|
|
|
|
#define CANVASIMAGECACHE_H_
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2016-05-10 18:00:06 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2014-04-16 04:41:40 +04:00
|
|
|
#include "nsSize.h"
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2012-06-30 09:53:21 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2013-01-04 09:16:14 +04:00
|
|
|
class HTMLCanvasElement;
|
2012-06-30 09:53:21 +04:00
|
|
|
} // namespace dom
|
2013-12-12 01:05:27 +04:00
|
|
|
namespace gfx {
|
|
|
|
class SourceSurface;
|
|
|
|
} // namespace gfx
|
2012-06-30 09:53:21 +04:00
|
|
|
} // namespace mozilla
|
2016-05-10 18:00:06 +03:00
|
|
|
class imgIContainer;
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
namespace mozilla {
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
class CanvasImageCache {
|
2013-12-12 01:05:27 +04:00
|
|
|
typedef mozilla::gfx::SourceSurface SourceSurface;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
public:
|
|
|
|
/**
|
2016-05-10 18:00:06 +03:00
|
|
|
* Notify that image element aImage was drawn to aCanvas element
|
2011-03-24 06:13:56 +03:00
|
|
|
* using the first frame of aRequest's image. The data for the surface is
|
2019-07-12 15:46:03 +03:00
|
|
|
* in aSurface, and the image size is in aSize. aIntrinsicSize is the size
|
|
|
|
* the surface is intended to be rendered at.
|
2011-03-24 06:13:56 +03:00
|
|
|
*/
|
2012-06-30 09:53:21 +04:00
|
|
|
static void NotifyDrawImage(dom::Element* aImage,
|
2013-01-04 09:16:14 +04:00
|
|
|
dom::HTMLCanvasElement* aCanvas,
|
2019-07-12 15:46:03 +03:00
|
|
|
SourceSurface* aSource, const gfx::IntSize& aSize,
|
|
|
|
const gfx::IntSize& aIntrinsicSize);
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
/**
|
2016-05-10 18:00:06 +03:00
|
|
|
* Check whether aImage has recently been drawn any canvas. If we return
|
|
|
|
* a non-null surface, then the same image was recently drawn into a canvas.
|
2011-03-24 06:13:56 +03:00
|
|
|
*/
|
2019-02-28 17:58:19 +03:00
|
|
|
static SourceSurface* LookupAllCanvas(dom::Element* aImage);
|
2014-10-29 18:17:00 +03:00
|
|
|
|
|
|
|
/**
|
2016-05-10 18:00:06 +03:00
|
|
|
* Like the top above, but restricts the lookup to only aCanvas. This is
|
|
|
|
* required for CORS security.
|
2014-10-29 18:17:00 +03:00
|
|
|
*/
|
2016-05-10 18:00:06 +03:00
|
|
|
static SourceSurface* LookupCanvas(dom::Element* aImage,
|
|
|
|
dom::HTMLCanvasElement* aCanvas,
|
2019-07-12 15:46:03 +03:00
|
|
|
gfx::IntSize* aSizeOut,
|
|
|
|
gfx::IntSize* aIntrinsicSizeOut);
|
2011-03-24 06:13:56 +03:00
|
|
|
};
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2014-06-19 04:56:02 +04:00
|
|
|
|
2011-03-24 06:13:56 +03:00
|
|
|
#endif /* CANVASIMAGECACHE_H_ */
|