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,7 +54,7 @@ class SkDrawTiler {
|
||||
SkDraw fDraw;
|
||||
|
||||
// fCurr... are only used if fNeedTiling
|
||||
SkTLazy<SkPostConcatMatrixProvider> fTileMatrixProvider;
|
||||
SkTLazy<SkPostTranslateMatrixProvider> fTileMatrixProvider;
|
||||
SkRasterClip fTileRC;
|
||||
SkIPoint fOrigin;
|
||||
|
||||
@ -164,9 +164,9 @@ private:
|
||||
SkASSERT_RELEASE(success);
|
||||
// now don't use bounds, since fDst has the clipped dimensions.
|
||||
|
||||
fDraw.fMatrixProvider = fTileMatrixProvider.init(
|
||||
fDevice->asMatrixProvider(),
|
||||
SkMatrix::MakeTrans(SkIntToScalar(-fOrigin.x()), SkIntToScalar(-fOrigin.y())));
|
||||
fDraw.fMatrixProvider = fTileMatrixProvider.init(fDevice->asMatrixProvider(),
|
||||
SkIntToScalar(-fOrigin.x()),
|
||||
SkIntToScalar(-fOrigin.y()));
|
||||
fDevice->fRCStack.rc().translate(-fOrigin.x(), -fOrigin.y(), &fTileRC);
|
||||
fTileRC.op(SkIRect::MakeWH(fDraw.fDst.width(), fDraw.fDst.height()),
|
||||
SkRegion::kIntersect_Op);
|
||||
|
@ -51,16 +51,15 @@ private:
|
||||
const SkMatrixProvider& fParent;
|
||||
};
|
||||
|
||||
class SkPostConcatMatrixProvider : public SkMatrixProvider {
|
||||
class SkPostTranslateMatrixProvider : public SkMatrixProvider {
|
||||
public:
|
||||
SkPostConcatMatrixProvider(const SkMatrixProvider& parent, const SkMatrix& postMatrix)
|
||||
SkPostTranslateMatrixProvider(const SkMatrixProvider& parent, SkScalar dx, SkScalar dy)
|
||||
#if defined(SK_SUPPORT_LEGACY_MATRIX44)
|
||||
: SkMatrixProvider(SkMatrix::Concat(postMatrix, parent.localToDevice()))
|
||||
: SkMatrixProvider(SkMatrix::Concat(SkMatrix::MakeTrans(dx, dy), parent.localToDevice()))
|
||||
#else
|
||||
: SkMatrixProvider(SkM44(postMatrix) * parent.localToDevice44())
|
||||
: SkMatrixProvider(SkM44::Translate(dx, dy) * parent.localToDevice44())
|
||||
#endif
|
||||
, fParent(parent)
|
||||
, fPostMatrix(postMatrix) {}
|
||||
, fParent(parent) {}
|
||||
|
||||
// Assume that the post-matrix doesn't apply to any marked matrices
|
||||
bool getLocalToMarker(uint32_t id, SkM44* localToMarker) const override {
|
||||
@ -69,7 +68,6 @@ public:
|
||||
|
||||
private:
|
||||
const SkMatrixProvider& fParent;
|
||||
const SkMatrix fPostMatrix;
|
||||
};
|
||||
|
||||
class SkPreConcatMatrixProvider : public SkMatrixProvider {
|
||||
|
@ -325,13 +325,12 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
|
||||
|
||||
const SkMatrixProvider* matrixProvider = this;
|
||||
#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
|
||||
// points and lines.
|
||||
if (GrIsPrimTypeLines(primitiveType) || GrPrimitiveType::kPoints == primitiveType) {
|
||||
static const SkScalar kOffset = 0.063f; // Just greater than 1/16.
|
||||
matrixProvider = postConcatMatrixProvider.init(*matrixProvider,
|
||||
SkMatrix::MakeTrans(kOffset, kOffset));
|
||||
matrixProvider = postTranslateMatrixProvider.init(*matrixProvider, kOffset, kOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user