//--------------------------------------------------------------------------- void TJS_INTF_METHOD tTVPLayerManager::RequestInvalidation(const tTVPRect &r) { // called by the owner window to notify window surface is invalidated by // the system or user. if(!Primary) return; tTVPRect ur; tTVPRect cr(0, 0, Primary->Rect.get_width(), Primary->Rect.get_height()); if(TVPIntersectRect(&ur, r, cr)) { AddUpdateRegion(ur); } }
//--------------------------------------------------------------------------- void tTVPScrollDivisibleData::Blend(tTVPScrollTransFrom from, tTVPScrollTransStay stay, tjs_int phase) { // scroll the image tjs_int imagewidth; tjs_int imageheight; Src1->GetWidth(&imagewidth); Src1->GetHeight(&imageheight); tjs_int src1left = 0; tjs_int src1top = 0; tjs_int src2left = 0; tjs_int src2top = 0; switch(from) { case sttLeft: if(stay == ststNoStay) src1left = phase, src2left = phase - imagewidth; else if(stay == ststStayDest) src2left = phase - imagewidth; else if(stay == ststStaySrc) src1left = phase; break; case sttTop: if(stay == ststNoStay) src1top = phase, src2top = phase - imageheight; else if(stay == ststStayDest) src2top = phase - imageheight; else if(stay == ststStaySrc) src1top = phase; break; case sttRight: if(stay == ststNoStay) src1left = -phase, src2left = imagewidth - phase; else if(stay == ststStayDest) src2left = imagewidth - phase; else if(stay == ststStaySrc) src1left = -phase; break; case sttBottom: if(stay == ststNoStay) src1top = -phase, src2top = imageheight - phase; else if(stay == ststStayDest) src2top = imageheight - phase; else if(stay == ststStaySrc) src1top = -phase; break; } tTVPRect rdest(Left, Top, Width+Left, Height+Top); tTVPRect rs1(src1left, src1top, imagewidth + src1left, imageheight + src1top); tTVPRect rs2(src2left, src2top, imagewidth + src2left, imageheight + src2top); if(stay == ststNoStay) { // both layers have no priority than another. // nothing to do. } else if(stay == ststStayDest) { // Src2 has priority. if(from == sttLeft || from == sttRight) { if(rs2.right >= rs1.left && rs2.right < rs1.right) rs1.left = rs2.right; if(rs2.left >= rs1.left && rs2.left < rs1.right) rs1.right = rs2.left; } else { if(rs2.bottom >= rs1.top && rs2.bottom < rs1.bottom) rs1.top = rs2.bottom; if(rs2.top >= rs1.top && rs2.top < rs1.bottom) rs1.bottom = rs2.top; } } else if(stay == ststStaySrc) { // Src1 has priority. if(from == sttLeft || from == sttRight) { if(rs1.right >= rs2.left && rs1.right < rs2.right) rs2.left = rs1.right; if(rs1.left >= rs2.left && rs1.left < rs2.right) rs2.right = rs1.left; } else { if(rs1.bottom >= rs2.top && rs1.bottom < rs2.bottom) rs2.top = rs1.bottom; if(rs1.top >= rs2.top && rs1.top < rs2.bottom) rs2.bottom = rs1.top; } } // copy to destination image tTVPRect d; if(TVPIntersectRect(&d, rdest, rs1)) { tjs_int dl = d.left - Left + DestLeft, dt = d.top - Top + DestTop; d.add_offsets(-src1left, -src1top); TVPSLPCopyRect(Dest, dl, dt, Src1, d); } if(TVPIntersectRect(&d, rdest, rs2)) { tjs_int dl = d.left - Left + DestLeft, dt = d.top - Top + DestTop; d.add_offsets(-src2left, -src2top); TVPSLPCopyRect(Dest, dl, dt, Src2, d); } }