зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1028786, part 1 - Add a gfxUtils::ClearThebesSurface() helper method. r=mattwoodrow
--HG-- extra : rebase_source : 524ffe6d276ea9b51cf01d534f65c9b74b32b950
This commit is contained in:
Родитель
bd8f23ccd6
Коммит
8e7356e992
|
@ -4,6 +4,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "gfxUtils.h"
|
||||
|
||||
#include "cairo.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
@ -993,6 +995,21 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ void gfxUtils::ClearThebesSurface(gfxASurface* aSurface)
|
||||
{
|
||||
if (aSurface->CairoStatus()) {
|
||||
return;
|
||||
}
|
||||
cairo_surface_t* surf = aSurface->CairoSurface();
|
||||
if (cairo_surface_status(surf)) {
|
||||
return;
|
||||
}
|
||||
cairo_t* ctx = cairo_create(surf);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint_with_alpha(ctx, 1.0);
|
||||
cairo_destroy(ctx);
|
||||
}
|
||||
|
||||
/* static */ TemporaryRef<DataSourceSurface>
|
||||
gfxUtils::CopySurfaceToDataSourceSurfaceWithFormat(SourceSurface* aSurface,
|
||||
SurfaceFormat aFormat)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
class gfxASurface;
|
||||
class gfxDrawable;
|
||||
class nsIntRegion;
|
||||
struct nsIntRect;
|
||||
|
@ -166,6 +167,11 @@ public:
|
|||
unsigned char* aDestBuffer,
|
||||
int32_t aStride);
|
||||
|
||||
/**
|
||||
* Clears surface to transparent black.
|
||||
*/
|
||||
static void ClearThebesSurface(gfxASurface* aSurface);
|
||||
|
||||
/**
|
||||
* Creates a copy of aSurface, but having the SurfaceFormat aFormat.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче