mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 782416 - Switch from NULL to nullptr in gfx::2d. r=Bas
--HG-- extra : rebase_source : 9b12a2af4c55f4dc383e8075b400e7a1fbe1ac23
This commit is contained in:
parent
292e0de55b
commit
bd561fcfea
@ -330,7 +330,7 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
|
||||
const Rect* aSkipRect)
|
||||
: mSpreadRadius(aSpreadRadius),
|
||||
mBlurRadius(aBlurRadius),
|
||||
mData(NULL)
|
||||
mData(nullptr)
|
||||
{
|
||||
Rect rect(aRect);
|
||||
rect.Inflate(Size(aBlurRadius + aSpreadRadius));
|
||||
@ -424,7 +424,7 @@ AlphaBoxBlur::GetDirtyRect()
|
||||
return &mDirtyRect;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -45,11 +45,11 @@ public:
|
||||
*
|
||||
* @param aDirtyRect A pointer to a dirty rect, measured in device units, if
|
||||
* available. This will be used for optimizing the blur operation. It is
|
||||
* safe to pass NULL here.
|
||||
* safe to pass nullptr here.
|
||||
*
|
||||
* @param aSkipRect A pointer to a rect, measured in device units, that
|
||||
* represents an area where blurring is unnecessary and shouldn't be done for
|
||||
* speed reasons. It is safe to pass NULL here.
|
||||
* speed reasons. It is safe to pass nullptr here.
|
||||
*/
|
||||
AlphaBoxBlur(const Rect& aRect,
|
||||
const IntSize& aSpreadRadius,
|
||||
@ -84,7 +84,7 @@ public:
|
||||
IntRect GetRect();
|
||||
|
||||
/**
|
||||
* Return a pointer to a dirty rect, as passed in to the constructor, or NULL
|
||||
* Return a pointer to a dirty rect, as passed in to the constructor, or nullptr
|
||||
* if none was passed in.
|
||||
*/
|
||||
Rect* GetDirtyRect();
|
||||
|
@ -77,7 +77,7 @@ CGBlendMode ToBlendMode(CompositionOp op)
|
||||
|
||||
|
||||
|
||||
DrawTargetCG::DrawTargetCG() : mSnapshot(NULL)
|
||||
DrawTargetCG::DrawTargetCG() : mSnapshot(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ DrawTargetCG::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aForma
|
||||
if (newTarget->Init(GetType(), aSize, aFormat)) {
|
||||
return newTarget;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ DrawTargetCG::CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
RefPtr<SourceSurfaceCG> newSurf = new SourceSurfaceCG();
|
||||
|
||||
if (!newSurf->InitFromData(aData, aSize, aStride, aFormat)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSurf;
|
||||
@ -162,7 +162,7 @@ GetImageFromSourceSurface(SourceSurface *aSurface)
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetCG::OptimizeSourceSurface(SourceSurface *aSurface) const
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class UnboundnessFixer
|
||||
@ -171,7 +171,7 @@ class UnboundnessFixer
|
||||
CGLayerRef mLayer;
|
||||
CGContextRef mCg;
|
||||
public:
|
||||
UnboundnessFixer() : mCg(NULL) {}
|
||||
UnboundnessFixer() : mCg(nullptr) {}
|
||||
|
||||
CGContextRef Check(CGContextRef baseCg, CompositionOp blend)
|
||||
{
|
||||
@ -182,8 +182,8 @@ class UnboundnessFixer
|
||||
|
||||
//XXX: The size here is in default user space units, of the layer relative to the graphics context.
|
||||
// is the clip bounds still correct if, for example, we have a scale applied to the context?
|
||||
mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, NULL);
|
||||
//XXX: if the size is 0x0 we get a NULL CGContext back from GetContext
|
||||
mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, nullptr);
|
||||
//XXX: if the size is 0x0 we get a nullptr CGContext back from GetContext
|
||||
mCg = CGLayerGetContext(mLayer);
|
||||
// CGContext's default to have the origin at the bottom left
|
||||
// so flip it to the top left and adjust for the origin
|
||||
@ -219,7 +219,7 @@ DrawTargetCG::DrawSurface(SourceSurface *aSurface,
|
||||
MarkChanged();
|
||||
|
||||
CGImageRef image;
|
||||
CGImageRef subimage = NULL;
|
||||
CGImageRef subimage = nullptr;
|
||||
CGContextSaveGState(mCg);
|
||||
|
||||
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
|
||||
@ -429,7 +429,7 @@ SetFillFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern &
|
||||
} else if (aPattern.GetType() == PATTERN_SURFACE) {
|
||||
|
||||
CGColorSpaceRef patternSpace;
|
||||
patternSpace = CGColorSpaceCreatePattern (NULL);
|
||||
patternSpace = CGColorSpaceCreatePattern (nullptr);
|
||||
CGContextSetFillColorSpace(cg, patternSpace);
|
||||
CGColorSpaceRelease(patternSpace);
|
||||
|
||||
@ -452,7 +452,7 @@ SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern
|
||||
CGColorRelease(cgcolor);
|
||||
} else if (aPattern.GetType() == PATTERN_SURFACE) {
|
||||
CGColorSpaceRef patternSpace;
|
||||
patternSpace = CGColorSpaceCreatePattern (NULL);
|
||||
patternSpace = CGColorSpaceCreatePattern (nullptr);
|
||||
CGContextSetStrokeColorSpace(cg, patternSpace);
|
||||
CGColorSpaceRelease(patternSpace);
|
||||
|
||||
@ -756,7 +756,7 @@ DrawTargetCG::CopySurface(SourceSurface *aSurface,
|
||||
MarkChanged();
|
||||
|
||||
CGImageRef image;
|
||||
CGImageRef subimage = NULL;
|
||||
CGImageRef subimage = nullptr;
|
||||
if (aSurface->GetType() == SURFACE_COREGRAPHICS_IMAGE) {
|
||||
image = GetImageFromSourceSurface(aSurface);
|
||||
/* we have two options here:
|
||||
@ -830,9 +830,9 @@ DrawTargetCG::Init(BackendType aType,
|
||||
// 32767 is the maximum size supported by cairo
|
||||
// we clamp to that to make it easier to interoperate
|
||||
aSize.width > 32767 || aSize.height > 32767) {
|
||||
mColorSpace = NULL;
|
||||
mCg = NULL;
|
||||
mData = NULL;
|
||||
mColorSpace = nullptr;
|
||||
mCg = nullptr;
|
||||
mData = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -841,14 +841,14 @@ DrawTargetCG::Init(BackendType aType,
|
||||
//XXX: we'd be better off reusing the Colorspace across draw targets
|
||||
mColorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
if (aData == NULL && aType != BACKEND_COREGRAPHICS_ACCELERATED) {
|
||||
if (aData == nullptr && aType != BACKEND_COREGRAPHICS_ACCELERATED) {
|
||||
// XXX: Currently, Init implicitly clears, that can often be a waste of time
|
||||
mData = calloc(aSize.height * aStride, 1);
|
||||
aData = static_cast<unsigned char*>(mData);
|
||||
} else {
|
||||
// mData == NULL means DrawTargetCG doesn't own the image data and will not
|
||||
// mData == nullptr means DrawTargetCG doesn't own the image data and will not
|
||||
// delete it in the destructor
|
||||
mData = NULL;
|
||||
mData = nullptr;
|
||||
}
|
||||
|
||||
mSize = aSize;
|
||||
@ -858,7 +858,7 @@ DrawTargetCG::Init(BackendType aType,
|
||||
mCg = ioSurface->CreateIOSurfaceContext();
|
||||
// If we don't have the symbol for 'CreateIOSurfaceContext' mCg will be null
|
||||
// and we will fallback to software below
|
||||
mData = NULL;
|
||||
mData = nullptr;
|
||||
}
|
||||
|
||||
if (!mCg || aType == BACKEND_COREGRAPHICS) {
|
||||
@ -916,9 +916,9 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
|
||||
// XXX: we should come up with some consistent semantics for dealing
|
||||
// with zero area drawtargets
|
||||
if (aSize.width == 0 || aSize.height == 0) {
|
||||
mColorSpace = NULL;
|
||||
mCg = NULL;
|
||||
mData = NULL;
|
||||
mColorSpace = nullptr;
|
||||
mCg = nullptr;
|
||||
mData = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -931,7 +931,7 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
|
||||
|
||||
mCg = cgContext;
|
||||
|
||||
mData = NULL;
|
||||
mData = nullptr;
|
||||
|
||||
assert(mCg);
|
||||
// CGContext's default to have the origin at the bottom left
|
||||
@ -950,8 +950,8 @@ DrawTargetCG::Init(BackendType aType, const IntSize &aSize, SurfaceFormat &aForm
|
||||
{
|
||||
int stride = aSize.width*4;
|
||||
|
||||
// Calling Init with aData == NULL will allocate.
|
||||
return Init(aType, NULL, aSize, stride, aFormat);
|
||||
// Calling Init with aData == nullptr will allocate.
|
||||
return Init(aType, nullptr, aSize, stride, aFormat);
|
||||
}
|
||||
|
||||
TemporaryRef<PathBuilder>
|
||||
@ -968,7 +968,7 @@ DrawTargetCG::GetNativeSurface(NativeSurfaceType aType)
|
||||
aType == NATIVE_SURFACE_CGCONTEXT_ACCELERATED && GetContextType(mCg) == CG_CONTEXT_TYPE_IOSURFACE) {
|
||||
return mCg;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ DrawTargetCG::MarkChanged()
|
||||
// We only need to worry about snapshots that someone else knows about
|
||||
mSnapshot->DrawTargetWillChange();
|
||||
}
|
||||
mSnapshot = NULL;
|
||||
mSnapshot = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
virtual void PushClip(const Path *);
|
||||
virtual void PushClipRect(const Rect &aRect);
|
||||
virtual void PopClip();
|
||||
virtual TemporaryRef<SourceSurface> CreateSourceSurfaceFromNativeSurface(const NativeSurface&) const { return NULL;}
|
||||
virtual TemporaryRef<SourceSurface> CreateSourceSurfaceFromNativeSurface(const NativeSurface&) const { return nullptr;}
|
||||
virtual TemporaryRef<DrawTarget> CreateSimilarDrawTarget(const IntSize &, SurfaceFormat) const;
|
||||
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule) const;
|
||||
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *, uint32_t,
|
||||
@ -155,7 +155,7 @@ private:
|
||||
|
||||
/**
|
||||
* A pointer to the image buffer if the buffer is owned by this class (set to
|
||||
* NULL otherwise).
|
||||
* nullptr otherwise).
|
||||
* The data is not considered owned by DrawTargetCG if the DrawTarget was
|
||||
* created for a pre-existing buffer or if the buffer's lifetime is managed
|
||||
* by CoreGraphics.
|
||||
|
@ -164,7 +164,7 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface)
|
||||
return surf;
|
||||
}
|
||||
|
||||
// Never returns NULL. As such, you must always pass in Cairo-compatible
|
||||
// Never returns nullptr. As such, you must always pass in Cairo-compatible
|
||||
// patterns, most notably gradients with a GradientStopCairo.
|
||||
// The pattern returned must have cairo_pattern_destroy() called on it by the
|
||||
// caller.
|
||||
@ -275,7 +275,7 @@ NeedIntermediateSurface(const Pattern& aPattern, const DrawOptions& aOptions)
|
||||
}
|
||||
|
||||
DrawTargetCairo::DrawTargetCairo()
|
||||
: mContext(NULL)
|
||||
: mContext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ DrawTargetCairo::Flush()
|
||||
}
|
||||
|
||||
void
|
||||
DrawTargetCairo::PrepareForDrawing(cairo_t* aContext, const Path* aPath /* = NULL */)
|
||||
DrawTargetCairo::PrepareForDrawing(cairo_t* aContext, const Path* aPath /* = nullptr */)
|
||||
{
|
||||
WillChange(aPath);
|
||||
}
|
||||
@ -391,7 +391,7 @@ DrawTargetCairo::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
|
||||
AlphaBoxBlur blur(extents, IntSize(0, 0),
|
||||
AlphaBoxBlur::CalculateBlurRadius(Point(aSigma, aSigma)),
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
if (!blur.GetData()) {
|
||||
return;
|
||||
}
|
||||
@ -786,7 +786,7 @@ DrawTargetCairo::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurf
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
@ -802,7 +802,7 @@ DrawTargetCairo::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFo
|
||||
return target;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -824,7 +824,7 @@ DrawTargetCairo::GetNativeSurface(NativeSurfaceType aType)
|
||||
return cairo_get_target(mContext);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -857,7 +857,7 @@ DrawTargetCairo::RemoveSnapshot(SourceSurfaceCairo* aSnapshot)
|
||||
}
|
||||
|
||||
void
|
||||
DrawTargetCairo::WillChange(const Path* aPath /* = NULL */)
|
||||
DrawTargetCairo::WillChange(const Path* aPath /* = nullptr */)
|
||||
{
|
||||
if (!mSnapshots.empty()) {
|
||||
for (std::vector<SourceSurfaceCairo*>::iterator iter = mSnapshots.begin();
|
||||
@ -871,7 +871,7 @@ DrawTargetCairo::WillChange(const Path* aPath /* = NULL */)
|
||||
if (mPathObserver &&
|
||||
(!aPath || !mPathObserver->ContainsPath(aPath))) {
|
||||
mPathObserver->PathWillChange();
|
||||
mPathObserver = NULL;
|
||||
mPathObserver = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
@ -132,7 +132,7 @@ public:
|
||||
// Call to set up aContext for drawing (with the current transform, etc).
|
||||
// Pass the path you're going to be using if you have one.
|
||||
// Implicitly calls WillChange(aPath).
|
||||
void PrepareForDrawing(cairo_t* aContext, const Path* aPath = NULL);
|
||||
void PrepareForDrawing(cairo_t* aContext, const Path* aPath = nullptr);
|
||||
|
||||
private: // methods
|
||||
enum DrawPatternType { DRAW_FILL, DRAW_STROKE };
|
||||
@ -149,7 +149,7 @@ private: // methods
|
||||
// Call before you make any changes to the backing surface with which this
|
||||
// context is associated. Pass the path you're going to be using if you have
|
||||
// one.
|
||||
void WillChange(const Path* aPath = NULL);
|
||||
void WillChange(const Path* aPath = nullptr);
|
||||
|
||||
// Call if there is any reason to disassociate all snapshots from this draw
|
||||
// target; for example, because we're going to be destroyed.
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
|
||||
HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, NULL, byRef(tmpTexture));
|
||||
HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture));
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create temporary texture to hold surface data.";
|
||||
}
|
||||
@ -128,7 +128,7 @@ public:
|
||||
RefPtr<ID2D1GeometrySink> sink;
|
||||
invClippedArea->Open(byRef(sink));
|
||||
|
||||
rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, NULL, sink);
|
||||
rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, nullptr, sink);
|
||||
sink->Close();
|
||||
|
||||
RefPtr<ID2D1BitmapBrush> brush;
|
||||
@ -151,7 +151,7 @@ private:
|
||||
DrawTargetD2D::DrawTargetD2D()
|
||||
: mCurrentCachedLayer(0)
|
||||
, mClipsArePushed(false)
|
||||
, mPrivateData(NULL)
|
||||
, mPrivateData(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ DrawTargetD2D::~DrawTargetD2D()
|
||||
|
||||
for (int i = 0; i < kLayerCacheSize; i++) {
|
||||
if (mCachedLayers[i]) {
|
||||
mCachedLayers[i] = NULL;
|
||||
mCachedLayers[i] = nullptr;
|
||||
mVRAMUsageDT -= GetByteSize();
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
Float aSigma,
|
||||
CompositionOp aOperator)
|
||||
{
|
||||
RefPtr<ID3D10ShaderResourceView> srView = NULL;
|
||||
RefPtr<ID3D10ShaderResourceView> srView = nullptr;
|
||||
if (aSurface->GetType() != SURFACE_D2D1_DRAWTARGET) {
|
||||
return;
|
||||
}
|
||||
@ -342,7 +342,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
|
||||
if (!mTempRTView) {
|
||||
// This view is only needed in this path.
|
||||
HRESULT hr = mDevice->CreateRenderTargetView(mTempTexture, NULL, byRef(mTempRTView));
|
||||
HRESULT hr = mDevice->CreateRenderTargetView(mTempTexture, nullptr, byRef(mTempRTView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failure to create RenderTargetView. Code: " << hr;
|
||||
@ -360,7 +360,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
if (mPushedClips.size()) {
|
||||
EnsureClipMaskTexture();
|
||||
|
||||
mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, NULL, byRef(maskSRView));
|
||||
mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, byRef(maskSRView));
|
||||
}
|
||||
|
||||
IntSize srcSurfSize;
|
||||
@ -402,7 +402,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
desc.MiscFlags = D3D10_RESOURCE_MISC_GENERATE_MIPS;
|
||||
|
||||
RefPtr<ID3D10Texture2D> mipTexture;
|
||||
hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mipTexture));
|
||||
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mipTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failure to create temporary texture. Size: " <<
|
||||
@ -430,7 +430,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
dsSize.height, 1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
RefPtr<ID3D10Texture2D> tmpDSTexture;
|
||||
hr = mDevice->CreateTexture2D(&desc, NULL, byRef(tmpDSTexture));
|
||||
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpDSTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failure to create temporary texture. Size: " << dsSize << " Code: " << hr;
|
||||
@ -444,13 +444,13 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
box.bottom = aSurface->GetSize().height;
|
||||
mDevice->CopySubresourceRegion(mipTexture, 0, 0, 0, 0, static_cast<SourceSurfaceD2DTarget*>(aSurface)->mTexture, 0, &box);
|
||||
|
||||
mDevice->CreateShaderResourceView(mipTexture, NULL, byRef(srView));
|
||||
mDevice->CreateShaderResourceView(mipTexture, nullptr, byRef(srView));
|
||||
mDevice->GenerateMips(srView);
|
||||
|
||||
RefPtr<ID3D10RenderTargetView> dsRTView;
|
||||
RefPtr<ID3D10ShaderResourceView> dsSRView;
|
||||
mDevice->CreateRenderTargetView(tmpDSTexture, NULL, byRef(dsRTView));
|
||||
mDevice->CreateShaderResourceView(tmpDSTexture, NULL, byRef(dsSRView));
|
||||
mDevice->CreateRenderTargetView(tmpDSTexture, nullptr, byRef(dsRTView));
|
||||
mDevice->CreateShaderResourceView(tmpDSTexture, nullptr, byRef(dsSRView));
|
||||
|
||||
// We're not guaranteed the texture we created will be empty, we've
|
||||
// seen old content at least on NVidia drivers.
|
||||
@ -458,7 +458,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
mDevice->ClearRenderTargetView(dsRTView, color);
|
||||
|
||||
rtViews = dsRTView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, nullptr);
|
||||
|
||||
viewport.MaxDepth = 1;
|
||||
viewport.MinDepth = 0;
|
||||
@ -472,7 +472,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
mPrivateData->mEffect->GetTechniqueByName("SampleTexture")->
|
||||
GetPassByIndex(0)->Apply(0);
|
||||
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(OP_OVER), NULL, 0xffffffff);
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(OP_OVER), nullptr, 0xffffffff);
|
||||
|
||||
mDevice->Draw(4, 0);
|
||||
|
||||
@ -541,15 +541,15 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
|
||||
mDevice->CreateTexture2D(&desc, NULL, byRef(tmpTexture));
|
||||
mDevice->CreateRenderTargetView(tmpTexture, NULL, byRef(tmpRTView));
|
||||
mDevice->CreateShaderResourceView(tmpTexture, NULL, byRef(tmpSRView));
|
||||
mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture));
|
||||
mDevice->CreateRenderTargetView(tmpTexture, nullptr, byRef(tmpRTView));
|
||||
mDevice->CreateShaderResourceView(tmpTexture, nullptr, byRef(tmpSRView));
|
||||
|
||||
tmpSurfSize = srcSurfSize;
|
||||
}
|
||||
|
||||
rtViews = tmpRTView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, nullptr);
|
||||
|
||||
mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(srView);
|
||||
|
||||
@ -593,7 +593,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(tmpSRView);
|
||||
|
||||
rtViews = destRTView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, nullptr);
|
||||
|
||||
Point shadowDest = aDest + aOffset;
|
||||
|
||||
@ -619,7 +619,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
GetPassByIndex(1)->Apply(0);
|
||||
}
|
||||
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), NULL, 0xffffffff);
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), nullptr, 0xffffffff);
|
||||
|
||||
mDevice->Draw(4, 0);
|
||||
|
||||
@ -644,7 +644,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
GetPassByIndex(0)->Apply(0);
|
||||
}
|
||||
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), NULL, 0xffffffff);
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), nullptr, 0xffffffff);
|
||||
|
||||
mDevice->Draw(4, 0);
|
||||
}
|
||||
@ -868,7 +868,7 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
|
||||
|
||||
ScaledFontDWrite *font = static_cast<ScaledFontDWrite*>(aFont);
|
||||
|
||||
IDWriteRenderingParams *params = NULL;
|
||||
IDWriteRenderingParams *params = nullptr;
|
||||
if (aRenderOptions) {
|
||||
if (aRenderOptions->GetType() != FONT_DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
|
||||
@ -927,7 +927,7 @@ DrawTargetD2D::Mask(const Pattern &aSource,
|
||||
|
||||
layer = GetCachedLayer();
|
||||
|
||||
rt->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), NULL,
|
||||
rt->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr,
|
||||
D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
D2D1::IdentityMatrix(),
|
||||
1.0f, maskBrush),
|
||||
@ -951,8 +951,8 @@ DrawTargetD2D::PushClip(const Path *aPath)
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentClipMaskTexture = NULL;
|
||||
mCurrentClippedGeometry = NULL;
|
||||
mCurrentClipMaskTexture = nullptr;
|
||||
mCurrentClippedGeometry = nullptr;
|
||||
|
||||
RefPtr<PathD2D> pathD2D = static_cast<PathD2D*>(const_cast<Path*>(aPath));
|
||||
|
||||
@ -980,7 +980,7 @@ DrawTargetD2D::PushClip(const Path *aPath)
|
||||
|
||||
mRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), pathD2D->mGeometry,
|
||||
D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
clip.mTransform, 1.0f, NULL,
|
||||
clip.mTransform, 1.0f, nullptr,
|
||||
options), clip.mLayer);
|
||||
}
|
||||
}
|
||||
@ -988,8 +988,8 @@ DrawTargetD2D::PushClip(const Path *aPath)
|
||||
void
|
||||
DrawTargetD2D::PushClipRect(const Rect &aRect)
|
||||
{
|
||||
mCurrentClipMaskTexture = NULL;
|
||||
mCurrentClippedGeometry = NULL;
|
||||
mCurrentClipMaskTexture = nullptr;
|
||||
mCurrentClippedGeometry = nullptr;
|
||||
if (!mTransform.IsRectilinear()) {
|
||||
// Whoops, this isn't a rectangle in device space, Direct2D will not deal
|
||||
// with this transform the way we want it to.
|
||||
@ -1021,8 +1021,8 @@ DrawTargetD2D::PushClipRect(const Rect &aRect)
|
||||
void
|
||||
DrawTargetD2D::PopClip()
|
||||
{
|
||||
mCurrentClipMaskTexture = NULL;
|
||||
mCurrentClippedGeometry = NULL;
|
||||
mCurrentClipMaskTexture = nullptr;
|
||||
mCurrentClippedGeometry = nullptr;
|
||||
if (mClipsArePushed) {
|
||||
if (mPushedClips.back().mLayer) {
|
||||
PopCachedLayer(mRT);
|
||||
@ -1042,7 +1042,7 @@ DrawTargetD2D::CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
RefPtr<SourceSurfaceD2D> newSurf = new SourceSurfaceD2D();
|
||||
|
||||
if (!newSurf->InitFromData(aData, aSize, aStride, aFormat, mRT)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSurf;
|
||||
@ -1052,7 +1052,7 @@ TemporaryRef<SourceSurface>
|
||||
DrawTargetD2D::OptimizeSourceSurface(SourceSurface *aSurface) const
|
||||
{
|
||||
// Unsupported!
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
@ -1060,7 +1060,7 @@ DrawTargetD2D::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurfac
|
||||
{
|
||||
if (aSurface.mType != NATIVE_SURFACE_D3D10_TEXTURE) {
|
||||
gfxDebug() << *this << ": Failure to create source surface from non-D3D10 texture native surface.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<SourceSurfaceD2D> newSurf = new SourceSurfaceD2D();
|
||||
|
||||
@ -1069,7 +1069,7 @@ DrawTargetD2D::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurfac
|
||||
mRT))
|
||||
{
|
||||
gfxWarning() << *this << ": Failed to create SourceSurface from texture.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSurf;
|
||||
@ -1083,7 +1083,7 @@ DrawTargetD2D::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aForm
|
||||
|
||||
if (!newTarget->Init(aSize, aFormat)) {
|
||||
gfxDebug() << *this << ": Failed to create optimal draw target. Size: " << aSize;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newTarget;
|
||||
@ -1097,14 +1097,14 @@ DrawTargetD2D::CreatePathBuilder(FillRule aFillRule) const
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create Direct2D Path Geometry. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ID2D1GeometrySink> sink;
|
||||
hr = path->Open(byRef(sink));
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to access Direct2D Path Geometry. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aFillRule == FILL_WINDING) {
|
||||
@ -1134,7 +1134,7 @@ DrawTargetD2D::CreateGradientStops(GradientStop *rawStops, uint32_t aNumStops, E
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create GradientStopCollection. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new GradientStopsD2D(stopCollection);
|
||||
@ -1144,7 +1144,7 @@ void*
|
||||
DrawTargetD2D::GetNativeSurface(NativeSurfaceType aType)
|
||||
{
|
||||
if (aType != NATIVE_SURFACE_D3D10_TEXTURE) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mTexture;
|
||||
@ -1173,7 +1173,7 @@ DrawTargetD2D::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
||||
1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
|
||||
hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mTexture));
|
||||
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxDebug() << "Failed to init Direct2D DrawTarget. Size: " << mSize << " Code: " << hr;
|
||||
@ -1243,7 +1243,7 @@ DrawTargetD2D::InitD3D10Data()
|
||||
createD3DEffect = (D3D10CreateEffectFromMemoryFunc)
|
||||
GetProcAddress(d3dModule, "D3D10CreateEffectFromMemory");
|
||||
|
||||
hr = createD3DEffect((void*)d2deffect, sizeof(d2deffect), 0, mDevice, NULL, byRef(mPrivateData->mEffect));
|
||||
hr = createD3DEffect((void*)d2deffect, sizeof(d2deffect), 0, mDevice, nullptr, byRef(mPrivateData->mEffect));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to initialize Direct2D required effects. Code: " << hr;
|
||||
@ -1375,7 +1375,7 @@ DrawTargetD2D::MarkChanged()
|
||||
if (mSnapshot) {
|
||||
if (mSnapshot->hasOneRef()) {
|
||||
// Just destroy it, since no-one else knows about it.
|
||||
mSnapshot = NULL;
|
||||
mSnapshot = nullptr;
|
||||
} else {
|
||||
mSnapshot->DrawTargetWillChange();
|
||||
// The snapshot will no longer depend on this target.
|
||||
@ -1533,7 +1533,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP
|
||||
}
|
||||
|
||||
ID3D10RenderTargetView *rtViews = mRTView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, nullptr);
|
||||
|
||||
UINT stride = sizeof(Vertex);
|
||||
UINT offset = 0;
|
||||
@ -1573,7 +1573,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP
|
||||
SetupEffectForRadialGradient(pat);
|
||||
}
|
||||
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), NULL, 0xffffffff);
|
||||
mDevice->OMSetBlendState(GetBlendStateForOperator(aOperator), nullptr, 0xffffffff);
|
||||
|
||||
mDevice->Draw(4, 0);
|
||||
}
|
||||
@ -1671,7 +1671,7 @@ DrawTargetD2D::CreateRTForTexture(ID3D10Texture2D *aTexture, SurfaceFormat aForm
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to QI texture to surface.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
@ -1689,7 +1689,7 @@ DrawTargetD2D::CreateRTForTexture(ID3D10Texture2D *aTexture, SurfaceFormat aForm
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create D2D render target for texture.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return rt;
|
||||
@ -1710,7 +1710,7 @@ DrawTargetD2D::EnsureViews()
|
||||
1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
|
||||
hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mTempTexture));
|
||||
hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mTempTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << *this << "Failed to create temporary texture for rendertarget. Size: "
|
||||
@ -1718,14 +1718,14 @@ DrawTargetD2D::EnsureViews()
|
||||
return;
|
||||
}
|
||||
|
||||
hr = mDevice->CreateShaderResourceView(mTempTexture, NULL, byRef(mSRView));
|
||||
hr = mDevice->CreateShaderResourceView(mTempTexture, nullptr, byRef(mSRView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << *this << "Failed to create shader resource view for temp texture. Code: " << hr;
|
||||
return;
|
||||
}
|
||||
|
||||
hr = mDevice->CreateRenderTargetView(mTexture, NULL, byRef(mRTView));
|
||||
hr = mDevice->CreateRenderTargetView(mTexture, nullptr, byRef(mRTView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << *this << "Failed to create rendertarget view for temp texture. Code: " << hr;
|
||||
@ -1756,7 +1756,7 @@ DrawTargetD2D::PushClipsToRT(ID2D1RenderTarget *aRT)
|
||||
|
||||
aRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), iter->mPath->mGeometry,
|
||||
D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
iter->mTransform, 1.0f, NULL,
|
||||
iter->mTransform, 1.0f, nullptr,
|
||||
options), iter->mLayer);
|
||||
} else {
|
||||
aRT->PushAxisAlignedClip(iter->mBounds, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
@ -1789,7 +1789,7 @@ DrawTargetD2D::EnsureClipMaskTexture()
|
||||
1, 1);
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
|
||||
|
||||
HRESULT hr = mDevice->CreateTexture2D(&desc, NULL, byRef(mCurrentClipMaskTexture));
|
||||
HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mCurrentClipMaskTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create texture for ClipMask!";
|
||||
@ -1909,7 +1909,7 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont,
|
||||
}
|
||||
|
||||
RefPtr<ID3D10ShaderResourceView> srView;
|
||||
hr = mDevice->CreateShaderResourceView(tex, NULL, byRef(srView));
|
||||
hr = mDevice->CreateShaderResourceView(tex, nullptr, byRef(srView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
@ -1960,7 +1960,7 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont,
|
||||
EnsureClipMaskTexture();
|
||||
|
||||
RefPtr<ID3D10ShaderResourceView> srViewMask;
|
||||
hr = mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, NULL, byRef(srViewMask));
|
||||
hr = mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, byRef(srViewMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
@ -1979,10 +1979,10 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont,
|
||||
|
||||
RefPtr<ID3D10RenderTargetView> rtView;
|
||||
ID3D10RenderTargetView *rtViews;
|
||||
mDevice->CreateRenderTargetView(mTexture, NULL, byRef(rtView));
|
||||
mDevice->CreateRenderTargetView(mTexture, nullptr, byRef(rtView));
|
||||
|
||||
rtViews = rtView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, nullptr);
|
||||
|
||||
mDevice->Draw(4, 0);
|
||||
return true;
|
||||
@ -2014,7 +2014,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
|
||||
if (!stops) {
|
||||
gfxDebug() << "No stops specified for gradient pattern.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (pat->mBegin == pat->mEnd) {
|
||||
@ -2043,7 +2043,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
|
||||
if (!stops) {
|
||||
gfxDebug() << "No stops specified for gradient pattern.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// This will not be a complex radial gradient brush.
|
||||
@ -2063,7 +2063,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
|
||||
if (!pat->mSurface) {
|
||||
gfxDebug() << "No source surface specified for surface pattern";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ID2D1Bitmap> bitmap;
|
||||
@ -2078,7 +2078,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
bitmap = surf->mBitmap;
|
||||
|
||||
if (!bitmap) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2097,7 +2097,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
bitmap = CreatePartialBitmapForSurface(dataSurf, mat, pat->mExtendMode);
|
||||
|
||||
if (!bitmap) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2116,7 +2116,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
}
|
||||
|
||||
gfxWarning() << "Invalid pattern type detected.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<ID2D1StrokeStyle>
|
||||
@ -2183,7 +2183,7 @@ DrawTargetD2D::CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions)
|
||||
D2D1::StrokeStyleProperties(capStyle, capStyle,
|
||||
capStyle, joinStyle,
|
||||
aStrokeOptions.mMiterLimit),
|
||||
NULL, 0, byRef(style));
|
||||
nullptr, 0, byRef(style));
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
@ -2285,7 +2285,7 @@ DrawTargetD2D::CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, cons
|
||||
|
||||
if (FAILED(hr)) {
|
||||
delete [] texture;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int alignedBufferSize = aBounds.width * aBounds.height * 4;
|
||||
@ -2324,7 +2324,7 @@ DrawTargetD2D::CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, cons
|
||||
delete [] texture;
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return tex;
|
||||
@ -2344,7 +2344,7 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
|
||||
Matrix invTransform = transform = aMatrix * transform;
|
||||
if (!invTransform.Invert()) {
|
||||
// Singular transform, nothing to be drawn.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Rect rect(0, 0, mSize.width, mSize.height);
|
||||
@ -2412,7 +2412,7 @@ DrawTargetD2D::CreatePartialBitmapForSurface(DataSourceSurface *aSurface, Matrix
|
||||
if (Bpp != 4) {
|
||||
// This shouldn't actually happen in practice!
|
||||
MOZ_ASSERT(false);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ImageHalfScaler scaler(aSurface->GetData(), stride, size);
|
||||
@ -2469,7 +2469,7 @@ DrawTargetD2D::SetupEffectForRadialGradient(const RadialGradientPattern *aPatter
|
||||
RefPtr<ID3D10Texture2D> tex = CreateGradientTexture(stops);
|
||||
|
||||
RefPtr<ID3D10ShaderResourceView> srView;
|
||||
mDevice->CreateShaderResourceView(tex, NULL, byRef(srView));
|
||||
mDevice->CreateShaderResourceView(tex, nullptr, byRef(srView));
|
||||
|
||||
mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(srView);
|
||||
|
||||
@ -2563,7 +2563,7 @@ DrawTargetD2D::factory()
|
||||
|
||||
if (!createD2DFactory) {
|
||||
gfxWarning() << "Failed to locate D2D1CreateFactory function.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D2D1_FACTORY_OPTIONS options;
|
||||
@ -2599,7 +2599,7 @@ DrawTargetD2D::GetDWriteFactory()
|
||||
|
||||
if (!createDWriteFactory) {
|
||||
gfxWarning() << "Failed to locate DWriteCreateFactory function.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HRESULT hr = createDWriteFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -135,4 +135,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MOZILLA_GFX_DRAWTARGETDUAL_H_ */
|
||||
#endif /* MOZILLA_GFX_DRAWTARGETDUAL_H_ */
|
||||
|
@ -162,7 +162,7 @@ DrawTargetSkia::Snapshot()
|
||||
{
|
||||
RefPtr<SourceSurfaceSkia> source = new SourceSurfaceSkia();
|
||||
if (!source->InitWithBitmap(mBitmap, mFormat, this)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
AppendSnapshot(source);
|
||||
return source;
|
||||
@ -311,7 +311,7 @@ struct AutoPaintSetup {
|
||||
temp.setXfermodeMode(GfxOpToSkiaOp(aOptions.mCompositionOp));
|
||||
temp.setAlpha(aOptions.mAlpha*255);
|
||||
//TODO: Get a rect here
|
||||
mCanvas->saveLayer(NULL, &temp);
|
||||
mCanvas->saveLayer(nullptr, &temp);
|
||||
mNeedsRestore = true;
|
||||
} else {
|
||||
mPaint.setAlpha(aOptions.mAlpha*255.0);
|
||||
@ -591,7 +591,7 @@ DrawTargetSkia::CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
|
||||
if (!newSurf->InitFromData(aData, aSize, aStride, aFormat)) {
|
||||
gfxDebug() << *this << ": Failure to create source surface from data. Size: " << aSize;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSurf;
|
||||
@ -602,7 +602,7 @@ DrawTargetSkia::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
|
||||
{
|
||||
RefPtr<DrawTargetSkia> target = new DrawTargetSkia();
|
||||
if (!target->Init(aSize, aFormat)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
@ -610,13 +610,13 @@ DrawTargetSkia::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetSkia::OptimizeSourceSurface(SourceSurface *aSurface) const
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetSkia::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
@ -196,12 +196,12 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor
|
||||
#endif
|
||||
default:
|
||||
gfxDebug() << "Invalid draw target type specified.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gfxDebug() << "Failed to create DrawTarget, Type: " << aBackend << " Size: " << aSize;
|
||||
// Failed
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
@ -232,12 +232,12 @@ Factory::CreateDrawTargetForData(BackendType aBackend,
|
||||
#endif
|
||||
default:
|
||||
gfxDebug() << "Invalid draw target type specified.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gfxDebug() << "Failed to create DrawTarget, Type: " << aBackend << " Size: " << aSize;
|
||||
// Failed
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<ScaledFont>
|
||||
@ -278,7 +278,7 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
|
||||
#endif
|
||||
default:
|
||||
gfxWarning() << "Invalid native font type specified.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ Factory::CreateScaledFontWithCairo(const NativeFont& aNativeFont, Float aSize, c
|
||||
static_cast<ScaledFontBase*>(font.get())->SetCairoScaledFont(aScaledFont);
|
||||
return font;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ Factory::CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceForma
|
||||
gfxWarning() << "Failed to create draw target for D3D10 texture.";
|
||||
|
||||
// Failed
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
@ -326,13 +326,13 @@ Factory::CreateDualDrawTargetForD3D10Textures(ID3D10Texture2D *aTextureA,
|
||||
newTargetA = new DrawTargetD2D();
|
||||
if (!newTargetA->Init(aTextureA, aFormat)) {
|
||||
gfxWarning() << "Failed to create draw target for D3D10 texture.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
newTargetB = new DrawTargetD2D();
|
||||
if (!newTargetB->Init(aTextureB, aFormat)) {
|
||||
gfxWarning() << "Failed to create draw target for D3D10 texture.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> newTarget =
|
||||
@ -386,7 +386,7 @@ Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSiz
|
||||
}
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<DataSourceSurface>
|
||||
@ -400,7 +400,7 @@ Factory::CreateWrappingDataSourceSurface(uint8_t *aData, int32_t aStride,
|
||||
return newSurf;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class ImageHalfScaler
|
||||
public:
|
||||
ImageHalfScaler(uint8_t *aData, int32_t aStride, const IntSize &aSize)
|
||||
: mOrigData(aData), mOrigStride(aStride), mOrigSize(aSize)
|
||||
, mDataStorage(NULL)
|
||||
, mDataStorage(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ PathBuilderCG::~PathBuilderCG()
|
||||
void
|
||||
PathBuilderCG::MoveTo(const Point &aPoint)
|
||||
{
|
||||
CGPathMoveToPoint(mCGPath, NULL, aPoint.x, aPoint.y);
|
||||
CGPathMoveToPoint(mCGPath, nullptr, aPoint.x, aPoint.y);
|
||||
}
|
||||
|
||||
void
|
||||
@ -28,7 +28,7 @@ PathBuilderCG::LineTo(const Point &aPoint)
|
||||
if (CGPathIsEmpty(mCGPath))
|
||||
MoveTo(aPoint);
|
||||
else
|
||||
CGPathAddLineToPoint(mCGPath, NULL, aPoint.x, aPoint.y);
|
||||
CGPathAddLineToPoint(mCGPath, nullptr, aPoint.x, aPoint.y);
|
||||
}
|
||||
|
||||
void
|
||||
@ -39,7 +39,7 @@ PathBuilderCG::BezierTo(const Point &aCP1,
|
||||
|
||||
if (CGPathIsEmpty(mCGPath))
|
||||
MoveTo(aCP1);
|
||||
CGPathAddCurveToPoint(mCGPath, NULL,
|
||||
CGPathAddCurveToPoint(mCGPath, nullptr,
|
||||
aCP1.x, aCP1.y,
|
||||
aCP2.x, aCP2.y,
|
||||
aCP3.x, aCP3.y);
|
||||
@ -52,7 +52,7 @@ PathBuilderCG::QuadraticBezierTo(const Point &aCP1,
|
||||
{
|
||||
if (CGPathIsEmpty(mCGPath))
|
||||
MoveTo(aCP1);
|
||||
CGPathAddQuadCurveToPoint(mCGPath, NULL,
|
||||
CGPathAddQuadCurveToPoint(mCGPath, nullptr,
|
||||
aCP1.x, aCP1.y,
|
||||
aCP2.x, aCP2.y);
|
||||
}
|
||||
@ -171,7 +171,7 @@ PathCG::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const
|
||||
|
||||
// The transform parameter of CGPathContainsPoint doesn't seem to work properly on OS X 10.5
|
||||
// so we transform aPoint ourselves.
|
||||
return CGPathContainsPoint(mPath, NULL, point, mFillRule == FILL_EVEN_ODD);
|
||||
return CGPathContainsPoint(mPath, nullptr, point, mFillRule == FILL_EVEN_ODD);
|
||||
}
|
||||
|
||||
static size_t
|
||||
@ -184,9 +184,9 @@ PutBytesNull(void *info, const void *buffer, size_t count)
|
||||
static CGContextRef
|
||||
CreateScratchContext()
|
||||
{
|
||||
CGDataConsumerCallbacks callbacks = {PutBytesNull, NULL};
|
||||
CGDataConsumerRef consumer = CGDataConsumerCreate(NULL, &callbacks);
|
||||
CGContextRef cg = CGPDFContextCreate(consumer, NULL, NULL);
|
||||
CGDataConsumerCallbacks callbacks = {PutBytesNull, nullptr};
|
||||
CGDataConsumerRef consumer = CGDataConsumerCreate(nullptr, &callbacks);
|
||||
CGContextRef cg = CGPDFContextCreate(consumer, nullptr, nullptr);
|
||||
CGDataConsumerRelease(consumer);
|
||||
return cg;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ CairoPathContext::CairoPathContext(cairo_t* aCtx, DrawTargetCairo* aDrawTarget,
|
||||
CairoPathContext::~CairoPathContext()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->SetPathObserver(NULL);
|
||||
mDrawTarget->SetPathObserver(nullptr);
|
||||
}
|
||||
cairo_destroy(mContext);
|
||||
}
|
||||
@ -52,7 +52,7 @@ CairoPathContext::ObserveTarget(DrawTargetCairo* aDrawTarget)
|
||||
}
|
||||
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->SetPathObserver(NULL);
|
||||
mDrawTarget->SetPathObserver(nullptr);
|
||||
}
|
||||
mDrawTarget = aDrawTarget;
|
||||
|
||||
@ -159,7 +159,7 @@ CairoPathContext::CopyPathTo(cairo_t* aToContext)
|
||||
void
|
||||
CairoPathContext::ForgetDrawTarget()
|
||||
{
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -236,7 +236,7 @@ PathBuilderD2D::Finish()
|
||||
HRESULT hr = mSink->Close();
|
||||
if (FAILED(hr)) {
|
||||
gfxDebug() << "Failed to close PathSink. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new PathD2D(mGeometry, mFigureActive, mCurrentPoint, mFillRule);
|
||||
@ -256,14 +256,14 @@ PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule)
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create PathGeometry. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ID2D1GeometrySink> sink;
|
||||
hr = path->Open(byRef(sink));
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to open Geometry for writing. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aFillRule == FILL_WINDING) {
|
||||
|
@ -137,7 +137,7 @@ CGLTexImageIOSurface2DFunc MacIOSurfaceLib::sTexImage;
|
||||
IOSurfaceContextCreateFunc MacIOSurfaceLib::sIOSurfaceContextCreate;
|
||||
IOSurfaceContextCreateImageFunc MacIOSurfaceLib::sIOSurfaceContextCreateImage;
|
||||
IOSurfaceContextGetSurfaceFunc MacIOSurfaceLib::sIOSurfaceContextGetSurface;
|
||||
unsigned int (*MacIOSurfaceLib::sCGContextGetTypePtr) (CGContextRef) = NULL;
|
||||
unsigned int (*MacIOSurfaceLib::sCGContextGetTypePtr) (CGContextRef) = nullptr;
|
||||
|
||||
CFStringRef MacIOSurfaceLib::kPropWidth;
|
||||
CFStringRef MacIOSurfaceLib::kPropHeight;
|
||||
@ -208,19 +208,19 @@ CGContextRef MacIOSurfaceLib::IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr,
|
||||
unsigned aBitsPerComponent, unsigned aBytes,
|
||||
CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo) {
|
||||
if (!sIOSurfaceContextCreate)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return sIOSurfaceContextCreate(aIOSurfacePtr, aWidth, aHeight, aBitsPerComponent, aBytes, aColorSpace, bitmapInfo);
|
||||
}
|
||||
|
||||
CGImageRef MacIOSurfaceLib::IOSurfaceContextCreateImage(CGContextRef aContext) {
|
||||
if (!sIOSurfaceContextCreateImage)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return sIOSurfaceContextCreateImage(aContext);
|
||||
}
|
||||
|
||||
IOSurfacePtr MacIOSurfaceLib::IOSurfaceContextGetSurface(CGContextRef aContext) {
|
||||
if (!sIOSurfaceContextGetSurface)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return sIOSurfaceContextGetSurface(aContext);
|
||||
}
|
||||
|
||||
@ -314,9 +314,9 @@ TemporaryRef<MacIOSurface> MacIOSurface::CreateIOSurface(int aWidth, int aHeight
|
||||
return nullptr;
|
||||
|
||||
int32_t bytesPerElem = 4;
|
||||
CFNumberRef cfWidth = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aWidth);
|
||||
CFNumberRef cfHeight = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aHeight);
|
||||
CFNumberRef cfBytesPerElem = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &bytesPerElem);
|
||||
CFNumberRef cfWidth = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aWidth);
|
||||
CFNumberRef cfHeight = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &aHeight);
|
||||
CFNumberRef cfBytesPerElem = ::CFNumberCreate(nullptr, kCFNumberSInt32Type, &bytesPerElem);
|
||||
::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropWidth,
|
||||
cfWidth);
|
||||
::CFRelease(cfWidth);
|
||||
@ -382,11 +382,11 @@ size_t MacIOSurface::GetBytesPerRow() {
|
||||
|
||||
#define READ_ONLY 0x1
|
||||
void MacIOSurface::Lock() {
|
||||
MacIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, READ_ONLY, NULL);
|
||||
MacIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, READ_ONLY, nullptr);
|
||||
}
|
||||
|
||||
void MacIOSurface::Unlock() {
|
||||
MacIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, READ_ONLY, NULL);
|
||||
MacIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, READ_ONLY, nullptr);
|
||||
}
|
||||
|
||||
#include "SourceSurfaceRawData.h"
|
||||
@ -590,7 +590,7 @@ nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
|
||||
|
||||
mCGImage = ::CGImageCreate(aWidth, aHeight, 8, 32, aWidth * 4, colorSpace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
|
||||
dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||
dataProvider, nullptr, true, kCGRenderingIntentDefault);
|
||||
|
||||
::CGDataProviderRelease(dataProvider);
|
||||
if (colorSpace) {
|
||||
@ -763,8 +763,8 @@ nsresult nsCARenderer::Render(int aWidth, int aHeight,
|
||||
NS_ERROR("No target destination for rendering");
|
||||
} else if (aOutCGImage) {
|
||||
// We are expected to return a CGImageRef, we will set
|
||||
// it to NULL in case we fail before the image is ready.
|
||||
*aOutCGImage = NULL;
|
||||
// it to nullptr in case we fail before the image is ready.
|
||||
*aOutCGImage = nullptr;
|
||||
}
|
||||
|
||||
if (aWidth == 0 || aHeight == 0)
|
||||
@ -813,7 +813,7 @@ nsresult nsCARenderer::Render(int aWidth, int aHeight,
|
||||
|
||||
[CATransaction commit];
|
||||
double caTime = ::CACurrentMediaTime();
|
||||
[caRenderer beginFrameAtTime:caTime timeStamp:NULL];
|
||||
[caRenderer beginFrameAtTime:caTime timeStamp:nullptr];
|
||||
[caRenderer addUpdateRect:CGRectMake(0,0, aWidth, aHeight)];
|
||||
[caRenderer render];
|
||||
[caRenderer endFrame];
|
||||
@ -867,7 +867,7 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
|
||||
void* ioData = surf->GetBaseAddress();
|
||||
CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData,
|
||||
ioData, ioHeight*(bytesPerRow)*4,
|
||||
NULL); //No release callback
|
||||
nullptr); //No release callback
|
||||
if (!dataProvider) {
|
||||
surf->Unlock();
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -875,7 +875,7 @@ nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
|
||||
|
||||
CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
|
||||
aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
|
||||
dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||
dataProvider, nullptr, true, kCGRenderingIntentDefault);
|
||||
::CGDataProviderRelease(dataProvider);
|
||||
if (!cgImage) {
|
||||
surf->Unlock();
|
||||
@ -925,7 +925,7 @@ void nsCARenderer::SaveToDisk(MacIOSurface *surf) {
|
||||
void* ioData = surf->GetBaseAddress();
|
||||
CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData,
|
||||
ioData, ioHeight*(bytesPerRow)*4,
|
||||
NULL); //No release callback
|
||||
nullptr); //No release callback
|
||||
if (!dataProvider) {
|
||||
surf->Unlock();
|
||||
return;
|
||||
@ -934,7 +934,7 @@ void nsCARenderer::SaveToDisk(MacIOSurface *surf) {
|
||||
CGColorSpaceRef colorSpace = CreateSystemColorSpace();
|
||||
CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
|
||||
colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
|
||||
dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||
dataProvider, nullptr, true, kCGRenderingIntentDefault);
|
||||
::CGDataProviderRelease(dataProvider);
|
||||
::CGColorSpaceRelease(colorSpace);
|
||||
if (!cgImage) {
|
||||
@ -949,16 +949,16 @@ void nsCARenderer::SaveToDisk(MacIOSurface *surf) {
|
||||
CFStringRef cfStr = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman);
|
||||
|
||||
printf("Exporting: %s\n", cstr);
|
||||
CFURLRef url = ::CFURLCreateWithString( NULL, cfStr, NULL);
|
||||
CFURLRef url = ::CFURLCreateWithString( nullptr, cfStr, nullptr);
|
||||
::CFRelease(cfStr);
|
||||
|
||||
CFStringRef type = kUTTypePNG;
|
||||
size_t count = 1;
|
||||
CFDictionaryRef options = NULL;
|
||||
CFDictionaryRef options = nullptr;
|
||||
CGImageDestinationRef dest = ::CGImageDestinationCreateWithURL(url, type, count, options);
|
||||
::CFRelease(url);
|
||||
|
||||
::CGImageDestinationAddImage(dest, cgImage, NULL);
|
||||
::CGImageDestinationAddImage(dest, cgImage, nullptr);
|
||||
|
||||
::CGImageDestinationFinalize(dest);
|
||||
::CFRelease(dest);
|
||||
|
@ -37,10 +37,10 @@ ScaledFontBase::ScaledFontBase(Float aSize)
|
||||
: mSize(aSize)
|
||||
{
|
||||
#ifdef USE_SKIA
|
||||
mTypeface = NULL;
|
||||
mTypeface = nullptr;
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
mScaledFont = NULL;
|
||||
mScaledFont = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *a
|
||||
return builder->Finish();
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -18,7 +18,7 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget
|
||||
if (aTarget->GetType() != BACKEND_DIRECT2D) {
|
||||
// For now we only support Direct2D.
|
||||
gfxWarning() << "Attempt to use Direct Write font with non-Direct2D backend";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<PathBuilder> pathBuilder = aTarget->CreatePathBuilder();
|
||||
|
@ -38,7 +38,7 @@ ScaledFontMac::~ScaledFontMac()
|
||||
SkTypeface* ScaledFontMac::GetSkTypeface()
|
||||
{
|
||||
if (!mTypeface) {
|
||||
CTFontRef fontFace = CTFontCreateWithGraphicsFont(mFont, mSize, NULL, NULL);
|
||||
CTFontRef fontFace = CTFontCreateWithGraphicsFont(mFont, mSize, nullptr, nullptr);
|
||||
mTypeface = SkCreateTypefaceFromCTFont(fontFace);
|
||||
CFRelease(fontFace);
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ SourceSurfaceCG::InitFromData(unsigned char *aData,
|
||||
SurfaceFormat aFormat)
|
||||
{
|
||||
//XXX: we should avoid creating this colorspace everytime
|
||||
CGColorSpaceRef colorSpace = NULL;
|
||||
CGColorSpaceRef colorSpace = nullptr;
|
||||
CGBitmapInfo bitinfo = 0;
|
||||
CGDataProviderRef dataProvider = NULL;
|
||||
CGDataProviderRef dataProvider = nullptr;
|
||||
int bitsPerComponent = 0;
|
||||
int bitsPerPixel = 0;
|
||||
|
||||
@ -110,7 +110,7 @@ SourceSurfaceCG::InitFromData(unsigned char *aData,
|
||||
colorSpace,
|
||||
bitinfo,
|
||||
dataProvider,
|
||||
NULL,
|
||||
nullptr,
|
||||
true,
|
||||
kCGRenderingIntentDefault);
|
||||
}
|
||||
@ -118,7 +118,7 @@ SourceSurfaceCG::InitFromData(unsigned char *aData,
|
||||
CGDataProviderRelease(dataProvider);
|
||||
CGColorSpaceRelease (colorSpace);
|
||||
|
||||
return mImage != NULL;
|
||||
return mImage != nullptr;
|
||||
}
|
||||
|
||||
DataSourceSurfaceCG::~DataSourceSurfaceCG()
|
||||
@ -144,9 +144,9 @@ DataSourceSurfaceCG::InitFromData(unsigned char *aData,
|
||||
SurfaceFormat aFormat)
|
||||
{
|
||||
//XXX: we should avoid creating this colorspace everytime
|
||||
CGColorSpaceRef colorSpace = NULL;
|
||||
CGColorSpaceRef colorSpace = nullptr;
|
||||
CGBitmapInfo bitinfo = 0;
|
||||
CGDataProviderRef dataProvider = NULL;
|
||||
CGDataProviderRef dataProvider = nullptr;
|
||||
int bitsPerComponent = 0;
|
||||
int bitsPerPixel = 0;
|
||||
|
||||
@ -199,7 +199,7 @@ DataSourceSurfaceCG::InitFromData(unsigned char *aData,
|
||||
colorSpace,
|
||||
bitinfo,
|
||||
dataProvider,
|
||||
NULL,
|
||||
nullptr,
|
||||
true,
|
||||
kCGRenderingIntentDefault);
|
||||
}
|
||||
@ -225,10 +225,10 @@ CGContextRef CreateBitmapContextForImage(CGImageRef image)
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
assert(colorSpace);
|
||||
|
||||
// we'd like to pass NULL as the first parameter
|
||||
// we'd like to pass nullptr as the first parameter
|
||||
// to let Quartz manage this memory for us. However,
|
||||
// on 10.5 and older CGBitmapContextGetData will return
|
||||
// NULL instead of the associated buffer so we need
|
||||
// nullptr instead of the associated buffer so we need
|
||||
// to manage it ourselves.
|
||||
CGContextRef cg = CGBitmapContextCreate(data,
|
||||
width,
|
||||
@ -248,7 +248,7 @@ DataSourceSurfaceCG::DataSourceSurfaceCG(CGImageRef aImage)
|
||||
{
|
||||
mImage = aImage;
|
||||
mCg = CreateBitmapContextForImage(aImage);
|
||||
if (mCg == NULL) {
|
||||
if (mCg == nullptr) {
|
||||
// error creating context
|
||||
return;
|
||||
}
|
||||
@ -295,7 +295,7 @@ SourceSurfaceCGBitmapContext::SourceSurfaceCGBitmapContext(DrawTargetCG *aDrawTa
|
||||
mStride = CGBitmapContextGetBytesPerRow(mCg);
|
||||
mData = CGBitmapContextGetData(mCg);
|
||||
|
||||
mImage = NULL;
|
||||
mImage = nullptr;
|
||||
}
|
||||
|
||||
void SourceSurfaceCGBitmapContext::EnsureImage() const
|
||||
@ -309,9 +309,9 @@ void SourceSurfaceCGBitmapContext::EnsureImage() const
|
||||
// performance characteristics.
|
||||
if (!mImage) {
|
||||
//XXX: we should avoid creating this colorspace everytime
|
||||
CGColorSpaceRef colorSpace = NULL;
|
||||
CGColorSpaceRef colorSpace = nullptr;
|
||||
CGBitmapInfo bitinfo = 0;
|
||||
CGDataProviderRef dataProvider = NULL;
|
||||
CGDataProviderRef dataProvider = nullptr;
|
||||
int bitsPerComponent = 8;
|
||||
int bitsPerPixel = 32;
|
||||
|
||||
@ -323,7 +323,7 @@ void SourceSurfaceCGBitmapContext::EnsureImage() const
|
||||
// if we have an mCg than it owns the data
|
||||
// and we don't want to tranfer ownership
|
||||
// to the CGDataProviderCreateWithData
|
||||
info = NULL;
|
||||
info = nullptr;
|
||||
} else {
|
||||
// otherwise we transfer ownership to
|
||||
// the dataProvider
|
||||
@ -344,7 +344,7 @@ void SourceSurfaceCGBitmapContext::EnsureImage() const
|
||||
colorSpace,
|
||||
bitinfo,
|
||||
dataProvider,
|
||||
NULL,
|
||||
nullptr,
|
||||
true,
|
||||
kCGRenderingIntentDefault);
|
||||
|
||||
@ -378,10 +378,10 @@ SourceSurfaceCGBitmapContext::DrawTargetWillChange()
|
||||
// drop the current image for the data associated with the CGBitmapContext
|
||||
if (mImage)
|
||||
CGImageRelease(mImage);
|
||||
mImage = NULL;
|
||||
mImage = nullptr;
|
||||
|
||||
mCg = NULL;
|
||||
mDrawTarget = NULL;
|
||||
mCg = nullptr;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ SourceSurfaceCGIOSurfaceContext::SourceSurfaceCGIOSurfaceContext(DrawTargetCG *a
|
||||
|
||||
// TODO use CreateImageFromIOSurfaceContext instead of reading back the surface
|
||||
//mImage = MacIOSurface::CreateImageFromIOSurfaceContext(cg);
|
||||
mImage = NULL;
|
||||
mImage = nullptr;
|
||||
|
||||
aDrawTarget->Flush();
|
||||
surf->Lock();
|
||||
@ -434,9 +434,9 @@ void SourceSurfaceCGIOSurfaceContext::EnsureImage() const
|
||||
// performance characteristics.
|
||||
if (!mImage) {
|
||||
//XXX: we should avoid creating this colorspace everytime
|
||||
CGColorSpaceRef colorSpace = NULL;
|
||||
CGColorSpaceRef colorSpace = nullptr;
|
||||
CGBitmapInfo bitinfo = 0;
|
||||
CGDataProviderRef dataProvider = NULL;
|
||||
CGDataProviderRef dataProvider = nullptr;
|
||||
int bitsPerComponent = 8;
|
||||
int bitsPerPixel = 32;
|
||||
|
||||
@ -457,7 +457,7 @@ void SourceSurfaceCGIOSurfaceContext::EnsureImage() const
|
||||
colorSpace,
|
||||
bitinfo,
|
||||
dataProvider,
|
||||
NULL,
|
||||
nullptr,
|
||||
true,
|
||||
kCGRenderingIntentDefault);
|
||||
|
||||
|
@ -31,7 +31,7 @@ CairoFormatToSurfaceFormat(cairo_format_t format)
|
||||
SourceSurfaceCairo::SourceSurfaceCairo(cairo_surface_t* aSurface,
|
||||
const IntSize& aSize,
|
||||
const SurfaceFormat& aFormat,
|
||||
DrawTargetCairo* aDrawTarget /* = NULL */)
|
||||
DrawTargetCairo* aDrawTarget /* = nullptr */)
|
||||
: mSize(aSize)
|
||||
, mFormat(aFormat)
|
||||
, mSurface(aSurface)
|
||||
@ -92,7 +92,7 @@ void
|
||||
SourceSurfaceCairo::DrawTargetWillChange()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
|
||||
// We're about to lose our version of the surface, so make a copy of it.
|
||||
cairo_surface_t* surface = cairo_surface_create_similar(mSurface,
|
||||
@ -116,7 +116,7 @@ SourceSurfaceCairo::MarkIndependent()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->RemoveSnapshot(this);
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@ class SourceSurfaceCairo : public SourceSurface
|
||||
public:
|
||||
// Create a SourceSurfaceCairo. The surface will not be copied, but simply
|
||||
// referenced.
|
||||
// If aDrawTarget is non-NULL, it is assumed that this is a snapshot source
|
||||
// If aDrawTarget is non-nullptr, it is assumed that this is a snapshot source
|
||||
// surface, and we'll call DrawTargetCairo::RemoveSnapshot(this) on it when
|
||||
// we're destroyed.
|
||||
SourceSurfaceCairo(cairo_surface_t* aSurface, const IntSize& aSize,
|
||||
const SurfaceFormat& aFormat,
|
||||
DrawTargetCairo* aDrawTarget = NULL);
|
||||
DrawTargetCairo* aDrawTarget = nullptr);
|
||||
virtual ~SourceSurfaceCairo();
|
||||
|
||||
virtual SurfaceType GetType() const { return SURFACE_CAIRO; }
|
||||
|
@ -43,7 +43,7 @@ SourceSurfaceD2D::IsValid() const
|
||||
TemporaryRef<DataSourceSurface>
|
||||
SourceSurfaceD2D::GetDataSurface()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -64,11 +64,11 @@ SourceSurfaceD2DTarget::GetDataSurface()
|
||||
desc.BindFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, NULL, byRef(dataSurf->mTexture));
|
||||
HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(dataSurf->mTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxDebug() << "Failed to create staging texture for SourceSurface. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Factory::GetDirect3D10Device()->CopyResource(dataSurf->mTexture, mTexture);
|
||||
|
||||
@ -82,7 +82,7 @@ SourceSurfaceD2DTarget::GetSRView()
|
||||
return mSRView;
|
||||
}
|
||||
|
||||
HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, NULL, byRef(mSRView));
|
||||
HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, nullptr, byRef(mSRView));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create ShaderResourceView. Code: " << hr;
|
||||
@ -100,10 +100,10 @@ SourceSurfaceD2DTarget::DrawTargetWillChange()
|
||||
mTexture->GetDesc(&desc);
|
||||
|
||||
// Get a copy of the surface data so the content at snapshot time was saved.
|
||||
Factory::GetDirect3D10Device()->CreateTexture2D(&desc, NULL, byRef(mTexture));
|
||||
Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture));
|
||||
Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture);
|
||||
|
||||
mBitmap = NULL;
|
||||
mBitmap = nullptr;
|
||||
|
||||
DrawTargetD2D::mVRAMUsageSS += desc.Width * desc.Height * BytesPerPixel(mFormat);
|
||||
mOwnsCopy = true;
|
||||
@ -130,7 +130,7 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT)
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to query interface texture to DXGISurface. Code: " << hr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D2D1_BITMAP_PROPERTIES props =
|
||||
@ -160,7 +160,7 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT)
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to QI texture to surface.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D2D1_RENDER_TARGET_PROPERTIES props =
|
||||
@ -169,11 +169,11 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT)
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxWarning() << "Failed to create D2D render target for texture.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
mBitmap->CopyFromRenderTarget(NULL, rt, NULL);
|
||||
mBitmap->CopyFromRenderTarget(nullptr, rt, nullptr);
|
||||
return mBitmap;
|
||||
}
|
||||
|
||||
@ -185,8 +185,8 @@ SourceSurfaceD2DTarget::MarkIndependent()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
MOZ_ASSERT(mDrawTarget->mSnapshot == this);
|
||||
mDrawTarget->mSnapshot = NULL;
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget->mSnapshot = nullptr;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
virtual SurfaceFormat GetFormat() const { return mA->GetFormat(); }
|
||||
|
||||
/* Readback from this surface type is not supported! */
|
||||
virtual TemporaryRef<DataSourceSurface> GetDataSurface() { return NULL; }
|
||||
virtual TemporaryRef<DataSourceSurface> GetDataSurface() { return nullptr; }
|
||||
private:
|
||||
friend class DualSurface;
|
||||
friend class DualPattern;
|
||||
|
@ -15,7 +15,7 @@ namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
SourceSurfaceSkia::SourceSurfaceSkia()
|
||||
: mDrawTarget(NULL)
|
||||
: mDrawTarget(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void
|
||||
SourceSurfaceSkia::DrawTargetWillChange()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
SkBitmap temp = mBitmap;
|
||||
mBitmap.reset();
|
||||
temp.copyTo(&mBitmap, temp.getConfig());
|
||||
@ -100,7 +100,7 @@ SourceSurfaceSkia::DrawTargetWillChange()
|
||||
void
|
||||
SourceSurfaceSkia::DrawTargetDestroyed()
|
||||
{
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -108,7 +108,7 @@ SourceSurfaceSkia::MarkIndependent()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->RemoveSnapshot(this);
|
||||
mDrawTarget = NULL;
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
SurfaceFormat aFormat);
|
||||
|
||||
/**
|
||||
* If aOwner is NULL, we make a copy of the pixel data in the bitmap,
|
||||
* If aOwner is nullptr, we make a copy of the pixel data in the bitmap,
|
||||
* otherwise we just reference this data until DrawTargetWillChange is called.
|
||||
*/
|
||||
bool InitWithBitmap(const SkBitmap& aBitmap,
|
||||
|
@ -21,7 +21,7 @@ class UserData
|
||||
{
|
||||
typedef void (*destroyFunc)(void *data);
|
||||
public:
|
||||
UserData() : count(0), entries(NULL) {}
|
||||
UserData() : count(0), entries(nullptr) {}
|
||||
|
||||
/* Attaches untyped userData associated with key. destroy is called on destruction */
|
||||
void Add(UserDataKey *key, void *userData, destroyFunc destroy)
|
||||
@ -68,7 +68,7 @@ public:
|
||||
return userData;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Retrives the userData for the associated key */
|
||||
@ -79,7 +79,7 @@ public:
|
||||
return entries[i].userData;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Has(UserDataKey *key)
|
||||
@ -100,7 +100,7 @@ public:
|
||||
}
|
||||
}
|
||||
free(entries);
|
||||
entries = NULL;
|
||||
entries = nullptr;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
using namespace mozilla::gfx;
|
||||
TestDrawTargetD2D::TestDrawTargetD2D()
|
||||
{
|
||||
::D3D10CreateDevice1(NULL,
|
||||
::D3D10CreateDevice1(nullptr,
|
||||
D3D10_DRIVER_TYPE_HARDWARE,
|
||||
NULL,
|
||||
nullptr,
|
||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
D3D10_FEATURE_LEVEL_10_0,
|
||||
|
@ -16,4 +16,4 @@ public:
|
||||
|
||||
private:
|
||||
mozilla::RefPtr<ID3D10Device1> mDevice;
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user