2014-06-19 04:56:02 +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/. */
|
|
|
|
|
|
|
|
#ifndef CANVASIMAGECACHE_H_
|
|
|
|
#define CANVASIMAGECACHE_H_
|
|
|
|
|
2016-05-10 18:00:06 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2014-06-19 04:56:02 +04:00
|
|
|
#include "nsSize.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
class HTMLCanvasElement;
|
|
|
|
} // namespace dom
|
|
|
|
namespace gfx {
|
|
|
|
class SourceSurface;
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2016-05-10 18:00:06 +03:00
|
|
|
class imgIContainer;
|
2014-06-19 04:56:02 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class CanvasImageCache {
|
|
|
|
typedef mozilla::gfx::SourceSurface SourceSurface;
|
|
|
|
public:
|
|
|
|
/**
|
2016-05-10 18:00:06 +03:00
|
|
|
* Notify that image element aImage was drawn to aCanvas element
|
2014-06-19 04:56:02 +04:00
|
|
|
* using the first frame of aRequest's image. The data for the surface is
|
|
|
|
* in aSurface, and the image size is in aSize.
|
|
|
|
*/
|
|
|
|
static void NotifyDrawImage(dom::Element* aImage,
|
|
|
|
dom::HTMLCanvasElement* aCanvas,
|
|
|
|
SourceSurface* aSource,
|
2015-11-04 05:12:24 +03:00
|
|
|
const gfx::IntSize& aSize,
|
|
|
|
bool aIsAccelerated);
|
2014-06-19 04:56:02 +04: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.
|
2014-06-19 04:56:02 +04:00
|
|
|
*/
|
2016-05-10 18:00:06 +03:00
|
|
|
static SourceSurface* LookupAllCanvas(dom::Element* aImage,
|
|
|
|
bool aIsAccelerated);
|
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,
|
|
|
|
gfx::IntSize* aSizeOut,
|
2015-11-04 05:12:24 +03:00
|
|
|
bool aIsAccelerated);
|
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
|
|
|
|
|
|
|
#endif /* CANVASIMAGECACHE_H_ */
|