SkPostConcatMatrixProvider -> SkPostTranslateMatrixProvider
The only uses of this are to do translation, so narrow the focus. Change-Id: Ia3ccd5ce8840ad516ea12c8d8e3f8fd522e731a1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289878 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
0a2464f51f
commit
cdb520a76a
@ -54,9 +54,9 @@ class SkDrawTiler {
|
|||||||
SkDraw fDraw;
|
SkDraw fDraw;
|
||||||
|
|
||||||
// fCurr... are only used if fNeedTiling
|
// fCurr... are only used if fNeedTiling
|
||||||
SkTLazy<SkPostConcatMatrixProvider> fTileMatrixProvider;
|
SkTLazy<SkPostTranslateMatrixProvider> fTileMatrixProvider;
|
||||||
SkRasterClip fTileRC;
|
SkRasterClip fTileRC;
|
||||||
SkIPoint fOrigin;
|
SkIPoint fOrigin;
|
||||||
|
|
||||||
bool fDone, fNeedsTiling;
|
bool fDone, fNeedsTiling;
|
||||||
|
|
||||||
@ -164,9 +164,9 @@ private:
|
|||||||
SkASSERT_RELEASE(success);
|
SkASSERT_RELEASE(success);
|
||||||
// now don't use bounds, since fDst has the clipped dimensions.
|
// now don't use bounds, since fDst has the clipped dimensions.
|
||||||
|
|
||||||
fDraw.fMatrixProvider = fTileMatrixProvider.init(
|
fDraw.fMatrixProvider = fTileMatrixProvider.init(fDevice->asMatrixProvider(),
|
||||||
fDevice->asMatrixProvider(),
|
SkIntToScalar(-fOrigin.x()),
|
||||||
SkMatrix::MakeTrans(SkIntToScalar(-fOrigin.x()), SkIntToScalar(-fOrigin.y())));
|
SkIntToScalar(-fOrigin.y()));
|
||||||
fDevice->fRCStack.rc().translate(-fOrigin.x(), -fOrigin.y(), &fTileRC);
|
fDevice->fRCStack.rc().translate(-fOrigin.x(), -fOrigin.y(), &fTileRC);
|
||||||
fTileRC.op(SkIRect::MakeWH(fDraw.fDst.width(), fDraw.fDst.height()),
|
fTileRC.op(SkIRect::MakeWH(fDraw.fDst.width(), fDraw.fDst.height()),
|
||||||
SkRegion::kIntersect_Op);
|
SkRegion::kIntersect_Op);
|
||||||
|
@ -51,16 +51,15 @@ private:
|
|||||||
const SkMatrixProvider& fParent;
|
const SkMatrixProvider& fParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkPostConcatMatrixProvider : public SkMatrixProvider {
|
class SkPostTranslateMatrixProvider : public SkMatrixProvider {
|
||||||
public:
|
public:
|
||||||
SkPostConcatMatrixProvider(const SkMatrixProvider& parent, const SkMatrix& postMatrix)
|
SkPostTranslateMatrixProvider(const SkMatrixProvider& parent, SkScalar dx, SkScalar dy)
|
||||||
#if defined(SK_SUPPORT_LEGACY_MATRIX44)
|
#if defined(SK_SUPPORT_LEGACY_MATRIX44)
|
||||||
: SkMatrixProvider(SkMatrix::Concat(postMatrix, parent.localToDevice()))
|
: SkMatrixProvider(SkMatrix::Concat(SkMatrix::MakeTrans(dx, dy), parent.localToDevice()))
|
||||||
#else
|
#else
|
||||||
: SkMatrixProvider(SkM44(postMatrix) * parent.localToDevice44())
|
: SkMatrixProvider(SkM44::Translate(dx, dy) * parent.localToDevice44())
|
||||||
#endif
|
#endif
|
||||||
, fParent(parent)
|
, fParent(parent) {}
|
||||||
, fPostMatrix(postMatrix) {}
|
|
||||||
|
|
||||||
// Assume that the post-matrix doesn't apply to any marked matrices
|
// Assume that the post-matrix doesn't apply to any marked matrices
|
||||||
bool getLocalToMarker(uint32_t id, SkM44* localToMarker) const override {
|
bool getLocalToMarker(uint32_t id, SkM44* localToMarker) const override {
|
||||||
@ -69,7 +68,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const SkMatrixProvider& fParent;
|
const SkMatrixProvider& fParent;
|
||||||
const SkMatrix fPostMatrix;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkPreConcatMatrixProvider : public SkMatrixProvider {
|
class SkPreConcatMatrixProvider : public SkMatrixProvider {
|
||||||
|
@ -325,13 +325,12 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
|
|||||||
|
|
||||||
const SkMatrixProvider* matrixProvider = this;
|
const SkMatrixProvider* matrixProvider = this;
|
||||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||||
SkTLazy<SkPostConcatMatrixProvider> postConcatMatrixProvider;
|
SkTLazy<SkPostTranslateMatrixProvider> postTranslateMatrixProvider;
|
||||||
// This offsetting in device space matches the expectations of the Android framework for non-AA
|
// This offsetting in device space matches the expectations of the Android framework for non-AA
|
||||||
// points and lines.
|
// points and lines.
|
||||||
if (GrIsPrimTypeLines(primitiveType) || GrPrimitiveType::kPoints == primitiveType) {
|
if (GrIsPrimTypeLines(primitiveType) || GrPrimitiveType::kPoints == primitiveType) {
|
||||||
static const SkScalar kOffset = 0.063f; // Just greater than 1/16.
|
static const SkScalar kOffset = 0.063f; // Just greater than 1/16.
|
||||||
matrixProvider = postConcatMatrixProvider.init(*matrixProvider,
|
matrixProvider = postTranslateMatrixProvider.init(*matrixProvider, kOffset, kOffset);
|
||||||
SkMatrix::MakeTrans(kOffset, kOffset));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user