@@ -363,7 +363,10 @@ void IGraphicsSkia::DrawResize()
363
363
#endif
364
364
#endif
365
365
if (mSurface )
366
+ {
366
367
mCanvas = mSurface ->getCanvas ();
368
+ mCanvas ->save ();
369
+ }
367
370
}
368
371
369
372
void IGraphicsSkia::BeginFrame ()
@@ -769,7 +772,6 @@ void IGraphicsSkia::RenderPath(SkPaint& paint)
769
772
770
773
void IGraphicsSkia::PathTransformSetMatrix (const IMatrix& m)
771
774
{
772
- double scale = GetScreenScale () * GetDrawScale ();
773
775
double xTranslate = 0.0 ;
774
776
double yTranslate = 0.0 ;
775
777
@@ -785,18 +787,22 @@ void IGraphicsSkia::PathTransformSetMatrix(const IMatrix& m)
785
787
}
786
788
787
789
mMatrix = SkMatrix::MakeAll (m.mXX , m.mXY , m.mTX , m.mYX , m.mYY , m.mTY , 0 , 0 , 1 );
788
- SkMatrix globalMatrix = SkMatrix::MakeScale (scale);
789
- SkMatrix skMatrix = mMatrix ;
790
+ SkMatrix globalMatrix = SkMatrix::MakeScale (GetTotalScale ());
791
+ mClipMatrix = SkMatrix ();
792
+ mFinalMatrix = mMatrix ;
790
793
globalMatrix.preTranslate (xTranslate, yTranslate);
791
- skMatrix.postConcat (globalMatrix);
792
- mCanvas ->setMatrix (skMatrix);
794
+ mClipMatrix .postConcat (globalMatrix);
795
+ mFinalMatrix .postConcat (globalMatrix);
796
+ mCanvas ->setMatrix (mFinalMatrix );
793
797
}
794
798
795
799
void IGraphicsSkia::SetClipRegion (const IRECT& r)
796
800
{
797
- mCanvas ->restore ( );
801
+ mCanvas ->restoreToCount ( 0 );
798
802
mCanvas ->save ();
803
+ mCanvas ->setMatrix (mClipMatrix );
799
804
mCanvas ->clipRect (SkiaRect (r));
805
+ mCanvas ->setMatrix (mFinalMatrix );
800
806
}
801
807
802
808
APIBitmap* IGraphicsSkia::CreateAPIBitmap (int width, int height, int scale, double drawScale, bool cacheable)
@@ -816,7 +822,9 @@ APIBitmap* IGraphicsSkia::CreateAPIBitmap(int width, int height, int scale, doub
816
822
#else
817
823
surface = SkSurface::MakeRasterN32Premul (width, height);
818
824
#endif
819
-
825
+
826
+ surface->getCanvas ()->save ();
827
+
820
828
return new Bitmap (std::move (surface), width, height, scale, drawScale);
821
829
}
822
830
0 commit comments