mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
55d6cf1e20
Generated by these regexes: find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(ImageFormat\|SurfaceType\|ContentType\|MemoryLocation\)[0-9A-Za-z_]*\)/gfx\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(CONTENT_\|MEMORY_\)[0-9A-Za-z_]*\)/GFX_\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(CONTENT_COLOR\|CONTENT_ALPHA\|CONTENT_COLOR_ALPHA\|CONTENT_SENTINEL\|MEMORY_IN_PROCESS_HEAP\|MEMORY_IN_PROCESS_NONHEAP\|MEMORY_OUT_OF_PROCESS\)\($\|[^A-Za-z0-9_]\)/\1GFX_\2\3/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(ImageFormatARGB32\|ImageFormatRGB24\|ImageFormatA8\|ImageFormatA1\|ImageFormatRGB16_565\|ImageFormatUnknown\|SurfaceTypeImage\|SurfaceTypePDF\|SurfaceTypePS\|SurfaceTypeXlib\|SurfaceTypeXcb\|SurfaceTypeGlitz\|SurfaceTypeQuartz\|SurfaceTypeWin32\|SurfaceTypeBeOS\|SurfaceTypeDirectFB\|SurfaceTypeSVG\|SurfaceTypeOS2\|SurfaceTypeWin32Printing\|SurfaceTypeQuartzImage\|SurfaceTypeScript\|SurfaceTypeQPainter\|SurfaceTypeRecording\|SurfaceTypeVG\|SurfaceTypeGL\|SurfaceTypeDRM\|SurfaceTypeTee\|SurfaceTypeXML\|SurfaceTypeSkia\|SurfaceTypeSubsurface\|SurfaceTypeD2D\|SurfaceTypeMax\)\($\|[^A-Za-z0-9_]\)/\1gfx\2\3/g'
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
/* 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/. */
|
|
|
|
#include "gfxReusableImageSurfaceWrapper.h"
|
|
#include "gfxImageSurface.h"
|
|
|
|
gfxReusableImageSurfaceWrapper::gfxReusableImageSurfaceWrapper(gfxImageSurface* aSurface)
|
|
: mSurface(aSurface)
|
|
{
|
|
MOZ_COUNT_CTOR(gfxReusableImageSurfaceWrapper);
|
|
}
|
|
|
|
gfxReusableImageSurfaceWrapper::~gfxReusableImageSurfaceWrapper()
|
|
{
|
|
MOZ_COUNT_DTOR(gfxReusableImageSurfaceWrapper);
|
|
}
|
|
|
|
void
|
|
gfxReusableImageSurfaceWrapper::ReadLock()
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(gfxReusableImageSurfaceWrapper);
|
|
AddRef();
|
|
}
|
|
|
|
void
|
|
gfxReusableImageSurfaceWrapper::ReadUnlock()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
gfxReusableSurfaceWrapper*
|
|
gfxReusableImageSurfaceWrapper::GetWritable(gfxImageSurface** aSurface)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(gfxReusableImageSurfaceWrapper);
|
|
|
|
if (mRefCnt == 1) {
|
|
*aSurface = mSurface;
|
|
return this;
|
|
}
|
|
|
|
// Something else is reading the surface, copy it
|
|
gfxImageSurface* copySurface = new gfxImageSurface(mSurface->GetSize(), mSurface->Format(), false);
|
|
copySurface->CopyFrom(mSurface);
|
|
*aSurface = copySurface;
|
|
|
|
return new gfxReusableImageSurfaceWrapper(copySurface);
|
|
}
|
|
|
|
const unsigned char*
|
|
gfxReusableImageSurfaceWrapper::GetReadOnlyData() const
|
|
{
|
|
return mSurface->Data();
|
|
}
|
|
|
|
gfxImageFormat
|
|
gfxReusableImageSurfaceWrapper::Format()
|
|
{
|
|
return mSurface->Format();
|
|
}
|
|
|