D2D1_MATRIX_3X2_F CanvasD2D::GetCurrentTransform() { D2D1_MATRIX_3X2_F d2dMatrix; Gdiplus::Matrix gdipMatrix; m_GdipGraphics->GetTransform(&gdipMatrix); gdipMatrix.GetElements((Gdiplus::REAL*)&d2dMatrix); return d2dMatrix; }
void CanvasD2D::UpdateTargetTransform() { Gdiplus::Matrix gdipMatrix; m_GdipGraphics->GetTransform(&gdipMatrix); D2D1_MATRIX_3X2_F d2dMatrix; gdipMatrix.GetElements((Gdiplus::REAL*)&d2dMatrix); m_Target->SetTransform(d2dMatrix); m_CanUseAxisAlignClip = d2dMatrix._12 == 0.0f && d2dMatrix._21 == 0.0f && d2dMatrix._31 == 0.0f && d2dMatrix._32 == 0.0f; }
HDC CanvasGdiplus::BeginPlatformPaint() { DCHECK(mem_graphics_.get()); Gdiplus::Matrix matrix; mem_graphics_->GetTransform(&matrix); Gdiplus::REAL elem[6]; matrix.GetElements(elem); Gdiplus::Region region; mem_graphics_->GetClip(®ion); HRGN hrgn = region.GetHRGN(mem_graphics_.get()); HDC hdc = mem_graphics_->GetHDC(); InitializeDC(hdc); XFORM xf = { elem[0], elem[1], elem[2], elem[3], elem[4], elem[5] }; SetWorldTransform(hdc, &xf); SelectClipRgn(hdc, hrgn); DeleteObject(hrgn); return hdc; }