Bug 885632 - Always use soft clipping with SkiaGL r=mattwoodrow

This commit is contained in:
James Willcox 2013-06-21 15:28:10 -04:00
parent f336c23ebd
commit 23ccf56611
2 changed files with 12 additions and 9 deletions

View File

@ -27,12 +27,6 @@
#include "Tools.h"
#include <algorithm>
#ifdef ANDROID
# define USE_SOFT_CLIPPING false
#else
# define USE_SOFT_CLIPPING true
#endif
namespace mozilla {
namespace gfx {
@ -83,6 +77,11 @@ public:
DrawTargetSkia::DrawTargetSkia()
{
#ifdef ANDROID
mSoftClipping = false;
#else
mSoftClipping = true;
#endif
}
DrawTargetSkia::~DrawTargetSkia()
@ -650,6 +649,9 @@ DrawTargetSkia::InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLCont
mSize = aSize;
mFormat = aFormat;
// Always use soft clipping when we're using GL
mSoftClipping = true;
mGrGLInterface = aGrGLInterface;
mGrGLInterface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
@ -722,7 +724,7 @@ DrawTargetSkia::ClearRect(const Rect &aRect)
MarkChanged();
SkPaint paint;
mCanvas->save();
mCanvas->clipRect(RectToSkRect(aRect), SkRegion::kIntersect_Op, USE_SOFT_CLIPPING);
mCanvas->clipRect(RectToSkRect(aRect), SkRegion::kIntersect_Op, mSoftClipping);
paint.setColor(SkColorSetARGB(0, 0, 0, 0));
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
mCanvas->drawPaint(paint);
@ -738,7 +740,7 @@ DrawTargetSkia::PushClip(const Path *aPath)
const PathSkia *skiaPath = static_cast<const PathSkia*>(aPath);
mCanvas->save(SkCanvas::kClip_SaveFlag);
mCanvas->clipPath(skiaPath->GetPath(), SkRegion::kIntersect_Op, USE_SOFT_CLIPPING);
mCanvas->clipPath(skiaPath->GetPath(), SkRegion::kIntersect_Op, mSoftClipping);
}
void
@ -747,7 +749,7 @@ DrawTargetSkia::PushClipRect(const Rect& aRect)
SkRect rect = RectToSkRect(aRect);
mCanvas->save(SkCanvas::kClip_SaveFlag);
mCanvas->clipRect(rect, SkRegion::kIntersect_Op, USE_SOFT_CLIPPING);
mCanvas->clipRect(rect, SkRegion::kIntersect_Op, mSoftClipping);
}
void

View File

@ -134,6 +134,7 @@ private:
IntSize mSize;
SkRefPtr<SkCanvas> mCanvas;
std::vector<SourceSurfaceSkia*> mSnapshots;
bool mSoftClipping;
};
}