ó
Ä‚Œ\c           @  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 m Z m Z m Z m Z m Z m Z e j ƒ  Z d e f d „  ƒ  YZ e ƒ  g Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   print_functionN(   t	   blit_lockt   IDENTITYt   BLITt   DISSOLVEt   IMAGEDISSOLVEt	   PIXELLATEt   Clipperc           B  s    e  Z d  Z d „  Z d „  Z RS(   s~   
    This is used to calculate the clipping rectangle and update rectangles
    used for a particular draw of the screen.
    c         C  s:   g  |  _  g  |  _ t ƒ  |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   t   blitst	   old_blitst   sett   forcedt
   old_forcedt   mutated(   t   self(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   __init__+   s
    		c   '      C  sF  |  j  } |  j } |  j } |  j } |  j } | |  _  g  |  _ | |  _ t ƒ  |  _ t ƒ  |  _ t j j } t j j	 } | | }	 d d | | f }
 | r§ |
 |
 g f S| | B} |
 | k rÊ |
 |
 g f Sd } d } t | ƒ } xØ t
 r¼| t | ƒ k s| t | ƒ k rPn  | | } | | } | | k rtt | d ƒ | k r]| j | d  ƒ n  | d 7} | d 7} qå | | k rž| j | d  ƒ | d 7} qå | j | d  ƒ | d 7} qå W| j d „  | | Dƒ ƒ | j d „  | | Dƒ ƒ | sd g  f Sg  } x| D]ú \ } } } } \ } } } } | d 7} | d 7} | | k  rZ| } n  | | k  ro| } n  | | k r„| } n  | | k r™| } n  | | } | | } | d k s| d k rËqn  | | } | |	 k rî|
 |
 g f S| j | | | | | f ƒ qW| j ƒ  g  } d } x¾| rä| j ƒ  \ } } } } } t } | | |	 k rƒd d | | f d d | | f g f Sd }  x|  t | ƒ k  r˜| |  \ }! }" }# }$ }% | |" k oÎ| k n sï| |$ k oê| k n r‹| |# k o| k n s'| |% k o"| k n r‹t
 } t | |" ƒ } t | |$ ƒ } t | |# ƒ } t | |% ƒ } | | | | } | j |  ƒ qŒ|  d 7}  qŒW| r¾| j | | | | | f ƒ q'| j | | | | f ƒ | | 7} q'W| sõd g  f S| j ƒ  \ } } } } t | ƒ } t | ƒ } t t j | ƒ ƒ } t t j | ƒ ƒ } | | | | | | f g }& x¹ | D]± \ }" }# }$ }% t |" ƒ }" t |# ƒ }# t t j |$ ƒ ƒ }$ t t j |% ƒ ƒ }% t | |" ƒ } t | |# ƒ } t | |$ ƒ } t | |% ƒ } |& j |" |# |$ |" |% |# f ƒ qsW| | | | | | f |& f S(   s“   
        This returns a clipping rectangle, and a list of update rectangles
        that cover the changes between the old and new frames.
        i    i   i   c         s  s   |  ] } | d   Vq d S(   i   N(    (   t   .0t   i(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pys	   <genexpr>~   s    c         s  s   |  ] } | d   Vq d S(   i   N(    (   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pys	   <genexpr>   s    N(   R	   R   R   R   R   R
   t   renpyt   configt   screen_widtht   screen_heightt   Truet   lent   idt   addt   updatet   Nonet   appendt   sortt   popt   Falset   mint   maxt   intt   matht   ceil('   R   t   full_redrawt   bl0t   bl1R   R   R   t   swt   sht   sat
   fullscreent   changest   i0t   i1t   bl1sett   b0t   b1t   sizedt   x0t   y0t   x1t   y1t   sx0t   sy0t   sx1t   sy1t   wt   ht   areat   noncontt   ncat   mergedR   t   _iareat   ix0t   iy0t   ix1t   iy1t   updates(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   compute:   sÒ    									

	$



(

				


 
	%88
%(   t   __name__t
   __module__t   __doc__R   RG   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyR   %   s   	c         C  se   | r, t  j |  d | d f t  j ƒ } n  t  j |  d | d f d ƒ } | j d d |  | f ƒ S(   sd   
    Creates a surface that shares a pixel format with the screen. The created
    surface will
    i   i    i   (   t   pygamet   Surfacet   SRCALPHAt
   subsurface(   R;   R<   t   alphat   rv(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   surfaceñ   s    & c         C  s>   |  j  ƒ  \ } } t | | t ƒ } t j j j |  | ƒ | S(   N(   t   get_sizeRQ   R   R   t   displayt   acceleratort
   nogil_copy(   t   surfR;   R<   RP   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   copy_surfaceÿ   s    c      	   C  s„  | j  ƒ  \ } } t | |  j | ƒ } t | |  j | ƒ } | d k sV | d k rZ d S|  j t k rL|  j d d j t ƒ } |  j d d j t ƒ }	 |  j	 r» t
 | | t ƒ }
 n | j d d | | f ƒ }
 t j j j | j | | | | f ƒ |	 j | | | | f ƒ |
 t |  j d ƒ ƒ |  j	 r€| j |
 d ƒ q€n4|  j t k rà|  j d d j t ƒ } |  j d d j t ƒ } |  j d d j t ƒ }	 |  j	 rÇt
 | | t ƒ }
 n | j d d | | f ƒ }
 |  j } d d } x/ t d | ƒ D] } | t d | | ƒ 7} qW| d d 7} t |  j d | ƒ } | | | d !} t j j j | j | | | | f ƒ |	 j | | | | f ƒ |
 | j | | | | f ƒ | ƒ |  j	 r€| j |
 d ƒ q€n  |  j t k rm|  j d d j | j ƒ  d	 ƒ } |  j } t j j j | j | | | | f ƒ | j d d | | f ƒ | | | | ƒ n t d
 |  j ƒ ‚ d S(   sØ   
    This handles the special drawing operations, such as dissolve and
    image dissolve. `x` and `y` are the offsets of the thing to be drawn
    relative to the destination rectangle, and are always negative.
    i    Ni   iÿ   i   t    i   s   ÿi   s   Unknown operation: %d(   i    i    (   i    i    (   RR   R    t   widtht   heightt	   operationR   t   childrent   render_to_textureR   t   operation_alphaRQ   RN   R   RS   t   modulet   blendR"   t   operation_completet   blitR   t   operation_parametert   xranget   chrt
   imageblendR   t	   get_maskst	   pixellatet	   Exception(   t   whatt   destt   xt   yt   dwt   dhR;   R<   t   bottomt   topt   targett   imaget   ramplent   rampR   t   stepRV   t   px(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   draw_special  s`    				
	$	c   "   
   C  sE  t  | t j j j ƒ s6t  | t ƒ rÎ t  | t ƒ rÎ | rQ t j | | ƒ } n  | r™ | j ƒ  \ } } |  j	 j
 | | | | | | | | d f ƒ q2z$ t j ƒ  |  j | | | f ƒ Wd t j ƒ  Xnd | r| j ƒ  \ } } |  j	 j
 | | | | | | | | d f ƒ n t j j j | |  | | ƒ d S| j r`| j | | d ƒ t j j _ n  | j t k rät | ƒ } t | ƒ } | r¶| \ } }	 }
 } |
 | } | |	 } n |  j ƒ  \ } } | d k rãd } | } n | } d } | d k r
d } | } n | } d } | | k s.| | k r2d St | | | j | ƒ } t | | | j | ƒ } | d k s~| d k r‚d S| r²|  j j | | | | | | | f ƒ n. |  j | | | | f ƒ } t | | | | ƒ d S| j sö| j  rc| r¡| \ } } } } t! | | ƒ } t! | | ƒ } t | | | j ƒ } t | | | j ƒ } | | k sp| | k rtd S| | | | f } |  j j | | f ƒ d S| d k r¼| } d } n d } | d k rÝ| } d } n d } |  j ƒ  \ } } t | | | j | ƒ } t | | | j | ƒ } | d k  sA| d k  rEd S|  j | | | | f ƒ }  n  | j" d k sŸ| j# d k sŸ| j$ d k	 rý| j$ t% k	 rýxW | j& D]L \ } } } }  }! t' |  | | | | | | | j" | j# | j$ | j( ƒ q©Wd SxA | j& D]6 \ } } } }  }! t) |  | | | | | | | ƒ qWd S(   sù  
    This is the simple draw routine, which only works when alpha is 1.0
    and the matrices are None. If those aren't the case, draw_complex
    is used instead.

    `dest` - Either a destination surface, or a clipper.
    `clip` - If None, we should draw. Otherwise we should clip, and this is
    the rectangle to clip to.
    `what` - The Render or Surface we're drawing to.
    `xo` - The X offset.
    `yo` - The Y offset.
    `screen` - True if this is a blit to the screen, False otherwise.
    Ni    i   g      ð?(*   t
   isinstanceR   RS   t   rendert   RenderR"   t	   rle_cachet   getRR   R   R   R   R   t   acquireRb   t   releaseR_   t   subpixelt
   text_inputt   screen_rectt	   interfacet	   text_rectR[   R   R    RY   RZ   R   R   RN   Rx   t	   xclippingt	   yclippingR!   RO   t   overt   forwardR   t   visible_childrent   draw_transformedt   reverset   draw("   Rk   t   clipRj   t   xot   yot   screenR;   R<   t   dx0t   dy0t   dx1t   dy1Rn   Ro   t   newxt   subxt   newyt   subyt   subwt   subht   newdestt   cx0t   cy0t   cx1t   cy1Rl   Rm   RY   RZ   t   childt   cxot   cyot   _focust   _main(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyRŒ   Y  s     0
0	!
		*		<!c   -      C  s½  | d k r d  S| d  k r+ t } t } n  t | t j j j ƒ sÒ| j ƒ  \ } }	 | r„ | \ }
 } } } | |
 } | | } n |  j ƒ  \ } } d \ } } | j | d ƒ \ } } | j | |	 ƒ \ } } | j d |	 ƒ \ } } t	 j
 t | | | | ƒ | ƒ } t	 j t | | | | ƒ | ƒ } t	 j
 t | | | | ƒ | ƒ } t	 j t | | | | ƒ | ƒ } | d k  r‡d } n  | d k  rœd } n  | | k r±| } n  | | k rÆ| } n  | | k sö| | k sö| d k  sö| d k  rúd  S| j | | | | ƒ \ } } | rq|  j j | | | |
 | | | | | | | j | j | j | j | f f ƒ n] |  j | | | | | | f ƒ }  t j j j | |  | | | j | j | j | j | t ƒ
 d  S| j rü| j | | | ƒ t j j _ n  | j s| j rÍ| j s | j rLt |  | | j t ƒ | | | | | ƒ d  S| j | j } | j  | j } | r| \ }  }! }" }# t |  | ƒ }  t |! | ƒ }! t |" | | ƒ }" t |# | | ƒ }# |  |" k sà|! |# k räd  S|  |! |" |# f } |  j! j" | | f ƒ d  S| d k r,| }$ d } n d }$ | d k rM| }% d } n d }% |  j ƒ  \ } } t | |$ | | ƒ } t | |% | | ƒ } | d k  s«| d k  r¯d  S|  j |$ |% | | f ƒ }  n  | j# så| j$ t% k r| j t ƒ }& t |  | |& | | | | | ƒ d  SxŸ | j& D]” \ }& }' }( }) }* | j |' |( ƒ \ }' }( | j' rt| | j' }+ | j( | }, n | }+ | }, t |  | |& | |' | |( | | j) | j* |+ |, ƒ q!Wd  S(   Ngú~j¼t“h?g        i    (   g        g        (+   R   R   Ry   R   RS   Rz   R{   RR   t	   transformR#   t   floorR    R$   R!   R   R   t   xdxt   ydxt   xdyt   ydyRN   R_   R   R   R‚   Rƒ   R„   R…   R†   RŠ   t   pygame_surfaceRY   RZ   R   R   t	   draw_funcR[   R   R‰   Rˆ   R‹   RO   R‡   (-   Rk   R   Rj   RŽ   R   RO   Rˆ   R‹   R(   R)   R‘   R’   R“   R”   Rn   Ro   R3   R4   R5   R6   t   x2t   y2t   x3t   y3t   minxt   maxxt   minyt   maxyt   cxt   cyRY   RZ   Rœ   R   Rž   RŸ   Rl   Rm   R    R¡   R¢   R£   R¤   t   child_forwardt   child_reverse(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyRŠ   ó  s¶    	
""""				0 	#
	!(			c         C  s¿   d } } |  j  ƒ  | | | |  j | |  j f } t d } t | | |  | | t ƒ | j | ƒ \ } } | d k r| g  S| \ }	 }
 } } | j j	 | ƒ } t | d |  |	 |
 t ƒ | S(   sC   
    Draws the render produced by render_screen to the screen.
    i    N(
   t	   is_opaqueRY   RZ   t   clippersRŒ   R   RG   R   t   windowRN   (   t   screen_renderR%   t   swdrawt   yoffsett   xoffsetR   t   clippert   cliprectRF   Rl   Rm   t   _wt   _hRk   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   do_draw_screen‡  s    

 
t   SWDrawc           B  s  e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s@   
    This uses the software renderer to draw to the screen.
    c         C  s   d  |  _ |  j ƒ  d  S(   N(   R   t   display_infot   reset(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyR   §  s    	c         C  sá   t  |  _ d |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _	 i d d 6t  d 6t  d 6|  _
 t j j ƒ  t j j j ƒ  |  j d  k r§ t j j ƒ  |  _ n  d |  _ d t j k |  _ d  |  _ d  |  _ t  |  _ d  S(   Ni    R(   t   renderert	   resizablet   additiveg      ð?t   RENPY_SCALE_FAST(   R   t   suppressed_blitt
   next_frameR   t   mouse_locationt   mouse_backingt   mouse_backing_post
   mouse_infot   mouse_old_visiblet   fullscreen_surfacet   infoRK   RS   t   initR   Rƒ   t	   post_initRÆ   t   get_infot   scale_factort   ost   environt
   scale_fastR   R»   t   showing_video(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyRÇ   ¬  s$    											c         C  s   d S(   Ni    (   i    i    (    (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   get_texture_sizeÙ  s    c         C  sà  t  j j j ƒ  |  j ƒ  | \ } } |  j j } |  j j } | s[ | d 8} | d 8} n  t d | | d | | d ƒ } d t	 j
 k r¢ t t	 j
 d ƒ } n  | |  _ | r½ t j }	 n d }	 t | | ƒ }
 t | | ƒ } t j j |
 | f |	 d ƒ |  _ | d k r(t | | t ƒ |  _ n |  j |  _ t  j j j ƒ  d |  _ t  j j j |  j d d |  j ƒ |  _ t  j j j d |  j d d d |  j ƒ |  _ t |  _ |  j |  _ d  |  _ d  |  _  d  |  _! d  |  _" t S(   Nif   g      ð?t   RENPY_SCALE_FACTORi    i    (#   R   RS   Rƒ   t   kill_textures_and_surfacesRÇ   RÆ   t	   current_wt	   current_hR    RÙ   RÚ   t   floatRØ   RK   t
   FULLSCREENR"   t   set_modeR   RQ   R   R»   t   pgrendert   set_rgba_maskst   draw_per_virtRz   t   Matrix2Dt   virt_to_drawt   draw_to_virtR%   RÓ   R   RÎ   RÏ   RÐ   RÑ   (   R   t   virtual_sizet   physical_sizeR+   RY   RZ   R   R   RØ   t   fsflagt   scaled_widtht   scaled_height(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyRä   Ü  s@    

"	!	'/					c         C  sÅ   | |  _  | |  _ | \ } } } | \ } } | j ƒ  \ } }	 | | }
 | | } |
 | f |  _ t | |	 t ƒ |  _ |  j j |  j d |
 | | |	 f ƒ |  j	 j | |
 | f ƒ |
 | | |	 f S(   s+   
        Actually shows the mouse.
        i    (   i    i    (
   RÎ   RÑ   RR   RÐ   RQ   R   RÏ   Rb   R»   R   (   R   t   posRÔ   t   mxot   myot   text   mxt   myt   mwt   mht   bxt   by(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt
   show_mouse  s    		

%c         C  sT   |  j  j ƒ  } |  j j |  j  |  j ƒ |  j | } d |  _  d |  _ d |  _ | S(   s+   
        Actually hides the mouse.
        N(   RÏ   RR   R   Rb   RÐ   R   RÎ   (   R   t   sizeRP   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt
   hide_mouse3  s    			c   	      C  s  t  j j j ƒ  \ } } } } |  j | k rI t j j | ƒ | |  _ n  |  j rV g  S| se d } n  | | | f } t j j
 ƒ  } | |  j k r« | r« | |  j k r« g  Sg  } |  j rÐ | j |  j ƒ  ƒ n  | r| rt  j j j r| j |  j | | ƒ ƒ n  | S(   sÚ   
        This draws the mouse to the screen, if necessary. It uses the
        buffer to minimize the amount of the screen that needs to be
        drawn, and only redraws if the mouse has actually been moved.
        N(   R   t   gameRƒ   t   get_mouse_infoRÒ   RK   t   mouset   set_visibleRÌ   R   t   get_posRÎ   RÑ   R   Rü   t   mouse_focusedRú   (	   R   Rú   t   hardwareRl   Rm   Ró   RÔ   Rð   RF   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt
   draw_mouseD  s$    		$	c         C  s$   | |  j  :} | |  j  :} | | f S(   N(   RØ   (   R   Rl   Rm   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   translate_pointi  s    c         C  s$   | |  j  9} | |  j  9} | | f S(   N(   RØ   (   R   Rl   Rm   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   untranslate_pointn  s    c         C  s,   |  j  t ƒ } | r( t j j | ƒ n  d S(   s?   
        Draws the mouse, and then updates the screen.
        N(   R  R   RK   RS   R   (   R   RF   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   update_mouses  s    c         C  sE   t  | d t j j ƒ  ƒ \ } } | |  j :} | |  j :} | | f S(   NRð   (   t   getattrRK   Rÿ   R  RØ   (   R   t   evRl   Rm   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   mouse_event}  s    !c         C  s9   t  j j ƒ  \ } } | |  j :} | |  j :} | | f S(   N(   RK   Rÿ   R  RØ   (   R   Rl   Rm   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   get_mouse_pos…  s    c         C  s0   | |  j  9} | |  j  9} t j j | | g ƒ S(   N(   RØ   RK   Rÿ   t   set_pos(   R   Rl   Rm   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   set_mouse_pos  s    c         C  s   |  j  S(   sC   
        Returns a pygame surface containing a screenshot.
        (   R»   (   R   t   surftreet   fullscreen_video(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt
   screenshot”  s    c         C  s   t  S(   N(   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt	   can_block›  s    c         C  s   | s
 t  St j j } | d k r& t S|  j } t j j	 ƒ  } d | } | | | k ra | } n  | | k  rx | rx t  S| | } | |  _ t S(   sN   
        Uses the framerate to determine if we can and should redraw.
        g     @@N(
   R   R   R   t	   framerateR   R   RÍ   RK   t   timet	   get_ticks(   R   t   needs_redrawt
   first_passR  R  RÍ   t   nowt	   frametime(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   should_redrawž  s    	
	
	c         C  s™  | r| |  j  s" |  j j d ƒ n  |  j j ƒ  \ } } t j j j d | | ƒ } | d k	 rg | } n  t	 |  _
 t	 |  _  n	 t |  _  g  } | j |  j t ƒ ƒ t | |  j
 |  ƒ } | rÌ | j | ƒ n  t |  _
 |  j |  j k r| j |  j t	 ƒ ƒ t j j | ƒ ns |  j rAt j j |  j |  j j ƒ  |  j ƒ n( t j j j |  j |  j j ƒ  |  j ƒ |  j t	 ƒ t j j ƒ  | r•t	 |  _
 n  d S(   s#   
        Draws the screen.
        i    iÿ   t   movieN(   i    i    i    iÿ   (   RÜ   R»   t   fillRR   R   RS   t   videot   render_movieR   R   R%   R   t   extendR  RÄ   R   RK   R   RÛ   R¥   t   scalet   smoothscalet   flip(   R   R  R  R;   R<   t   frameRF   t   damage(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   draw_screenÂ  s4    						((c         C  s5   t  | j | j | ƒ } t | d  | d d t ƒ | S(   Ni    (   RQ   RY   RZ   RŒ   R   R   (   R   Rz   RO   RP   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyR]   õ  s    c         C  s·  | j  t k rW |  j | j d d | | ƒ } |  j | j d d | | ƒ } | | S| d k  s | d k  s | | j k s | | j k r‘ d Sx| j D]\ } } } }	 }
 | | } | | } | j rë | j j | | ƒ \ } } n  t | t	 j
 j j ƒ r|  j | | | ƒ r¯t Sq› t | ƒ } t | ƒ } | d k  sO| d k  rSt S| j ƒ  \ } } | | k s}| | k rt S| j ƒ  d s«| j | | f ƒ d r› t Sq› Wt S(   Ni    i   i   (   R[   R   t   is_pixel_opaqueR‰   RY   RZ   Rˆ   R¥   Ry   R   RS   Rz   R{   R   R"   R   RR   Rg   t   get_at(   R   Rj   Rl   Rm   t   a0t   a2R    RŽ   R   R£   R¤   Rµ   R¶   t   cwt   ch(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyR%  ü  s0      6

	*c         C  sA   x$ t  D] } | j j t | ƒ ƒ q W| t k r= t | =n  d S(   sH   
        Called to indicate that the given surface has changed.
        N(   Rº   R   R   R   R|   (   R   RV   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   mutated_surface'  s    c         C  sW   | t  k r t  | St | ƒ } | s< | j d t j ƒ n  |  j | ƒ | t  | <| S(   sÀ   
        Creates a texture from the surface. In the software implementation,
        the only difference between a texture and a surface is that a texture
        is in the RLE cache.
        iÿ   (   R|   RW   t	   set_alphaRK   t   RLEACCELR+  (   R   RV   t	   transientt   rle_surf(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   load_texture2  s    
c         C  s   t  S(   N(   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   ready_one_textureF  s    c         C  s`   t  | d | d t ƒ } | j | ƒ |  j | ƒ | j d d | | f ƒ } |  j | ƒ | S(   sC   
        Creates a texture filled to the edges with color.
        i   i   (   RQ   R   R  R+  RN   (   R   R;   R<   t   colorRV   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   solid_textureI  s    c         C  s   t  j ƒ  d S(   s"   
        Frees up memory.
        N(   R|   t   clear(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   free_memoryW  s    c         C  s   t  j j j ƒ  d S(   s.   
        Called when we're restarted.
        N(   R   RS   Rz   R5  (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   deinit^  s    c         C  s   t  j j ƒ  d S(   s0   
        Shuts down the drawing system.
        N(   RK   RS   t   quit(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyR7  g  s    c         C  s   t  j d ƒ d S(   s@   
        Wait a little bit so the CPU doesn't speed up.
        g-Cëâ6?N(   R  t   sleep(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   event_peek_sleepp  s    c         C  s   t  j j t  j j f S(   sE   
        Return the physical width and height of the screen.
        (   R   R   R   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   get_physical_sizew  s    (    RH   RI   RJ   R   RÇ   RÝ   Rä   Rú   Rü   R  R  R  R  R
  R  R  R  R  R  R$  R]   R%  R+  R   R0  R1  R3  R5  R6  R7  R9  R:  (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyRÅ   ¢  s:   		-		>			%			
						$	3		+									(   t
   __future__R    t   renpy.displayR   t   pygame_sdl2RK   R#   t   weakrefR  RÙ   t   renpy.display.renderR   R   R   R   R   R   t   WeakKeyDictionaryR|   t   objectR   Rº   RQ   RW   Rx   RŒ   RŠ   RÄ   RÅ   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\swdraw.pyt   <module>   s"   .É			R	š	”	