Bug 1037570 - Remove gfxPath. r=mattwoodrow

This commit is contained in:
Jonathan Watt 2014-07-11 11:25:00 +02:00
parent 616e4c5a42
commit ca6f6bf7a8
6 changed files with 15 additions and 89 deletions

View File

@ -103,8 +103,7 @@ SVGEllipseElement::ConstructPath(gfxContext *aCtx)
RefPtr<PathBuilder> builder = dt->CreatePathBuilder(fillRule);
RefPtr<Path> path = BuildPath(builder);
if (path) {
nsRefPtr<gfxPath> gfxpath = new gfxPath(path);
aCtx->SetPath(gfxpath);
aCtx->SetPath(path);
}
}

View File

@ -235,18 +235,16 @@ gfxContext::ClosePath()
mPathBuilder->Close();
}
already_AddRefed<gfxPath> gfxContext::CopyPath()
TemporaryRef<Path> gfxContext::GetPath()
{
EnsurePath();
nsRefPtr<gfxPath> path = new gfxPath(mPath);
return path.forget();
return mPath;
}
void gfxContext::SetPath(gfxPath* path)
void gfxContext::SetPath(Path* path)
{
MOZ_ASSERT(path->mMoz2DPath, "Can't mix cairo and azure paths!");
MOZ_ASSERT(path->mMoz2DPath->GetBackendType() == mDT->GetBackendType());
mPath = path->mMoz2DPath;
MOZ_ASSERT(path->GetBackendType() == mDT->GetBackendType());
mPath = path;
mPathBuilder = nullptr;
mPathIsRect = false;
mTransformChanged = false;

View File

@ -13,7 +13,6 @@
#include "gfxRect.h"
#include "gfxMatrix.h"
#include "gfxPattern.h"
#include "gfxPath.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
@ -38,6 +37,8 @@ template <typename T> class FallibleTArray;
* as opposed to app units.
*/
class gfxContext MOZ_FINAL {
typedef mozilla::gfx::Path Path;
NS_INLINE_DECL_REFCOUNTING(gfxContext)
public:
@ -133,14 +134,14 @@ public:
void ClosePath();
/**
* Copies the current path and returns the copy.
* Returns the current path.
*/
already_AddRefed<gfxPath> CopyPath();
mozilla::TemporaryRef<Path> GetPath();
/**
* Appends the given path to the current path.
*/
void SetPath(gfxPath* path);
void SetPath(Path* path);
/**
* Moves the pen to a new point without drawing a line.
@ -724,7 +725,6 @@ private:
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Rect Rect;
typedef mozilla::gfx::CompositionOp CompositionOp;
typedef mozilla::gfx::Path Path;
typedef mozilla::gfx::PathBuilder PathBuilder;
typedef mozilla::gfx::SourceSurface SourceSurface;
@ -852,6 +852,8 @@ private:
*/
class gfxContextPathAutoSaveRestore
{
typedef mozilla::gfx::Path Path;
public:
gfxContextPathAutoSaveRestore() : mContext(nullptr) {}
@ -880,7 +882,7 @@ public:
void Save()
{
if (!mPath && mContext) {
mPath = mContext->CopyPath();
mPath = mContext->GetPath();
}
}
@ -899,7 +901,7 @@ public:
private:
gfxContext *mContext;
nsRefPtr<gfxPath> mPath;
mozilla::RefPtr<Path> mPath;
};
/**

View File

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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 "gfxPath.h"
#include "mozilla/gfx/2D.h"
#include "cairo.h"
using namespace mozilla::gfx;
gfxPath::gfxPath(cairo_path_t* aPath)
: mPath(aPath)
{
}
gfxPath::gfxPath(Path* aPath)
: mPath(nullptr)
, mMoz2DPath(aPath)
{
}
gfxPath::~gfxPath()
{
cairo_path_destroy(mPath);
}

View File

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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 GFX_PATH_H
#define GFX_PATH_H
#include "gfxTypes.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
class gfxContext;
typedef struct cairo_path cairo_path_t;
namespace mozilla {
namespace gfx {
class Path;
}
}
/**
* Class representing a path. Can be created by copying the current path
* of a gfxContext.
*/
class gfxPath MOZ_FINAL {
NS_INLINE_DECL_REFCOUNTING(gfxPath)
friend class gfxContext;
gfxPath(cairo_path_t* aPath);
public:
gfxPath(mozilla::gfx::Path* aPath);
private:
// Private destructor, to discourage deletion outside of Release():
~gfxPath();
cairo_path_t* mPath;
mozilla::RefPtr<mozilla::gfx::Path> mMoz2DPath;
};
#endif

View File

@ -28,7 +28,6 @@ EXPORTS += [
'gfxLineSegment.h',
'gfxMathTable.h',
'gfxMatrix.h',
'gfxPath.h',
'gfxPattern.h',
'gfxPlatform.h',
'gfxPoint.h',
@ -233,7 +232,6 @@ UNIFIED_SOURCES += [
'gfxImageSurface.cpp',
'gfxMathTable.cpp',
'gfxMatrix.cpp',
'gfxPath.cpp',
'gfxPattern.cpp',
'gfxRect.cpp',
'gfxReusableImageSurfaceWrapper.cpp',