{#-
diff --git a/docs/reST/themes/classic/static/pygame.css_t b/docs/reST/themes/classic/static/pygame.css_t
index ba7c3b7228..e3fe6f545d 100644
--- a/docs/reST/themes/classic/static/pygame.css_t
+++ b/docs/reST/themes/classic/static/pygame.css_t
@@ -73,12 +73,29 @@ div.highlight-python.notranslate {
/* -- page layout ----------------------------------------------------------- */
body {
- font-family: {{ theme_bodyfont }};
color: {{ theme_textcolor }};
font-style: normal;
+ font-family: {{ theme_bodyfont }};
+ background-color: {{ theme_dark_bgcolor2 }};
text-decoration: none;
text-align: left;
border-style: none;
+ min-height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+html {
+ background-color: {{ theme_bgcolor }};
+ height: 100vh;
+}
+html.dark-theme {
+ background-color: {{ theme_dark_bgcolor }};
+}
+html.dark-theme body {
+ color: {{ theme_dark_textcolor }};
+}
+html:has(body.dark-theme) {
+ background-color: {{ theme_dark_bgcolor }};
}
div.header {
@@ -91,7 +108,10 @@ div.header > div {
border-collapse: collapse;
background-color: {{ theme_headerbgcolor }};
}
-
+.dark-theme div.header > div {
+ background-color: {{ theme_dark_headerbgcolor }};
+ border: {{ theme_dark_headerborder }};
+}
div.header .logo {
background-color: {{ theme_logobgcolor }};
padding: 0.3em;
@@ -101,7 +121,10 @@ div.header .logo {
justify-content: center;
flex-direction: column;
}
-
+.dark-theme div.header .logo {
+ background-color: {{ theme_dark_logobgcolor }};
+ border: none;
+}
div.header .logo img {
min-width: 200px;
min-height: 60px;
@@ -128,14 +151,137 @@ div.header p.bottom {
div.header .pagelinks a {
text-decoration: underline;
}
+.dark-theme div.header .pagelinks a {
+ text-decoration: none;
+}
div.header .pagelinks a:hover {
text-decoration: none;
}
+.dark-theme div.header .pagelinks a:hover {
+ text-decoration: underline;
+}
+
+.pagelinks .top a {
+ color: {{ theme_linkcolor }};
+ font-weight: 400;
+}
+.dark-theme .pagelinks .top a {
+ color: {{ theme_dark_linkcolor }};
+ font-size: 1.1rem;
+ font-weight: 600;
+}
+
+.pagelinks .bottom a {
+ font-weight: 400;
+ color: {{ theme_linkcolor2 }};
+}
+.dark-theme .pagelinks .bottom a {
+ color: {{ theme_dark_linkcolor2 }};
+ font-size: 1.1rem;
+ font-weight: 600;
+}
+
+.dl .dt{
+ font-size: 1.1rem;
+ font-weight: 600;
+ color: {{ theme_linkcolor }};
+}
+.dark-theme .dl .dt{
+ color: {{ theme_dark_linkcolor }};
+}
+
+.pagelinks .top{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.pagelinks .top .nav-top-wrapper{
+ flex-grow: 1;
+}
+
+.pagelinks .bottom b{
+ color: {{ theme_headertitlecolor }};
+}
+.dark-theme .pagelinks .bottom b{
+ color: {{ theme_dark_headertitlecolor }};
+}
+
+input[type="text"]{
+ background-color: {{ theme_searchbarbgcolor }};
+ color: {{ theme_searchbartextcolor }};
+ font-size: 1rem;
+}
+.dark-theme input[type="text"]{
+ background-color: {{ theme_dark_searchbarbgcolor }};
+ color: {{ theme_dark_searchbartextcolor }};
+ border-radius: {{ theme_searchbarborderradius }};
+ border: none;
+ padding: 0.3rem;
+}
+
+input[type="text"]:focus{
+ background-color: {{ theme_searchbarbgcolor }};
+}
+.dark-theme input[type="text"]:focus{
+ background-color: {{ theme_dark_searchbarbgcolor }};
+}
+
+
+input[type="submit"]{
+ display: none;
+}
+
+.searchbar-form{
+ display: flex;
+ justify-content: space-between;
+ gap: 0.5rem;
+ justify-content: flex-end;
+}
+
+.searchbar-button{
+ background-color: transparent;
+ width: 24px;
+ position: relative;
+ top: 5px;
+ /* fill: {{ theme_searchbarcolor }}; */
+ cursor: pointer;
+}
+/*
+.dark-theme .searchbar-button{
+ fill: {{ theme_dark_searchbarcolor }};
+}
+*/
div.document {
background-color: {{ theme_bgcolor }};
overflow: hidden;
+ flex-grow: 1
+}
+.dark-theme div.document {
+ background-color: {{ theme_dark_bgcolor }};
+}
+
+.theme-icon {
+ cursor: pointer;
+ position: relative;
+ top: 2px;
+}
+/* Ignore this, gets rid of minor positionaning difference*/
+.theme-icon[data-theme="light-theme"] {
+ transform: translate(0, 2px);
+}
+.theme-icon[data-theme="dark-theme"] {
+ transform: translate(-4px, 2px);
+}
+
+/* Show the items when they are the same theme and not a theme-change icon */
+.light-theme *[data-theme="dark-theme"]{
+ display: none;
+}
+.dark-theme *[data-theme="light-theme"]{
+ display: none;
}
.flex-container {
@@ -143,6 +289,13 @@ div.document {
flex-direction: row;
}
+@media only screen and (max-width: 900px) {
+ .pagelinks .top{
+ flex-direction: column;
+ gap: 1rem;
+ }
+}
+
@media only screen and (max-width: 680px) {
.flex-container {
flex-direction: column;
@@ -150,7 +303,6 @@ div.document {
div.header .logo {
border-right: none;
- border-bottom: 3px solid black;
}
}
@@ -218,13 +370,19 @@ div.related {
background-color: {{ theme_relbarbgcolor }};
line-height: 30px;
color: {{ theme_relbartextcolor }};
- border-top: 3px solid black;
- border-bottom: 3px solid black;
+ font-size: 1rem;
+}
+.dark-theme div.related {
+ background-color: {{ theme_dark_relbarbgcolor }};
+ color: {{ theme_dark_relbartextcolor }};
}
div.related a {
color: {{ theme_relbarlinkcolor }};
}
+.dark-theme div.related a {
+ color: {{ theme_dark_relbarlinkcolor }};
+}
div.sphinxsidebar {
{%- if theme_stickysidebar|tobool %}
@@ -292,16 +450,26 @@ div.sphinxsidebar input {
/* -- body styles ----------------------------------------------------------- */
a {
- color: {{ theme_linkcolor }};
background-color: transparent;
text-decoration: underline;
+ color: {{ theme_linkcolor2 }};
+ font-size: 1rem;
+}
+.dark-theme a {
+ color: {{ theme_dark_linkcolor2 }};
+ text-decoration: none;
+ font-weight: 600;
}
a:hover {
- color: {{ theme_linkcolor }};
+ color: {{ theme_linkcolor2 }};
background-color: transparent;
text-decoration: none;
}
+.dark-theme a:hover {
+ color: {{ theme_dark_linkcolor2 }};
+ text-decoration: underline;
+}
p {
margin: 0.5em 0;
@@ -354,6 +522,80 @@ span.signature {
span.pre {
font-family: 'consolas', monospace;
+ color: {{ theme_cli }};
+}
+.dark-theme span.pre {
+ color: {{ theme_dark_cli }};
+}
+
+a.reference.internal span.pre {
+ color: {{ theme_linkcolor2 }};
+}
+.dark-theme a.reference.internal span.pre {
+ color: {{ theme_dark_linkcolor2 }};
+}
+
+a.tooltip.reference.internal span.pre {
+ color: {{ theme_cli }};
+}
+.dark-theme a.tooltip.reference.internal span.pre {
+ color: {{ theme_dark_cli }};
+}
+
+dt code span.pre {
+ color: {{ theme_h1color }};
+}
+.dark-theme dt code span.pre {
+ color: {{ theme_dark_h1color }};
+}
+.dark-theme dt.title code span.pre {
+ color: {{ theme_dark_h1color }};
+ font-size: 1.8rem;
+}
+
+/* Not sure if I need to enable this
+dt code {
+ background-color: transparent;
+}
+*/
+.dark-theme dt code {
+ background-color: transparent;
+}
+
+.highlight .o{
+ color: {{ theme_codedot }};
+}
+.dark-theme .highlight .o{
+ color: {{ theme_dark_codedot }};
+}
+
+.highlight .c1{
+ color: {{ theme_codecomment }};
+}
+.dark-theme .highlight .c1{
+ color: {{ theme_dark_codecomment }};
+}
+
+.highlight .kn, .highlight .k{
+ color: {{ theme_codekeyword }};
+}
+.dark-theme .highlight .kn, .dark-theme .highlight .k{
+ color: {{ theme_dark_codekeyword }};
+}
+
+.highlight .n{
+ color: {{ theme_codetextcolor }};
+}
+.dark-theme .highlight .n{
+ color: {{ theme_dark_codetextcolor }};
+}
+
+/* Doc strings */
+.highlight .sd{
+ color: {{ theme_codecomment }};
+}
+.dark-theme .highlight .sd{
+ color: {{ theme_dark_codecomment }};
}
code.download span.pre {
@@ -380,6 +622,8 @@ div.body h6 {
font-weight: bold;
margin: 1em 0 0.5em;
text-align: left;
+ display: flex;
+ justify-content: center;
}
div.body h6 {
@@ -390,8 +634,19 @@ div.body h6 {
line-height: 130%;
}
-div.body h1 { font-size: 1.5em; }
-div.body h2 { font-size: 1.4em; }
+div.body h1 {
+ font-size: 1.5em; color: {{ theme_h1color }};
+}
+.dark-theme div.body h1 {
+ color: {{ theme_dark_h1color }};
+}
+div.body h2 {
+ font-size: 1.4em;
+ color: {{ theme_h2color }};
+}
+.dark-theme div.body h2 {
+ color: {{ theme_dark_h2color }};
+}
div.body h3 { font-size: 1.3em; }
div.body h4 { font-size: 1.2em; }
div.body h5 { font-size: 1.1em; }
@@ -403,11 +658,18 @@ a.headerlink {
padding: 0 4px 0 4px;
text-decoration: none;
}
+.dark-theme a.headerlink {
+ color: {{ theme_dark_headlinkcolor }};
+}
a.headerlink:hover {
background-color: {{ theme_headlinkcolor }};
color: white;
}
+.dark-theme a.headerlink:hover {
+ background-color: {{ theme_dark_headlinkcolor }};
+ color: white;
+}
blockquote {
margin-left: 2em;
@@ -469,8 +731,9 @@ div.caution {
}
div.warning {
- background-color: #ffe4e4;
+ background-color: #ffaec4;
border: 1px solid #f66;
+ color: #000;
}
.warning tt {
@@ -487,20 +750,32 @@ p.linklist {
dt:target,
span.highlighted {
background-color: {{ theme_highlightbgcolor }};
+ padding-left: 0.4rem;
+}
+.dark-theme .section:target > h2,
+.dark-theme .section:target > h3,
+.dark-theme .section:target > h4,
+.dark-theme dt:target,
+.dark-theme span.highlighted {
+ background-color: {{ theme_dark_highlightbgcolor }};
+ padding-left: 0.4rem;
}
-code{
+code {
border-radius: 0.25em;
padding: 0 0.2em 0;
background-color: {{ theme_codebgcolor }};
}
+.dark-theme code {
+ background-color: {{ theme_dark_codebgcolor }};
+}
pre {
background-color: {{ theme_codebgcolor }};
border: 1px solid #ac9;
border-left: none;
border-right: none;
- color: #333333;
+ color: {{ theme_codetextcolor }};
display: block;
font-family: 'consolas', monospace;
line-height: 120%;
@@ -508,6 +783,10 @@ pre {
padding: 5px 5px 5px 15px;
text-align: justify;
}
+.dark-theme pre {
+ background-color: {{ theme_dark_codebgcolor }};
+ color: {{ theme_dark_codetextcolor }};
+}
div.highlight pre {
border: none;
@@ -602,7 +881,6 @@ div.body span.codelineref {
.py-class .pre,
.reference.internal em {
font-weight: bold;
- background-color: {{ theme_keywordbgcolor }};
}
span.linenos {
@@ -638,6 +916,10 @@ div.example div.break {
a.tooltip {
text-decoration: underline;
+ color: {{ theme_tooltipcolor }};
+}
+.dark-theme a.tooltip {
+ color: {{ theme_dark_tooltipcolor }};
}
a.tooltip:hover {
@@ -656,6 +938,10 @@ a.tooltip:hover {
-webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
}
+.dark-theme .tooltip-content {
+ background-color: {{ theme_dark_tooltipbgcolor }};
+ border: 1px solid {{ theme_dark_tooltipbdrcolor }};
+}
/* -- comments style --------------------------------------------------------- */
diff --git a/docs/reST/themes/classic/theme.conf b/docs/reST/themes/classic/theme.conf
index e68d25ba3c..9532cdebee 100644
--- a/docs/reST/themes/classic/theme.conf
+++ b/docs/reST/themes/classic/theme.conf
@@ -1,46 +1,99 @@
[theme]
-inherit = basic
-stylesheet = pygame.css
-pygments_style = sphinx
+inherit = basic
+stylesheet = pygame.css
+pygments_style = sphinx
[options]
-home_uri = ''
-embedded = true
-nosidebar = true
-nofooter = true
-relbar = false
-noheader = false
-noheading = false
-notableofcontents = false
-
-footerbgcolor = #11303d
-footertextcolor = #000000
-sidebarbgcolor = #1c4e63
-sidebartextcolor = #ffffff
-sidebarlinkcolor = #98dbcc
-relbarbgcolor = #6aee28
-relbartextcolor = #000000
-relbarlinkcolor = #000000
-bgcolor = #aaeebb
-textcolor = #000000
-headbgcolor = #f2f2f2
-headtextcolor = #20435c
-headlinkcolor = #68698b
-linkcolor = #000000
-codebgcolor = #eeffcc
-codetextcolor = #333333
-cautionbgcolor = #eeffcc
-notebgcolor = #eeeeee
-highlightbgcolor = #c7c695
-headerbgcolor = #6aee28
-logobgcolor = #c2fc20
-keywordbgcolor = #90ee90
-examplebgcolor = #6aee28
-tooltipbgcolor = #c2fc20
-tooltipbdrcolor = #ace01C
-
-headerborder = 3px solid black
-
-bodyfont = sans-serif
-headfont = sans-serif
-sigfont = monospace
+home_uri = ''
+embedded = true
+nosidebar = true
+nofooter = true
+relbar = false
+noheader = false
+noheading = false
+notableofcontents = false
+
+footerbgcolor = #11303d
+footertextcolor = #000000
+sidebarbgcolor = #1c4e63
+sidebartextcolor = #ffffff
+sidebarlinkcolor = #98dbcc
+
+dark_relbarbgcolor = #141414
+dark_relbartextcolor = #00ba10
+dark_relbarlinkcolor = #00ba10
+dark_bgcolor = #1E1E1E
+dark_bgcolor2 = #141414
+dark_textcolor = #EEEEEE
+dark_headbgcolor = #f2f2f2
+dark_headtextcolor = #20435c
+dark_headlinkcolor = #68698b
+dark_linkcolor = #EEEEEE
+dark_linkcolor2 = #2288ec
+dark_codebgcolor = #141414
+dark_codetextcolor = #CBCBCB
+dark_cli = #00ba10
+dark_codedot = #D4D4D4
+dark_codecomment = #169d00
+dark_codeword = #85E5FF
+dark_codekeyword = #DE6C90
+dark_highlightbgcolor = #0E5114
+dark_logobgcolor = transparent
+dark_tooltipcolor = #00ba10
+dark_tooltipbgcolor = #141414
+dark_tooltipbdrcolor = #00ba10
+dark_searchbarbgcolor = #292929
+dark_searchbarborderradius = 11px
+dark_searchbartextcolor = #EEEEEE
+dark_headerborder = none
+dark_headerbgcolor = #141414
+dark_headertitlecolor = #00ba10
+dark_headerlogoborder = #00ba10
+dark_h1color = #e1cd62
+dark_h2color = #00b800
+
+relbarbgcolor = #6aee28
+relbartextcolor = #000000
+relbarlinkcolor = #000000
+
+bgcolor = #aaeebb
+textcolor = #000000
+
+headbgcolor = #f2f2f2
+headtextcolor = #20435c
+headlinkcolor = #68698b
+
+linkcolor = #000000
+linkcolor2 = #000000
+codebgcolor = #eeffcc
+codetextcolor = #333333
+cli = #000000
+codedot = #D4D4D4
+codecomment = #169d00
+codeword = #85E5FF
+codekeyword = #DE6C90
+
+cautionbgcolor = #eeffcc
+notebgcolor = #eeeeee
+
+highlightbgcolor = #c7c695
+logobgcolor = #c2fc20
+
+keywordbgcolor = #90ee90
+examplebgcolor = #6aee28
+
+tooltipcolor = #000000
+tooltipbgcolor = #c2fc20
+tooltipbdrcolor = #ace01C
+searchbarbgcolor = #ffffff
+searchbartextcolor = #000000
+headerborder = 3px solid black
+headerbgcolor = #6aee28
+headertitlecolor = #000000
+headerlogoborder = #00ba10
+h1color = #000000
+h2color = #000000
+
+bodyfont = sans-serif
+headfont = sans-serif
+sigfont = monospace
diff --git a/docs/reST/tutorials/en/chimp-explanation.rst b/docs/reST/tutorials/en/chimp-explanation.rst
index b0532f094b..30633976a7 100644
--- a/docs/reST/tutorials/en/chimp-explanation.rst
+++ b/docs/reST/tutorials/en/chimp-explanation.rst
@@ -63,11 +63,11 @@ It also checks for the availability of some of the optional pygame modules. ::
# Import Modules
import os
- import pygame as pg
+ import pygame
- if not pg.font:
+ if not pygame.font:
print("Warning, fonts disabled")
- if not pg.mixer:
+ if not pygame.mixer:
print("Warning, sound disabled")
main_dir = os.path.split(os.path.abspath(__file__))[0]
@@ -77,9 +77,7 @@ It also checks for the availability of some of the optional pygame modules. ::
First, we import the standard "os" python module. This allow
us to do things like create platform independent file paths.
-In the next line, we import the pygame package. In our case, we import
-pygame as ``pg``, so that all of the functionality of pygame is able to
-be referenced from the namespace ``pg``.
+In the next line, we import the pygame package.
Some pygame modules are optional, and if they aren't found,
they evaluate to ``False``. Because of that, we decide to print
@@ -102,17 +100,17 @@ look at each function individually in this section. ::
def load_image(name, colorkey=None, scale=1):
fullname = os.path.join(data_dir, name)
- image = pg.image.load(fullname)
+ image = pygame.image.load(fullname)
size = image.get_size()
size = (size[0] * scale, size[1] * scale)
- image = pg.transform.scale(image, size)
+ image = pygame.transform.scale(image, size)
image = image.convert()
if colorkey is not None:
if colorkey == -1:
colorkey = image.get_at((0, 0))
- image.set_colorkey(colorkey, pg.RLEACCEL)
+ image.set_colorkey(colorkey, pygame.RLEACCEL)
return image, image.get_rect()
@@ -148,11 +146,11 @@ that color for the colorkey. ::
def play(self):
pass
- if not pg.mixer or not pg.mixer.get_init():
+ if not pygame.mixer or not pygame.mixer.get_init():
return NoneSound()
fullname = os.path.join(data_dir, name)
- sound = pg.mixer.Sound(fullname)
+ sound = pygame.mixer.Sound(fullname)
return sound
@@ -175,18 +173,18 @@ Here we create two classes to represent the objects in our game. Almost
all the logic for the game goes into these two classes. We will look over
them one at a time here. ::
- class Fist(pg.sprite.Sprite):
+ class Fist(pygame.sprite.Sprite):
"""moves a clenched fist on the screen, following the mouse"""
def __init__(self):
- pg.sprite.Sprite.__init__(self) # call Sprite initializer
+ pygame.sprite.Sprite.__init__(self) # call Sprite initializer
self.image, self.rect = load_image("fist.png", -1)
self.fist_offset = (-235, -80)
self.punching = False
def update(self):
"""move the fist based on the mouse position"""
- pos = pg.mouse.get_pos()
+ pos = pygame.mouse.get_pos()
self.rect.topleft = pos
self.rect.move_ip(self.fist_offset)
if self.punching:
@@ -224,14 +222,14 @@ The following two functions `punch()` and `unpunch()` change the punching
state for the fist. The `punch()` method also returns a true value if the fist
is colliding with the given target sprite. ::
- class Chimp(pg.sprite.Sprite):
+ class Chimp(pygame.sprite.Sprite):
"""moves a monkey critter across the screen. it can spin the
monkey when it is punched."""
def __init__(self):
- pg.sprite.Sprite.__init__(self) # call Sprite initializer
+ pygame.sprite.Sprite.__init__(self) # call Sprite initializer
self.image, self.rect = load_image("chimp.png", -1, 4)
- screen = pg.display.get_surface()
+ screen = pygame.display.get_surface()
self.area = screen.get_rect()
self.rect.topleft = 10, 90
self.move = 18
@@ -251,7 +249,7 @@ is colliding with the given target sprite. ::
if self.rect.left < self.area.left or self.rect.right > self.area.right:
self.move = -self.move
newpos = self.rect.move((self.move, 0))
- self.image = pg.transform.flip(self.image, True, False)
+ self.image = pygame.transform.flip(self.image, True, False)
self.rect = newpos
def _spin(self):
@@ -262,7 +260,7 @@ is colliding with the given target sprite. ::
self.dizzy = False
self.image = self.original
else:
- rotate = pg.transform.rotate
+ rotate = pygame.transform.rotate
self.image = rotate(self.original, self.dizzy)
self.rect = self.image.get_rect(center=center)
@@ -321,10 +319,10 @@ Before we can do much with pygame, we need to make sure its modules
are initialized. In this case we will also open a simple graphics window.
Now we are in the `main()` function of the program, which actually runs everything. ::
- pg.init()
- screen = pg.display.set_mode((1280, 480), pg.SCALED)
- pg.display.set_caption("Monkey Fever")
- pg.mouse.set_visible(False)
+ pygame.init()
+ screen = pygame.display.set_mode((1280, 480), pygame.SCALED)
+ pygame.display.set_caption("Monkey Fever")
+ pygame.mouse.set_visible(False)
The first line to initialize *pygame* takes care of a bit of
work for us. It checks through the imported *pygame* modules and attempts
@@ -352,7 +350,7 @@ Our program is going to have text message in the background. It would
be nice for us to create a single surface to represent the background and
repeatedly use that. The first step is to create the surface. ::
- background = pg.Surface(screen.get_size())
+ background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((170, 238, 187))
@@ -373,8 +371,8 @@ Now that we have a background surface, lets get the text rendered to it. We
only do this if we see the :mod:`pygame.font` module has imported properly.
If not, we just skip this section. ::
- if pg.font:
- font = pg.font.Font(None, 64)
+ if pygame.font:
+ font = pygame.font.Font(None, 64)
text = font.render("Pummel The Chimp, And Win $$$", True, (10, 10, 10))
textpos = text.get_rect(centerx=background.get_width() / 2, y=10)
background.blit(text, textpos)
@@ -408,7 +406,7 @@ We still have a black window on the screen. Lets show our background
while we wait for the other resources to load. ::
screen.blit(background, (0, 0))
- pg.display.flip()
+ pygame.display.flip()
This will blit our entire background onto the display window. The
blit is self explanatory, but what about this flip routine?
@@ -430,8 +428,8 @@ Here we create all the objects that the game is going to need.
punch_sound = load_sound("punch.wav")
chimp = Chimp()
fist = Fist()
- allsprites = pg.sprite.RenderPlain((chimp, fist))
- clock = pg.time.Clock()
+ allsprites = pygame.sprite.RenderPlain((chimp, fist))
+ clock = pygame.time.Clock()
First we load two sound effects using the `load_sound` function we defined
above. Then we create an instance of each of our sprite classes. And lastly
@@ -473,18 +471,18 @@ Handle All Input Events
This is an extremely simple case of working the event queue. ::
- for event in pg.event.get():
- if event.type == pg.QUIT:
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT:
going = False
- elif event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE:
+ elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
going = False
- elif event.type == pg.MOUSEBUTTONDOWN:
+ elif event.type == pygame.MOUSEBUTTONDOWN:
if fist.punch(chimp):
punch_sound.play() # punch
chimp.punched()
else:
whiff_sound.play() # miss
- elif event.type == pg.MOUSEBUTTONUP:
+ elif event.type == pygame.MOUSEBUTTONUP:
fist.unpunch()
First we get all the available Events from pygame and loop through each
@@ -518,7 +516,7 @@ Now that all the objects are in the right place, time to draw them. ::
screen.blit(background, (0, 0))
allsprites.draw(screen)
- pg.display.flip()
+ pygame.display.flip()
The first blit call will draw the background onto the entire screen. This
erases everything we saw from the previous frame (slightly inefficient, but
@@ -534,8 +532,8 @@ Game Over
User has quit, time to clean up. ::
- pg.quit()
+ pygame.quit()
Cleaning up the running game in *pygame* is extremely simple.
Since all variables are automatically destructed, we don't really have to do
-anything, but calling `pg.quit()` explicitly cleans up pygame's internals.
+anything, but calling `pygame.quit()` explicitly cleans up pygame's internals.
diff --git a/docs/reST/tutorials/en/intro-to-camera.rst b/docs/reST/tutorials/en/intro-to-camera.rst
index 39dbee272e..771926990f 100644
--- a/docs/reST/tutorials/en/intro-to-camera.rst
+++ b/docs/reST/tutorials/en/intro-to-camera.rst
@@ -25,10 +25,10 @@ for the full API.
.. note::
As of Pygame 1.9, the camera module offers native support for cameras
- that use v4l2 on Linux. There is support for other platforms via Videocapture
- or OpenCV, but this guide will focus on the native module. Most of the code
- will be valid for other platforms, but certain things like controls will not
- work. The module is also marked as **EXPERIMENTAL**, meaning the API could
+ that use v4l2 on Linux. There is support for other platforms via OpenCV,
+ but this guide will focus on the native module. Most of the code will be
+ valid for other platforms, but certain things like controls will not work.
+ The module is also marked as **EXPERIMENTAL**, meaning the API could
change in subsequent versions.
diff --git a/docs/readmes/README.fa.rst b/docs/readmes/README.fa.rst
new file mode 100644
index 0000000000..6fad564b0d
--- /dev/null
+++ b/docs/readmes/README.fa.rst
@@ -0,0 +1,256 @@
+.. image:: https://raw.githubusercontent.com/pygame-community/pygame-ce/main/docs/reST/_static/pygame_logo.svg
+ :alt: pygame
+ :target: https://pyga.me/
+
+
+|DocsStatus|
+|PyPiVersion| |PyPiLicense|
+|Python3| |GithubCommits| |BlackFormatBadge|
+
+`English`_ `简体中文`_ `Français`_ **فارسی**
+---------------------------------------------------------------------------------------------------
+کتابخانه
+Pygame_
+برای توسعه دادن برنامه های چند رسانه ای
+مانند بازی های رایانه ای, به کار می رود.
+
+کتابخانه
+pygame به عنوان زیرساخت های اصلی خود از کتابخانه
+`Simple DirectMedia Layer library`_
+استفاده می کند.
+
+
+همچنین از کتابخانه های پرطرفدار و متعدد زیادی برای دسترسی
+به پرکاربرد ترین الگوریتم ها استفاده می کند,
+که در نتیجه این مسئله, فرایند تولید و توسعه برنامه
+با استفاده از کتابخانه pygame خلاقانه تر و آسان تر می شود.
+
+
+این توزیع با نام
+**'pygame - Community Edition'** ('pygame-ce' برای اختصار)
+شناخته می شود.
+
+این توزیع یک فورک از نسخه آپ استریم (نسخه اصلی) کتابخانه pygame می باشد
+که توسط مشارکت کنندگان (contributor) های سابق نسخه
+آپ استریم در حال توسعه و نگهداری هست,
+و بعد از رخ دادن چالش هایی حل نشدنی که همکاری در نسخه اصلی کتابخانه
+را غیر ممکن می کرد, برای اولین بار ساخته شد.
+
+این توزیع به عنوان اهداف خود, انتشار های سریع تر و بیشتر نسخه های پروژه, رفع ادامه دار باگ ها و بهینه سازی پروژه,
+و کنترل کردن فرایند توسعه پروژه به صورت دموکراتیک
+را مد نظر خود دارد.
+
+ما به مشارکت کننده (contributor) هایی که علاقه مند به همکاری با
+ما هستند خوش آمد میگوییم و از آنها به گرمی استقبال می کنیم!.
+
+
+
+روش نصب
+------------
+
+::
+
+ pip install pygame-ce
+
+
+Help (کمک و راهنمایی)
+----
+اگر به تازگی قصد یادگیری کتابخانه pygame را دارید, می توانید به سادگی
+این فرایند را آغاز کنید.
+آموزش ها و معرفی های زیادی از کتابخانه pygame در اینترنت موجود هست.
+همچنین اسناد ارجاعی کاملی برای این کتابخانه تهیه و تدوین شده است.
+می توانید با استفاده از این لینک
+`docs page`_
+به اسناد ارجاعی دسترسی داشته باشید.
+
+همچنین اگر کتابخانه pygame را نصب کرده اید می توانید با وارد کردن دستور
+
+``python -m pygame.docs``
+
+در فضای ترمینال یا کامند لاین سیستم عامل خود, به اسناد ارجاعی دسترسی داشته باشید.
+
+
+اسناد ارجاعی کتابخانه پس از هر بروزرسانی نسخه توسعه داده شده در مخزن
+pygame_ce_
+آپدیت می شوند.
+
+محتوای این اسناد ممکن است از نسخه ای از pygame که شما استفاده می کنید کمی جدید تر باشد.
+برای آپگرید کردن pygame خود به آخرین ورژن, دستور زیر را در فضای کامند لاین اجرا کنید.
+
+``pip install pygame-ce --upgrade``
+
+همچنین پوشه ی examples شامل تعداد زیادی از برنامه ها قابل اجرا هست که
+می توانید به سادگی با تغییر دادن آنها با قابلیت های کتابخانه آشنا بشوید.
+
+Building From Source (ساخت و اجرا با استفاده از سرس کد)
+--------------------
+
+اگر می خواهید از قابلیت هایی که در حال توسعه هستند و هنوز به آخرین نسخه پروژه اضافه
+نشده اند استفاده کنید, یا می خواهید در توسعه و نگه داری این پروژه مشارکت داشته باشید,
+به جای نصب کردن کتابخانه روی سیستم عامل خود با استفاده از pip,
+شما باید کتابخانه pygame را روی سیستم خود به صورت local بسازید (build بگیرید).
+
+نصب کردن کتابخانه با استفاده از سرس کد تا حد زیادی اتوماتیک شد است.
+اکثر کار هایی که در این فرایند انجام می شوند شامل کامپایل کردن و نصب کردن
+تمام وابستگی (dependency) های پاگیم می باشد.
+زمانی که این فرایند به پایان رسیده است, اسکریپت
+``setup.py``
+را اجرا کنید که تلاش میکند کتابخانه pygame را روی دستگاه شما پیکربندی (configure) و نصب کند.
+
+برای کسب اطلاعات بیشتر در رابطه با فرایند نصب کردن و کامپایل کردن, می توانید به صفحه
+`Compilation wiki page`_
+مراجعه کنید.
+
+
+Credits
+-------
+
+ما از تمام افرادی که در توسعه و نگه داری این پروژه اپن سرس
+با ما همکاری کرده اند سپاس گذاری می کنیم.
+
+همچنین قصد داریم تشکر ویژه ی خود را از افراد زیر اعلام کنیم.
+
+
+* Marcus Von Appen: many changes, and fixes, 1.7.1+ freebsd maintainer
+* Lenard Lindstrom: the 1.8+ windows maintainer, many changes, and fixes
+* Brian Fisher for svn auto builder, bug tracker and many contributions
+* Rene Dudfield: many changes, and fixes, 1.7+ release manager/maintainer
+* Phil Hassey for his work on the pygame.org website
+* DR0ID for his work on the sprite module
+* Richard Goedeken for his smoothscale function
+* Ulf Ekström for his pixel perfect collision detection code
+* Pete Shinners: original author
+* David Clark for filling the right-hand-man position
+* Ed Boraas and Francis Irving: Debian packages
+* Maxim Sobolev: FreeBSD packaging
+* Bob Ippolito: MacOS and OS X porting (much work!)
+* Jan Ekhol, Ray Kelm, and Peter Nicolai: putting up with early design ideas
+* Nat Pryce for starting our unit tests
+* Dan Richter for documentation work
+* TheCorruptor for his incredible logos and graphics
+* Nicholas Dudfield: many test improvements
+* Alex Folkner for pygame-ctypes
+
+
+از افراد زیر بابت ارسال patch ها و تصحیح اشکالات پروژه تشکر می کنیم:
+Niki Spahiev, Gordon
+Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman,
+Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen, Herve Cauwelier,
+James Mazer, Lalo Martins, Timothy Stranex, Chad Lester, Matthias
+Spiller, Bo Jangeborg, Dmitry Borisov, Campbell Barton, Diego Essaya,
+Eyal Lotem, Regis Desgroppes, Emmanuel Hainry, Randy Kaelber
+Matthew L Daniel, Nirav Patel, Forrest Voight, Charlie Nolan,
+Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine,
+Michael George, Saul Spatz, Thomas Ibbotson, Tom Rothamel, Evan Kroske,
+Cambell Barton.
+
+همچنین از افرادی که در پیدا کردن باگ های پروژه به ما کمک کرده اند نیز قدردانی ویژه داریم:
+Angus, Guillaume Proux, Frank
+Raiser, Austin Henry, Kaweh Kazemi, Arturo Aldama, Mike Mulcheck,
+Michael Benfield, David Lau
+
+
+هنوز افراد بسیار بیشتری هستند که در توسعه این پروژه به ما کمک کرده اند,
+ایده های جدیدی ارسال کرده اند, و نگه داری پروژه را ممکن ساخته اند.
+زحمات شما زندگی توسعه دهندگی ما را آسان تر کرده است. از شما متشکریم!
+
+از افرادی که در تهیه و تدوین اسناد ارجاعی در سایت pygame.org به ما کمک کرده اند متشکریم.
+
+از تمام افرادی که با ساخت بازی های و متعدد و ارسال کردن آنها
+در سایت pygame.org به دیگر کاربران جهت یادگیری و لذت بردن از آنها
+کمک کرده اند نیز تشکر ویژه ای داریم.
+
+تشکر های بسیاری نیز به Jame Paige بابت میزبانی کردن سرویس pygame در bugzilla بدهکاریم.
+
+
+همچنین از Roger Dingledine و تیم SEUL.ORG بابت
+میزبانی فوق العاده ای که بابت سایت pygame.org ارائه داده اند سپاس گذاری می کنیم.
+
+Dependencies (وابستگی ها)
+------------
+
+کتابخانه Pygame به وضوح به کتابخانه SDL و زبان Python وابسته است.
+همچنین به چندین کتابخانه کوچکتر دیگر نیز لینک میشود و از آنها استفاده میکند.
+ماژول فونت به کتابخانه SDL_ttf تکیه می کند که خود نیز به freetype وابسته است.
+ماژول mixer و mixer.music هم به کتابخانه SDL_mixer وابستگی دارند.
+
+ماژول image به SDL_image که می تواند به libjpeg و libpng وابستگی داشته باشد تکیه می کند.
+ماژول transform نیز از نسخه ای جاسازی شده از SDL_rotozoom برای فانکش rotozoom خود استفاده می کند.
+
+ماژول surfarray نیز از پکیج NumPy در زبان پایتون, برای پردازش آرایه های چندبعدی عددی خود
+استفاده می کند.
+
+
+
+در لیست زیر می توانید نسخه های دقیق هر یک از وابستگی های مورد نیاز را
+مشاهده کنید.
+
++----------+------------------------+
+| CPython | >= 3.7 (Or use PyPy3) |
++----------+------------------------+
+| SDL | >= 2.0.8 |
++----------+------------------------+
+| SDL_mixer| >= 2.0.0 |
++----------+------------------------+
+| SDL_image| >= 2.0.2 |
++----------+------------------------+
+| SDL_ttf | >= 2.0.11 |
++----------+------------------------+
+| SDL_gfx | (Optional, vendored in)|
++----------+------------------------+
+| NumPy | >= 1.6.2 (Optional) |
++----------+------------------------+
+
+
+
+License
+-------
+این کتابخانه با استفاده از
+`GNU LGPL version 2.1`_
+لایسنس شده است که در فایل
+``docs/LDGP.txt``
+قابل دسترس هست.
+ما حق تغییر دادن این لایسنس را در نسخه های آینده این کتابخانه رزرو می کنیم.
+
+این مسئله در اختصار به این معنی است که شما می توانید از کتابخانه pygame در
+تمام پروژه های خود استفاده کنید. اما اگر تغییری در سرس کد pygame ایجاد کنید,
+آن تغییرات باید با لایسنسی که با لایسنس pygame سازگار است منتشر شوند. (ترجیحا
+ارجاع داده شده به pygame).
+انتشار بازی هایی که متن بسته و بازی هایی که منجر به درآمد زایی می شوند مجاز است.
+
+تمام برنامه های داخل پوشه
+``examples``
+شامل اموال عمومی (public domain) می شوند.
+
+برای اطلاعات بیشتر در مورد لایسنس هر وابستگی (dependency),
+فایل docs/licenses را مشاهده کنید.
+
+
+.. |PyPiVersion| image:: https://img.shields.io/pypi/v/pygame-ce.svg?v=1
+ :target: https://pypi.python.org/pypi/pygame-ce
+
+.. |PyPiLicense| image:: https://img.shields.io/pypi/l/pygame-ce.svg?v=1
+ :target: https://pypi.python.org/pypi/pygame-ce
+
+.. |Python3| image:: https://img.shields.io/badge/python-3-blue.svg?v=1
+
+.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.3.0.svg
+ :target: https://github.com/pygame-community/pygame-ce/compare/2.3.0...main
+
+.. |DocsStatus| image:: https://img.shields.io/website?down_message=offline&label=docs&up_message=online&url=https%3A%2F%2Fpyga.me%2Fdocs%2F
+ :target: https://pyga.me/docs/
+
+.. |BlackFormatBadge| image:: https://img.shields.io/badge/code%20style-black-000000.svg
+ :target: https://github.com/psf/black
+
+.. _pygame: https://pyga.me
+.. _Simple DirectMedia Layer library: https://www.libsdl.org
+.. _We need your help: https://www.pygame.org/contribute.html
+.. _Compilation wiki page: https://github.com/pygame-community/pygame-ce/wiki#compiling
+.. _docs page: https://pyga.me/docs
+.. _GNU LGPL version 2.1: https://www.gnu.org/copyleft/lesser.html
+.. _pygame_ce: https://github.com/pygame-community/pygame-ce
+
+.. _English: ./../../README.rst
+.. _简体中文: README.zh-cn.rst
+.. _Français: README.fr.rst
diff --git a/docs/readmes/README.fr.rst b/docs/readmes/README.fr.rst
index fd494825dd..c4e03763bb 100644
--- a/docs/readmes/README.fr.rst
+++ b/docs/readmes/README.fr.rst
@@ -7,21 +7,21 @@
|PyPiVersion| |PyPiLicense|
|Python3| |GithubCommits| |BlackFormatBadge|
-`English`_ `简体中文`_ **Français**
+`English`_ `简体中文`_ **Français** `فارسی`_
---------------------------------------------------------------------------------------------------
-Pygame est une librarie multi-plateforme, libre et open-source
+Pygame est une bibliothèque multi-plateforme, libre et open-source
permettant de développer des applications multimédias comme des jeux-vidéos, avec Python.
-Il utilise la librarie "Simple DirectMedia Layer (SDL)" et plusieurs autres libraries
-populaires pour abstraire les fonctions les plus courantes et rendre l'écriture de programmes
+Il utilise la bibliiothèque « `Simple DirectMedia Layer`_ » (SDL) et plusieurs autres bibliothèque
+populaires pour abstraire les fonctions les plus courantes et rendre l’écriture de programmes
le plus intuitive possible.
-Cette distribution se nomme **'pygame - Community Edition'** ('pygame-ce' pour faire plus court).
+Cette distribution se nomme **« pygame - Community Edition »** (abrégé « pygame-ce »).
Ceci est un fork du projet initial par ses principaux anciens développeurs,
il a été créé à cause de plusieurs obstacles impossibles à franchir, les empêchant de continuer
-le développement du projet initial. Cette nouvelle distribution a pour but d'offrir des mise à jours
-plus régulières, des améliorations et des correctifs, mais aussi une modèle de gouvernance plus
+le développement du projet initial. Cette nouvelle distribution a pour but d’offrir des mises à jour
+plus régulières, des améliorations et des correctifs, mais aussi un modèle de gouvernance plus
démocratique.
Tout nouveau contributeur est le bienvenu !
@@ -37,37 +37,36 @@ Installation
Aide
----
-Si vous venez de commencer avec pygame, vous devriez être capable d'y
-vous lancer assez rapidement. Pygame vous vient avec un grand nombre de
-tutoriels et d'introductions. Il y a aussi une documentation très bien référencée
-sur toute la librarie. Naviguez dans la documentation sur la `docs page`_. Vous pouvez
-aussi y jeter un coup d'oeil localement en lançant cette commande ``python -m pygame.docs``
-dans votre terminal. Si la documentation n'est pas trouvé localement, cela va lancer le
-site web.
+Si vous venez de commencer avec pygame, vous devriez être capable de vous y lancer assez
+rapidement. Pygame vient avec un grand nombre de tutoriels et d'introductions. Il y a
+aussi une documentation très bien référencée sur toute la bibliothèque. Naviguez dans la
+documentation sur la `docs page`_. Vous pouvez aussi y jeter un coup d'œil localement en
+exécutant la commande ``python -m pygame.docs`` dans votre terminal. Si la documentation
+n’est pas trouvée localement, cela va lancer le site web.
-La documentation en ligne reste à jour avec la version de pygame en cours de
-développement sur github. Cela peut être un peu plus récent que la version de
+La documentation en ligne reste à jour avec la version de pygame-ce en cours de
+développement sur GitHub. Cela peut être un peu plus récent que la version de
pygame que vous utilisez. Pour passer à la version sortie la plus récente, lancez
``pip install pygame-ce --upgrade`` dans votre terminal.
-Chose particulièrement intéressante, c'est que vous avez à votre disposition un dossier
-d'exemples contenant beaucoup de petits programmes jouables, vous permettant
+Un point particulièrement intéressant : vous avez à votre disposition un dossier
+d’exemples contenant beaucoup de petits programmes jouables, vous permettant
de commencer à jouer avec le code tout de suite.
-Build grâce au code source
+Build depuis le code source
--------------------
-Si vous voulez utiliser des features en cours de développement,
+Si vous voulez utiliser des fonctionnalités en cours de développement,
ou que vous voulez contribuer à pygame, vous allez avoir besoin de
-build pygame localement grâce au code source, plutôt que de l'installer avec
+build pygame localement depuis le code source, plutôt que de l’installer avec
pip.
-L'installer grâce au code source est assez automatisé. La majeur
-partie du travail sera de compiler et installer toute les dépendances de
+Installer Pygame depuis le code source est assez automatisé. La majeure
+partie du travail sera de compiler et d’installer toutes les dépendances de
pygame. Une fois ceci fait, lancez le script ``setup.py`` qui va essayer
-de l'auto-configurer, le build, et installer pygame.
+de l’auto-configurer, le build, et l’installer.
-Plus d'informations à propos de l'installation et la compilation disponibles
+Plus d’informations à propos de l’installation et de la compilation sont disponibles
sur `Compilation wiki page`_.
Crédits
@@ -97,7 +96,7 @@ Des remerciements particuliers s'imposent également.
* Nicholas Dudfield: many test improvements
* Alex Folkner for pygame-ctypes
-Merci à celles et ceux qui ont proposé des correctifs: Niki Spahiev, Gordon
+Merci à celles et ceux qui ont proposé des correctifs : Niki Spahiev, Gordon
Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman,
Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen, Herve Cauwelier,
James Mazer, Lalo Martins, Timothy Stranex, Chad Lester, Matthias
@@ -108,20 +107,20 @@ Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine,
Michael George, Saul Spatz, Thomas Ibbotson, Tom Rothamel, Evan Kroske,
Cambell Barton.
-Et à nos chasseurs de bugs: Angus, Guillaume Proux, Frank
+Et à nos chasseurs de bugs : Angus, Guillaume Proux, Frank
Raiser, Austin Henry, Kaweh Kazemi, Arturo Aldama, Mike Mulcheck,
Michael Benfield, David Lau
Il y a aussi pas mal de personnes présentes qui soumettent des idées utiles et intéressantes,
qui ont permis à ce projet de continuer à vivre, et qui ont pratiquement rendu notre
-travail facile. Merci !
+travail facile. Merci !
-Très grands remerciemments à toutes les personnes commentant la documentation,
+Très grands remerciements à toutes les personnes commentant la documentation,
et ajoutant du nouveau contenu dans le wiki pygame.org.
Aussi de très grands remerciements à toutes les personnes créant des jeux et les
partageant sur le site pygame.org pour permettre aux autres d'apprendre et de
-s'amuser.
+s’amuser.
Très grands remerciements à James Paige en particulier pour avoir hébergé
pygame bugzilla.
@@ -133,8 +132,8 @@ Dépendances
------------
Pygame est évidemment très dépendant de SDL et Python. Il a aussi
-des liens, mais de même intègre plusieurs autres petites librairies.
-Le module font s'appuie sur SDL_ttf, qui est lui même dépendant de freetype.
+des liens, mais de même intègre plusieurs autres petites bibliothèques.
+Le module font s’appuie sur SDL_ttf, qui est lui-même dépendant de freetype.
Le module mixer (et mixer.music) dépend de SDL_mixer. Le module image
dépend de SDL_image, qui dépend de libjpeg et libpng. Le module transform
a une version intégrée de SDL_rotozoom pour ses propres fonctions de rotozoom.
@@ -162,18 +161,18 @@ Versions des dépendances:
-License
+Licence
-------
-La librarie est distribuée sous la licence `GNU LGPL version 2.1`_, qui
+La bibliothèque est distribuée sous la licence `GNU LGPL version 2.1`_, qui
peut être retrouvée dans le fichier ``docs/LGPL.txt``. Nous nous réservons
-le droit de placer les futures versions de cette librarie sous une licence
+le droit de placer les futures versions de cette bibliothèque sous une licence
différente.
-Ceci veut en quelque sorte dire que vous êtes dans l'habilité d'utiliser pygame
-dans n'importe quel projet que souhaitez, mais que si vous voulez effectuer des
-changements ou des ajouts à pygame lui-même, alors vous serez dans l'obligation
-de les publier avec une licence compatible (préférable de les soumettrent au projet
+Ceci veut en quelque sorte dire que vous êtes habilité à utiliser pygame-ce
+dans n’importe quel projet que souhaitez, mais que si vous voulez effectuer des
+changements ou des ajouts à pygame lui-même, alors vous serez dans l’obligation
+de les publier avec une licence compatible (de préférence en les soumettant au projet
pygame). Les codes propriétaires et les jeux commerciaux sont autorisés.
Les programmes présents dans le sous-répertoire ``examples`` appartiennent
@@ -190,8 +189,8 @@ Voir les docs/licences pour les licences des dépendances.
.. |Python3| image:: https://img.shields.io/badge/python-3-blue.svg?v=1
-.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.2.1.svg
- :target: https://github.com/pygame-community/pygame-ce/compare/2.2.1...main
+.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.3.0.svg
+ :target: https://github.com/pygame-community/pygame-ce/compare/2.3.0...main
.. |DocsStatus| image:: https://img.shields.io/website?down_message=offline&label=docs&up_message=online&url=https%3A%2F%2Fpyga.me%2Fdocs%2F
:target: https://pyga.me/docs/
@@ -200,11 +199,12 @@ Voir les docs/licences pour les licences des dépendances.
:target: https://github.com/psf/black
.. _pygame: https://pyga.me
-.. _Simple DirectMedia Layer library: https://www.libsdl.org
+.. _Simple DirectMedia Layer: https://www.libsdl.org
.. _We need your help: https://www.pygame.org/contribute.html
.. _Compilation wiki page: https://github.com/pygame-community/pygame-ce/wiki#compiling
.. _docs page: https://pyga.me/docs
.. _GNU LGPL version 2.1: https://www.gnu.org/copyleft/lesser.html
.. _简体中文: README.zh-cn.rst
-.. _English: ./../../README.rst
\ No newline at end of file
+.. _English: ./../../README.rst
+.. _فارسی: README.fa.rst
\ No newline at end of file
diff --git a/docs/readmes/README.zh-cn.rst b/docs/readmes/README.zh-cn.rst
index 22327db74a..45a454e973 100644
--- a/docs/readmes/README.zh-cn.rst
+++ b/docs/readmes/README.zh-cn.rst
@@ -7,7 +7,7 @@
|PyPiVersion| |PyPiLicense|
|Python3| |GithubCommits| |BlackFormatBadge|
-`English`_ **简体中文** `Français`_
+`English`_ **简体中文** `Français`_ `فارسی`_
----
Pygame_ 是一款自由且开源的跨平台库,用于开发电子游戏等多媒体应用。Pygame基于 `Simple DirectMedia Layer library`_ 以及其他几个广受欢迎的库,汲取其中最常见的函数,让编写游戏成为更加符合直觉的事情。
@@ -143,8 +143,8 @@ pygame显然依赖于SDL和Python。此外pygame还嵌入了几个较小的库
.. |Python3| image:: https://img.shields.io/badge/python-3-blue.svg?v=1
-.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.2.1.svg
- :target: https://github.com/pygame-community/pygame-ce/compare/2.2.1...main
+.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.3.0.svg
+ :target: https://github.com/pygame-community/pygame-ce/compare/2.3.0...main
.. |DocsStatus| image:: https://img.shields.io/website?down_message=offline&label=docs&up_message=online&url=https%3A%2F%2Fpyga.me%2Fdocs%2F
:target: https://pyga.me/docs/
@@ -160,4 +160,5 @@ pygame显然依赖于SDL和Python。此外pygame还嵌入了几个较小的库
.. _GNU LGPL version 2.1: https://www.gnu.org/copyleft/lesser.html
.. _English: ./../../README.rst
-.. _Français: README.fr.rst
\ No newline at end of file
+.. _Français: README.fr.rst
+.. _فارسی: README.fa.rst
\ No newline at end of file
diff --git a/examples/eventlist.py b/examples/eventlist.py
index 4092baeff1..a2c7271398 100644
--- a/examples/eventlist.py
+++ b/examples/eventlist.py
@@ -12,7 +12,7 @@
Mouse Controls
==============
-- 1st button on mouse (left click) to toggle events 'grabed'.
+- 1st button on mouse (left click) to toggle events 'grabbed'.
- 3rd button on mouse (right click) to toggle mouse visible.
- The window can be resized.
- Mouse the mouse around to see mouse events.
@@ -99,22 +99,15 @@ def drawstatus(win):
def drawhistory(win, history):
img = font.render("Event History Area", 1, (155, 155, 155), (0, 0, 0))
win.blit(img, (2, 132))
- ypos = 450
- h = list(history)
- h.reverse()
- for line in h:
- r = win.blit(line, (10, ypos))
- win.fill(0, (r.right, r.top, 620, r.height))
- ypos -= font.get_height()
+
+ img = font.render("\n".join(history), 1, (50, 200, 50), (0, 0, 0), wraplength=640)
+ win.blit(img, (10, 250))
def draw_usage_in_history(history, text):
- lines = text.split("\n")
- for line in lines:
- if line == "" or "===" in line:
- continue
- img = font.render(line, 1, (50, 200, 50), (0, 0, 0))
- history.append(img)
+ for line in text.split("\n"):
+ if "===" not in line and line != "":
+ history.append(line)
def main():
@@ -131,23 +124,22 @@ def main():
img_on_off.append(font.render("Off", 1, (0, 0, 0), (255, 50, 50)))
img_on_off.append(font.render("On", 1, (0, 0, 0), (50, 255, 50)))
- # stores surfaces of text representing what has gone through the event queue
+ # stores lines of text representing what has gone through the event queue
history = []
# let's turn on the joysticks just so we can play with em
for x in range(pygame.joystick.get_count()):
if SDL2 and pygame._sdl2.controller.is_controller(x):
c = pygame._sdl2.controller.Controller(x)
- txt = "Enabled controller: " + c.name
+ txt = f"Enabled controller: {c.name}"
else:
j = pygame.joystick.Joystick(x)
- txt = "Enabled joystick: " + j.get_name()
+ txt = f"Enabled joystick: {j.get_name()}"
+
+ history.append(txt)
- img = font.render(txt, 1, (50, 200, 50), (0, 0, 0))
- history.append(img)
if not pygame.joystick.get_count():
- img = font.render("No Joysticks to Initialize", 1, (50, 200, 50), (0, 0, 0))
- history.append(img)
+ history.append("No Joysticks to Initialize")
going = True
while going:
@@ -172,8 +164,7 @@ def main():
if e.type != pygame.MOUSEMOTION:
txt = f"{pygame.event.event_name(e.type)}: {e.dict}"
- img = font.render(txt, 1, (50, 200, 50), (0, 0, 0))
- history.append(img)
+ history.append(txt)
history = history[-13:]
if e.type == pygame.VIDEORESIZE:
diff --git a/examples/music_drop_fade.py b/examples/music_drop_fade.py
index f7f5c1e152..b725873c74 100644
--- a/examples/music_drop_fade.py
+++ b/examples/music_drop_fade.py
@@ -167,12 +167,9 @@ def main():
font = pygame.font.SysFont("Arial", 24)
clock = pygame.Clock()
- pygame.scrap.init()
- pygame.SCRAP_TEXT = pygame.scrap.get_types()[
- 0
- ] # TODO remove when scrap module is fixed
- clipped = pygame.scrap.get(pygame.SCRAP_TEXT).decode("UTF-8")
- # store the current text from the clipboard TODO remove decode
+ clipped = ""
+ if pygame.scrap.has_text():
+ clipped = pygame.scrap.get_text()
# add the command line arguments to the music_file_list
for arg in sys.argv[1:]:
@@ -235,11 +232,11 @@ def main():
pygame.mixer.music.set_volume(volume)
print("volume:", volume)
- # TODO remove decode when SDL2 scrap is fixed
- new_text = pygame.scrap.get(pygame.SCRAP_TEXT).decode("UTF-8")
- if new_text != clipped: # has the clipboard changed?
- clipped = new_text
- play_file(clipped) # try to play the file if it has
+ if pygame.scrap.has_text():
+ new_text = pygame.scrap.get_text()
+ if new_text != clipped:
+ clipped = new_text
+ play_file(clipped)
pygame.display.flip()
clock.tick(9) # keep CPU use down by updating screen less often
diff --git a/examples/scrap_clipboard.py b/examples/scrap_clipboard.py
index 08d819af66..73ff8d83f4 100644
--- a/examples/scrap_clipboard.py
+++ b/examples/scrap_clipboard.py
@@ -8,89 +8,63 @@
Keyboard Controls
-----------------
+ v - View the current clipboard data.
+ c - Copy some text into the clipboard.
-g - get and print types in clipboard. If, image blit to screen.
-p - place some text into clipboard
-a - print types available in the clipboard
-i - put image into the clipboard
"""
-import os
+
import pygame
-import pygame.scrap as scrap
-from io import BytesIO
+pygame.init()
+pygame.display.set_caption("Clipboard Example")
+width, height = (960, 540)
+screen = pygame.display.set_mode((width, height))
+clock = pygame.Clock()
+font = pygame.Font(None, 30)
+
+
+clipboard_text = ""
+running = True
+
+while running:
+ screen.fill("black")
+
+ instruction = "Keyboard Controls:\nV - View the current clipboard data.\nC - Copy some text into the clipboard.\nEscape - Quit"
+ text = font.render(instruction, True, "white")
+ screen.blit(text, (0, 0))
+
+ text = font.render(
+ f"Text on the clipboard:\n{clipboard_text}", True, "white", None, width - 20
+ )
+ screen.blit(text, (0, 100))
+
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT:
+ running = False
+
+ elif event.type == pygame.KEYDOWN:
+ if event.key == pygame.K_v:
+ # Look for any text data in the clipboard.
+ print("Looking for text in the clipboard.")
+ if pygame.scrap.has_text():
+ print("Text found in the clipboard.")
+ clipboard_text = pygame.scrap.get_text()
+ else:
+ print("No text in the clipboard.")
-def usage():
- print("Press the 'g' key to get all of the current clipboard data")
- print("Press the 'p' key to put a string into the clipboard")
- print("Press the 'a' key to get a list of the currently available types")
- print("Press the 'i' key to put an image into the clipboard")
+ elif event.key == pygame.K_c:
+ # put some text into the clipboard.
+ print("Putting text into the clipboard.")
+ pygame.scrap.put_text(
+ "Hello World! This is some text from the pygame scrap example.",
+ )
-main_dir = os.path.split(os.path.abspath(__file__))[0]
+ elif event.key == pygame.K_ESCAPE:
+ running = False
-pygame.init()
-screen = pygame.display.set_mode((200, 200))
-c = pygame.Clock()
-going = True
-
-# Initialize the scrap module and use the clipboard mode.
-scrap.init()
-scrap.set_mode(pygame.SCRAP_CLIPBOARD)
-
-usage()
-
-while going:
- for e in pygame.event.get():
- if e.type == pygame.QUIT or (
- e.type == pygame.KEYDOWN and e.key == pygame.K_ESCAPE
- ):
- going = False
-
- elif e.type == pygame.KEYDOWN and e.key == pygame.K_g:
- # This means to look for data.
- print("Getting the different clipboard data..")
- for t in scrap.get_types():
- r = scrap.get(t)
- if r and len(r) > 500:
- print(f"Type {t} : (large {len(r)} byte buffer)")
- elif r is None:
- print(f"Type {t} : None")
- else:
- print(f"Type {t} : '{r.decode('ascii', 'ignore')}'")
- if "image" in t:
- namehint = t.split("/")[1]
- if namehint in ["bmp", "png", "jpg"]:
- f = BytesIO(r)
- loaded_surf = pygame.image.load(f, "." + namehint)
- screen.blit(loaded_surf, (0, 0))
-
- elif e.type == pygame.KEYDOWN and e.key == pygame.K_p:
- # Place some text into the selection.
- print("Placing clipboard text.")
- scrap.put(pygame.SCRAP_TEXT, b"Hello. This is a message from scrap.")
-
- elif e.type == pygame.KEYDOWN and e.key == pygame.K_a:
- # Get all available types.
- print("Getting the available types from the clipboard.")
- types = scrap.get_types()
- print(types)
- if len(types) > 0:
- print(f"Contains {types[0]}: {scrap.contains(types[0])}")
- print("Contains _INVALID_: ", scrap.contains("_INVALID_"))
-
- elif e.type == pygame.KEYDOWN and e.key == pygame.K_i:
- print("Putting image into the clipboard.")
- scrap.set_mode(pygame.SCRAP_CLIPBOARD)
- fp = open(os.path.join(main_dir, "data", "liquid.bmp"), "rb")
- buf = fp.read()
- scrap.put("image/bmp", buf)
- fp.close()
-
- elif e.type in (pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN):
- usage()
- pygame.display.flip()
- c.tick(40)
+ pygame.display.flip()
+ clock.tick(60)
pygame.quit()
diff --git a/setup.py b/setup.py
index 28fbe4d8e6..87e164edc0 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
METADATA = {
"name": "pygame-ce",
- "version": "2.3.0.dev3",
+ "version": "2.3.1.dev1",
"license": "LGPL",
"url": "https://pyga.me",
"author": "A community project.",
@@ -120,7 +120,7 @@ def spawn(self, cmd, **kwargs):
distutils.ccompiler.CCompiler.__spawn = distutils.ccompiler.CCompiler.spawn
distutils.ccompiler.CCompiler.spawn = spawn
-# A (bit hacky) fix for https://github.com/pygame/pygame/issues/2613
+# A (bit hacky) fix for https://github.com/pygame-community/pygame-ce/issues/1346
# This is due to the fact that distutils uses command line args to
# export PyInit_* functions on windows, but those functions are already exported
# and that is why compiler gives warnings
@@ -153,9 +153,9 @@ def compilation_help():
if not hasattr(sys, 'version_info') or sys.version_info < (3, 7):
compilation_help()
- raise SystemExit("Pygame requires Python3 version 3.7 or above.")
+ raise SystemExit("Pygame-ce requires Python3 version 3.7 or above.")
if IS_PYPY and sys.pypy_version_info < (7,):
- raise SystemExit("Pygame requires PyPy version 7.0.0 above, compatible with CPython >= 3.7")
+ raise SystemExit("Pygame-ce requires PyPy version 7.0.0 above, compatible with CPython >= 3.7")
def consume_arg(name):
diff --git a/src_c/_camera.c b/src_c/_camera.c
index 2aae4250b3..b4c298c0ac 100644
--- a/src_c/_camera.c
+++ b/src_c/_camera.c
@@ -1791,7 +1791,7 @@ camera_dealloc(PyObject *self)
#else
free(((pgCameraObject *)self)->device_name);
#endif
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
/*
PyObject* camera_getattr(PyObject* self, char* attrname) {
diff --git a/src_c/_freetype.c b/src_c/_freetype.c
index e4872dfd6e..a30fecc5dc 100644
--- a/src_c/_freetype.c
+++ b/src_c/_freetype.c
@@ -877,7 +877,7 @@ _ftfont_init(pgFontObject *self, PyObject *args, PyObject *kwds)
/* Keep the current freetype 2 connection open while this object exists.
Otherwise, the freetype library may be closed before the object frees
- its local resources. See Pygame issue #187
+ its local resources. See pygame-ce issue #202
*/
self->freetype = ft;
++ft->ref_count;
diff --git a/src_c/_pygame.h b/src_c/_pygame.h
index 419454460d..579124f2ac 100644
--- a/src_c/_pygame.h
+++ b/src_c/_pygame.h
@@ -331,7 +331,7 @@ struct pgColorObject {
*/
#define PYGAMEAPI_RECT_NUMSLOTS 10
-#define PYGAMEAPI_JOYSTICK_NUMSLOTS 2
+#define PYGAMEAPI_JOYSTICK_NUMSLOTS 3
#define PYGAMEAPI_DISPLAY_NUMSLOTS 2
#define PYGAMEAPI_SURFACE_NUMSLOTS 4
#define PYGAMEAPI_SURFLOCK_NUMSLOTS 8
@@ -341,5 +341,6 @@ struct pgColorObject {
#define PYGAMEAPI_MATH_NUMSLOTS 2
#define PYGAMEAPI_BASE_NUMSLOTS 24
#define PYGAMEAPI_EVENT_NUMSLOTS 6
+#define PYGAMEAPI_WINDOW_NUMSLOTS 1
#endif /* _PYGAME_INTERNAL_H */
diff --git a/src_c/_sdl2/video.c b/src_c/_sdl2/video.c
index d43c62f169..7180c9191a 100644
--- a/src_c/_sdl2/video.c
+++ b/src_c/_sdl2/video.c
@@ -1009,7 +1009,7 @@ static const char *__pyx_f[] = {
};
/*--- Type declarations ---*/
-struct __pyx_obj_6pygame_5_sdl2_5video_Window;
+struct __pyx_obj_6pygame_5_sdl2_5video__Window;
struct __pyx_obj_6pygame_5_sdl2_5video_Renderer;
struct __pyx_obj_6pygame_5_sdl2_5video_Texture;
struct __pyx_obj_6pygame_5_sdl2_5video_Image;
@@ -1019,7 +1019,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal;
struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw;
struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw;
-/* "pygame/_sdl2/video.pxd":524
+/* "pygame/_sdl2/video.pxd":530
*
* cpdef object get_viewport(self)
* cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*) # <<<<<<<<<<<<<<
@@ -1033,7 +1033,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit {
int special_flags;
};
-/* "pygame/_sdl2/video.pxd":533
+/* "pygame/_sdl2/video.pxd":539
* cdef readonly int height
*
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*, # <<<<<<<<<<<<<<
@@ -1048,7 +1048,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal {
int flip_y;
};
-/* "pygame/_sdl2/video.pxd":535
+/* "pygame/_sdl2/video.pxd":541
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*,
* bint flip_x=*, bint flip_y=*)
* cpdef void draw(self, srcrect=*, dstrect=*, float angle=*, origin=*, # <<<<<<<<<<<<<<
@@ -1065,7 +1065,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw {
int flip_y;
};
-/* "pygame/_sdl2/video.pxd":551
+/* "pygame/_sdl2/video.pxd":557
* cdef public Rect srcrect
*
* cpdef void draw(self, srcrect=*, dstrect=*) # <<<<<<<<<<<<<<
@@ -1076,21 +1076,21 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw {
PyObject *dstrect;
};
-/* "pygame/_sdl2/video.pxd":512
- *
+/* "pygame/_sdl2/video.pxd":518
+ * void import_pygame_window()
*
- * cdef class Window: # <<<<<<<<<<<<<<
+ * cdef class _Window: # <<<<<<<<<<<<<<
* cdef SDL_Window* _win
* cdef int _is_borrowed
*/
-struct __pyx_obj_6pygame_5_sdl2_5video_Window {
+struct __pyx_obj_6pygame_5_sdl2_5video__Window {
PyObject_HEAD
SDL_Window *_win;
int _is_borrowed;
};
-/* "pygame/_sdl2/video.pxd":516
+/* "pygame/_sdl2/video.pxd":522
* cdef int _is_borrowed
*
* cdef class Renderer: # <<<<<<<<<<<<<<
@@ -1103,12 +1103,12 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Renderer {
SDL_Renderer *_renderer;
pgColorObject *_draw_color;
struct __pyx_obj_6pygame_5_sdl2_5video_Texture *_target;
- struct __pyx_obj_6pygame_5_sdl2_5video_Window *_win;
+ pgWindowObject *_win;
int _is_borrowed;
};
-/* "pygame/_sdl2/video.pxd":526
+/* "pygame/_sdl2/video.pxd":532
* cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*)
*
* cdef class Texture: # <<<<<<<<<<<<<<
@@ -1126,7 +1126,7 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Texture {
};
-/* "pygame/_sdl2/video.pxd":538
+/* "pygame/_sdl2/video.pxd":544
* bint flip_x=*, bint flip_y=*)
*
* cdef class Image: # <<<<<<<<<<<<<<
@@ -1149,12 +1149,12 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Image {
};
-/* "pygame/_sdl2/video.pyx":34
+/* "pygame/_sdl2/video.pyx":35
* )
*
* def get_drivers(): # <<<<<<<<<<<<<<
- * cdef int num = SDL_GetNumRenderDrivers()
- * cdef SDL_RendererInfo info
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
*/
struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers {
PyObject_HEAD
@@ -1167,7 +1167,7 @@ struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers {
-/* "pygame/_sdl2/video.pyx":1008
+/* "pygame/_sdl2/video.pyx":1125
*
*
* cdef class Renderer: # <<<<<<<<<<<<<<
@@ -1182,7 +1182,7 @@ struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer {
static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer;
-/* "pygame/_sdl2/video.pyx":501
+/* "pygame/_sdl2/video.pyx":540
*
*
* cdef class Texture: # <<<<<<<<<<<<<<
@@ -1197,7 +1197,7 @@ struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture {
static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *__pyx_vtabptr_6pygame_5_sdl2_5video_Texture;
-/* "pygame/_sdl2/video.pyx":885
+/* "pygame/_sdl2/video.pyx":971
* raise error()
*
* cdef class Image: # <<<<<<<<<<<<<<
@@ -1790,6 +1790,9 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases,
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
+/* Globals.proto */
+static PyObject* __Pyx_Globals(void);
+
/* ClassMethod.proto */
#include "descrobject.h"
static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);
@@ -1994,6 +1997,8 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
/* Module declarations from 'pygame' */
+/* Module declarations from 'pygame._window' */
+
/* Module declarations from 'cpython.version' */
/* Module declarations from '__builtin__' */
@@ -2079,6 +2084,7 @@ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Color = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Rect = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Window = 0;
+static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video__Window = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Renderer = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Texture = 0;
static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Image = 0;
@@ -2156,7 +2162,7 @@ static const char __pyx_k_p4_xy[] = "p4_xy";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_title[] = "title";
static const char __pyx_k_vsync[] = "vsync";
-static const char __pyx_k_Window[] = "Window";
+static const char __pyx_k_Window[] = "_Window";
static const char __pyx_k_button[] = "button";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_flip_x[] = "flip_x";
@@ -2172,7 +2178,6 @@ static const char __pyx_k_p1_mod[] = "p1_mod";
static const char __pyx_k_p2_mod[] = "p2_mod";
static const char __pyx_k_p3_mod[] = "p3_mod";
static const char __pyx_k_p4_mod[] = "p4_mod";
-static const char __pyx_k_pygame[] = "pygame";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_source[] = "source";
static const char __pyx_k_static[] = "static";
@@ -2196,6 +2201,7 @@ static const char __pyx_k_tooltip[] = "tooltip";
static const char __pyx_k_utility[] = "utility";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_Renderer[] = "Renderer";
+static const char __pyx_k_Window_2[] = "Window";
static const char __pyx_k_buttonid[] = "buttonid";
static const char __pyx_k_errorfnc[] = "errorfnc";
static const char __pyx_k_get_rect[] = "get_rect";
@@ -2249,16 +2255,17 @@ static const char __pyx_k_escape_button[] = "escape_button";
static const char __pyx_k_input_grabbed[] = "input_grabbed";
static const char __pyx_k_kwarg_to_flag[] = "_kwarg_to_flag";
static const char __pyx_k_mouse_capture[] = "mouse_capture";
+static const char __pyx_k_pygame_window[] = "pygame window";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_return_button[] = "return_button";
static const char __pyx_k_scale_quality[] = "scale_quality";
static const char __pyx_k_special_flags[] = "special_flags";
static const char __pyx_k_pygame_pkgdata[] = "pygame.pkgdata";
static const char __pyx_k_target_texture[] = "target_texture";
-static const char __pyx_k_textureOrImage[] = "textureOrImage";
static const char __pyx_k_pygame_icon_bmp[] = "pygame_icon.bmp";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_MESSAGEBOX_ERROR[] = "MESSAGEBOX_ERROR";
+static const char __pyx_k_texture_or_image[] = "texture_or_image";
static const char __pyx_k_SCALEQUALITY_BEST[] = "SCALEQUALITY_BEST";
static const char __pyx_k_max_texture_width[] = "max_texture_width";
static const char __pyx_k_pygame__sdl2_sdl2[] = "pygame._sdl2.sdl2";
@@ -2293,6 +2300,7 @@ static const char __pyx_k_s_name_s_flags_0x_02x_num_textu[] = "<%s(name: %s, fla
static const char __pyx_k_src_c_cython_pygame__sdl2_video[] = "src_c\\cython\\pygame\\_sdl2\\video.pyx";
static const char __pyx_k_surface_must_be_a_surface_or_No[] = "'surface' must be a surface or None";
static const char __pyx_k_the_argument_is_not_a_rectangle[] = "the argument is not a rectangle or None";
+static const char __pyx_k_Argument_window_has_incorrect_ty[] = "Argument 'window' has incorrect type (expected pygame.Window or pygame._sdl2._Window, got %s)";
static const char __pyx_k_area_must_be_a_rectangle_or_None[] = "area must be a rectangle or None";
static const char __pyx_k_draw_quad_requires_SDL_2_0_18_or[] = "draw_quad requires SDL 2.0.18 or newer";
static const char __pyx_k_draw_triangle_requires_SDL_2_0_1[] = "draw_triangle requires SDL 2.0.18 or newer";
@@ -2310,6 +2318,7 @@ static const char __pyx_k_surface_must_be_a_Surface_object[] = "surface must be
static const char __pyx_k_target_must_be_a_Texture_or_None[] = "target must be a Texture or None";
static const char __pyx_k_update_source_should_be_a_Surfac[] = "update source should be a Surface.";
static PyObject *__pyx_kp_s_2nd_argument_must_be_a_surface;
+static PyObject *__pyx_kp_s_Argument_window_has_incorrect_ty;
static PyObject *__pyx_n_s_DEFAULT_SIZE;
static PyObject *__pyx_n_s_Image;
static PyObject *__pyx_n_s_KeyError;
@@ -2330,6 +2339,7 @@ static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_WINDOWPOS_CENTERED;
static PyObject *__pyx_n_s_WINDOWPOS_UNDEFINED;
static PyObject *__pyx_n_s_Window;
+static PyObject *__pyx_n_s_Window_2;
static PyObject *__pyx_n_s_accelerated;
static PyObject *__pyx_n_s_allow_highdpi;
static PyObject *__pyx_n_s_alpha;
@@ -2451,11 +2461,11 @@ static PyObject *__pyx_n_s_popup_menu;
static PyObject *__pyx_n_s_position;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_ptr;
-static PyObject *__pyx_n_s_pygame;
static PyObject *__pyx_n_s_pygame__sdl2_sdl2;
static PyObject *__pyx_n_s_pygame__sdl2_video;
static PyObject *__pyx_kp_s_pygame_icon_bmp;
static PyObject *__pyx_n_s_pygame_pkgdata;
+static PyObject *__pyx_kp_s_pygame_window;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_kp_s_rect_values_are_out_of_range;
@@ -2504,7 +2514,7 @@ static PyObject *__pyx_kp_s_target_must_be_a_Texture_or_None;
static PyObject *__pyx_n_s_target_texture;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_texture;
-static PyObject *__pyx_n_s_textureOrImage;
+static PyObject *__pyx_n_s_texture_or_image;
static PyObject *__pyx_kp_s_the_argument_is_not_a_rectangle;
static PyObject *__pyx_kp_s_the_surface_is_too_small;
static PyObject *__pyx_n_s_throw;
@@ -2525,41 +2535,41 @@ static PyObject *__pyx_n_s_y;
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_get_drivers(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTypeObject *__pyx_v_cls); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_grabbed); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_enable); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_desktop); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_input_only); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_surface); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_position); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_opacity); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_parent); /* proto */
-static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, pgWindowObject *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_from_display_module(PyTypeObject *__pyx_v_cls); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_grabbed); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_enable); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_desktop); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_title); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_input_only); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_surface); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_position); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_opacity); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, pgWindowObject *__pyx_v_parent); /* proto */
+static void __pyx_pf_6pygame_5_sdl2_5video_7_Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_size, int __pyx_v_depth, PyObject *__pyx_v_static, PyObject *__pyx_v_streaming, PyObject *__pyx_v_target, PyObject *__pyx_v_scale_quality); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_surface); /* proto */
@@ -2581,7 +2591,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(struct
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_textureOrImage, PyObject *__pyx_v_srcrect); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_texture_or_image, PyObject *__pyx_v_srcrect); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_new_color); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
@@ -2606,8 +2616,8 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(struct __pyx_
static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window); /* proto */
-static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_window); /* proto */
+static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture); /* proto */
static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_blendMode); /* proto */
@@ -2616,11 +2626,11 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_scale); /* proto */
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_newtarget); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_source, pgRectObject *__pyx_v_dest, pgRectObject *__pyx_v_area, int __pyx_v_special_flags); /* proto */
@@ -2636,7 +2646,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend_mode(PyObject *__pyx_v_color_mode, PyObject *__pyx_v_alpha_mode); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
-static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video__Window(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Renderer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Texture(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Image(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
@@ -2704,7 +2714,7 @@ static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__52;
/* Late includes */
-/* "pygame/_sdl2/video.pyx":24
+/* "pygame/_sdl2/video.pyx":25
*
* class RendererDriverInfo:
* def __repr__(self): # <<<<<<<<<<<<<<
@@ -2741,7 +2751,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CY
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__repr__", 0);
- /* "pygame/_sdl2/video.pyx":25
+ /* "pygame/_sdl2/video.pyx":26
* class RendererDriverInfo:
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % ( # <<<<<<<<<<<<<<
@@ -2750,77 +2760,77 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CY
*/
__Pyx_XDECREF(__pyx_r);
- /* "pygame/_sdl2/video.pyx":26
+ /* "pygame/_sdl2/video.pyx":27
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
* self.__class__.__name__, # <<<<<<<<<<<<<<
* self.name,
* self.flags,
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":27
+ /* "pygame/_sdl2/video.pyx":28
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
* self.__class__.__name__,
* self.name, # <<<<<<<<<<<<<<
* self.flags,
* self.num_texture_formats,
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- /* "pygame/_sdl2/video.pyx":28
+ /* "pygame/_sdl2/video.pyx":29
* self.__class__.__name__,
* self.name,
* self.flags, # <<<<<<<<<<<<<<
* self.num_texture_formats,
* self.max_texture_width,
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- /* "pygame/_sdl2/video.pyx":29
+ /* "pygame/_sdl2/video.pyx":30
* self.name,
* self.flags,
* self.num_texture_formats, # <<<<<<<<<<<<<<
* self.max_texture_width,
* self.max_texture_height,
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_texture_formats); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_texture_formats); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- /* "pygame/_sdl2/video.pyx":30
+ /* "pygame/_sdl2/video.pyx":31
* self.flags,
* self.num_texture_formats,
* self.max_texture_width, # <<<<<<<<<<<<<<
* self.max_texture_height,
* )
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
- /* "pygame/_sdl2/video.pyx":31
+ /* "pygame/_sdl2/video.pyx":32
* self.num_texture_formats,
* self.max_texture_width,
* self.max_texture_height, # <<<<<<<<<<<<<<
* )
*
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- /* "pygame/_sdl2/video.pyx":26
+ /* "pygame/_sdl2/video.pyx":27
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
* self.__class__.__name__, # <<<<<<<<<<<<<<
* self.name,
* self.flags,
*/
- __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error)
+ __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
@@ -2841,21 +2851,21 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CY
__pyx_t_5 = 0;
__pyx_t_6 = 0;
- /* "pygame/_sdl2/video.pyx":25
+ /* "pygame/_sdl2/video.pyx":26
* class RendererDriverInfo:
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % ( # <<<<<<<<<<<<<<
* self.__class__.__name__,
* self.name,
*/
- __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_name_s_flags_0x_02x_num_textu, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_name_s_flags_0x_02x_num_textu, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_r = __pyx_t_6;
__pyx_t_6 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":24
+ /* "pygame/_sdl2/video.pyx":25
*
* class RendererDriverInfo:
* def __repr__(self): # <<<<<<<<<<<<<<
@@ -2881,17 +2891,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CY
}
static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
-/* "pygame/_sdl2/video.pyx":34
+/* "pygame/_sdl2/video.pyx":35
* )
*
* def get_drivers(): # <<<<<<<<<<<<<<
- * cdef int num = SDL_GetNumRenderDrivers()
- * cdef SDL_RendererInfo info
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_1get_drivers(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_1get_drivers = {"get_drivers", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_1get_drivers, METH_NOARGS, 0};
+static char __pyx_doc_6pygame_5_sdl2_5video_get_drivers[] = "Yield info about the rendering drivers available for Renderer objects\n ";
+static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_1get_drivers = {"get_drivers", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_1get_drivers, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_get_drivers};
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_1get_drivers(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -2915,12 +2926,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_get_drivers(CYTHON_UNUSED PyObje
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)Py_None);
__Pyx_INCREF(Py_None);
- __PYX_ERR(0, 34, __pyx_L1_error)
+ __PYX_ERR(0, 35, __pyx_L1_error)
} else {
__Pyx_GOTREF(__pyx_cur_scope);
}
{
- __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pygame_5_sdl2_5video_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_get_drivers, __pyx_n_s_get_drivers, __pyx_n_s_pygame__sdl2_video); if (unlikely(!gen)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pygame_5_sdl2_5video_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_get_drivers, __pyx_n_s_get_drivers, __pyx_n_s_pygame__sdl2_video); if (unlikely(!gen)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -2958,18 +2969,18 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 34, __pyx_L1_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 35, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":35
- *
- * def get_drivers():
+ /* "pygame/_sdl2/video.pyx":38
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
* cdef int num = SDL_GetNumRenderDrivers() # <<<<<<<<<<<<<<
* cdef SDL_RendererInfo info
* cdef int ind
*/
__pyx_cur_scope->__pyx_v_num = SDL_GetNumRenderDrivers();
- /* "pygame/_sdl2/video.pyx":38
+ /* "pygame/_sdl2/video.pyx":41
* cdef SDL_RendererInfo info
* cdef int ind
* for ind from 0 <= ind < num: # <<<<<<<<<<<<<<
@@ -2979,7 +2990,7 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_num;
for (__pyx_cur_scope->__pyx_v_ind = 0; __pyx_cur_scope->__pyx_v_ind < __pyx_t_1; __pyx_cur_scope->__pyx_v_ind++) {
- /* "pygame/_sdl2/video.pyx":39
+ /* "pygame/_sdl2/video.pyx":42
* cdef int ind
* for ind from 0 <= ind < num:
* SDL_GetRenderDriverInfo(ind, &info) # <<<<<<<<<<<<<<
@@ -2988,14 +2999,14 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
*/
(void)(SDL_GetRenderDriverInfo(__pyx_cur_scope->__pyx_v_ind, (&__pyx_cur_scope->__pyx_v_info)));
- /* "pygame/_sdl2/video.pyx":40
+ /* "pygame/_sdl2/video.pyx":43
* for ind from 0 <= ind < num:
* SDL_GetRenderDriverInfo(ind, &info)
* ret = RendererDriverInfo() # <<<<<<<<<<<<<<
* ret.name = info.name.decode("utf-8")
* ret.flags = info.flags
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RendererDriverInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RendererDriverInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -3009,7 +3020,7 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ret);
@@ -3017,7 +3028,7 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":41
+ /* "pygame/_sdl2/video.pyx":44
* SDL_GetRenderDriverInfo(ind, &info)
* ret = RendererDriverInfo()
* ret.name = info.name.decode("utf-8") # <<<<<<<<<<<<<<
@@ -3025,60 +3036,60 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
* ret.num_texture_formats = info.num_texture_formats
*/
__pyx_t_5 = __pyx_cur_scope->__pyx_v_info.name;
- __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_5, 0, strlen(__pyx_t_5), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_5, 0, strlen(__pyx_t_5), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_name_2, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_name_2, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":42
+ /* "pygame/_sdl2/video.pyx":45
* ret = RendererDriverInfo()
* ret.name = info.name.decode("utf-8")
* ret.flags = info.flags # <<<<<<<<<<<<<<
* ret.num_texture_formats = info.num_texture_formats
* ret.max_texture_width = info.max_texture_width
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_flags, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_flags, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":43
+ /* "pygame/_sdl2/video.pyx":46
* ret.name = info.name.decode("utf-8")
* ret.flags = info.flags
* ret.num_texture_formats = info.num_texture_formats # <<<<<<<<<<<<<<
* ret.max_texture_width = info.max_texture_width
* ret.max_texture_height = info.max_texture_height
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.num_texture_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.num_texture_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_num_texture_formats, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_num_texture_formats, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":44
+ /* "pygame/_sdl2/video.pyx":47
* ret.flags = info.flags
* ret.num_texture_formats = info.num_texture_formats
* ret.max_texture_width = info.max_texture_width # <<<<<<<<<<<<<<
* ret.max_texture_height = info.max_texture_height
* yield ret
*/
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_width, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_width, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":45
+ /* "pygame/_sdl2/video.pyx":48
* ret.num_texture_formats = info.num_texture_formats
* ret.max_texture_width = info.max_texture_width
* ret.max_texture_height = info.max_texture_height # <<<<<<<<<<<<<<
* yield ret
*
*/
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_height, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_height, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":46
+ /* "pygame/_sdl2/video.pyx":49
* ret.max_texture_width = info.max_texture_width
* ret.max_texture_height = info.max_texture_height
* yield ret # <<<<<<<<<<<<<<
@@ -3096,16 +3107,16 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
return __pyx_r;
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 46, __pyx_L1_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 49, __pyx_L1_error)
}
CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
- /* "pygame/_sdl2/video.pyx":34
+ /* "pygame/_sdl2/video.pyx":35
* )
*
* def get_drivers(): # <<<<<<<<<<<<<<
- * cdef int num = SDL_GetNumRenderDrivers()
- * cdef SDL_RendererInfo info
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
*/
/* function exit code */
@@ -3127,17 +3138,17 @@ static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":49
+/* "pygame/_sdl2/video.pyx":52
*
*
* def get_grabbed_window(): # <<<<<<<<<<<<<<
- * """return the Window with input grab enabled,
- * or None if input isn't grabbed."""
+ * """Get the window with input grab enabled
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_3get_grabbed_window[] = "return the Window with input grab enabled,\n or None if input isn't grabbed.";
+static char __pyx_doc_6pygame_5_sdl2_5video_3get_grabbed_window[] = "Get the window with input grab enabled\n\n Gets the :class:`Window` with input grab enabled, if input is grabbed,\n otherwise ``None`` is returned.\n ";
static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_4get_grabbed_window = {"get_grabbed_window", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_3get_grabbed_window};
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
@@ -3158,16 +3169,16 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
int __pyx_t_1;
__Pyx_RefNannySetupContext("get_grabbed_window", 0);
- /* "pygame/_sdl2/video.pyx":52
- * """return the Window with input grab enabled,
- * or None if input isn't grabbed."""
+ /* "pygame/_sdl2/video.pyx":58
+ * otherwise ``None`` is returned.
+ * """
* cdef SDL_Window *win = SDL_GetGrabbedWindow() # <<<<<<<<<<<<<<
* cdef void *ptr
* if win:
*/
__pyx_v_win = SDL_GetGrabbedWindow();
- /* "pygame/_sdl2/video.pyx":54
+ /* "pygame/_sdl2/video.pyx":60
* cdef SDL_Window *win = SDL_GetGrabbedWindow()
* cdef void *ptr
* if win: # <<<<<<<<<<<<<<
@@ -3177,7 +3188,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
__pyx_t_1 = (__pyx_v_win != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":55
+ /* "pygame/_sdl2/video.pyx":61
* cdef void *ptr
* if win:
* ptr = SDL_GetWindowData(win, "pg_window") # <<<<<<<<<<<<<<
@@ -3186,7 +3197,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
*/
__pyx_v_ptr = SDL_GetWindowData(__pyx_v_win, ((char const *)"pg_window"));
- /* "pygame/_sdl2/video.pyx":56
+ /* "pygame/_sdl2/video.pyx":62
* if win:
* ptr = SDL_GetWindowData(win, "pg_window")
* if not ptr: # <<<<<<<<<<<<<<
@@ -3196,7 +3207,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
__pyx_t_1 = ((!(__pyx_v_ptr != 0)) != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":57
+ /* "pygame/_sdl2/video.pyx":63
* ptr = SDL_GetWindowData(win, "pg_window")
* if not ptr:
* return None # <<<<<<<<<<<<<<
@@ -3207,7 +3218,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":56
+ /* "pygame/_sdl2/video.pyx":62
* if win:
* ptr = SDL_GetWindowData(win, "pg_window")
* if not ptr: # <<<<<<<<<<<<<<
@@ -3216,7 +3227,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
*/
}
- /* "pygame/_sdl2/video.pyx":58
+ /* "pygame/_sdl2/video.pyx":64
* if not ptr:
* return None
* return
ptr # <<<<<<<<<<<<<<
@@ -3228,7 +3239,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
__pyx_r = ((PyObject *)__pyx_v_ptr);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":54
+ /* "pygame/_sdl2/video.pyx":60
* cdef SDL_Window *win = SDL_GetGrabbedWindow()
* cdef void *ptr
* if win: # <<<<<<<<<<<<<<
@@ -3237,23 +3248,23 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
*/
}
- /* "pygame/_sdl2/video.pyx":59
+ /* "pygame/_sdl2/video.pyx":65
* return None
* return ptr
* return None # <<<<<<<<<<<<<<
*
- *
+ * def messagebox(title, message,
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":49
+ /* "pygame/_sdl2/video.pyx":52
*
*
* def get_grabbed_window(): # <<<<<<<<<<<<<<
- * """return the Window with input grab enabled,
- * or None if input isn't grabbed."""
+ * """Get the window with input grab enabled
+ *
*/
/* function exit code */
@@ -3263,8 +3274,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":62
- *
+/* "pygame/_sdl2/video.pyx":67
+ * return None
*
* def messagebox(title, message, # <<<<<<<<<<<<<<
* Window window=None,
@@ -3273,12 +3284,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSE
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_5messagebox[] = " Display a message box.\n\n :param str title: A title string or None.\n :param str message: A message string.\n :param bool info: If ``True``, display an info message.\n :param bool warn: If ``True``, display a warning message.\n :param bool error: If ``True``, display an error message.\n :param tuple buttons: An optional sequence of buttons to show to the user (strings).\n :param int return_button: Button index to use if the return key is hit (-1 for none).\n :param int escape_button: Button index to use if the escape key is hit (-1 for none).\n :return: The index of the button that was pushed.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_5messagebox[] = "Create a native GUI message box\n\n Creates a native GUI message box.\n\n :param str title: A title string, or ``None`` to omit a title.\n :param str message: A message string.\n :param bool info: If ``True``, display an info message.\n :param bool warn: If ``True``, display a warning message.\n :param bool error: If ``True``, display an error message.\n :param tuple buttons: An optional sequence of button name strings to show to the user.\n :param int return_button: Button index to use if the return key is hit (``-1`` for none).\n :param int escape_button: Button index to use if the escape key is hit (``-1`` for none).\n :return: The index of the button that was pushed.\n ";
static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_6messagebox = {"messagebox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6messagebox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_5messagebox};
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_title = 0;
PyObject *__pyx_v_message = 0;
- struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window = 0;
+ pgWindowObject *__pyx_v_window = 0;
int __pyx_v_info;
int __pyx_v_warn;
int __pyx_v_error;
@@ -3295,16 +3306,16 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_title,&__pyx_n_s_message,&__pyx_n_s_window,&__pyx_n_s_info,&__pyx_n_s_warn,&__pyx_n_s_error,&__pyx_n_s_buttons,&__pyx_n_s_return_button,&__pyx_n_s_escape_button,0};
PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
- /* "pygame/_sdl2/video.pyx":63
+ /* "pygame/_sdl2/video.pyx":68
*
* def messagebox(title, message,
* Window window=None, # <<<<<<<<<<<<<<
* bint info=False,
* bint warn=False,
*/
- values[2] = (PyObject *)((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None);
+ values[2] = (PyObject *)((pgWindowObject *)Py_None);
- /* "pygame/_sdl2/video.pyx":67
+ /* "pygame/_sdl2/video.pyx":72
* bint warn=False,
* bint error=False,
* buttons=('OK', ), # <<<<<<<<<<<<<<
@@ -3348,7 +3359,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, 1); __PYX_ERR(0, 62, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, 1); __PYX_ERR(0, 67, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
@@ -3394,7 +3405,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "messagebox") < 0)) __PYX_ERR(0, 62, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "messagebox") < 0)) __PYX_ERR(0, 67, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -3420,12 +3431,12 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
}
__pyx_v_title = values[0];
__pyx_v_message = values[1];
- __pyx_v_window = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)values[2]);
+ __pyx_v_window = ((pgWindowObject *)values[2]);
if (values[3]) {
- __pyx_v_info = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_info == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L3_error)
+ __pyx_v_info = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_info == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":64
+ /* "pygame/_sdl2/video.pyx":69
* def messagebox(title, message,
* Window window=None,
* bint info=False, # <<<<<<<<<<<<<<
@@ -3435,10 +3446,10 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
__pyx_v_info = ((int)0);
}
if (values[4]) {
- __pyx_v_warn = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_warn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error)
+ __pyx_v_warn = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_warn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":65
+ /* "pygame/_sdl2/video.pyx":70
* Window window=None,
* bint info=False,
* bint warn=False, # <<<<<<<<<<<<<<
@@ -3448,10 +3459,10 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
__pyx_v_warn = ((int)0);
}
if (values[5]) {
- __pyx_v_error = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_error == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error)
+ __pyx_v_error = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_error == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":66
+ /* "pygame/_sdl2/video.pyx":71
* bint info=False,
* bint warn=False,
* bint error=False, # <<<<<<<<<<<<<<
@@ -3466,17 +3477,17 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 62, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.messagebox", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 63, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 68, __pyx_L1_error)
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5messagebox(__pyx_self, __pyx_v_title, __pyx_v_message, __pyx_v_window, __pyx_v_info, __pyx_v_warn, __pyx_v_error, __pyx_v_buttons, __pyx_v_return_button, __pyx_v_escape_button);
- /* "pygame/_sdl2/video.pyx":62
- *
+ /* "pygame/_sdl2/video.pyx":67
+ * return None
*
* def messagebox(title, message, # <<<<<<<<<<<<<<
* Window window=None,
@@ -3492,7 +3503,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, pgWindowObject *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button) {
SDL_MessageBoxButtonData *__pyx_v_c_buttons;
SDL_MessageBoxData __pyx_v_data;
SDL_MessageBoxButtonData __pyx_v_button;
@@ -3525,7 +3536,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__Pyx_INCREF(__pyx_v_title);
__Pyx_INCREF(__pyx_v_message);
- /* "pygame/_sdl2/video.pyx":84
+ /* "pygame/_sdl2/video.pyx":91
* # TODO: type check
* # TODO: color scheme
* cdef SDL_MessageBoxButtonData* c_buttons = NULL # <<<<<<<<<<<<<<
@@ -3534,7 +3545,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_c_buttons = NULL;
- /* "pygame/_sdl2/video.pyx":87
+ /* "pygame/_sdl2/video.pyx":94
*
* cdef SDL_MessageBoxData data
* data.flags = 0 # <<<<<<<<<<<<<<
@@ -3543,7 +3554,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.flags = 0;
- /* "pygame/_sdl2/video.pyx":88
+ /* "pygame/_sdl2/video.pyx":95
* cdef SDL_MessageBoxData data
* data.flags = 0
* if warn: # <<<<<<<<<<<<<<
@@ -3553,7 +3564,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_1 = (__pyx_v_warn != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":89
+ /* "pygame/_sdl2/video.pyx":96
* data.flags = 0
* if warn:
* data.flags |= _SDL_MESSAGEBOX_WARNING # <<<<<<<<<<<<<<
@@ -3562,7 +3573,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_WARNING);
- /* "pygame/_sdl2/video.pyx":88
+ /* "pygame/_sdl2/video.pyx":95
* cdef SDL_MessageBoxData data
* data.flags = 0
* if warn: # <<<<<<<<<<<<<<
@@ -3571,7 +3582,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":90
+ /* "pygame/_sdl2/video.pyx":97
* if warn:
* data.flags |= _SDL_MESSAGEBOX_WARNING
* if error: # <<<<<<<<<<<<<<
@@ -3581,7 +3592,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_1 = (__pyx_v_error != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":91
+ /* "pygame/_sdl2/video.pyx":98
* data.flags |= _SDL_MESSAGEBOX_WARNING
* if error:
* data.flags |= _SDL_MESSAGEBOX_ERROR # <<<<<<<<<<<<<<
@@ -3590,7 +3601,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_ERROR);
- /* "pygame/_sdl2/video.pyx":90
+ /* "pygame/_sdl2/video.pyx":97
* if warn:
* data.flags |= _SDL_MESSAGEBOX_WARNING
* if error: # <<<<<<<<<<<<<<
@@ -3599,7 +3610,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":92
+ /* "pygame/_sdl2/video.pyx":99
* if error:
* data.flags |= _SDL_MESSAGEBOX_ERROR
* if info: # <<<<<<<<<<<<<<
@@ -3609,7 +3620,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_1 = (__pyx_v_info != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":93
+ /* "pygame/_sdl2/video.pyx":100
* data.flags |= _SDL_MESSAGEBOX_ERROR
* if info:
* data.flags |= _SDL_MESSAGEBOX_INFORMATION # <<<<<<<<<<<<<<
@@ -3618,7 +3629,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_INFORMATION);
- /* "pygame/_sdl2/video.pyx":92
+ /* "pygame/_sdl2/video.pyx":99
* if error:
* data.flags |= _SDL_MESSAGEBOX_ERROR
* if info: # <<<<<<<<<<<<<<
@@ -3627,18 +3638,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":94
+ /* "pygame/_sdl2/video.pyx":101
* if info:
* data.flags |= _SDL_MESSAGEBOX_INFORMATION
* if not window: # <<<<<<<<<<<<<<
* data.window = NULL
* else:
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_window)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 94, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_window)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
__pyx_t_2 = ((!__pyx_t_1) != 0);
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":95
+ /* "pygame/_sdl2/video.pyx":102
* data.flags |= _SDL_MESSAGEBOX_INFORMATION
* if not window:
* data.window = NULL # <<<<<<<<<<<<<<
@@ -3647,7 +3658,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.window = NULL;
- /* "pygame/_sdl2/video.pyx":94
+ /* "pygame/_sdl2/video.pyx":101
* if info:
* data.flags |= _SDL_MESSAGEBOX_INFORMATION
* if not window: # <<<<<<<<<<<<<<
@@ -3657,7 +3668,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
goto __pyx_L6;
}
- /* "pygame/_sdl2/video.pyx":97
+ /* "pygame/_sdl2/video.pyx":104
* data.window = NULL
* else:
* data.window = window._win # <<<<<<<<<<<<<<
@@ -3670,7 +3681,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_L6:;
- /* "pygame/_sdl2/video.pyx":98
+ /* "pygame/_sdl2/video.pyx":105
* else:
* data.window = window._win
* if title is not None: # <<<<<<<<<<<<<<
@@ -3681,14 +3692,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":99
+ /* "pygame/_sdl2/video.pyx":106
* data.window = window._win
* if title is not None:
* title = title.encode('utf8') # <<<<<<<<<<<<<<
* data.title = title
* else:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
@@ -3702,23 +3713,23 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_utf8);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF_SET(__pyx_v_title, __pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":100
+ /* "pygame/_sdl2/video.pyx":107
* if title is not None:
* title = title.encode('utf8')
* data.title = title # <<<<<<<<<<<<<<
* else:
* data.title = NULL
*/
- __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_title); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_title); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
__pyx_v_data.title = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":98
+ /* "pygame/_sdl2/video.pyx":105
* else:
* data.window = window._win
* if title is not None: # <<<<<<<<<<<<<<
@@ -3728,7 +3739,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
goto __pyx_L7;
}
- /* "pygame/_sdl2/video.pyx":102
+ /* "pygame/_sdl2/video.pyx":109
* data.title = title
* else:
* data.title = NULL # <<<<<<<<<<<<<<
@@ -3740,14 +3751,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_L7:;
- /* "pygame/_sdl2/video.pyx":103
+ /* "pygame/_sdl2/video.pyx":110
* else:
* data.title = NULL
* message = message.encode('utf8') # <<<<<<<<<<<<<<
* data.message = message
* data.colorScheme = NULL
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
@@ -3761,23 +3772,23 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_utf8);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":104
+ /* "pygame/_sdl2/video.pyx":111
* data.title = NULL
* message = message.encode('utf8')
* data.message = message # <<<<<<<<<<<<<<
* data.colorScheme = NULL
*
*/
- __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_message); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_message); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
__pyx_v_data.message = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":105
+ /* "pygame/_sdl2/video.pyx":112
* message = message.encode('utf8')
* data.message = message
* data.colorScheme = NULL # <<<<<<<<<<<<<<
@@ -3786,18 +3797,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.colorScheme = NULL;
- /* "pygame/_sdl2/video.pyx":108
+ /* "pygame/_sdl2/video.pyx":115
*
* cdef SDL_MessageBoxButtonData button
* if not buttons: # <<<<<<<<<<<<<<
* button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\
* _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_buttons); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 108, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_buttons); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 115, __pyx_L1_error)
__pyx_t_2 = ((!__pyx_t_1) != 0);
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":109
+ /* "pygame/_sdl2/video.pyx":116
* cdef SDL_MessageBoxButtonData button
* if not buttons:
* button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\ # <<<<<<<<<<<<<<
@@ -3806,7 +3817,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_button.flags = (SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT);
- /* "pygame/_sdl2/video.pyx":111
+ /* "pygame/_sdl2/video.pyx":118
* button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\
* _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
* button.buttonid = 0 # <<<<<<<<<<<<<<
@@ -3815,7 +3826,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_button.buttonid = 0;
- /* "pygame/_sdl2/video.pyx":112
+ /* "pygame/_sdl2/video.pyx":119
* _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
* button.buttonid = 0
* button.text = "OK" # <<<<<<<<<<<<<<
@@ -3824,7 +3835,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_button.text = ((char const *)"OK");
- /* "pygame/_sdl2/video.pyx":113
+ /* "pygame/_sdl2/video.pyx":120
* button.buttonid = 0
* button.text = "OK"
* data.buttons = &button # <<<<<<<<<<<<<<
@@ -3833,7 +3844,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.buttons = (&__pyx_v_button);
- /* "pygame/_sdl2/video.pyx":114
+ /* "pygame/_sdl2/video.pyx":121
* button.text = "OK"
* data.buttons = &button
* data.numbuttons = 1 # <<<<<<<<<<<<<<
@@ -3842,7 +3853,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_data.numbuttons = 1;
- /* "pygame/_sdl2/video.pyx":108
+ /* "pygame/_sdl2/video.pyx":115
*
* cdef SDL_MessageBoxButtonData button
* if not buttons: # <<<<<<<<<<<<<<
@@ -3852,7 +3863,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
goto __pyx_L8;
}
- /* "pygame/_sdl2/video.pyx":116
+ /* "pygame/_sdl2/video.pyx":123
* data.numbuttons = 1
* else:
* buttons_utf8 = [s.encode('utf8') for s in buttons] # <<<<<<<<<<<<<<
@@ -3861,32 +3872,32 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
/*else*/ {
{ /* enter inner scope */
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_4);
if (likely(PyList_CheckExact(__pyx_v_buttons)) || PyTuple_CheckExact(__pyx_v_buttons)) {
__pyx_t_5 = __pyx_v_buttons; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
__pyx_t_10 = NULL;
} else {
- __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_buttons); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_buttons); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 123, __pyx_L11_error)
}
for (;;) {
if (likely(!__pyx_t_10)) {
if (likely(PyList_CheckExact(__pyx_t_5))) {
if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 123, __pyx_L11_error)
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
} else {
if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 123, __pyx_L11_error)
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
}
@@ -3896,7 +3907,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else __PYX_ERR(0, 116, __pyx_L11_error)
+ else __PYX_ERR(0, 123, __pyx_L11_error)
}
break;
}
@@ -3904,7 +3915,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_s, __pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __pyx_L11_error)
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
@@ -3918,10 +3929,10 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_n_s_utf8);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L11_error)
+ if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 116, __pyx_L11_error)
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 123, __pyx_L11_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -3935,17 +3946,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_v_buttons_utf8 = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":117
+ /* "pygame/_sdl2/video.pyx":124
* else:
* buttons_utf8 = [s.encode('utf8') for s in buttons]
* data.numbuttons = len(buttons) # <<<<<<<<<<<<<<
* c_buttons =\
* malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
*/
- __pyx_t_9 = PyObject_Length(__pyx_v_buttons); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 117, __pyx_L1_error)
+ __pyx_t_9 = PyObject_Length(__pyx_v_buttons); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 124, __pyx_L1_error)
__pyx_v_data.numbuttons = __pyx_t_9;
- /* "pygame/_sdl2/video.pyx":119
+ /* "pygame/_sdl2/video.pyx":126
* data.numbuttons = len(buttons)
* c_buttons =\
* malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData)) # <<<<<<<<<<<<<<
@@ -3954,7 +3965,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
__pyx_v_c_buttons = ((SDL_MessageBoxButtonData *)malloc((__pyx_v_data.numbuttons * (sizeof(SDL_MessageBoxButtonData)))));
- /* "pygame/_sdl2/video.pyx":120
+ /* "pygame/_sdl2/video.pyx":127
* c_buttons =\
* malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
* if not c_buttons: # <<<<<<<<<<<<<<
@@ -3964,16 +3975,16 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_2 = ((!(__pyx_v_c_buttons != 0)) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":121
+ /* "pygame/_sdl2/video.pyx":128
* malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
* if not c_buttons:
* raise MemoryError() # <<<<<<<<<<<<<<
* for i, but in enumerate(reversed(buttons_utf8)):
* c_buttons[i].flags = 0
*/
- PyErr_NoMemory(); __PYX_ERR(0, 121, __pyx_L1_error)
+ PyErr_NoMemory(); __PYX_ERR(0, 128, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":120
+ /* "pygame/_sdl2/video.pyx":127
* c_buttons =\
* malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
* if not c_buttons: # <<<<<<<<<<<<<<
@@ -3982,7 +3993,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":122
+ /* "pygame/_sdl2/video.pyx":129
* if not c_buttons:
* raise MemoryError()
* for i, but in enumerate(reversed(buttons_utf8)): # <<<<<<<<<<<<<<
@@ -3996,78 +4007,78 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
if (__pyx_t_9 < 0) break;
if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9--; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error)
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9--; if (unlikely(0 < 0)) __PYX_ERR(0, 129, __pyx_L1_error)
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9--; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error)
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9--; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_XDECREF_SET(__pyx_v_but, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
- __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "pygame/_sdl2/video.pyx":123
+ /* "pygame/_sdl2/video.pyx":130
* raise MemoryError()
* for i, but in enumerate(reversed(buttons_utf8)):
* c_buttons[i].flags = 0 # <<<<<<<<<<<<<<
* c_buttons[i].buttonid = data.numbuttons - i - 1
* if c_buttons[i].buttonid == return_button:
*/
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error)
(__pyx_v_c_buttons[__pyx_t_13]).flags = 0;
- /* "pygame/_sdl2/video.pyx":124
+ /* "pygame/_sdl2/video.pyx":131
* for i, but in enumerate(reversed(buttons_utf8)):
* c_buttons[i].flags = 0
* c_buttons[i].buttonid = data.numbuttons - i - 1 # <<<<<<<<<<<<<<
* if c_buttons[i].buttonid == return_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
*/
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_data.numbuttons); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_data.numbuttons); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_11 = PyNumber_Subtract(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 124, __pyx_L1_error)
+ __pyx_t_11 = PyNumber_Subtract(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_11, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_11, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
(__pyx_v_c_buttons[__pyx_t_13]).buttonid = __pyx_t_14;
- /* "pygame/_sdl2/video.pyx":125
+ /* "pygame/_sdl2/video.pyx":132
* c_buttons[i].flags = 0
* c_buttons[i].buttonid = data.numbuttons - i - 1
* if c_buttons[i].buttonid == return_button: # <<<<<<<<<<<<<<
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
* if c_buttons[i].buttonid == escape_button:
*/
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
- __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_11 = PyObject_RichCompare(__pyx_t_6, __pyx_v_return_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 125, __pyx_L1_error)
+ __pyx_t_11 = PyObject_RichCompare(__pyx_t_6, __pyx_v_return_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 125, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":126
+ /* "pygame/_sdl2/video.pyx":133
* c_buttons[i].buttonid = data.numbuttons - i - 1
* if c_buttons[i].buttonid == return_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT # <<<<<<<<<<<<<<
* if c_buttons[i].buttonid == escape_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
*/
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)
(__pyx_v_c_buttons[__pyx_t_13]).flags = ((__pyx_v_c_buttons[__pyx_t_13]).flags | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT);
- /* "pygame/_sdl2/video.pyx":125
+ /* "pygame/_sdl2/video.pyx":132
* c_buttons[i].flags = 0
* c_buttons[i].buttonid = data.numbuttons - i - 1
* if c_buttons[i].buttonid == return_button: # <<<<<<<<<<<<<<
@@ -4076,33 +4087,33 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":127
+ /* "pygame/_sdl2/video.pyx":134
* if c_buttons[i].buttonid == return_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
* if c_buttons[i].buttonid == escape_button: # <<<<<<<<<<<<<<
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
* c_buttons[i].text = but
*/
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L1_error)
- __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_6 = PyObject_RichCompare(__pyx_t_11, __pyx_v_escape_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_11, __pyx_v_escape_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":128
+ /* "pygame/_sdl2/video.pyx":135
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
* if c_buttons[i].buttonid == escape_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT # <<<<<<<<<<<<<<
* c_buttons[i].text = but
* data.buttons = c_buttons
*/
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
(__pyx_v_c_buttons[__pyx_t_13]).flags = ((__pyx_v_c_buttons[__pyx_t_13]).flags | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT);
- /* "pygame/_sdl2/video.pyx":127
+ /* "pygame/_sdl2/video.pyx":134
* if c_buttons[i].buttonid == return_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
* if c_buttons[i].buttonid == escape_button: # <<<<<<<<<<<<<<
@@ -4111,18 +4122,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":129
+ /* "pygame/_sdl2/video.pyx":136
* if c_buttons[i].buttonid == escape_button:
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
* c_buttons[i].text = but # <<<<<<<<<<<<<<
* data.buttons = c_buttons
*
*/
- __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_but); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error)
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error)
+ __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_but); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
(__pyx_v_c_buttons[__pyx_t_13]).text = __pyx_t_15;
- /* "pygame/_sdl2/video.pyx":122
+ /* "pygame/_sdl2/video.pyx":129
* if not c_buttons:
* raise MemoryError()
* for i, but in enumerate(reversed(buttons_utf8)): # <<<<<<<<<<<<<<
@@ -4133,7 +4144,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":130
+ /* "pygame/_sdl2/video.pyx":137
* c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
* c_buttons[i].text = but
* data.buttons = c_buttons # <<<<<<<<<<<<<<
@@ -4144,7 +4155,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_L8:;
- /* "pygame/_sdl2/video.pyx":133
+ /* "pygame/_sdl2/video.pyx":140
*
* cdef int buttonid
* if SDL_ShowMessageBox(&data, &buttonid): # <<<<<<<<<<<<<<
@@ -4154,7 +4165,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
__pyx_t_2 = (SDL_ShowMessageBox((&__pyx_v_data), (&__pyx_v_buttonid)) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":134
+ /* "pygame/_sdl2/video.pyx":141
* cdef int buttonid
* if SDL_ShowMessageBox(&data, &buttonid):
* free(c_buttons) # <<<<<<<<<<<<<<
@@ -4163,14 +4174,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
free(__pyx_v_c_buttons);
- /* "pygame/_sdl2/video.pyx":135
+ /* "pygame/_sdl2/video.pyx":142
* if SDL_ShowMessageBox(&data, &buttonid):
* free(c_buttons)
* raise errorfnc() # <<<<<<<<<<<<<<
*
* free(c_buttons)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_errorfnc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_errorfnc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -4184,14 +4195,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
}
__pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __PYX_ERR(0, 135, __pyx_L1_error)
+ __PYX_ERR(0, 142, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":133
+ /* "pygame/_sdl2/video.pyx":140
*
* cdef int buttonid
* if SDL_ShowMessageBox(&data, &buttonid): # <<<<<<<<<<<<<<
@@ -4200,7 +4211,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
}
- /* "pygame/_sdl2/video.pyx":137
+ /* "pygame/_sdl2/video.pyx":144
* raise errorfnc()
*
* free(c_buttons) # <<<<<<<<<<<<<<
@@ -4209,22 +4220,22 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
*/
free(__pyx_v_c_buttons);
- /* "pygame/_sdl2/video.pyx":138
+ /* "pygame/_sdl2/video.pyx":145
*
* free(c_buttons)
* return buttonid # <<<<<<<<<<<<<<
*
- *
+ * globals()["Window"]=Window
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_buttonid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_buttonid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":62
- *
+ /* "pygame/_sdl2/video.pyx":67
+ * return None
*
* def messagebox(title, message, # <<<<<<<<<<<<<<
* Window window=None,
@@ -4252,29 +4263,30 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObje
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":166
+/* "pygame/_sdl2/video.pyx":174
*
* @classmethod
* def from_display_module(cls): # <<<<<<<<<<<<<<
- * cdef Window self = cls.__new__(cls)
- * cdef SDL_Window* window = pg_GetDefaultWindow()
+ * """Create a Window object using window data from display module
+ *
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_from_display_module[] = "Create a Window object using window data from display module\n\n Creates a Window object that uses the same window data from the :mod:`pygame.display` module, created upon calling\n :func:`pygame.display.set_mode`.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("from_display_module (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(((PyTypeObject*)__pyx_v_cls));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_from_display_module(((PyTypeObject*)__pyx_v_cls));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTypeObject *__pyx_v_cls) {
- struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self = 0;
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_from_display_module(PyTypeObject *__pyx_v_cls) {
+ struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self = 0;
SDL_Window *__pyx_v_window;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -4287,34 +4299,34 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("from_display_module", 0);
- /* "pygame/_sdl2/video.pyx":167
- * @classmethod
- * def from_display_module(cls):
- * cdef Window self = cls.__new__(cls) # <<<<<<<<<<<<<<
+ /* "pygame/_sdl2/video.pyx":180
+ * :func:`pygame.display.set_mode`.
+ * """
+ * cdef _Window self = cls.__new__(cls) # <<<<<<<<<<<<<<
* cdef SDL_Window* window = pg_GetDefaultWindow()
* if not window:
*/
if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
- __PYX_ERR(0, 167, __pyx_L1_error)
+ __PYX_ERR(0, 180, __pyx_L1_error)
}
- __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Window)))) __PYX_ERR(0, 167, __pyx_L1_error)
- __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_t_1);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video__Window)))) __PYX_ERR(0, 180, __pyx_L1_error)
+ __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":168
- * def from_display_module(cls):
- * cdef Window self = cls.__new__(cls)
+ /* "pygame/_sdl2/video.pyx":181
+ * """
+ * cdef _Window self = cls.__new__(cls)
* cdef SDL_Window* window = pg_GetDefaultWindow() # <<<<<<<<<<<<<<
* if not window:
* raise error()
*/
__pyx_v_window = pg_GetDefaultWindow();
- /* "pygame/_sdl2/video.pyx":169
- * cdef Window self = cls.__new__(cls)
+ /* "pygame/_sdl2/video.pyx":182
+ * cdef _Window self = cls.__new__(cls)
* cdef SDL_Window* window = pg_GetDefaultWindow()
* if not window: # <<<<<<<<<<<<<<
* raise error()
@@ -4323,14 +4335,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
__pyx_t_2 = ((!(__pyx_v_window != 0)) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":170
+ /* "pygame/_sdl2/video.pyx":183
* cdef SDL_Window* window = pg_GetDefaultWindow()
* if not window:
* raise error() # <<<<<<<<<<<<<<
* self._win=window
* self._is_borrowed=1
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -4344,15 +4356,15 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
}
__pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 170, __pyx_L1_error)
+ __PYX_ERR(0, 183, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":169
- * cdef Window self = cls.__new__(cls)
+ /* "pygame/_sdl2/video.pyx":182
+ * cdef _Window self = cls.__new__(cls)
* cdef SDL_Window* window = pg_GetDefaultWindow()
* if not window: # <<<<<<<<<<<<<<
* raise error()
@@ -4360,7 +4372,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
*/
}
- /* "pygame/_sdl2/video.pyx":171
+ /* "pygame/_sdl2/video.pyx":184
* if not window:
* raise error()
* self._win=window # <<<<<<<<<<<<<<
@@ -4369,7 +4381,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
*/
__pyx_v_self->_win = __pyx_v_window;
- /* "pygame/_sdl2/video.pyx":172
+ /* "pygame/_sdl2/video.pyx":185
* raise error()
* self._win=window
* self._is_borrowed=1 # <<<<<<<<<<<<<<
@@ -4378,7 +4390,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
*/
__pyx_v_self->_is_borrowed = 1;
- /* "pygame/_sdl2/video.pyx":173
+ /* "pygame/_sdl2/video.pyx":186
* self._win=window
* self._is_borrowed=1
* SDL_SetWindowData(window, "pg_window", self) # <<<<<<<<<<<<<<
@@ -4387,24 +4399,24 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
*/
(void)(SDL_SetWindowData(__pyx_v_window, ((char const *)"pg_window"), ((PyObject *)__pyx_v_self)));
- /* "pygame/_sdl2/video.pyx":174
+ /* "pygame/_sdl2/video.pyx":187
* self._is_borrowed=1
* SDL_SetWindowData(window, "pg_window", self)
* return self # <<<<<<<<<<<<<<
*
- * def __init__(self, title='pygame',
+ * def __init__(self, title='pygame window',
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":166
+ /* "pygame/_sdl2/video.pyx":174
*
* @classmethod
* def from_display_module(cls): # <<<<<<<<<<<<<<
- * cdef Window self = cls.__new__(cls)
- * cdef SDL_Window* window = pg_GetDefaultWindow()
+ * """Create a Window object using window data from display module
+ *
*/
/* function exit code */
@@ -4412,7 +4424,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.from_display_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.from_display_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_self);
@@ -4421,21 +4433,21 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTy
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":176
+/* "pygame/_sdl2/video.pyx":189
* return self
*
- * def __init__(self, title='pygame', # <<<<<<<<<<<<<<
+ * def __init__(self, title='pygame window', # <<<<<<<<<<<<<<
* size=DEFAULT_SIZE,
* position=WINDOWPOS_UNDEFINED,
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_2__init__[] = " Create a window with the specified position, dimensions, and flags.\n\n :param str title: the title of the window, in UTF-8 encoding\n :param tuple size: the size of the window, in screen coordinates (width, height)\n :param position: a tuple specifying the window position, WINDOWPOS_CENTERED, or WINDOWPOS_UNDEFINED.\n :param bool fullscreen: fullscreen window using the window size as the resolution (videomode change)\n :param bool fullscreen_desktop: fullscreen window using the current desktop resolution\n :param bool opengl: Usable with OpenGL context. You will still need to create an OpenGL context.\n :param bool vulkan: usable with a Vulkan instance\n :param bool hidden: window is not visible\n :param bool borderless: no window decoration\n :param bool resizable: window can be resized\n :param bool minimized: window is minimized\n :param bool maximized: window is maximized\n :param bool input_grabbed: window has grabbed input focus\n :param bool input_focus: window has input focus\n :param bool mouse_focus: window has mouse focus\n :param bool foreign: window not created by SDL\n :param bool allow_highdpi: window should be created in high-DPI mode if supported (>= SDL 2.0.1)\n :param bool mouse_capture: window has mouse captured (unrelated to INPUT_GRABBED, >= SDL 2.0.4)\n :param bool always_on_top: window should always be above others (X11 only, >= SDL 2.0.5)\n :param bool skip_taskbar: window should not be added to the taskbar (X11 only, >= SDL 2.0.5)\n :param bool utility: window should be treated as a utility window (X11 only, >= SDL 2.0.5)\n :param bool tooltip: window should be treated as a tooltip (X11 only, >= SDL 2.0.5)\n :param bool popup_menu: window should be treated as a popup menu (X11 only, >= SDL 2.0.5)\n ";
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_2__init__[] = "pygame object that represents a window\n\n Creates a window.\n\n :param str title: The title of the window.\n :param (int, int) size: The size of the window, in screen coordinates.\n :param (int, int) or int position: A tuple specifying the window position, or\n ``WINDOWPOS_CENTERED``, or ``WINDOWPOS_UNDEFINED``.\n :param bool fullscreen: Create a fullscreen window using the window size as\n the resolution (videomode change).\n :param bool fullscreen_desktop: Create a fullscreen window using the current\n desktop resolution.\n :param bool opengl: Create a window with support for an OpenGL context. You\n will still need to create an OpenGL context separately.\n :param bool vulkan: Create a window with support for a Vulkan instance.\n :param bool hidden: Create a hidden window.\n :param bool borderless: Create a window without borders.\n :param bool resizable: Create a resizable window.\n :param bool minimized: Create a mimized window.\n :param bool maximized: Create a maximized window.\n :param bool input_grabbed: Create a window with a grabbed input focus.\n :param bool input_focus: Create a window with input focus.\n :param bool mouse_focus: Create a window with mouse focus.\n :param bool foreign: Marks a window not created by SDL.\n :param bool allow_highdpi: Create a window in high-DPI mode if supported\n (>= SDL 2.0.1).\n :param bool mouse_capture: Create a window that has the mouse captured\n (unrelated to INPUT_GRABBED, >= SDL 2.0.4).\n :param bool always_on_top: Create a window that is always on top\n (X11 only, >= SDL 2.0.5).\n :param bool skip_taskbar: Create a window that sho""uld not be added to the\n taskbar (X11 only, >= SDL 2.0.5).\n :param bool utility: Create a window that should be treated as a utility\n window (X11 only, >= SDL 2.0.5).\n :param bool tooltip: Create a window that should be treated as a tooltip\n (X11 only, >= SDL 2.0.5).\n :param bool popup_menu: Create a window that should be treated as a popup menu \n (X11 only, >= SDL 2.0.5).\n ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
-struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__;
+struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_7_Window_2__init__;
#endif
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_title = 0;
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_position = 0;
@@ -4453,7 +4465,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_se
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_title,&__pyx_n_s_size,&__pyx_n_s_position,&__pyx_n_s_fullscreen,&__pyx_n_s_fullscreen_desktop,0};
PyObject* values[5] = {0,0,0,0,0};
- values[0] = ((PyObject *)__pyx_n_s_pygame);
+ values[0] = ((PyObject *)__pyx_kp_s_pygame_window);
values[1] = __pyx_k__3;
values[2] = __pyx_k__4;
if (unlikely(__pyx_kwds)) {
@@ -4506,7 +4518,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_se
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 176, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 189, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -4528,27 +4540,27 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_se
__pyx_v_size = values[1];
__pyx_v_position = values[2];
if (values[3]) {
- __pyx_v_fullscreen = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_fullscreen == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L3_error)
+ __pyx_v_fullscreen = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_fullscreen == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":179
+ /* "pygame/_sdl2/video.pyx":192
* size=DEFAULT_SIZE,
* position=WINDOWPOS_UNDEFINED,
* bint fullscreen=False, # <<<<<<<<<<<<<<
* bint fullscreen_desktop=False, **kwargs):
- * """ Create a window with the specified position, dimensions, and flags.
+ * """pygame object that represents a window
*/
__pyx_v_fullscreen = ((int)0);
}
if (values[4]) {
- __pyx_v_fullscreen_desktop = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_fullscreen_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
+ __pyx_v_fullscreen_desktop = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_fullscreen_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":180
+ /* "pygame/_sdl2/video.pyx":193
* position=WINDOWPOS_UNDEFINED,
* bint fullscreen=False,
* bint fullscreen_desktop=False, **kwargs): # <<<<<<<<<<<<<<
- * """ Create a window with the specified position, dimensions, and flags.
+ * """pygame object that represents a window
*
*/
__pyx_v_fullscreen_desktop = ((int)0);
@@ -4556,19 +4568,19 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_se
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 176, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 189, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_title, __pyx_v_size, __pyx_v_position, __pyx_v_fullscreen, __pyx_v_fullscreen_desktop, __pyx_v_kwargs);
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), __pyx_v_title, __pyx_v_size, __pyx_v_position, __pyx_v_fullscreen, __pyx_v_fullscreen_desktop, __pyx_v_kwargs);
- /* "pygame/_sdl2/video.pyx":176
+ /* "pygame/_sdl2/video.pyx":189
* return self
*
- * def __init__(self, title='pygame', # <<<<<<<<<<<<<<
+ * def __init__(self, title='pygame window', # <<<<<<<<<<<<<<
* size=DEFAULT_SIZE,
* position=WINDOWPOS_UNDEFINED,
*/
@@ -4579,7 +4591,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_se
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs) {
PyObject *__pyx_v_x = NULL;
PyObject *__pyx_v_y = NULL;
PyObject *__pyx_v_flags = NULL;
@@ -4616,38 +4628,38 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "pygame/_sdl2/video.pyx":209
+ /* "pygame/_sdl2/video.pyx":235
* # https://wiki.libsdl.org/SDL_CreateWindow
* # https://wiki.libsdl.org/SDL_WindowFlags
* if position == WINDOWPOS_UNDEFINED: # <<<<<<<<<<<<<<
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 235, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":210
+ /* "pygame/_sdl2/video.pyx":236
* # https://wiki.libsdl.org/SDL_WindowFlags
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED # <<<<<<<<<<<<<<
* elif position == WINDOWPOS_CENTERED:
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_x = __pyx_t_2;
__pyx_t_2 = 0;
__pyx_v_y = __pyx_t_1;
__pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":209
+ /* "pygame/_sdl2/video.pyx":235
* # https://wiki.libsdl.org/SDL_CreateWindow
* # https://wiki.libsdl.org/SDL_WindowFlags
* if position == WINDOWPOS_UNDEFINED: # <<<<<<<<<<<<<<
@@ -4657,38 +4669,38 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":211
+ /* "pygame/_sdl2/video.pyx":237
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED: # <<<<<<<<<<<<<<
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
* else:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":212
+ /* "pygame/_sdl2/video.pyx":238
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED:
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED # <<<<<<<<<<<<<<
* else:
* x, y = position
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_x = __pyx_t_2;
__pyx_t_2 = 0;
__pyx_v_y = __pyx_t_1;
__pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":211
+ /* "pygame/_sdl2/video.pyx":237
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED: # <<<<<<<<<<<<<<
@@ -4698,7 +4710,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":214
+ /* "pygame/_sdl2/video.pyx":240
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
* else:
* x, y = position # <<<<<<<<<<<<<<
@@ -4712,7 +4724,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- __PYX_ERR(0, 214, __pyx_L1_error)
+ __PYX_ERR(0, 240, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
@@ -4725,21 +4737,21 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_2);
#else
- __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error)
+ __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
} else {
Py_ssize_t index = -1;
- __pyx_t_4 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
+ __pyx_t_4 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 214, __pyx_L1_error)
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
__pyx_t_5 = NULL;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L5_unpacking_done;
@@ -4747,7 +4759,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- __PYX_ERR(0, 214, __pyx_L1_error)
+ __PYX_ERR(0, 240, __pyx_L1_error)
__pyx_L5_unpacking_done:;
}
__pyx_v_x = __pyx_t_1;
@@ -4757,7 +4769,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":216
+ /* "pygame/_sdl2/video.pyx":242
* x, y = position
*
* flags = 0 # <<<<<<<<<<<<<<
@@ -4767,7 +4779,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_INCREF(__pyx_int_0);
__pyx_v_flags = __pyx_int_0;
- /* "pygame/_sdl2/video.pyx":217
+ /* "pygame/_sdl2/video.pyx":243
*
* flags = 0
* if fullscreen and fullscreen_desktop: # <<<<<<<<<<<<<<
@@ -4785,20 +4797,20 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_L7_bool_binop_done:;
if (unlikely(__pyx_t_3)) {
- /* "pygame/_sdl2/video.pyx":218
+ /* "pygame/_sdl2/video.pyx":244
* flags = 0
* if fullscreen and fullscreen_desktop:
* raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.") # <<<<<<<<<<<<<<
* if fullscreen:
* flags |= _SDL_WINDOW_FULLSCREEN
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 218, __pyx_L1_error)
+ __PYX_ERR(0, 244, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":217
+ /* "pygame/_sdl2/video.pyx":243
*
* flags = 0
* if fullscreen and fullscreen_desktop: # <<<<<<<<<<<<<<
@@ -4807,7 +4819,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
}
- /* "pygame/_sdl2/video.pyx":219
+ /* "pygame/_sdl2/video.pyx":245
* if fullscreen and fullscreen_desktop:
* raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
* if fullscreen: # <<<<<<<<<<<<<<
@@ -4817,22 +4829,22 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_t_3 = (__pyx_v_fullscreen != 0);
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":220
+ /* "pygame/_sdl2/video.pyx":246
* raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
* if fullscreen:
* flags |= _SDL_WINDOW_FULLSCREEN # <<<<<<<<<<<<<<
* elif fullscreen_desktop:
* flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
+ __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
__pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":219
+ /* "pygame/_sdl2/video.pyx":245
* if fullscreen and fullscreen_desktop:
* raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
* if fullscreen: # <<<<<<<<<<<<<<
@@ -4842,7 +4854,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
goto __pyx_L9;
}
- /* "pygame/_sdl2/video.pyx":221
+ /* "pygame/_sdl2/video.pyx":247
* if fullscreen:
* flags |= _SDL_WINDOW_FULLSCREEN
* elif fullscreen_desktop: # <<<<<<<<<<<<<<
@@ -4852,22 +4864,22 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_t_3 = (__pyx_v_fullscreen_desktop != 0);
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":222
+ /* "pygame/_sdl2/video.pyx":248
* flags |= _SDL_WINDOW_FULLSCREEN
* elif fullscreen_desktop:
* flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP # <<<<<<<<<<<<<<
*
* _kwarg_to_flag = self._kwarg_to_flag
*/
- __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN_DESKTOP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN_DESKTOP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
+ __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":221
+ /* "pygame/_sdl2/video.pyx":247
* if fullscreen:
* flags |= _SDL_WINDOW_FULLSCREEN
* elif fullscreen_desktop: # <<<<<<<<<<<<<<
@@ -4877,19 +4889,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_L9:;
- /* "pygame/_sdl2/video.pyx":224
+ /* "pygame/_sdl2/video.pyx":250
* flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
*
* _kwarg_to_flag = self._kwarg_to_flag # <<<<<<<<<<<<<<
* for k, v in kwargs.items():
* try:
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwarg_to_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwarg_to_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v__kwarg_to_flag = __pyx_t_2;
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":225
+ /* "pygame/_sdl2/video.pyx":251
*
* _kwarg_to_flag = self._kwarg_to_flag
* for k, v in kwargs.items(): # <<<<<<<<<<<<<<
@@ -4897,7 +4909,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
* flag = _kwarg_to_flag[k]
*/
__pyx_t_7 = 0;
- __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_1;
@@ -4905,7 +4917,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
while (1) {
__pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_8, &__pyx_t_7, &__pyx_t_1, &__pyx_t_4, NULL, __pyx_t_9);
if (unlikely(__pyx_t_10 == 0)) break;
- if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 225, __pyx_L1_error)
+ if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
@@ -4913,7 +4925,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":226
+ /* "pygame/_sdl2/video.pyx":252
* _kwarg_to_flag = self._kwarg_to_flag
* for k, v in kwargs.items():
* try: # <<<<<<<<<<<<<<
@@ -4929,41 +4941,41 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_XGOTREF(__pyx_t_13);
/*try:*/ {
- /* "pygame/_sdl2/video.pyx":227
+ /* "pygame/_sdl2/video.pyx":253
* for k, v in kwargs.items():
* try:
* flag = _kwarg_to_flag[k] # <<<<<<<<<<<<<<
* if v:
* flags |= flag
*/
- __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v__kwarg_to_flag, __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L12_error)
+ __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v__kwarg_to_flag, __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L12_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_flag, __pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":228
+ /* "pygame/_sdl2/video.pyx":254
* try:
* flag = _kwarg_to_flag[k]
* if v: # <<<<<<<<<<<<<<
* flags |= flag
* except KeyError:
*/
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 228, __pyx_L12_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 254, __pyx_L12_error)
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":229
+ /* "pygame/_sdl2/video.pyx":255
* flag = _kwarg_to_flag[k]
* if v:
* flags |= flag # <<<<<<<<<<<<<<
* except KeyError:
* raise TypeError("unknown parameter: %s" % k)
*/
- __pyx_t_4 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_v_flag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L12_error)
+ __pyx_t_4 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_v_flag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L12_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":228
+ /* "pygame/_sdl2/video.pyx":254
* try:
* flag = _kwarg_to_flag[k]
* if v: # <<<<<<<<<<<<<<
@@ -4972,7 +4984,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
}
- /* "pygame/_sdl2/video.pyx":226
+ /* "pygame/_sdl2/video.pyx":252
* _kwarg_to_flag = self._kwarg_to_flag
* for k, v in kwargs.items():
* try: # <<<<<<<<<<<<<<
@@ -4988,7 +5000,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":230
+ /* "pygame/_sdl2/video.pyx":256
* if v:
* flags |= flag
* except KeyError: # <<<<<<<<<<<<<<
@@ -4997,32 +5009,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
__pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
if (__pyx_t_10) {
- __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_14) < 0) __PYX_ERR(0, 230, __pyx_L14_except_error)
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_14) < 0) __PYX_ERR(0, 256, __pyx_L14_except_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_14);
- /* "pygame/_sdl2/video.pyx":231
+ /* "pygame/_sdl2/video.pyx":257
* flags |= flag
* except KeyError:
* raise TypeError("unknown parameter: %s" % k) # <<<<<<<<<<<<<<
*
* self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
*/
- __pyx_t_15 = __Pyx_PyString_FormatSafe(__pyx_kp_s_unknown_parameter_s, __pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 231, __pyx_L14_except_error)
+ __pyx_t_15 = __Pyx_PyString_FormatSafe(__pyx_kp_s_unknown_parameter_s, __pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 257, __pyx_L14_except_error)
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 231, __pyx_L14_except_error)
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 257, __pyx_L14_except_error)
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_Raise(__pyx_t_16, 0, 0, 0);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __PYX_ERR(0, 231, __pyx_L14_except_error)
+ __PYX_ERR(0, 257, __pyx_L14_except_error)
}
goto __pyx_L14_except_error;
__pyx_L14_except_error:;
- /* "pygame/_sdl2/video.pyx":226
+ /* "pygame/_sdl2/video.pyx":252
* _kwarg_to_flag = self._kwarg_to_flag
* for k, v in kwargs.items():
* try: # <<<<<<<<<<<<<<
@@ -5039,14 +5051,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":233
+ /* "pygame/_sdl2/video.pyx":259
* raise TypeError("unknown parameter: %s" % k)
*
* self._win = SDL_CreateWindow(title.encode('utf8'), x, y, # <<<<<<<<<<<<<<
* size[0], size[1], flags)
* self._is_borrowed=0
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 233, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 259, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_1 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
@@ -5060,31 +5072,31 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_n_s_utf8);
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_x); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
- __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_y); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
+ __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_x); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error)
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_y); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":234
+ /* "pygame/_sdl2/video.pyx":260
*
* self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
* size[0], size[1], flags) # <<<<<<<<<<<<<<
* self._is_borrowed=0
* if not self._win:
*/
- __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 234, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 260, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_14); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
+ __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_14); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 234, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 260, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_14); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
+ __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_14); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_20 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_20 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
+ __pyx_t_20 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_20 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":233
+ /* "pygame/_sdl2/video.pyx":259
* raise TypeError("unknown parameter: %s" % k)
*
* self._win = SDL_CreateWindow(title.encode('utf8'), x, y, # <<<<<<<<<<<<<<
@@ -5094,7 +5106,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_v_self->_win = SDL_CreateWindow(__pyx_t_17, __pyx_t_9, __pyx_t_10, __pyx_t_18, __pyx_t_19, __pyx_t_20);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":235
+ /* "pygame/_sdl2/video.pyx":261
* self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
* size[0], size[1], flags)
* self._is_borrowed=0 # <<<<<<<<<<<<<<
@@ -5103,7 +5115,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
__pyx_v_self->_is_borrowed = 0;
- /* "pygame/_sdl2/video.pyx":236
+ /* "pygame/_sdl2/video.pyx":262
* size[0], size[1], flags)
* self._is_borrowed=0
* if not self._win: # <<<<<<<<<<<<<<
@@ -5113,14 +5125,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_t_3 = ((!(__pyx_v_self->_win != 0)) != 0);
if (unlikely(__pyx_t_3)) {
- /* "pygame/_sdl2/video.pyx":237
+ /* "pygame/_sdl2/video.pyx":263
* self._is_borrowed=0
* if not self._win:
* raise error() # <<<<<<<<<<<<<<
* SDL_SetWindowData(self._win, "pg_window", self)
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_error); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 237, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_error); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 263, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_1 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
@@ -5134,14 +5146,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 237, __pyx_L1_error)
+ __PYX_ERR(0, 263, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":236
+ /* "pygame/_sdl2/video.pyx":262
* size[0], size[1], flags)
* self._is_borrowed=0
* if not self._win: # <<<<<<<<<<<<<<
@@ -5150,7 +5162,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
}
- /* "pygame/_sdl2/video.pyx":238
+ /* "pygame/_sdl2/video.pyx":264
* if not self._win:
* raise error()
* SDL_SetWindowData(self._win, "pg_window", self) # <<<<<<<<<<<<<<
@@ -5159,33 +5171,33 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
*/
(void)(SDL_SetWindowData(__pyx_v_self->_win, ((char const *)"pg_window"), ((PyObject *)__pyx_v_self)));
- /* "pygame/_sdl2/video.pyx":240
+ /* "pygame/_sdl2/video.pyx":266
* SDL_SetWindowData(self._win, "pg_window", self)
*
* import pygame.pkgdata # <<<<<<<<<<<<<<
* surf = pygame.image.load(pygame.pkgdata.getResource(
* 'pygame_icon.bmp'))
*/
- __pyx_t_2 = __Pyx_Import(__pyx_n_s_pygame_pkgdata, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_pygame_pkgdata, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_pygame = __pyx_t_2;
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":241
+ /* "pygame/_sdl2/video.pyx":267
*
* import pygame.pkgdata
* surf = pygame.image.load(pygame.pkgdata.getResource( # <<<<<<<<<<<<<<
* 'pygame_icon.bmp'))
* surf.set_colorkey(0)
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_image); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_image); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_pkgdata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_pkgdata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getResource); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 241, __pyx_L1_error)
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getResource); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = NULL;
@@ -5200,7 +5212,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_t_14 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_4, __pyx_kp_s_pygame_icon_bmp) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_kp_s_pygame_icon_bmp);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error)
+ if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_16 = NULL;
@@ -5216,20 +5228,20 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__pyx_t_2 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_16, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14);
__Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_surf = __pyx_t_2;
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":243
+ /* "pygame/_sdl2/video.pyx":269
* surf = pygame.image.load(pygame.pkgdata.getResource(
* 'pygame_icon.bmp'))
* surf.set_colorkey(0) # <<<<<<<<<<<<<<
* self.set_icon(surf)
*
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_set_colorkey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_set_colorkey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_14 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
@@ -5243,19 +5255,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_0);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":244
+ /* "pygame/_sdl2/video.pyx":270
* 'pygame_icon.bmp'))
* surf.set_colorkey(0)
* self.set_icon(surf) # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_icon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_icon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_14 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
@@ -5269,15 +5281,15 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
}
__pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_v_surf) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surf);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":176
+ /* "pygame/_sdl2/video.pyx":189
* return self
*
- * def __init__(self, title='pygame', # <<<<<<<<<<<<<<
+ * def __init__(self, title='pygame window', # <<<<<<<<<<<<<<
* size=DEFAULT_SIZE,
* position=WINDOWPOS_UNDEFINED,
*/
@@ -5292,7 +5304,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
__Pyx_XDECREF(__pyx_t_14);
__Pyx_XDECREF(__pyx_t_15);
__Pyx_XDECREF(__pyx_t_16);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_x);
@@ -5308,28 +5320,28 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6py
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":247
+/* "pygame/_sdl2/video.pyx":273
*
* @property
* def grab(self): # <<<<<<<<<<<<<<
- * """ Window's input grab state (``True`` or ``False``).
+ * """Get or set the window's input grab state
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -5338,32 +5350,32 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":258
- * :rtype: bool
+ /* "pygame/_sdl2/video.pyx":281
+ * the other window loses its grab in favor of the caller's window.
* """
* return SDL_GetWindowGrab(self._win) != 0 # <<<<<<<<<<<<<<
*
* @grab.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((SDL_GetWindowGrab(__pyx_v_self->_win) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyBool_FromLong((SDL_GetWindowGrab(__pyx_v_self->_win) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":247
+ /* "pygame/_sdl2/video.pyx":273
*
* @property
* def grab(self): # <<<<<<<<<<<<<<
- * """ Window's input grab state (``True`` or ``False``).
+ * """Get or set the window's input grab state
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.grab.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.grab.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -5371,7 +5383,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":261
+/* "pygame/_sdl2/video.pyx":284
*
* @grab.setter
* def grab(self, bint grabbed): # <<<<<<<<<<<<<<
@@ -5380,8 +5392,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __p
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed) {
int __pyx_v_grabbed;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -5390,28 +5402,28 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
assert(__pyx_arg_grabbed); {
- __pyx_v_grabbed = __Pyx_PyObject_IsTrue(__pyx_arg_grabbed); if (unlikely((__pyx_v_grabbed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L3_error)
+ __pyx_v_grabbed = __Pyx_PyObject_IsTrue(__pyx_arg_grabbed); if (unlikely((__pyx_v_grabbed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 284, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.grab.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.grab.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((int)__pyx_v_grabbed));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((int)__pyx_v_grabbed));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_grabbed) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_grabbed) {
int __pyx_r;
__Pyx_RefNannyDeclarations
SDL_bool __pyx_t_1;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":263
+ /* "pygame/_sdl2/video.pyx":286
* def grab(self, bint grabbed):
* # https://wiki.libsdl.org/SDL_SetWindowGrab
* SDL_SetWindowGrab(self._win, 1 if grabbed else 0) # <<<<<<<<<<<<<<
@@ -5425,7 +5437,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_ob
}
SDL_SetWindowGrab(__pyx_v_self->_win, __pyx_t_1);
- /* "pygame/_sdl2/video.pyx":261
+ /* "pygame/_sdl2/video.pyx":284
*
* @grab.setter
* def grab(self, bint grabbed): # <<<<<<<<<<<<<<
@@ -5439,28 +5451,28 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":266
+/* "pygame/_sdl2/video.pyx":289
*
* @property
* def relative_mouse(self): # <<<<<<<<<<<<<<
- * """ Window's relative mouse motion state (``True`` or ``False``).
+ * """Get or set the window's relative mouse mode state
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -5469,32 +5481,32 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":275
- * :rtype: bool
+ /* "pygame/_sdl2/video.pyx":303
+ * ``True`` will exit relative mouse mode.
* """
* return SDL_GetRelativeMouseMode() # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_SDL_bool(SDL_GetRelativeMouseMode()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_SDL_bool(SDL_GetRelativeMouseMode()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":266
+ /* "pygame/_sdl2/video.pyx":289
*
* @property
* def relative_mouse(self): # <<<<<<<<<<<<<<
- * """ Window's relative mouse motion state (``True`` or ``False``).
+ * """Get or set the window's relative mouse mode state
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.relative_mouse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.relative_mouse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -5502,7 +5514,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":279
+/* "pygame/_sdl2/video.pyx":307
*
* @relative_mouse.setter
* def relative_mouse(self, bint enable): # <<<<<<<<<<<<<<
@@ -5511,8 +5523,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable) {
int __pyx_v_enable;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -5521,28 +5533,28 @@ static int __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
assert(__pyx_arg_enable); {
- __pyx_v_enable = __Pyx_PyObject_IsTrue(__pyx_arg_enable); if (unlikely((__pyx_v_enable == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L3_error)
+ __pyx_v_enable = __Pyx_PyObject_IsTrue(__pyx_arg_enable); if (unlikely((__pyx_v_enable == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.relative_mouse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.relative_mouse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((int)__pyx_v_enable));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((int)__pyx_v_enable));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_enable) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_enable) {
int __pyx_r;
__Pyx_RefNannyDeclarations
SDL_bool __pyx_t_1;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":282
+ /* "pygame/_sdl2/video.pyx":310
* # https://wiki.libsdl.org/SDL_SetRelativeMouseMode
* #SDL_SetWindowGrab(self._win, 1 if enable else 0)
* SDL_SetRelativeMouseMode(1 if enable else 0) # <<<<<<<<<<<<<<
@@ -5556,7 +5568,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTH
}
(void)(SDL_SetRelativeMouseMode(__pyx_t_1));
- /* "pygame/_sdl2/video.pyx":279
+ /* "pygame/_sdl2/video.pyx":307
*
* @relative_mouse.setter
* def relative_mouse(self, bint enable): # <<<<<<<<<<<<<<
@@ -5570,29 +5582,29 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTH
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":284
+/* "pygame/_sdl2/video.pyx":312
* SDL_SetRelativeMouseMode(1 if enable else 0)
*
* def set_windowed(self): # <<<<<<<<<<<<<<
- * """ Enable windowed mode
+ * """Enable windowed mode (exit fullscreen)
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_4set_windowed[] = " Enable windowed mode\n\n .. seealso:: :func:`set_fullscreen`\n\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_4set_windowed[] = "Enable windowed mode (exit fullscreen)\n\n .. seealso:: :func:`set_fullscreen`\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_windowed (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_4set_windowed(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -5604,7 +5616,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set_windowed", 0);
- /* "pygame/_sdl2/video.pyx":291
+ /* "pygame/_sdl2/video.pyx":318
* """
* # https://wiki.libsdl.org/SDL_SetWindowFullscreen
* if SDL_SetWindowFullscreen(self._win, 0): # <<<<<<<<<<<<<<
@@ -5614,14 +5626,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
__pyx_t_1 = (SDL_SetWindowFullscreen(__pyx_v_self->_win, 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":292
+ /* "pygame/_sdl2/video.pyx":319
* # https://wiki.libsdl.org/SDL_SetWindowFullscreen
* if SDL_SetWindowFullscreen(self._win, 0):
* raise error() # <<<<<<<<<<<<<<
*
* #TODO: not sure about this...
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -5635,14 +5647,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 292, __pyx_L1_error)
+ __PYX_ERR(0, 319, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":291
+ /* "pygame/_sdl2/video.pyx":318
* """
* # https://wiki.libsdl.org/SDL_SetWindowFullscreen
* if SDL_SetWindowFullscreen(self._win, 0): # <<<<<<<<<<<<<<
@@ -5651,11 +5663,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":284
+ /* "pygame/_sdl2/video.pyx":312
* SDL_SetRelativeMouseMode(1 if enable else 0)
*
* def set_windowed(self): # <<<<<<<<<<<<<<
- * """ Enable windowed mode
+ * """Enable windowed mode (exit fullscreen)
*
*/
@@ -5666,7 +5678,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.set_windowed", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.set_windowed", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -5674,18 +5686,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":299
+/* "pygame/_sdl2/video.pyx":326
* # window.fullscreen_desktop = True
* # window.windowed = True
* def set_fullscreen(self, bint desktop=False): # <<<<<<<<<<<<<<
- * """ Enable fullscreen for the window
+ * """Enter fullscreen
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_6set_fullscreen[] = " Enable fullscreen for the window\n\n :param bool desktop: If ``True``: use the current desktop resolution.\n If ``False``: change the fullscreen resolution to the window size.\n\n .. seealso:: :func:`set_windowed`\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_6set_fullscreen[] = "Enter fullscreen\n\n :param bool desktop: If ``True``, use the current desktop resolution.\n If ``False``, change the fullscreen resolution to the window size.\n\n .. seealso:: :meth:`set_windowed`.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
int __pyx_v_desktop;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -5714,7 +5726,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_fullscreen") < 0)) __PYX_ERR(0, 299, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_fullscreen") < 0)) __PYX_ERR(0, 326, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -5725,27 +5737,27 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject
}
}
if (values[0]) {
- __pyx_v_desktop = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error)
+ __pyx_v_desktop = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error)
} else {
__pyx_v_desktop = ((int)0);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("set_fullscreen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 299, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("set_fullscreen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 326, __pyx_L3_error)
__pyx_L3_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_desktop);
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_6set_fullscreen(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), __pyx_v_desktop);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_desktop) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, int __pyx_v_desktop) {
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5758,8 +5770,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set_fullscreen", 0);
- /* "pygame/_sdl2/video.pyx":307
- * .. seealso:: :func:`set_windowed`
+ /* "pygame/_sdl2/video.pyx":334
+ * .. seealso:: :meth:`set_windowed`.
* """
* cdef int flags = 0 # <<<<<<<<<<<<<<
* if desktop:
@@ -5767,7 +5779,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
*/
__pyx_v_flags = 0;
- /* "pygame/_sdl2/video.pyx":308
+ /* "pygame/_sdl2/video.pyx":335
* """
* cdef int flags = 0
* if desktop: # <<<<<<<<<<<<<<
@@ -5777,7 +5789,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
__pyx_t_1 = (__pyx_v_desktop != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":309
+ /* "pygame/_sdl2/video.pyx":336
* cdef int flags = 0
* if desktop:
* flags = _SDL_WINDOW_FULLSCREEN_DESKTOP # <<<<<<<<<<<<<<
@@ -5786,7 +5798,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
*/
__pyx_v_flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
- /* "pygame/_sdl2/video.pyx":308
+ /* "pygame/_sdl2/video.pyx":335
* """
* cdef int flags = 0
* if desktop: # <<<<<<<<<<<<<<
@@ -5796,7 +5808,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":311
+ /* "pygame/_sdl2/video.pyx":338
* flags = _SDL_WINDOW_FULLSCREEN_DESKTOP
* else:
* flags = _SDL_WINDOW_FULLSCREEN # <<<<<<<<<<<<<<
@@ -5808,7 +5820,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":312
+ /* "pygame/_sdl2/video.pyx":339
* else:
* flags = _SDL_WINDOW_FULLSCREEN
* if SDL_SetWindowFullscreen(self._win, flags): # <<<<<<<<<<<<<<
@@ -5818,14 +5830,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
__pyx_t_1 = (SDL_SetWindowFullscreen(__pyx_v_self->_win, __pyx_v_flags) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":313
+ /* "pygame/_sdl2/video.pyx":340
* flags = _SDL_WINDOW_FULLSCREEN
* if SDL_SetWindowFullscreen(self._win, flags):
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -5839,14 +5851,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 313, __pyx_L1_error)
+ __PYX_ERR(0, 340, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":312
+ /* "pygame/_sdl2/video.pyx":339
* else:
* flags = _SDL_WINDOW_FULLSCREEN
* if SDL_SetWindowFullscreen(self._win, flags): # <<<<<<<<<<<<<<
@@ -5855,11 +5867,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
*/
}
- /* "pygame/_sdl2/video.pyx":299
+ /* "pygame/_sdl2/video.pyx":326
* # window.fullscreen_desktop = True
* # window.windowed = True
* def set_fullscreen(self, bint desktop=False): # <<<<<<<<<<<<<<
- * """ Enable fullscreen for the window
+ * """Enter fullscreen
*
*/
@@ -5870,7 +5882,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -5878,28 +5890,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct _
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":316
+/* "pygame/_sdl2/video.pyx":343
*
* @property
* def title(self): # <<<<<<<<<<<<<<
- * """ The title of the window or u"" if there is none.
- * """
+ * """Get or set the window title
+ *
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_5title___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
char const *__pyx_t_1;
@@ -5909,7 +5921,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":320
+ /* "pygame/_sdl2/video.pyx":349
* """
* # https://wiki.libsdl.org/SDL_GetWindowTitle
* return SDL_GetWindowTitle(self._win).decode('utf8') # <<<<<<<<<<<<<<
@@ -5918,25 +5930,25 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = SDL_GetWindowTitle(__pyx_v_self->_win);
- __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":316
+ /* "pygame/_sdl2/video.pyx":343
*
* @property
* def title(self): # <<<<<<<<<<<<<<
- * """ The title of the window or u"" if there is none.
- * """
+ * """Get or set the window title
+ *
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -5944,28 +5956,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":323
+/* "pygame/_sdl2/video.pyx":352
*
* @title.setter
* def title(self, title): # <<<<<<<<<<<<<<
- * """ Set the window title.
- *
+ * # https://wiki.libsdl.org/SDL_SetWindowTitle
+ * SDL_SetWindowTitle(self._win, title.encode('utf8'))
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_title));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_5title_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_title));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_title) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -5977,14 +5989,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":329
- * """
+ /* "pygame/_sdl2/video.pyx":354
+ * def title(self, title):
* # https://wiki.libsdl.org/SDL_SetWindowTitle
* SDL_SetWindowTitle(self._win, title.encode('utf8')) # <<<<<<<<<<<<<<
*
* def destroy(self):
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
@@ -5998,19 +6010,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_o
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_utf8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 354, __pyx_L1_error)
SDL_SetWindowTitle(__pyx_v_self->_win, __pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":323
+ /* "pygame/_sdl2/video.pyx":352
*
* @title.setter
* def title(self, title): # <<<<<<<<<<<<<<
- * """ Set the window title.
- *
+ * # https://wiki.libsdl.org/SDL_SetWindowTitle
+ * SDL_SetWindowTitle(self._win, title.encode('utf8'))
*/
/* function exit code */
@@ -6020,42 +6032,42 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_o
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.title.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.title.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":331
+/* "pygame/_sdl2/video.pyx":356
* SDL_SetWindowTitle(self._win, title.encode('utf8'))
*
* def destroy(self): # <<<<<<<<<<<<<<
- * """ Destroys the window.
- * """
+ * """Destroy the window
+ *
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_8destroy[] = " Destroys the window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_8destroy[] = "Destroy the window\n\n Destroys the internal window data of this Window object. This method is\n called automatically when this Window object is garbage collected, so\n there usually aren't any reasons to call it manually.\n\n Other methods that try to manipulate that window data will raise an error.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("destroy (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_8destroy(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("destroy", 0);
- /* "pygame/_sdl2/video.pyx":335
+ /* "pygame/_sdl2/video.pyx":366
* """
* # https://wiki.libsdl.org/SDL_DestroyWindow
* if self._win: # <<<<<<<<<<<<<<
@@ -6065,7 +6077,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_ob
__pyx_t_1 = (__pyx_v_self->_win != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":336
+ /* "pygame/_sdl2/video.pyx":367
* # https://wiki.libsdl.org/SDL_DestroyWindow
* if self._win:
* SDL_DestroyWindow(self._win) # <<<<<<<<<<<<<<
@@ -6074,7 +6086,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_ob
*/
SDL_DestroyWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":337
+ /* "pygame/_sdl2/video.pyx":368
* if self._win:
* SDL_DestroyWindow(self._win)
* self._win = NULL # <<<<<<<<<<<<<<
@@ -6083,7 +6095,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_ob
*/
__pyx_v_self->_win = NULL;
- /* "pygame/_sdl2/video.pyx":335
+ /* "pygame/_sdl2/video.pyx":366
* """
* # https://wiki.libsdl.org/SDL_DestroyWindow
* if self._win: # <<<<<<<<<<<<<<
@@ -6092,12 +6104,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_ob
*/
}
- /* "pygame/_sdl2/video.pyx":331
+ /* "pygame/_sdl2/video.pyx":356
* SDL_SetWindowTitle(self._win, title.encode('utf8'))
*
* def destroy(self): # <<<<<<<<<<<<<<
- * """ Destroys the window.
- * """
+ * """Destroy the window
+ *
*/
/* function exit code */
@@ -6107,34 +6119,34 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":339
+/* "pygame/_sdl2/video.pyx":370
* self._win = NULL
*
* def hide(self): # <<<<<<<<<<<<<<
- * """ Hide the window.
+ * """Hide the window
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_10hide[] = " Hide the window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_10hide[] = "Hide the window\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("hide (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_10hide(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("hide", 0);
- /* "pygame/_sdl2/video.pyx":343
+ /* "pygame/_sdl2/video.pyx":374
* """
* # https://wiki.libsdl.org/SDL_HideWindow
* SDL_HideWindow(self._win) # <<<<<<<<<<<<<<
@@ -6143,11 +6155,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_
*/
SDL_HideWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":339
+ /* "pygame/_sdl2/video.pyx":370
* self._win = NULL
*
* def hide(self): # <<<<<<<<<<<<<<
- * """ Hide the window.
+ * """Hide the window
* """
*/
@@ -6158,34 +6170,34 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":345
+/* "pygame/_sdl2/video.pyx":376
* SDL_HideWindow(self._win)
*
* def show(self): # <<<<<<<<<<<<<<
- * """ Show the window.
+ * """Show the window
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_12show[] = " Show the window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_12show[] = "Show the window\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("show (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_12show(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_12show(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("show", 0);
- /* "pygame/_sdl2/video.pyx":349
+ /* "pygame/_sdl2/video.pyx":380
* """
* # https://wiki.libsdl.org/SDL_ShowWindow
* SDL_ShowWindow(self._win) # <<<<<<<<<<<<<<
@@ -6194,11 +6206,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_
*/
SDL_ShowWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":345
+ /* "pygame/_sdl2/video.pyx":376
* SDL_HideWindow(self._win)
*
* def show(self): # <<<<<<<<<<<<<<
- * """ Show the window.
+ * """Show the window
* """
*/
@@ -6209,18 +6221,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":351
+/* "pygame/_sdl2/video.pyx":382
* SDL_ShowWindow(self._win)
*
* def focus(self, input_only=False): # <<<<<<<<<<<<<<
- * """ Raise the window above other windows and set the input focus.
+ * """Set the window to be focused
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_14focus[] = " Raise the window above other windows and set the input focus.\n\n :param bool input_only: if ``True``, the window will be given input focus\n but may be completely obscured by other windows.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_14focus[] = "Set the window to be focused\n\n Raises the window above other windows and sets the input focus.\n\n :param bool input_only: if ``True``, the window will be given input focus\n but may be completely obscured by other windows.\n Only supported on X11.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_input_only = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -6250,7 +6262,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "focus") < 0)) __PYX_ERR(0, 351, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "focus") < 0)) __PYX_ERR(0, 382, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -6264,20 +6276,20 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("focus", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 351, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("focus", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 382, __pyx_L3_error)
__pyx_L3_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_input_only);
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_14focus(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), __pyx_v_input_only);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_input_only) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_input_only) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -6289,17 +6301,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("focus", 0);
- /* "pygame/_sdl2/video.pyx":358
+ /* "pygame/_sdl2/video.pyx":392
* """
* # https://wiki.libsdl.org/SDL_RaiseWindow
* if input_only: # <<<<<<<<<<<<<<
* if SDL_SetWindowInputFocus(self._win):
* raise error()
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_input_only); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_input_only); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 392, __pyx_L1_error)
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":359
+ /* "pygame/_sdl2/video.pyx":393
* # https://wiki.libsdl.org/SDL_RaiseWindow
* if input_only:
* if SDL_SetWindowInputFocus(self._win): # <<<<<<<<<<<<<<
@@ -6309,14 +6321,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
__pyx_t_1 = (SDL_SetWindowInputFocus(__pyx_v_self->_win) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":360
+ /* "pygame/_sdl2/video.pyx":394
* if input_only:
* if SDL_SetWindowInputFocus(self._win):
* raise error() # <<<<<<<<<<<<<<
* else:
* SDL_RaiseWindow(self._win)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -6330,14 +6342,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 360, __pyx_L1_error)
+ __PYX_ERR(0, 394, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":359
+ /* "pygame/_sdl2/video.pyx":393
* # https://wiki.libsdl.org/SDL_RaiseWindow
* if input_only:
* if SDL_SetWindowInputFocus(self._win): # <<<<<<<<<<<<<<
@@ -6346,7 +6358,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
*/
}
- /* "pygame/_sdl2/video.pyx":358
+ /* "pygame/_sdl2/video.pyx":392
* """
* # https://wiki.libsdl.org/SDL_RaiseWindow
* if input_only: # <<<<<<<<<<<<<<
@@ -6356,7 +6368,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":362
+ /* "pygame/_sdl2/video.pyx":396
* raise error()
* else:
* SDL_RaiseWindow(self._win) # <<<<<<<<<<<<<<
@@ -6368,11 +6380,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":351
+ /* "pygame/_sdl2/video.pyx":382
* SDL_ShowWindow(self._win)
*
* def focus(self, input_only=False): # <<<<<<<<<<<<<<
- * """ Raise the window above other windows and set the input focus.
+ * """Set the window to be focused
*
*/
@@ -6383,7 +6395,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -6391,35 +6403,35 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":364
+/* "pygame/_sdl2/video.pyx":398
* SDL_RaiseWindow(self._win)
*
* def restore(self): # <<<<<<<<<<<<<<
- * """ Restore the size and position of a minimized or maximized window.
+ * """Restore the size and position of a minimized or maximized window
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_16restore[] = " Restore the size and position of a minimized or maximized window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_16restore[] = "Restore the size and position of a minimized or maximized window\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("restore (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_16restore(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("restore", 0);
- /* "pygame/_sdl2/video.pyx":367
- * """ Restore the size and position of a minimized or maximized window.
+ /* "pygame/_sdl2/video.pyx":401
+ * """Restore the size and position of a minimized or maximized window
* """
* SDL_RestoreWindow(self._win) # <<<<<<<<<<<<<<
*
@@ -6427,11 +6439,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_o
*/
SDL_RestoreWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":364
+ /* "pygame/_sdl2/video.pyx":398
* SDL_RaiseWindow(self._win)
*
* def restore(self): # <<<<<<<<<<<<<<
- * """ Restore the size and position of a minimized or maximized window.
+ * """Restore the size and position of a minimized or maximized window
* """
*/
@@ -6442,35 +6454,35 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_o
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":369
+/* "pygame/_sdl2/video.pyx":403
* SDL_RestoreWindow(self._win)
*
* def maximize(self): # <<<<<<<<<<<<<<
- * """ Maximize the window.
+ * """Maximize the window
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_18maximize[] = " Maximize the window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_18maximize[] = "Maximize the window\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("maximize (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_18maximize(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("maximize", 0);
- /* "pygame/_sdl2/video.pyx":372
- * """ Maximize the window.
+ /* "pygame/_sdl2/video.pyx":406
+ * """Maximize the window
* """
* SDL_MaximizeWindow(self._win) # <<<<<<<<<<<<<<
*
@@ -6478,11 +6490,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_
*/
SDL_MaximizeWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":369
+ /* "pygame/_sdl2/video.pyx":403
* SDL_RestoreWindow(self._win)
*
* def maximize(self): # <<<<<<<<<<<<<<
- * """ Maximize the window.
+ * """Maximize the window
* """
*/
@@ -6493,35 +6505,35 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":374
+/* "pygame/_sdl2/video.pyx":408
* SDL_MaximizeWindow(self._win)
*
* def minimize(self): # <<<<<<<<<<<<<<
- * """ Minimize the window.
+ * """Minimize the window
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_20minimize[] = " Minimize the window.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_20minimize[] = "Minimize the window\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("minimize (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_20minimize(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("minimize", 0);
- /* "pygame/_sdl2/video.pyx":377
- * """ Minimize the window.
+ /* "pygame/_sdl2/video.pyx":411
+ * """Minimize the window
* """
* SDL_MinimizeWindow(self._win) # <<<<<<<<<<<<<<
*
@@ -6529,11 +6541,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_
*/
SDL_MinimizeWindow(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":374
+ /* "pygame/_sdl2/video.pyx":408
* SDL_MaximizeWindow(self._win)
*
* def minimize(self): # <<<<<<<<<<<<<<
- * """ Minimize the window.
+ * """Minimize the window
* """
*/
@@ -6544,28 +6556,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":380
+/* "pygame/_sdl2/video.pyx":414
*
* @property
* def resizable(self): # <<<<<<<<<<<<<<
- * """ Sets whether the window is resizable.
+ * """Get or set whether the window is resizable
* """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -6574,32 +6586,32 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":383
- * """ Sets whether the window is resizable.
+ /* "pygame/_sdl2/video.pyx":417
+ * """Get or set whether the window is resizable
* """
* return SDL_GetWindowFlags(self._win) & _SDL_WINDOW_RESIZABLE != 0 # <<<<<<<<<<<<<<
*
* @resizable.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_RESIZABLE) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_RESIZABLE) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":380
+ /* "pygame/_sdl2/video.pyx":414
*
* @property
* def resizable(self): # <<<<<<<<<<<<<<
- * """ Sets whether the window is resizable.
+ * """Get or set whether the window is resizable
* """
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.resizable.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.resizable.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -6607,7 +6619,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struc
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":386
+/* "pygame/_sdl2/video.pyx":420
*
* @resizable.setter
* def resizable(self, enabled): # <<<<<<<<<<<<<<
@@ -6616,19 +6628,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struc
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
int __pyx_r;
__Pyx_RefNannyDeclarations
SDL_bool __pyx_t_1;
@@ -6638,14 +6650,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":387
+ /* "pygame/_sdl2/video.pyx":421
* @resizable.setter
* def resizable(self, enabled):
* SDL_SetWindowResizable(self._win, 1 if enabled else 0) # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 421, __pyx_L1_error)
if (__pyx_t_2) {
__pyx_t_1 = 1;
} else {
@@ -6653,7 +6665,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __p
}
SDL_SetWindowResizable(__pyx_v_self->_win, __pyx_t_1);
- /* "pygame/_sdl2/video.pyx":386
+ /* "pygame/_sdl2/video.pyx":420
*
* @resizable.setter
* def resizable(self, enabled): # <<<<<<<<<<<<<<
@@ -6665,35 +6677,35 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __p
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.resizable.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.resizable.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":390
+/* "pygame/_sdl2/video.pyx":424
*
* @property
* def borderless(self): # <<<<<<<<<<<<<<
- * """ Add or remove the border from the actual window.
+ * """Get or set whether the window is borderless
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -6702,7 +6714,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(str
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":395
+ /* "pygame/_sdl2/video.pyx":431
* .. note:: You can't change the border state of a fullscreen window.
* """
* return SDL_GetWindowFlags(self._win) & _SDL_WINDOW_BORDERLESS != 0 # <<<<<<<<<<<<<<
@@ -6710,24 +6722,24 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(str
* @borderless.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_BORDERLESS) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_BORDERLESS) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":390
+ /* "pygame/_sdl2/video.pyx":424
*
* @property
* def borderless(self): # <<<<<<<<<<<<<<
- * """ Add or remove the border from the actual window.
+ * """Get or set whether the window is borderless
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.borderless.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.borderless.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -6735,7 +6747,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(str
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":398
+/* "pygame/_sdl2/video.pyx":434
*
* @borderless.setter
* def borderless(self, enabled): # <<<<<<<<<<<<<<
@@ -6744,19 +6756,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(str
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
int __pyx_r;
__Pyx_RefNannyDeclarations
SDL_bool __pyx_t_1;
@@ -6766,14 +6778,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":399
+ /* "pygame/_sdl2/video.pyx":435
* @borderless.setter
* def borderless(self, enabled):
* SDL_SetWindowBordered(self._win, 0 if enabled else 1) # <<<<<<<<<<<<<<
*
* def set_icon(self, surface):
*/
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 435, __pyx_L1_error)
if (__pyx_t_2) {
__pyx_t_1 = 0;
} else {
@@ -6781,7 +6793,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct _
}
SDL_SetWindowBordered(__pyx_v_self->_win, __pyx_t_1);
- /* "pygame/_sdl2/video.pyx":398
+ /* "pygame/_sdl2/video.pyx":434
*
* @borderless.setter
* def borderless(self, enabled): # <<<<<<<<<<<<<<
@@ -6793,36 +6805,36 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct _
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_AddTraceback("pygame._sdl2.video.Window.borderless.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.borderless.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":401
+/* "pygame/_sdl2/video.pyx":437
* SDL_SetWindowBordered(self._win, 0 if enabled else 1)
*
* def set_icon(self, surface): # <<<<<<<<<<<<<<
- * """ Set the icon for the window.
+ * """Set the window icon
*
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_22set_icon[] = " Set the icon for the window.\n\n :param pygame.Surface surface: A Surface to use as the icon.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_22set_icon[] = "Set the window icon\n\n Sets the window icon.\n\n :param pygame.Surface surface: A Surface to use as the icon.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_icon (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_surface));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_22set_icon(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_surface));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_surface) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_surface) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -6832,7 +6844,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set_icon", 0);
- /* "pygame/_sdl2/video.pyx":406
+ /* "pygame/_sdl2/video.pyx":444
* :param pygame.Surface surface: A Surface to use as the icon.
* """
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -6842,20 +6854,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
__pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":407
+ /* "pygame/_sdl2/video.pyx":445
* """
* if not pgSurface_Check(surface):
* raise TypeError('surface must be a Surface object') # <<<<<<<<<<<<<<
* SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
*
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 407, __pyx_L1_error)
+ __PYX_ERR(0, 445, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":406
+ /* "pygame/_sdl2/video.pyx":444
* :param pygame.Surface surface: A Surface to use as the icon.
* """
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -6864,7 +6876,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
*/
}
- /* "pygame/_sdl2/video.pyx":408
+ /* "pygame/_sdl2/video.pyx":446
* if not pgSurface_Check(surface):
* raise TypeError('surface must be a Surface object')
* SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface)) # <<<<<<<<<<<<<<
@@ -6873,11 +6885,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
*/
SDL_SetWindowIcon(__pyx_v_self->_win, pgSurface_AsSurface(__pyx_v_surface));
- /* "pygame/_sdl2/video.pyx":401
+ /* "pygame/_sdl2/video.pyx":437
* SDL_SetWindowBordered(self._win, 0 if enabled else 1)
*
* def set_icon(self, surface): # <<<<<<<<<<<<<<
- * """ Set the icon for the window.
+ * """Set the window icon
*
*/
@@ -6886,7 +6898,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.set_icon", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.set_icon", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -6894,28 +6906,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":411
+/* "pygame/_sdl2/video.pyx":449
*
* @property
* def id(self): # <<<<<<<<<<<<<<
- * """ A unique window ID. *Read-only*.
- *
+ * """Get the unique window ID (**read-only**)
+ * """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_2id_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_2id___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -6924,32 +6936,32 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":416
- * :rtype: int
+ /* "pygame/_sdl2/video.pyx":452
+ * """Get the unique window ID (**read-only**)
* """
* return SDL_GetWindowID(self._win) # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_GetWindowID(__pyx_v_self->_win)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_GetWindowID(__pyx_v_self->_win)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":411
+ /* "pygame/_sdl2/video.pyx":449
*
* @property
* def id(self): # <<<<<<<<<<<<<<
- * """ A unique window ID. *Read-only*.
- *
+ * """Get the unique window ID (**read-only**)
+ * """
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -6957,28 +6969,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":419
+/* "pygame/_sdl2/video.pyx":455
*
* @property
* def size(self): # <<<<<<<<<<<<<<
- * """ The size of the window's client area."""
+ * """Get or set the window size in pixels"""
* cdef int w, h
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_4size___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
int __pyx_v_w;
int __pyx_v_h;
PyObject *__pyx_r = NULL;
@@ -6991,8 +7003,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":422
- * """ The size of the window's client area."""
+ /* "pygame/_sdl2/video.pyx":458
+ * """Get or set the window size in pixels"""
* cdef int w, h
* SDL_GetWindowSize(self._win, &w, &h) # <<<<<<<<<<<<<<
* return (w, h)
@@ -7000,7 +7012,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
*/
SDL_GetWindowSize(__pyx_v_self->_win, (&__pyx_v_w), (&__pyx_v_h));
- /* "pygame/_sdl2/video.pyx":423
+ /* "pygame/_sdl2/video.pyx":459
* cdef int w, h
* SDL_GetWindowSize(self._win, &w, &h)
* return (w, h) # <<<<<<<<<<<<<<
@@ -7008,11 +7020,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
* @size.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
@@ -7024,11 +7036,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":419
+ /* "pygame/_sdl2/video.pyx":455
*
* @property
* def size(self): # <<<<<<<<<<<<<<
- * """ The size of the window's client area."""
+ * """Get or set the window size in pixels"""
* cdef int w, h
*/
@@ -7037,7 +7049,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -7045,7 +7057,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":426
+/* "pygame/_sdl2/video.pyx":462
*
* @size.setter
* def size(self, size): # <<<<<<<<<<<<<<
@@ -7054,19 +7066,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __p
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_4size_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_size));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_size) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_size) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -7077,24 +7089,24 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":427
+ /* "pygame/_sdl2/video.pyx":463
* @size.setter
* def size(self, size):
* SDL_SetWindowSize(self._win, size[0], size[1]) # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
SDL_SetWindowSize(__pyx_v_self->_win, __pyx_t_2, __pyx_t_3);
- /* "pygame/_sdl2/video.pyx":426
+ /* "pygame/_sdl2/video.pyx":462
*
* @size.setter
* def size(self, size): # <<<<<<<<<<<<<<
@@ -7107,35 +7119,35 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_ob
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":430
+/* "pygame/_sdl2/video.pyx":466
*
* @property
* def position(self): # <<<<<<<<<<<<<<
- * """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
- * cdef int x, y
+ * """Get or set the window position in screen coordinates
+ * """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_8position___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
int __pyx_v_x;
int __pyx_v_y;
PyObject *__pyx_r = NULL;
@@ -7148,8 +7160,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":433
- * """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
+ /* "pygame/_sdl2/video.pyx":470
+ * """
* cdef int x, y
* SDL_GetWindowPosition(self._win, &x, &y) # <<<<<<<<<<<<<<
* return (x, y)
@@ -7157,7 +7169,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
*/
SDL_GetWindowPosition(__pyx_v_self->_win, (&__pyx_v_x), (&__pyx_v_y));
- /* "pygame/_sdl2/video.pyx":434
+ /* "pygame/_sdl2/video.pyx":471
* cdef int x, y
* SDL_GetWindowPosition(self._win, &x, &y)
* return (x, y) # <<<<<<<<<<<<<<
@@ -7165,11 +7177,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
* @position.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
@@ -7181,12 +7193,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":430
+ /* "pygame/_sdl2/video.pyx":466
*
* @property
* def position(self): # <<<<<<<<<<<<<<
- * """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
- * cdef int x, y
+ * """Get or set the window position in screen coordinates
+ * """
*/
/* function exit code */
@@ -7194,7 +7206,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.position.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.position.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -7202,7 +7214,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":437
+/* "pygame/_sdl2/video.pyx":474
*
* @position.setter
* def position(self, position): # <<<<<<<<<<<<<<
@@ -7211,19 +7223,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_position));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_8position_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_position));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_position) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_position) {
int __pyx_v_x;
int __pyx_v_y;
int __pyx_r;
@@ -7240,40 +7252,40 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":439
+ /* "pygame/_sdl2/video.pyx":476
* def position(self, position):
* cdef int x, y
* if position == WINDOWPOS_UNDEFINED: # <<<<<<<<<<<<<<
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 476, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":440
+ /* "pygame/_sdl2/video.pyx":477
* cdef int x, y
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED # <<<<<<<<<<<<<<
* elif position == WINDOWPOS_CENTERED:
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_x = __pyx_t_4;
__pyx_v_y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":439
+ /* "pygame/_sdl2/video.pyx":476
* def position(self, position):
* cdef int x, y
* if position == WINDOWPOS_UNDEFINED: # <<<<<<<<<<<<<<
@@ -7283,40 +7295,40 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":441
+ /* "pygame/_sdl2/video.pyx":478
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED: # <<<<<<<<<<<<<<
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
* else:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_position, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_position, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 441, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 478, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
- /* "pygame/_sdl2/video.pyx":442
+ /* "pygame/_sdl2/video.pyx":479
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED:
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED # <<<<<<<<<<<<<<
* else:
* x, y = position
*/
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_x = __pyx_t_5;
__pyx_v_y = __pyx_t_4;
- /* "pygame/_sdl2/video.pyx":441
+ /* "pygame/_sdl2/video.pyx":478
* if position == WINDOWPOS_UNDEFINED:
* x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
* elif position == WINDOWPOS_CENTERED: # <<<<<<<<<<<<<<
@@ -7326,7 +7338,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":444
+ /* "pygame/_sdl2/video.pyx":481
* x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
* else:
* x, y = position # <<<<<<<<<<<<<<
@@ -7340,7 +7352,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- __PYX_ERR(0, 444, __pyx_L1_error)
+ __PYX_ERR(0, 481, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
@@ -7353,21 +7365,21 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_2);
#else
- __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
+ __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
} else {
Py_ssize_t index = -1;
- __pyx_t_6 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
+ __pyx_t_6 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 481, __pyx_L1_error)
__pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L5_unpacking_done;
@@ -7375,19 +7387,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- __PYX_ERR(0, 444, __pyx_L1_error)
+ __PYX_ERR(0, 481, __pyx_L1_error)
__pyx_L5_unpacking_done:;
}
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_x = __pyx_t_4;
__pyx_v_y = __pyx_t_5;
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":445
+ /* "pygame/_sdl2/video.pyx":482
* else:
* x, y = position
* SDL_SetWindowPosition(self._win, x, y) # <<<<<<<<<<<<<<
@@ -7396,7 +7408,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
*/
SDL_SetWindowPosition(__pyx_v_self->_win, __pyx_v_x, __pyx_v_y);
- /* "pygame/_sdl2/video.pyx":437
+ /* "pygame/_sdl2/video.pyx":474
*
* @position.setter
* def position(self, position): # <<<<<<<<<<<<<<
@@ -7411,35 +7423,35 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __py
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.position.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.position.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":448
+/* "pygame/_sdl2/video.pyx":485
*
* @property
* def opacity(self): # <<<<<<<<<<<<<<
- * """ Window opacity. It ranges between 0.0 (fully transparent)
- * and 1.0 (fully opaque)."""
+ * """Get or set the window opacity, a value between 0.0 (fully transparent) and 1.0 (fully opaque)
+ * """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
float __pyx_v_opacity;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -7452,8 +7464,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":452
- * and 1.0 (fully opaque)."""
+ /* "pygame/_sdl2/video.pyx":489
+ * """
* cdef float opacity
* if SDL_GetWindowOpacity(self._win, &opacity): # <<<<<<<<<<<<<<
* raise error()
@@ -7462,14 +7474,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
__pyx_t_1 = (SDL_GetWindowOpacity(__pyx_v_self->_win, (&__pyx_v_opacity)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":453
+ /* "pygame/_sdl2/video.pyx":490
* cdef float opacity
* if SDL_GetWindowOpacity(self._win, &opacity):
* raise error() # <<<<<<<<<<<<<<
* return opacity
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -7483,15 +7495,15 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 453, __pyx_L1_error)
+ __PYX_ERR(0, 490, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":452
- * and 1.0 (fully opaque)."""
+ /* "pygame/_sdl2/video.pyx":489
+ * """
* cdef float opacity
* if SDL_GetWindowOpacity(self._win, &opacity): # <<<<<<<<<<<<<<
* raise error()
@@ -7499,7 +7511,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
*/
}
- /* "pygame/_sdl2/video.pyx":454
+ /* "pygame/_sdl2/video.pyx":491
* if SDL_GetWindowOpacity(self._win, &opacity):
* raise error()
* return opacity # <<<<<<<<<<<<<<
@@ -7507,18 +7519,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
* @opacity.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyFloat_FromDouble(__pyx_v_opacity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error)
+ __pyx_t_2 = PyFloat_FromDouble(__pyx_v_opacity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":448
+ /* "pygame/_sdl2/video.pyx":485
*
* @property
* def opacity(self): # <<<<<<<<<<<<<<
- * """ Window opacity. It ranges between 0.0 (fully transparent)
- * and 1.0 (fully opaque)."""
+ * """Get or set the window opacity, a value between 0.0 (fully transparent) and 1.0 (fully opaque)
+ * """
*/
/* function exit code */
@@ -7526,7 +7538,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.opacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.opacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -7534,7 +7546,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":457
+/* "pygame/_sdl2/video.pyx":494
*
* @opacity.setter
* def opacity(self, opacity): # <<<<<<<<<<<<<<
@@ -7543,19 +7555,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct
*/
/* Python wrapper */
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity); /*proto*/
-static int __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity) {
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity); /*proto*/
+static int __pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_opacity));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v_opacity));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_opacity) {
+static int __pyx_pf_6pygame_5_sdl2_5video_7_Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, PyObject *__pyx_v_opacity) {
int __pyx_r;
__Pyx_RefNannyDeclarations
float __pyx_t_1;
@@ -7568,25 +7580,25 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":458
+ /* "pygame/_sdl2/video.pyx":495
* @opacity.setter
* def opacity(self, opacity):
* if SDL_SetWindowOpacity(self._win, opacity): # <<<<<<<<<<<<<<
* raise error()
*
*/
- __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_opacity); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L1_error)
+ __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_opacity); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L1_error)
__pyx_t_2 = (SDL_SetWindowOpacity(__pyx_v_self->_win, __pyx_t_1) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":459
+ /* "pygame/_sdl2/video.pyx":496
* def opacity(self, opacity):
* if SDL_SetWindowOpacity(self._win, opacity):
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -7600,14 +7612,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 459, __pyx_L1_error)
+ __PYX_ERR(0, 496, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":458
+ /* "pygame/_sdl2/video.pyx":495
* @opacity.setter
* def opacity(self, opacity):
* if SDL_SetWindowOpacity(self._win, opacity): # <<<<<<<<<<<<<<
@@ -7616,7 +7628,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx
*/
}
- /* "pygame/_sdl2/video.pyx":457
+ /* "pygame/_sdl2/video.pyx":494
*
* @opacity.setter
* def opacity(self, opacity): # <<<<<<<<<<<<<<
@@ -7631,35 +7643,35 @@ static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.opacity.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.opacity.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":462
+/* "pygame/_sdl2/video.pyx":499
*
* @property
* def display_index(self): # <<<<<<<<<<<<<<
- * """ The index of the display associated with the window. *Read-only*.
- *
+ * """Get the index of the display that owns the window
+ * """
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_13display_index_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_13display_index_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_13display_index___get__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
int __pyx_v_index;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -7672,8 +7684,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":467
- * :rtype: int
+ /* "pygame/_sdl2/video.pyx":502
+ * """Get the index of the display that owns the window
* """
* cdef int index = SDL_GetWindowDisplayIndex(self._win) # <<<<<<<<<<<<<<
* if index < 0:
@@ -7681,7 +7693,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
*/
__pyx_v_index = SDL_GetWindowDisplayIndex(__pyx_v_self->_win);
- /* "pygame/_sdl2/video.pyx":468
+ /* "pygame/_sdl2/video.pyx":503
* """
* cdef int index = SDL_GetWindowDisplayIndex(self._win)
* if index < 0: # <<<<<<<<<<<<<<
@@ -7691,14 +7703,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
__pyx_t_1 = ((__pyx_v_index < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":469
+ /* "pygame/_sdl2/video.pyx":504
* cdef int index = SDL_GetWindowDisplayIndex(self._win)
* if index < 0:
* raise error() # <<<<<<<<<<<<<<
* return index
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -7712,14 +7724,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 469, __pyx_L1_error)
+ __PYX_ERR(0, 504, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":468
+ /* "pygame/_sdl2/video.pyx":503
* """
* cdef int index = SDL_GetWindowDisplayIndex(self._win)
* if index < 0: # <<<<<<<<<<<<<<
@@ -7728,7 +7740,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
*/
}
- /* "pygame/_sdl2/video.pyx":470
+ /* "pygame/_sdl2/video.pyx":505
* if index < 0:
* raise error()
* return index # <<<<<<<<<<<<<<
@@ -7736,18 +7748,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
* def set_modal_for(self, Window parent):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":462
+ /* "pygame/_sdl2/video.pyx":499
*
* @property
* def display_index(self): # <<<<<<<<<<<<<<
- * """ The index of the display associated with the window. *Read-only*.
- *
+ * """Get the index of the display that owns the window
+ * """
*/
/* function exit code */
@@ -7755,7 +7767,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.display_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.display_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -7763,26 +7775,26 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":472
+/* "pygame/_sdl2/video.pyx":507
* return index
*
* def set_modal_for(self, Window parent): # <<<<<<<<<<<<<<
- * """set the window as a modal for a parent window
- * This function is only supported on X11."""
+ * """Set the window as a modal for a parent window
+ *
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_6Window_24set_modal_for[] = "set the window as a modal for a parent window\n This function is only supported on X11.";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_7_Window_24set_modal_for[] = "Set the window as a modal for a parent window\n\n :param Window parent: The parent window.\n\n .. note:: This function is only supported on X11.\n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_modal_for (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "parent", 0))) __PYX_ERR(0, 472, __pyx_L1_error)
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_parent));
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "parent", 0))) __PYX_ERR(0, 507, __pyx_L1_error)
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_24set_modal_for(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((pgWindowObject *)__pyx_v_parent));
/* function exit code */
goto __pyx_L0;
@@ -7793,7 +7805,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_parent) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, pgWindowObject *__pyx_v_parent) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -7805,9 +7817,9 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set_modal_for", 0);
- /* "pygame/_sdl2/video.pyx":475
- * """set the window as a modal for a parent window
- * This function is only supported on X11."""
+ /* "pygame/_sdl2/video.pyx":514
+ * .. note:: This function is only supported on X11.
+ * """
* if SDL_SetWindowModalFor(self._win, parent._win): # <<<<<<<<<<<<<<
* raise error()
*
@@ -7815,14 +7827,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
__pyx_t_1 = (SDL_SetWindowModalFor(__pyx_v_self->_win, __pyx_v_parent->_win) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":476
- * This function is only supported on X11."""
+ /* "pygame/_sdl2/video.pyx":515
+ * """
* if SDL_SetWindowModalFor(self._win, parent._win):
* raise error() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -7836,28 +7848,28 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 476, __pyx_L1_error)
+ __PYX_ERR(0, 515, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":475
- * """set the window as a modal for a parent window
- * This function is only supported on X11."""
+ /* "pygame/_sdl2/video.pyx":514
+ * .. note:: This function is only supported on X11.
+ * """
* if SDL_SetWindowModalFor(self._win, parent._win): # <<<<<<<<<<<<<<
* raise error()
*
*/
}
- /* "pygame/_sdl2/video.pyx":472
+ /* "pygame/_sdl2/video.pyx":507
* return index
*
* def set_modal_for(self, Window parent): # <<<<<<<<<<<<<<
- * """set the window as a modal for a parent window
- * This function is only supported on X11."""
+ * """Set the window as a modal for a parent window
+ *
*/
/* function exit code */
@@ -7867,7 +7879,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.set_modal_for", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.set_modal_for", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -7875,7 +7887,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":478
+/* "pygame/_sdl2/video.pyx":517
* raise error()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7884,17 +7896,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct _
*/
/* Python wrapper */
-static void __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_6pygame_5_sdl2_5video_7_Window_27__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_6pygame_5_sdl2_5video_7_Window_27__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
- __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_pf_6pygame_5_sdl2_5video_7_Window_26__dealloc__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
-static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static void __pyx_pf_6pygame_5_sdl2_5video_7_Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
@@ -7905,7 +7917,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "pygame/_sdl2/video.pyx":479
+ /* "pygame/_sdl2/video.pyx":518
*
* def __dealloc__(self):
* if self._is_borrowed: # <<<<<<<<<<<<<<
@@ -7915,7 +7927,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
__pyx_t_1 = (__pyx_v_self->_is_borrowed != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":480
+ /* "pygame/_sdl2/video.pyx":519
* def __dealloc__(self):
* if self._is_borrowed:
* return # <<<<<<<<<<<<<<
@@ -7924,7 +7936,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
*/
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":479
+ /* "pygame/_sdl2/video.pyx":518
*
* def __dealloc__(self):
* if self._is_borrowed: # <<<<<<<<<<<<<<
@@ -7933,14 +7945,14 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
*/
}
- /* "pygame/_sdl2/video.pyx":481
+ /* "pygame/_sdl2/video.pyx":520
* if self._is_borrowed:
* return
* self.destroy() # <<<<<<<<<<<<<<
*
* cdef Uint32 format_from_depth(int depth):
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
@@ -7954,12 +7966,12 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":478
+ /* "pygame/_sdl2/video.pyx":517
* raise error()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7973,7 +7985,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_WriteUnraisable("pygame._sdl2.video.Window.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
+ __Pyx_WriteUnraisable("pygame._sdl2.video._Window.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
@@ -7985,19 +7997,19 @@ static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_ob
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_28__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -8027,7 +8039,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTH
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -8042,19 +8054,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTH
*/
/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7_Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7_Window_30__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video__Window *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7_Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video__Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -8084,14 +8096,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CY
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("pygame._sdl2.video.Window.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("pygame._sdl2.video._Window.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":483
+/* "pygame/_sdl2/video.pyx":522
* self.destroy()
*
* cdef Uint32 format_from_depth(int depth): # <<<<<<<<<<<<<<
@@ -8112,7 +8124,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("format_from_depth", 0);
- /* "pygame/_sdl2/video.pyx":485
+ /* "pygame/_sdl2/video.pyx":524
* cdef Uint32 format_from_depth(int depth):
* cdef Uint32 Rmask, Gmask, Bmask, Amask
* if depth == 16: # <<<<<<<<<<<<<<
@@ -8122,7 +8134,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
switch (__pyx_v_depth) {
case 16:
- /* "pygame/_sdl2/video.pyx":486
+ /* "pygame/_sdl2/video.pyx":525
* cdef Uint32 Rmask, Gmask, Bmask, Amask
* if depth == 16:
* Rmask = 0xF << 8 # <<<<<<<<<<<<<<
@@ -8131,7 +8143,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Rmask = 0xF00;
- /* "pygame/_sdl2/video.pyx":487
+ /* "pygame/_sdl2/video.pyx":526
* if depth == 16:
* Rmask = 0xF << 8
* Gmask = 0xF << 4 # <<<<<<<<<<<<<<
@@ -8140,7 +8152,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Gmask = 0xF0;
- /* "pygame/_sdl2/video.pyx":488
+ /* "pygame/_sdl2/video.pyx":527
* Rmask = 0xF << 8
* Gmask = 0xF << 4
* Bmask = 0xF # <<<<<<<<<<<<<<
@@ -8149,7 +8161,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Bmask = 0xF;
- /* "pygame/_sdl2/video.pyx":489
+ /* "pygame/_sdl2/video.pyx":528
* Gmask = 0xF << 4
* Bmask = 0xF
* Amask = 0xF << 12 # <<<<<<<<<<<<<<
@@ -8158,7 +8170,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Amask = 0xF000;
- /* "pygame/_sdl2/video.pyx":485
+ /* "pygame/_sdl2/video.pyx":524
* cdef Uint32 format_from_depth(int depth):
* cdef Uint32 Rmask, Gmask, Bmask, Amask
* if depth == 16: # <<<<<<<<<<<<<<
@@ -8168,7 +8180,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
break;
case 0:
- /* "pygame/_sdl2/video.pyx":490
+ /* "pygame/_sdl2/video.pyx":529
* Bmask = 0xF
* Amask = 0xF << 12
* elif depth in (0, 32): # <<<<<<<<<<<<<<
@@ -8177,7 +8189,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
case 32:
- /* "pygame/_sdl2/video.pyx":491
+ /* "pygame/_sdl2/video.pyx":530
* Amask = 0xF << 12
* elif depth in (0, 32):
* Rmask = 0xFF << 16 # <<<<<<<<<<<<<<
@@ -8186,7 +8198,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Rmask = 0xFF0000;
- /* "pygame/_sdl2/video.pyx":492
+ /* "pygame/_sdl2/video.pyx":531
* elif depth in (0, 32):
* Rmask = 0xFF << 16
* Gmask = 0xFF << 8 # <<<<<<<<<<<<<<
@@ -8195,7 +8207,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Gmask = 0xFF00;
- /* "pygame/_sdl2/video.pyx":493
+ /* "pygame/_sdl2/video.pyx":532
* Rmask = 0xFF << 16
* Gmask = 0xFF << 8
* Bmask = 0xFF # <<<<<<<<<<<<<<
@@ -8204,7 +8216,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Bmask = 0xFF;
- /* "pygame/_sdl2/video.pyx":494
+ /* "pygame/_sdl2/video.pyx":533
* Gmask = 0xFF << 8
* Bmask = 0xFF
* Amask = 0xFF << 24 # <<<<<<<<<<<<<<
@@ -8213,7 +8225,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
*/
__pyx_v_Amask = 0xFF000000;
- /* "pygame/_sdl2/video.pyx":490
+ /* "pygame/_sdl2/video.pyx":529
* Bmask = 0xF
* Amask = 0xF << 12
* elif depth in (0, 32): # <<<<<<<<<<<<<<
@@ -8223,22 +8235,22 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
break;
default:
- /* "pygame/_sdl2/video.pyx":496
+ /* "pygame/_sdl2/video.pyx":535
* Amask = 0xFF << 24
* else:
* raise ValueError("no standard masks exist for given bitdepth with alpha") # <<<<<<<<<<<<<<
* return SDL_MasksToPixelFormatEnum(depth,
* Rmask, Gmask, Bmask, Amask)
*/
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 496, __pyx_L1_error)
+ __PYX_ERR(0, 535, __pyx_L1_error)
break;
}
- /* "pygame/_sdl2/video.pyx":497
+ /* "pygame/_sdl2/video.pyx":536
* else:
* raise ValueError("no standard masks exist for given bitdepth with alpha")
* return SDL_MasksToPixelFormatEnum(depth, # <<<<<<<<<<<<<<
@@ -8248,7 +8260,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
__pyx_r = SDL_MasksToPixelFormatEnum(__pyx_v_depth, __pyx_v_Rmask, __pyx_v_Gmask, __pyx_v_Bmask, __pyx_v_Amask);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":483
+ /* "pygame/_sdl2/video.pyx":522
* self.destroy()
*
* cdef Uint32 format_from_depth(int depth): # <<<<<<<<<<<<<<
@@ -8266,7 +8278,7 @@ static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":502
+/* "pygame/_sdl2/video.pyx":541
*
* cdef class Texture:
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -8301,7 +8313,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "pygame/_sdl2/video.pyx":503
+ /* "pygame/_sdl2/video.pyx":542
* cdef class Texture:
* def __cinit__(self):
* cdef Uint8[4] defaultColor = [255, 255, 255, 255] # <<<<<<<<<<<<<<
@@ -8314,23 +8326,23 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6p
__pyx_t_1[3] = 0xFF;
memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_1, sizeof(__pyx_v_defaultColor[0]) * (4));
- /* "pygame/_sdl2/video.pyx":504
+ /* "pygame/_sdl2/video.pyx":543
* def __cinit__(self):
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._color = pgColor_NewLength(defaultColor, 3) # <<<<<<<<<<<<<<
*
* def __init__(self,
*/
- __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
+ __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 504, __pyx_L1_error)
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 543, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_v_self->_color);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_color));
__pyx_v_self->_color = ((pgColorObject *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":502
+ /* "pygame/_sdl2/video.pyx":541
*
* cdef class Texture:
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -8350,7 +8362,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":506
+/* "pygame/_sdl2/video.pyx":545
* self._color = pgColor_NewLength(defaultColor, 3)
*
* def __init__(self, # <<<<<<<<<<<<<<
@@ -8360,7 +8372,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6p
/* Python wrapper */
static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_2__init__[] = " Create an empty texture.\n\n :param Renderer renderer: Rendering context for the texture.\n :param tuple size: The width and height of the texture.\n :param int depth: The pixel format (0 to use the default).\n\n One of ``static``, ``streaming``, or ``target`` can be set\n to ``True``. If all are ``False``, then ``static`` is used.\n\n :param bool static: Changes rarely, not lockable.\n :param bool streaming: Changes frequently, lockable.\n :param bool target: Can be used as a render target.\n :param scale_quality: The quality of scale.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_2__init__[] = "pygame object that represents a texture\n\n Creates an empty texture.\n\n :param Renderer renderer: The rendering context for the texture.\n :param tuple size: The width and height for the texture.\n :param int depth: The pixel format (``0`` to use the default).\n :param bool static: Initialize the texture as static\n (changes rarely, not lockable).\n :param bool streaming: Initialize the texture as streaming\n (changes frequently, lockable).\n :param bool target: Initialize the texture as target\n (can be used as a rendering target).\n :param int scale_quality: Set the texture scale quality. Can be ``0``\n (nearest pixel sampling), ``1``\n (linear filtering, supported by OpenGL and Direct3D)\n and ``2`` (anisotropic filtering, supported by Direct3D).\n\n One of ``static``, ``streaming``, or ``target`` can be set\n to ``True``. If all are ``False``, then ``static`` is used.\n\n\n :class:`Texture` objects provide a platform-agnostic API for working with GPU textures.\n They are stored in GPU video memory (VRAM), and are therefore very fast to\n rotate and resize when drawn onto a :class:`Renderer`\n (an object that manages a rendering context inside a :class:`Window`) on most GPUs.\n\n Since textures are stored in GPU video memory, they aren't as easy to modify\n as the image data of :class:`pygame.Surface` objects, which reside in RAM.\n\n Textures can be modified in 2 ways:\n\n * By drawing other textures onto them, achieved by marking them as \"target\" textures and setting them as the rendering target of their Renderer object (if properly configured and supported).\n\n * By updating them with a Surface.\n\n .. note::\n A "":class:`pygame.Surface`-to-:class:`Texture` update is generally\n considered a slow operation, as it requires image data to be uploaded from\n RAM to VRAM, which can have a notable overhead cost.\n ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__;
#endif
@@ -8382,21 +8394,21 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_s
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_renderer,&__pyx_n_s_size,&__pyx_n_s_depth,&__pyx_n_s_static,&__pyx_n_s_streaming,&__pyx_n_s_target,&__pyx_n_s_scale_quality,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
- /* "pygame/_sdl2/video.pyx":509
+ /* "pygame/_sdl2/video.pyx":548
* Renderer renderer,
* size, int depth=0,
* static=False, streaming=False, # <<<<<<<<<<<<<<
* target=False, scale_quality=None):
- * """ Create an empty texture.
+ * """pygame object that represents a texture
*/
values[3] = ((PyObject *)Py_False);
values[4] = ((PyObject *)Py_False);
- /* "pygame/_sdl2/video.pyx":510
+ /* "pygame/_sdl2/video.pyx":549
* size, int depth=0,
* static=False, streaming=False,
* target=False, scale_quality=None): # <<<<<<<<<<<<<<
- * """ Create an empty texture.
+ * """pygame object that represents a texture
*
*/
values[5] = ((PyObject *)Py_False);
@@ -8431,7 +8443,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_s
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 7, 1); __PYX_ERR(0, 506, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 7, 1); __PYX_ERR(0, 545, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
@@ -8465,7 +8477,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_s
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 506, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 545, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -8488,7 +8500,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_s
__pyx_v_renderer = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)values[0]);
__pyx_v_size = values[1];
if (values[2]) {
- __pyx_v_depth = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 508, __pyx_L3_error)
+ __pyx_v_depth = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L3_error)
} else {
__pyx_v_depth = ((int)0);
}
@@ -8499,16 +8511,16 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_s
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 506, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 545, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 507, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 546, __pyx_L1_error)
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_renderer, __pyx_v_size, __pyx_v_depth, __pyx_v_static, __pyx_v_streaming, __pyx_v_target, __pyx_v_scale_quality);
- /* "pygame/_sdl2/video.pyx":506
+ /* "pygame/_sdl2/video.pyx":545
* self._color = pgColor_NewLength(defaultColor, 3)
*
* def __init__(self, # <<<<<<<<<<<<<<
@@ -8553,7 +8565,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "pygame/_sdl2/video.pyx":528
+ /* "pygame/_sdl2/video.pyx":594
* # TODO: masks
* cdef Uint32 format
* try: # <<<<<<<<<<<<<<
@@ -8564,7 +8576,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
(void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
/*try:*/ {
- /* "pygame/_sdl2/video.pyx":529
+ /* "pygame/_sdl2/video.pyx":595
* cdef Uint32 format
* try:
* format = format_from_depth(depth) # <<<<<<<<<<<<<<
@@ -8573,7 +8585,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
__pyx_v_format = __pyx_f_6pygame_5_sdl2_5video_format_from_depth(__pyx_v_depth);
- /* "pygame/_sdl2/video.pyx":528
+ /* "pygame/_sdl2/video.pyx":594
* # TODO: masks
* cdef Uint32 format
* try: # <<<<<<<<<<<<<<
@@ -8583,31 +8595,31 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
}
}
- /* "pygame/_sdl2/video.pyx":534
+ /* "pygame/_sdl2/video.pyx":600
*
* cdef int width, height
* if len(size) != 2: # <<<<<<<<<<<<<<
* raise ValueError('size must have two elements')
* width, height = size[0], size[1]
*/
- __pyx_t_4 = PyObject_Length(__pyx_v_size); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 534, __pyx_L1_error)
+ __pyx_t_4 = PyObject_Length(__pyx_v_size); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 600, __pyx_L1_error)
__pyx_t_5 = ((__pyx_t_4 != 2) != 0);
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":535
+ /* "pygame/_sdl2/video.pyx":601
* cdef int width, height
* if len(size) != 2:
* raise ValueError('size must have two elements') # <<<<<<<<<<<<<<
* width, height = size[0], size[1]
* if width <= 0 or height <= 0:
*/
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 601, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 535, __pyx_L1_error)
+ __PYX_ERR(0, 601, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":534
+ /* "pygame/_sdl2/video.pyx":600
*
* cdef int width, height
* if len(size) != 2: # <<<<<<<<<<<<<<
@@ -8616,25 +8628,25 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":536
+ /* "pygame/_sdl2/video.pyx":602
* if len(size) != 2:
* raise ValueError('size must have two elements')
* width, height = size[0], size[1] # <<<<<<<<<<<<<<
* if width <= 0 or height <= 0:
* raise ValueError('size must contain two positive values')
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 536, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 602, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 536, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 602, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 536, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 602, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 536, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 602, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_width = __pyx_t_7;
__pyx_v_height = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":537
+ /* "pygame/_sdl2/video.pyx":603
* raise ValueError('size must have two elements')
* width, height = size[0], size[1]
* if width <= 0 or height <= 0: # <<<<<<<<<<<<<<
@@ -8652,20 +8664,20 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_L11_bool_binop_done:;
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":538
+ /* "pygame/_sdl2/video.pyx":604
* width, height = size[0], size[1]
* if width <= 0 or height <= 0:
* raise ValueError('size must contain two positive values') # <<<<<<<<<<<<<<
*
* cdef int access
*/
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 604, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 538, __pyx_L1_error)
+ __PYX_ERR(0, 604, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":537
+ /* "pygame/_sdl2/video.pyx":603
* raise ValueError('size must have two elements')
* width, height = size[0], size[1]
* if width <= 0 or height <= 0: # <<<<<<<<<<<<<<
@@ -8674,48 +8686,48 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":541
+ /* "pygame/_sdl2/video.pyx":607
*
* cdef int access
* if static: # <<<<<<<<<<<<<<
* if streaming or target:
* raise ValueError('only one of static, streaming, or target can be true')
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 541, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
if (__pyx_t_5) {
- /* "pygame/_sdl2/video.pyx":542
+ /* "pygame/_sdl2/video.pyx":608
* cdef int access
* if static:
* if streaming or target: # <<<<<<<<<<<<<<
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STATIC
*/
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 542, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 608, __pyx_L1_error)
if (!__pyx_t_9) {
} else {
__pyx_t_5 = __pyx_t_9;
goto __pyx_L15_bool_binop_done;
}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 542, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 608, __pyx_L1_error)
__pyx_t_5 = __pyx_t_9;
__pyx_L15_bool_binop_done:;
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":543
+ /* "pygame/_sdl2/video.pyx":609
* if static:
* if streaming or target:
* raise ValueError('only one of static, streaming, or target can be true') # <<<<<<<<<<<<<<
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming:
*/
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 543, __pyx_L1_error)
+ __PYX_ERR(0, 609, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":542
+ /* "pygame/_sdl2/video.pyx":608
* cdef int access
* if static:
* if streaming or target: # <<<<<<<<<<<<<<
@@ -8724,7 +8736,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":544
+ /* "pygame/_sdl2/video.pyx":610
* if streaming or target:
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STATIC # <<<<<<<<<<<<<<
@@ -8733,7 +8745,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
__pyx_v_access = SDL_TEXTUREACCESS_STATIC;
- /* "pygame/_sdl2/video.pyx":541
+ /* "pygame/_sdl2/video.pyx":607
*
* cdef int access
* if static: # <<<<<<<<<<<<<<
@@ -8743,48 +8755,48 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
goto __pyx_L13;
}
- /* "pygame/_sdl2/video.pyx":545
+ /* "pygame/_sdl2/video.pyx":611
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming: # <<<<<<<<<<<<<<
* if static or target:
* raise ValueError('only one of static, streaming, or target can be true')
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 611, __pyx_L1_error)
if (__pyx_t_5) {
- /* "pygame/_sdl2/video.pyx":546
+ /* "pygame/_sdl2/video.pyx":612
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming:
* if static or target: # <<<<<<<<<<<<<<
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STREAMING
*/
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 612, __pyx_L1_error)
if (!__pyx_t_9) {
} else {
__pyx_t_5 = __pyx_t_9;
goto __pyx_L18_bool_binop_done;
}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 612, __pyx_L1_error)
__pyx_t_5 = __pyx_t_9;
__pyx_L18_bool_binop_done:;
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":547
+ /* "pygame/_sdl2/video.pyx":613
* elif streaming:
* if static or target:
* raise ValueError('only one of static, streaming, or target can be true') # <<<<<<<<<<<<<<
* access = _SDL_TEXTUREACCESS_STREAMING
* elif target:
*/
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 613, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 547, __pyx_L1_error)
+ __PYX_ERR(0, 613, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":546
+ /* "pygame/_sdl2/video.pyx":612
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming:
* if static or target: # <<<<<<<<<<<<<<
@@ -8793,7 +8805,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":548
+ /* "pygame/_sdl2/video.pyx":614
* if static or target:
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STREAMING # <<<<<<<<<<<<<<
@@ -8802,7 +8814,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
__pyx_v_access = SDL_TEXTUREACCESS_STREAMING;
- /* "pygame/_sdl2/video.pyx":545
+ /* "pygame/_sdl2/video.pyx":611
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming: # <<<<<<<<<<<<<<
@@ -8812,48 +8824,48 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
goto __pyx_L13;
}
- /* "pygame/_sdl2/video.pyx":549
+ /* "pygame/_sdl2/video.pyx":615
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STREAMING
* elif target: # <<<<<<<<<<<<<<
* if streaming or static:
* raise ValueError('only one of static, streaming, or target can be true')
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 549, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 615, __pyx_L1_error)
if (__pyx_t_5) {
- /* "pygame/_sdl2/video.pyx":550
+ /* "pygame/_sdl2/video.pyx":616
* access = _SDL_TEXTUREACCESS_STREAMING
* elif target:
* if streaming or static: # <<<<<<<<<<<<<<
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_TARGET
*/
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 550, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 616, __pyx_L1_error)
if (!__pyx_t_9) {
} else {
__pyx_t_5 = __pyx_t_9;
goto __pyx_L21_bool_binop_done;
}
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 550, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 616, __pyx_L1_error)
__pyx_t_5 = __pyx_t_9;
__pyx_L21_bool_binop_done:;
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":551
+ /* "pygame/_sdl2/video.pyx":617
* elif target:
* if streaming or static:
* raise ValueError('only one of static, streaming, or target can be true') # <<<<<<<<<<<<<<
* access = _SDL_TEXTUREACCESS_TARGET
* else:
*/
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 551, __pyx_L1_error)
+ __PYX_ERR(0, 617, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":550
+ /* "pygame/_sdl2/video.pyx":616
* access = _SDL_TEXTUREACCESS_STREAMING
* elif target:
* if streaming or static: # <<<<<<<<<<<<<<
@@ -8862,7 +8874,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":552
+ /* "pygame/_sdl2/video.pyx":618
* if streaming or static:
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_TARGET # <<<<<<<<<<<<<<
@@ -8871,7 +8883,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
__pyx_v_access = SDL_TEXTUREACCESS_TARGET;
- /* "pygame/_sdl2/video.pyx":549
+ /* "pygame/_sdl2/video.pyx":615
* raise ValueError('only one of static, streaming, or target can be true')
* access = _SDL_TEXTUREACCESS_STREAMING
* elif target: # <<<<<<<<<<<<<<
@@ -8881,7 +8893,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
goto __pyx_L13;
}
- /* "pygame/_sdl2/video.pyx":555
+ /* "pygame/_sdl2/video.pyx":621
* else:
* # Create static texture by default.
* access = _SDL_TEXTUREACCESS_STATIC # <<<<<<<<<<<<<<
@@ -8893,7 +8905,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
}
__pyx_L13:;
- /* "pygame/_sdl2/video.pyx":557
+ /* "pygame/_sdl2/video.pyx":623
* access = _SDL_TEXTUREACCESS_STATIC
*
* self.renderer = renderer # <<<<<<<<<<<<<<
@@ -8906,7 +8918,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__Pyx_DECREF(((PyObject *)__pyx_v_self->renderer));
__pyx_v_self->renderer = __pyx_v_renderer;
- /* "pygame/_sdl2/video.pyx":558
+ /* "pygame/_sdl2/video.pyx":624
*
* self.renderer = renderer
* cdef SDL_Renderer* _renderer = renderer._renderer # <<<<<<<<<<<<<<
@@ -8916,7 +8928,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_t_10 = __pyx_v_renderer->_renderer;
__pyx_v__renderer = __pyx_t_10;
- /* "pygame/_sdl2/video.pyx":559
+ /* "pygame/_sdl2/video.pyx":625
* self.renderer = renderer
* cdef SDL_Renderer* _renderer = renderer._renderer
* self._tex = SDL_CreateTexture(_renderer, # <<<<<<<<<<<<<<
@@ -8925,7 +8937,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
__pyx_v_self->_tex = SDL_CreateTexture(__pyx_v__renderer, __pyx_v_format, __pyx_v_access, __pyx_v_width, __pyx_v_height);
- /* "pygame/_sdl2/video.pyx":563
+ /* "pygame/_sdl2/video.pyx":629
* access,
* width, height)
* if not self._tex: # <<<<<<<<<<<<<<
@@ -8935,14 +8947,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_t_5 = ((!(__pyx_v_self->_tex != 0)) != 0);
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":564
+ /* "pygame/_sdl2/video.pyx":630
* width, height)
* if not self._tex:
* raise error() # <<<<<<<<<<<<<<
*
* if not scale_quality is None:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_error); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 564, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_error); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 630, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
@@ -8956,14 +8968,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
}
__pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 564, __pyx_L1_error)
+ if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 630, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __PYX_ERR(0, 564, __pyx_L1_error)
+ __PYX_ERR(0, 630, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":563
+ /* "pygame/_sdl2/video.pyx":629
* access,
* width, height)
* if not self._tex: # <<<<<<<<<<<<<<
@@ -8972,7 +8984,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":566
+ /* "pygame/_sdl2/video.pyx":632
* raise error()
*
* if not scale_quality is None: # <<<<<<<<<<<<<<
@@ -8983,7 +8995,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_t_9 = (__pyx_t_5 != 0);
if (__pyx_t_9) {
- /* "pygame/_sdl2/video.pyx":567
+ /* "pygame/_sdl2/video.pyx":633
*
* if not scale_quality is None:
* if SDL_VERSION_ATLEAST(2,0,12): # <<<<<<<<<<<<<<
@@ -8993,17 +9005,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_t_9 = (SDL_VERSION_ATLEAST(2, 0, 12) != 0);
if (__pyx_t_9) {
- /* "pygame/_sdl2/video.pyx":568
+ /* "pygame/_sdl2/video.pyx":634
* if not scale_quality is None:
* if SDL_VERSION_ATLEAST(2,0,12):
* SDL_SetTextureScaleMode(self._tex,scale_quality) # <<<<<<<<<<<<<<
* else:
* SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,{
*/
- __pyx_t_13 = ((_pgsdlScaleMode)__Pyx_PyInt_As__pgsdlScaleMode(__pyx_v_scale_quality)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L1_error)
+ __pyx_t_13 = ((_pgsdlScaleMode)__Pyx_PyInt_As__pgsdlScaleMode(__pyx_v_scale_quality)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 634, __pyx_L1_error)
(void)(SDL_SetTextureScaleMode(__pyx_v_self->_tex, __pyx_t_13));
- /* "pygame/_sdl2/video.pyx":567
+ /* "pygame/_sdl2/video.pyx":633
*
* if not scale_quality is None:
* if SDL_VERSION_ATLEAST(2,0,12): # <<<<<<<<<<<<<<
@@ -9013,7 +9025,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
goto __pyx_L25;
}
- /* "pygame/_sdl2/video.pyx":570
+ /* "pygame/_sdl2/video.pyx":636
* SDL_SetTextureScaleMode(self._tex,scale_quality)
* else:
* SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,{ # <<<<<<<<<<<<<<
@@ -9022,32 +9034,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
/*else*/ {
- /* "pygame/_sdl2/video.pyx":571
+ /* "pygame/_sdl2/video.pyx":637
* else:
* SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,{
* 0: b'nearest', # <<<<<<<<<<<<<<
* 1: b'linear',
* 2: b'best'
*/
- __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 571, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 637, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- if (PyDict_SetItem(__pyx_t_6, __pyx_int_0, __pyx_n_b_nearest) < 0) __PYX_ERR(0, 571, __pyx_L1_error)
- if (PyDict_SetItem(__pyx_t_6, __pyx_int_1, __pyx_n_b_linear) < 0) __PYX_ERR(0, 571, __pyx_L1_error)
- if (PyDict_SetItem(__pyx_t_6, __pyx_int_2, __pyx_n_b_best) < 0) __PYX_ERR(0, 571, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_6, __pyx_int_0, __pyx_n_b_nearest) < 0) __PYX_ERR(0, 637, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_6, __pyx_int_1, __pyx_n_b_linear) < 0) __PYX_ERR(0, 637, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_6, __pyx_int_2, __pyx_n_b_best) < 0) __PYX_ERR(0, 637, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":574
+ /* "pygame/_sdl2/video.pyx":640
* 1: b'linear',
* 2: b'best'
* }[scale_quality]) # <<<<<<<<<<<<<<
*
* self.width, self.height = width, height
*/
- __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_t_6, __pyx_v_scale_quality); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_t_6, __pyx_v_scale_quality); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 640, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_11); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 574, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_11); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":570
+ /* "pygame/_sdl2/video.pyx":636
* SDL_SetTextureScaleMode(self._tex,scale_quality)
* else:
* SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,{ # <<<<<<<<<<<<<<
@@ -9059,7 +9071,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
}
__pyx_L25:;
- /* "pygame/_sdl2/video.pyx":566
+ /* "pygame/_sdl2/video.pyx":632
* raise error()
*
* if not scale_quality is None: # <<<<<<<<<<<<<<
@@ -9068,7 +9080,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
*/
}
- /* "pygame/_sdl2/video.pyx":576
+ /* "pygame/_sdl2/video.pyx":642
* }[scale_quality])
*
* self.width, self.height = width, height # <<<<<<<<<<<<<<
@@ -9080,7 +9092,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
__pyx_v_self->width = __pyx_t_8;
__pyx_v_self->height = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":506
+ /* "pygame/_sdl2/video.pyx":545
* self._color = pgColor_NewLength(defaultColor, 3)
*
* def __init__(self, # <<<<<<<<<<<<<<
@@ -9103,17 +9115,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":579
+/* "pygame/_sdl2/video.pyx":645
*
* @staticmethod
* def from_surface(Renderer renderer, surface): # <<<<<<<<<<<<<<
- * """ Create a texture from an existing surface.
+ * """Create a texture from an existing surface
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface[] = " Create a texture from an existing surface.\n\n :param Renderer renderer: Rendering context for the texture.\n :param pygame.Surface surface: The surface to create a texture from.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface[] = "Create a texture from an existing surface\n\n :param Renderer renderer: Rendering context for the texture.\n :param pygame.Surface surface: The surface to create a texture from.\n ";
static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_7Texture_5from_surface = {"from_surface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface};
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer = 0;
@@ -9147,11 +9159,11 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UN
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, 1); __PYX_ERR(0, 579, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, 1); __PYX_ERR(0, 645, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "from_surface") < 0)) __PYX_ERR(0, 579, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "from_surface") < 0)) __PYX_ERR(0, 645, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -9164,13 +9176,13 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UN
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 579, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 645, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.from_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 579, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 645, __pyx_L1_error)
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(__pyx_v_renderer, __pyx_v_surface);
/* function exit code */
@@ -9199,7 +9211,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("from_surface", 0);
- /* "pygame/_sdl2/video.pyx":586
+ /* "pygame/_sdl2/video.pyx":652
* """
* # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -9209,20 +9221,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
__pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":587
+ /* "pygame/_sdl2/video.pyx":653
* # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
* if not pgSurface_Check(surface):
* raise TypeError('2nd argument must be a surface') # <<<<<<<<<<<<<<
* cdef Texture self = Texture.__new__(Texture)
* self.renderer = renderer
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 587, __pyx_L1_error)
+ __PYX_ERR(0, 653, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":586
+ /* "pygame/_sdl2/video.pyx":652
* """
* # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -9231,19 +9243,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":588
+ /* "pygame/_sdl2/video.pyx":654
* if not pgSurface_Check(surface):
* raise TypeError('2nd argument must be a surface')
* cdef Texture self = Texture.__new__(Texture) # <<<<<<<<<<<<<<
* self.renderer = renderer
* cdef SDL_Renderer* _renderer = renderer._renderer
*/
- __pyx_t_2 = ((PyObject *)__pyx_tp_new_6pygame_5_sdl2_5video_Texture(((PyTypeObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
+ __pyx_t_2 = ((PyObject *)__pyx_tp_new_6pygame_5_sdl2_5video_Texture(((PyTypeObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error)
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":589
+ /* "pygame/_sdl2/video.pyx":655
* raise TypeError('2nd argument must be a surface')
* cdef Texture self = Texture.__new__(Texture)
* self.renderer = renderer # <<<<<<<<<<<<<<
@@ -9256,7 +9268,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
__Pyx_DECREF(((PyObject *)__pyx_v_self->renderer));
__pyx_v_self->renderer = __pyx_v_renderer;
- /* "pygame/_sdl2/video.pyx":590
+ /* "pygame/_sdl2/video.pyx":656
* cdef Texture self = Texture.__new__(Texture)
* self.renderer = renderer
* cdef SDL_Renderer* _renderer = renderer._renderer # <<<<<<<<<<<<<<
@@ -9266,7 +9278,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
__pyx_t_3 = __pyx_v_renderer->_renderer;
__pyx_v__renderer = __pyx_t_3;
- /* "pygame/_sdl2/video.pyx":591
+ /* "pygame/_sdl2/video.pyx":657
* self.renderer = renderer
* cdef SDL_Renderer* _renderer = renderer._renderer
* cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface) # <<<<<<<<<<<<<<
@@ -9275,7 +9287,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
*/
__pyx_v_surf_ptr = pgSurface_AsSurface(__pyx_v_surface);
- /* "pygame/_sdl2/video.pyx":592
+ /* "pygame/_sdl2/video.pyx":658
* cdef SDL_Renderer* _renderer = renderer._renderer
* cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface)
* self._tex = SDL_CreateTextureFromSurface(_renderer, # <<<<<<<<<<<<<<
@@ -9284,7 +9296,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
*/
__pyx_v_self->_tex = SDL_CreateTextureFromSurface(__pyx_v__renderer, __pyx_v_surf_ptr);
- /* "pygame/_sdl2/video.pyx":594
+ /* "pygame/_sdl2/video.pyx":660
* self._tex = SDL_CreateTextureFromSurface(_renderer,
* surf_ptr)
* if not self._tex: # <<<<<<<<<<<<<<
@@ -9294,14 +9306,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
__pyx_t_1 = ((!(__pyx_v_self->_tex != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":595
+ /* "pygame/_sdl2/video.pyx":661
* surf_ptr)
* if not self._tex:
* raise error() # <<<<<<<<<<<<<<
* self.width = surface.get_width()
* self.height = surface.get_height()
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -9315,14 +9327,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
}
__pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 595, __pyx_L1_error)
+ __PYX_ERR(0, 661, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":594
+ /* "pygame/_sdl2/video.pyx":660
* self._tex = SDL_CreateTextureFromSurface(_renderer,
* surf_ptr)
* if not self._tex: # <<<<<<<<<<<<<<
@@ -9331,14 +9343,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":596
+ /* "pygame/_sdl2/video.pyx":662
* if not self._tex:
* raise error()
* self.width = surface.get_width() # <<<<<<<<<<<<<<
* self.height = surface.get_height()
* return self
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
@@ -9352,21 +9364,21 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
}
__pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->width = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":597
+ /* "pygame/_sdl2/video.pyx":663
* raise error()
* self.width = surface.get_width()
* self.height = surface.get_height() # <<<<<<<<<<<<<<
* return self
*
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
@@ -9380,14 +9392,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
}
__pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->height = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":598
+ /* "pygame/_sdl2/video.pyx":664
* self.width = surface.get_width()
* self.height = surface.get_height()
* return self # <<<<<<<<<<<<<<
@@ -9399,11 +9411,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":579
+ /* "pygame/_sdl2/video.pyx":645
*
* @staticmethod
* def from_surface(Renderer renderer, surface): # <<<<<<<<<<<<<<
- * """ Create a texture from an existing surface.
+ * """Create a texture from an existing surface
*
*/
@@ -9421,7 +9433,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":600
+/* "pygame/_sdl2/video.pyx":666
* return self
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -9445,7 +9457,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_ob
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "pygame/_sdl2/video.pyx":601
+ /* "pygame/_sdl2/video.pyx":667
*
* def __dealloc__(self):
* if self._tex: # <<<<<<<<<<<<<<
@@ -9455,7 +9467,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_ob
__pyx_t_1 = (__pyx_v_self->_tex != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":602
+ /* "pygame/_sdl2/video.pyx":668
* def __dealloc__(self):
* if self._tex:
* SDL_DestroyTexture(self._tex) # <<<<<<<<<<<<<<
@@ -9464,7 +9476,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_ob
*/
SDL_DestroyTexture(__pyx_v_self->_tex);
- /* "pygame/_sdl2/video.pyx":601
+ /* "pygame/_sdl2/video.pyx":667
*
* def __dealloc__(self):
* if self._tex: # <<<<<<<<<<<<<<
@@ -9473,7 +9485,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_ob
*/
}
- /* "pygame/_sdl2/video.pyx":600
+ /* "pygame/_sdl2/video.pyx":666
* return self
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -9485,12 +9497,12 @@ static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_ob
__Pyx_RefNannyFinishContext();
}
-/* "pygame/_sdl2/video.pyx":605
+/* "pygame/_sdl2/video.pyx":671
*
* @property
* def alpha(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
- * cdef Uint8 alpha
+ * """Get or set the additional alpha value multiplied into draw operations
+ * """
*/
/* Python wrapper */
@@ -9520,7 +9532,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":608
+ /* "pygame/_sdl2/video.pyx":676
* # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
* cdef Uint8 alpha
* cdef int res = SDL_GetTextureAlphaMod(self._tex, &alpha) # <<<<<<<<<<<<<<
@@ -9529,7 +9541,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
*/
__pyx_v_res = SDL_GetTextureAlphaMod(__pyx_v_self->_tex, (&__pyx_v_alpha));
- /* "pygame/_sdl2/video.pyx":609
+ /* "pygame/_sdl2/video.pyx":677
* cdef Uint8 alpha
* cdef int res = SDL_GetTextureAlphaMod(self._tex, &alpha)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9539,14 +9551,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":610
+ /* "pygame/_sdl2/video.pyx":678
* cdef int res = SDL_GetTextureAlphaMod(self._tex, &alpha)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* return alpha
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 678, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -9560,14 +9572,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 610, __pyx_L1_error)
+ __PYX_ERR(0, 678, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":609
+ /* "pygame/_sdl2/video.pyx":677
* cdef Uint8 alpha
* cdef int res = SDL_GetTextureAlphaMod(self._tex, &alpha)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9576,7 +9588,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
*/
}
- /* "pygame/_sdl2/video.pyx":612
+ /* "pygame/_sdl2/video.pyx":680
* raise error()
*
* return alpha # <<<<<<<<<<<<<<
@@ -9584,18 +9596,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
* @alpha.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyInt_From_Uint8(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint8(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":605
+ /* "pygame/_sdl2/video.pyx":671
*
* @property
* def alpha(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
- * cdef Uint8 alpha
+ * """Get or set the additional alpha value multiplied into draw operations
+ * """
*/
/* function exit code */
@@ -9611,7 +9623,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct _
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":615
+/* "pygame/_sdl2/video.pyx":683
*
* @alpha.setter
* def alpha(self, Uint8 new_value): # <<<<<<<<<<<<<<
@@ -9630,7 +9642,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_3__set__(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
assert(__pyx_arg_new_value); {
- __pyx_v_new_value = __Pyx_PyInt_As_Uint8(__pyx_arg_new_value); if (unlikely((__pyx_v_new_value == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 615, __pyx_L3_error)
+ __pyx_v_new_value = __Pyx_PyInt_As_Uint8(__pyx_arg_new_value); if (unlikely((__pyx_v_new_value == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 683, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -9658,7 +9670,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":617
+ /* "pygame/_sdl2/video.pyx":685
* def alpha(self, Uint8 new_value):
* # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
* cdef int res = SDL_SetTextureAlphaMod(self._tex, new_value) # <<<<<<<<<<<<<<
@@ -9667,7 +9679,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
*/
__pyx_v_res = SDL_SetTextureAlphaMod(__pyx_v_self->_tex, __pyx_v_new_value);
- /* "pygame/_sdl2/video.pyx":618
+ /* "pygame/_sdl2/video.pyx":686
* # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
* cdef int res = SDL_SetTextureAlphaMod(self._tex, new_value)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9677,14 +9689,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":619
+ /* "pygame/_sdl2/video.pyx":687
* cdef int res = SDL_SetTextureAlphaMod(self._tex, new_value)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 687, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -9698,14 +9710,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 619, __pyx_L1_error)
+ __PYX_ERR(0, 687, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":618
+ /* "pygame/_sdl2/video.pyx":686
* # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
* cdef int res = SDL_SetTextureAlphaMod(self._tex, new_value)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9714,7 +9726,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
*/
}
- /* "pygame/_sdl2/video.pyx":615
+ /* "pygame/_sdl2/video.pyx":683
*
* @alpha.setter
* def alpha(self, Uint8 new_value): # <<<<<<<<<<<<<<
@@ -9736,12 +9748,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":622
+/* "pygame/_sdl2/video.pyx":690
*
* @property
* def blend_mode(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureBlendMode
- * cdef SDL_BlendMode blendMode
+ * """Get or set the blend mode for texture drawing operations
+ *
*/
/* Python wrapper */
@@ -9771,7 +9783,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":625
+ /* "pygame/_sdl2/video.pyx":698
* # https://wiki.libsdl.org/SDL_GetTextureBlendMode
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetTextureBlendMode(self._tex, &blendMode) # <<<<<<<<<<<<<<
@@ -9780,7 +9792,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
*/
__pyx_v_res = SDL_GetTextureBlendMode(__pyx_v_self->_tex, (&__pyx_v_blendMode));
- /* "pygame/_sdl2/video.pyx":626
+ /* "pygame/_sdl2/video.pyx":699
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetTextureBlendMode(self._tex, &blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9790,14 +9802,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":627
+ /* "pygame/_sdl2/video.pyx":700
* cdef int res = SDL_GetTextureBlendMode(self._tex, &blendMode)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* return blendMode
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 627, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -9811,14 +9823,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 627, __pyx_L1_error)
+ __PYX_ERR(0, 700, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":626
+ /* "pygame/_sdl2/video.pyx":699
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetTextureBlendMode(self._tex, &blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9827,7 +9839,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
*/
}
- /* "pygame/_sdl2/video.pyx":629
+ /* "pygame/_sdl2/video.pyx":702
* raise error()
*
* return blendMode # <<<<<<<<<<<<<<
@@ -9835,18 +9847,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
* @blend_mode.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":622
+ /* "pygame/_sdl2/video.pyx":690
*
* @property
* def blend_mode(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureBlendMode
- * cdef SDL_BlendMode blendMode
+ * """Get or set the blend mode for texture drawing operations
+ *
*/
/* function exit code */
@@ -9862,7 +9874,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(st
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":632
+/* "pygame/_sdl2/video.pyx":705
*
* @blend_mode.setter
* def blend_mode(self, blendMode): # <<<<<<<<<<<<<<
@@ -9897,17 +9909,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":634
+ /* "pygame/_sdl2/video.pyx":707
* def blend_mode(self, blendMode):
* # https://wiki.libsdl.org/SDL_SetTextureBlendMode
* cdef int res = SDL_SetTextureBlendMode(self._tex, blendMode) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 634, __pyx_L1_error)
+ __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 707, __pyx_L1_error)
__pyx_v_res = SDL_SetTextureBlendMode(__pyx_v_self->_tex, __pyx_t_1);
- /* "pygame/_sdl2/video.pyx":635
+ /* "pygame/_sdl2/video.pyx":708
* # https://wiki.libsdl.org/SDL_SetTextureBlendMode
* cdef int res = SDL_SetTextureBlendMode(self._tex, blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9917,14 +9929,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct
__pyx_t_2 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":636
+ /* "pygame/_sdl2/video.pyx":709
* cdef int res = SDL_SetTextureBlendMode(self._tex, blendMode)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -9938,14 +9950,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 636, __pyx_L1_error)
+ __PYX_ERR(0, 709, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":635
+ /* "pygame/_sdl2/video.pyx":708
* # https://wiki.libsdl.org/SDL_SetTextureBlendMode
* cdef int res = SDL_SetTextureBlendMode(self._tex, blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -9954,7 +9966,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct
*/
}
- /* "pygame/_sdl2/video.pyx":632
+ /* "pygame/_sdl2/video.pyx":705
*
* @blend_mode.setter
* def blend_mode(self, blendMode): # <<<<<<<<<<<<<<
@@ -9976,12 +9988,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":639
+/* "pygame/_sdl2/video.pyx":712
*
* @property
* def color(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureColorMod
- * cdef int res = SDL_GetTextureColorMod(self._tex,
+ * """Get or set the additional color value multiplied into texture drawing operations
+ * """
*/
/* Python wrapper */
@@ -10010,8 +10022,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":641
- * def color(self):
+ /* "pygame/_sdl2/video.pyx":716
+ * """
* # https://wiki.libsdl.org/SDL_GetTextureColorMod
* cdef int res = SDL_GetTextureColorMod(self._tex, # <<<<<<<<<<<<<<
* &self._color.data[0],
@@ -10019,7 +10031,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
*/
__pyx_v_res = SDL_GetTextureColorMod(__pyx_v_self->_tex, (&(__pyx_v_self->_color->data[0])), (&(__pyx_v_self->_color->data[1])), (&(__pyx_v_self->_color->data[2])));
- /* "pygame/_sdl2/video.pyx":645
+ /* "pygame/_sdl2/video.pyx":720
* &self._color.data[1],
* &self._color.data[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -10029,14 +10041,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":646
+ /* "pygame/_sdl2/video.pyx":721
* &self._color.data[2])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* return self._color
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 646, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -10050,14 +10062,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 646, __pyx_L1_error)
+ __PYX_ERR(0, 721, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":645
+ /* "pygame/_sdl2/video.pyx":720
* &self._color.data[1],
* &self._color.data[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -10066,7 +10078,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
*/
}
- /* "pygame/_sdl2/video.pyx":648
+ /* "pygame/_sdl2/video.pyx":723
* raise error()
*
* return self._color # <<<<<<<<<<<<<<
@@ -10078,12 +10090,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
__pyx_r = ((PyObject *)__pyx_v_self->_color);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":639
+ /* "pygame/_sdl2/video.pyx":712
*
* @property
* def color(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetTextureColorMod
- * cdef int res = SDL_GetTextureColorMod(self._tex,
+ * """Get or set the additional color value multiplied into texture drawing operations
+ * """
*/
/* function exit code */
@@ -10099,7 +10111,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct _
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":651
+/* "pygame/_sdl2/video.pyx":726
*
* @color.setter
* def color(self, new_value): # <<<<<<<<<<<<<<
@@ -10136,43 +10148,43 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":654
+ /* "pygame/_sdl2/video.pyx":729
* # https://wiki.libsdl.org/SDL_SetTextureColorMod
* cdef int res = SDL_SetTextureColorMod(self._tex,
* new_value[0], # <<<<<<<<<<<<<<
* new_value[1],
* new_value[2])
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":655
+ /* "pygame/_sdl2/video.pyx":730
* cdef int res = SDL_SetTextureColorMod(self._tex,
* new_value[0],
* new_value[1], # <<<<<<<<<<<<<<
* new_value[2])
* if res < 0:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":656
+ /* "pygame/_sdl2/video.pyx":731
* new_value[0],
* new_value[1],
* new_value[2]) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":653
+ /* "pygame/_sdl2/video.pyx":728
* def color(self, new_value):
* # https://wiki.libsdl.org/SDL_SetTextureColorMod
* cdef int res = SDL_SetTextureColorMod(self._tex, # <<<<<<<<<<<<<<
@@ -10181,7 +10193,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
*/
__pyx_v_res = SDL_SetTextureColorMod(__pyx_v_self->_tex, __pyx_t_2, __pyx_t_3, __pyx_t_4);
- /* "pygame/_sdl2/video.pyx":657
+ /* "pygame/_sdl2/video.pyx":732
* new_value[1],
* new_value[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -10191,14 +10203,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
__pyx_t_5 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_5)) {
- /* "pygame/_sdl2/video.pyx":658
+ /* "pygame/_sdl2/video.pyx":733
* new_value[2])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def get_rect(self, **kwargs):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 658, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
@@ -10212,14 +10224,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
}
__pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 658, __pyx_L1_error)
+ __PYX_ERR(0, 733, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":657
+ /* "pygame/_sdl2/video.pyx":732
* new_value[1],
* new_value[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -10228,7 +10240,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
*/
}
- /* "pygame/_sdl2/video.pyx":651
+ /* "pygame/_sdl2/video.pyx":726
*
* @color.setter
* def color(self, new_value): # <<<<<<<<<<<<<<
@@ -10250,17 +10262,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":660
+/* "pygame/_sdl2/video.pyx":735
* raise error()
*
* def get_rect(self, **kwargs): # <<<<<<<<<<<<<<
- * """ Get the rectangular area of the texture.
- * like surface.get_rect(), returns a new rectangle covering the entire surface.
+ * """Get the rectangular area of the texture
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_8get_rect[] = " Get the rectangular area of the texture.\n like surface.get_rect(), returns a new rectangle covering the entire surface.\n This rectangle will always start at 0, 0 with a width. and height the same size as the texture.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_8get_rect[] = "Get the rectangular area of the texture\n\n Like :meth:`pygame.Surface.get_rect`, this method returns a **new**\n :class:`pygame.Rect` covering the entire texture. It will always\n have a ``topleft`` of ``(0, 0)`` with a ``width`` and ``height`` the same size as the\n texture.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_kwargs = 0;
PyObject *__pyx_r = 0;
@@ -10296,19 +10308,19 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_rect", 0);
- /* "pygame/_sdl2/video.pyx":665
- * This rectangle will always start at 0, 0 with a width. and height the same size as the texture.
+ /* "pygame/_sdl2/video.pyx":743
+ * texture.
* """
* rect = pgRect_New4(0, 0, self.width, self.height) # <<<<<<<<<<<<<<
* for key in kwargs:
* setattr(rect, key, kwargs[key])
*/
- __pyx_t_1 = pgRect_New4(0, 0, __pyx_v_self->width, __pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
+ __pyx_t_1 = pgRect_New4(0, 0, __pyx_v_self->width, __pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_rect = __pyx_t_1;
__pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":666
+ /* "pygame/_sdl2/video.pyx":744
* """
* rect = pgRect_New4(0, 0, self.width, self.height)
* for key in kwargs: # <<<<<<<<<<<<<<
@@ -10316,7 +10328,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_
*
*/
__pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 744, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_5;
@@ -10324,26 +10336,26 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_
while (1) {
__pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4);
if (unlikely(__pyx_t_6 == 0)) break;
- if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 666, __pyx_L1_error)
+ if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 744, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
__pyx_t_5 = 0;
- /* "pygame/_sdl2/video.pyx":667
+ /* "pygame/_sdl2/video.pyx":745
* rect = pgRect_New4(0, 0, self.width, self.height)
* for key in kwargs:
* setattr(rect, key, kwargs[key]) # <<<<<<<<<<<<<<
*
* return rect
*/
- __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_7 = PyObject_SetAttr(__pyx_v_rect, __pyx_v_key, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 667, __pyx_L1_error)
+ __pyx_t_7 = PyObject_SetAttr(__pyx_v_rect, __pyx_v_key, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 745, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":669
+ /* "pygame/_sdl2/video.pyx":747
* setattr(rect, key, kwargs[key])
*
* return rect # <<<<<<<<<<<<<<
@@ -10355,12 +10367,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_
__pyx_r = __pyx_v_rect;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":660
+ /* "pygame/_sdl2/video.pyx":735
* raise error()
*
* def get_rect(self, **kwargs): # <<<<<<<<<<<<<<
- * """ Get the rectangular area of the texture.
- * like surface.get_rect(), returns a new rectangle covering the entire surface.
+ * """Get the rectangular area of the texture
+ *
*/
/* function exit code */
@@ -10377,7 +10389,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":671
+/* "pygame/_sdl2/video.pyx":749
* return rect
*
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL, # <<<<<<<<<<<<<<
@@ -10389,7 +10401,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
float __pyx_v_angle = ((float)0.0);
SDL_Point *__pyx_v_originptr = ((SDL_Point *)NULL);
- /* "pygame/_sdl2/video.pyx":672
+ /* "pygame/_sdl2/video.pyx":750
*
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,
* bint flip_x=False, bint flip_y=False): # <<<<<<<<<<<<<<
@@ -10425,7 +10437,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
}
}
- /* "pygame/_sdl2/video.pyx":673
+ /* "pygame/_sdl2/video.pyx":751
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,
* bint flip_x=False, bint flip_y=False):
* cdef int flip = SDL_FLIP_NONE # <<<<<<<<<<<<<<
@@ -10434,7 +10446,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
__pyx_v_flip = SDL_FLIP_NONE;
- /* "pygame/_sdl2/video.pyx":674
+ /* "pygame/_sdl2/video.pyx":752
* bint flip_x=False, bint flip_y=False):
* cdef int flip = SDL_FLIP_NONE
* if flip_x: # <<<<<<<<<<<<<<
@@ -10444,7 +10456,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
__pyx_t_1 = (__pyx_v_flip_x != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":675
+ /* "pygame/_sdl2/video.pyx":753
* cdef int flip = SDL_FLIP_NONE
* if flip_x:
* flip |= SDL_FLIP_HORIZONTAL # <<<<<<<<<<<<<<
@@ -10453,7 +10465,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
__pyx_v_flip = (__pyx_v_flip | SDL_FLIP_HORIZONTAL);
- /* "pygame/_sdl2/video.pyx":674
+ /* "pygame/_sdl2/video.pyx":752
* bint flip_x=False, bint flip_y=False):
* cdef int flip = SDL_FLIP_NONE
* if flip_x: # <<<<<<<<<<<<<<
@@ -10462,7 +10474,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":676
+ /* "pygame/_sdl2/video.pyx":754
* if flip_x:
* flip |= SDL_FLIP_HORIZONTAL
* if flip_y: # <<<<<<<<<<<<<<
@@ -10472,7 +10484,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
__pyx_t_1 = (__pyx_v_flip_y != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":677
+ /* "pygame/_sdl2/video.pyx":755
* flip |= SDL_FLIP_HORIZONTAL
* if flip_y:
* flip |= SDL_FLIP_VERTICAL # <<<<<<<<<<<<<<
@@ -10481,7 +10493,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
__pyx_v_flip = (__pyx_v_flip | SDL_FLIP_VERTICAL);
- /* "pygame/_sdl2/video.pyx":676
+ /* "pygame/_sdl2/video.pyx":754
* if flip_x:
* flip |= SDL_FLIP_HORIZONTAL
* if flip_y: # <<<<<<<<<<<<<<
@@ -10490,7 +10502,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":679
+ /* "pygame/_sdl2/video.pyx":757
* flip |= SDL_FLIP_VERTICAL
*
* cdef int res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect, # <<<<<<<<<<<<<<
@@ -10499,7 +10511,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
__pyx_v_res = SDL_RenderCopyEx(__pyx_v_self->renderer->_renderer, __pyx_v_self->_tex, __pyx_v_csrcrect, __pyx_v_cdstrect, __pyx_v_angle, __pyx_v_originptr, ((SDL_RendererFlip)__pyx_v_flip));
- /* "pygame/_sdl2/video.pyx":681
+ /* "pygame/_sdl2/video.pyx":759
* cdef int res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,
* angle, originptr, flip)
* if res < 0: # <<<<<<<<<<<<<<
@@ -10509,14 +10521,14 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":682
+ /* "pygame/_sdl2/video.pyx":760
* angle, originptr, flip)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -10530,14 +10542,14 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 682, __pyx_L1_error)
+ __PYX_ERR(0, 760, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":681
+ /* "pygame/_sdl2/video.pyx":759
* cdef int res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,
* angle, originptr, flip)
* if res < 0: # <<<<<<<<<<<<<<
@@ -10546,7 +10558,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":671
+ /* "pygame/_sdl2/video.pyx":749
* return rect
*
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL, # <<<<<<<<<<<<<<
@@ -10569,12 +10581,12 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":684
+/* "pygame/_sdl2/video.pyx":762
* raise error()
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None, # <<<<<<<<<<<<<<
* bint flip_x=False, bint flip_y=False):
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*/
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
@@ -10584,11 +10596,11 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
float __pyx_v_angle = ((float)0.0);
PyObject *__pyx_v_origin = ((PyObject *)Py_None);
- /* "pygame/_sdl2/video.pyx":685
+ /* "pygame/_sdl2/video.pyx":763
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
* bint flip_x=False, bint flip_y=False): # <<<<<<<<<<<<<<
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*
*/
int __pyx_v_flip_x = ((int)0);
@@ -10638,12 +10650,12 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
}
}
- /* "pygame/_sdl2/video.pyx":684
+ /* "pygame/_sdl2/video.pyx":762
* raise error()
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None, # <<<<<<<<<<<<<<
* bint flip_x=False, bint flip_y=False):
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*/
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
@@ -10654,14 +10666,14 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw)) {
- __pyx_t_3 = PyFloat_FromDouble(__pyx_v_angle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_angle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_flip_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_flip_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_flip_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_flip_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL;
@@ -10679,7 +10691,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_6)) {
PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_srcrect, __pyx_v_dstrect, __pyx_t_3, __pyx_v_origin, __pyx_t_4, __pyx_t_5};
- __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -10690,7 +10702,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_srcrect, __pyx_v_dstrect, __pyx_t_3, __pyx_v_origin, __pyx_t_4, __pyx_t_5};
- __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -10699,7 +10711,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
} else
#endif
{
- __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
if (__pyx_t_7) {
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
@@ -10722,7 +10734,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_3 = 0;
__pyx_t_4 = 0;
__pyx_t_5 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
@@ -10744,7 +10756,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
#endif
}
- /* "pygame/_sdl2/video.pyx":698
+ /* "pygame/_sdl2/video.pyx":780
* """
* cdef SDL_Rect src, dst
* cdef SDL_Rect *csrcrect = NULL # <<<<<<<<<<<<<<
@@ -10753,7 +10765,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_csrcrect = NULL;
- /* "pygame/_sdl2/video.pyx":699
+ /* "pygame/_sdl2/video.pyx":781
* cdef SDL_Rect src, dst
* cdef SDL_Rect *csrcrect = NULL
* cdef SDL_Rect *cdstrect = NULL # <<<<<<<<<<<<<<
@@ -10762,7 +10774,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_cdstrect = NULL;
- /* "pygame/_sdl2/video.pyx":703
+ /* "pygame/_sdl2/video.pyx":785
* cdef SDL_Point *originptr
*
* if srcrect is not None: # <<<<<<<<<<<<<<
@@ -10773,7 +10785,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_11 = (__pyx_t_10 != 0);
if (__pyx_t_11) {
- /* "pygame/_sdl2/video.pyx":704
+ /* "pygame/_sdl2/video.pyx":786
*
* if srcrect is not None:
* csrcrect = pgRect_FromObject(srcrect, &src) # <<<<<<<<<<<<<<
@@ -10782,7 +10794,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_csrcrect = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_src));
- /* "pygame/_sdl2/video.pyx":705
+ /* "pygame/_sdl2/video.pyx":787
* if srcrect is not None:
* csrcrect = pgRect_FromObject(srcrect, &src)
* if not csrcrect: # <<<<<<<<<<<<<<
@@ -10792,20 +10804,20 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_11 = ((!(__pyx_v_csrcrect != 0)) != 0);
if (unlikely(__pyx_t_11)) {
- /* "pygame/_sdl2/video.pyx":706
+ /* "pygame/_sdl2/video.pyx":788
* csrcrect = pgRect_FromObject(srcrect, &src)
* if not csrcrect:
* raise TypeError("the argument is not a rectangle or None") # <<<<<<<<<<<<<<
*
* if dstrect is not None:
*/
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 706, __pyx_L1_error)
+ __PYX_ERR(0, 788, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":705
+ /* "pygame/_sdl2/video.pyx":787
* if srcrect is not None:
* csrcrect = pgRect_FromObject(srcrect, &src)
* if not csrcrect: # <<<<<<<<<<<<<<
@@ -10814,7 +10826,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
}
- /* "pygame/_sdl2/video.pyx":703
+ /* "pygame/_sdl2/video.pyx":785
* cdef SDL_Point *originptr
*
* if srcrect is not None: # <<<<<<<<<<<<<<
@@ -10823,7 +10835,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
}
- /* "pygame/_sdl2/video.pyx":708
+ /* "pygame/_sdl2/video.pyx":790
* raise TypeError("the argument is not a rectangle or None")
*
* if dstrect is not None: # <<<<<<<<<<<<<<
@@ -10834,7 +10846,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_10 = (__pyx_t_11 != 0);
if (__pyx_t_10) {
- /* "pygame/_sdl2/video.pyx":709
+ /* "pygame/_sdl2/video.pyx":791
*
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst) # <<<<<<<<<<<<<<
@@ -10843,7 +10855,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_cdstrect = pgRect_FromObject(__pyx_v_dstrect, (&__pyx_v_dst));
- /* "pygame/_sdl2/video.pyx":710
+ /* "pygame/_sdl2/video.pyx":792
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL: # <<<<<<<<<<<<<<
@@ -10853,44 +10865,44 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_10 = ((__pyx_v_cdstrect == NULL) != 0);
if (__pyx_t_10) {
- /* "pygame/_sdl2/video.pyx":711
+ /* "pygame/_sdl2/video.pyx":793
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL:
* if len(dstrect) == 2: # <<<<<<<<<<<<<<
* dst.x = dstrect[0]
* dst.y = dstrect[1]
*/
- __pyx_t_12 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 711, __pyx_L1_error)
+ __pyx_t_12 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 793, __pyx_L1_error)
__pyx_t_10 = ((__pyx_t_12 == 2) != 0);
if (likely(__pyx_t_10)) {
- /* "pygame/_sdl2/video.pyx":712
+ /* "pygame/_sdl2/video.pyx":794
* if cdstrect == NULL:
* if len(dstrect) == 2:
* dst.x = dstrect[0] # <<<<<<<<<<<<<<
* dst.y = dstrect[1]
* dst.w = self.width
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.x = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":713
+ /* "pygame/_sdl2/video.pyx":795
* if len(dstrect) == 2:
* dst.x = dstrect[0]
* dst.y = dstrect[1] # <<<<<<<<<<<<<<
* dst.w = self.width
* dst.h = self.height
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 795, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.y = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":714
+ /* "pygame/_sdl2/video.pyx":796
* dst.x = dstrect[0]
* dst.y = dstrect[1]
* dst.w = self.width # <<<<<<<<<<<<<<
@@ -10900,7 +10912,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_8 = __pyx_v_self->width;
__pyx_v_dst.w = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":715
+ /* "pygame/_sdl2/video.pyx":797
* dst.y = dstrect[1]
* dst.w = self.width
* dst.h = self.height # <<<<<<<<<<<<<<
@@ -10910,7 +10922,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_8 = __pyx_v_self->height;
__pyx_v_dst.h = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":716
+ /* "pygame/_sdl2/video.pyx":798
* dst.w = self.width
* dst.h = self.height
* cdstrect = &dst # <<<<<<<<<<<<<<
@@ -10919,7 +10931,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_cdstrect = (&__pyx_v_dst);
- /* "pygame/_sdl2/video.pyx":711
+ /* "pygame/_sdl2/video.pyx":793
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL:
* if len(dstrect) == 2: # <<<<<<<<<<<<<<
@@ -10929,7 +10941,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
goto __pyx_L7;
}
- /* "pygame/_sdl2/video.pyx":718
+ /* "pygame/_sdl2/video.pyx":800
* cdstrect = &dst
* else:
* raise TypeError('dstrect must be a position, rect, or None') # <<<<<<<<<<<<<<
@@ -10937,15 +10949,15 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
* if origin:
*/
/*else*/ {
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 718, __pyx_L1_error)
+ __PYX_ERR(0, 800, __pyx_L1_error)
}
__pyx_L7:;
- /* "pygame/_sdl2/video.pyx":710
+ /* "pygame/_sdl2/video.pyx":792
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL: # <<<<<<<<<<<<<<
@@ -10954,7 +10966,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
}
- /* "pygame/_sdl2/video.pyx":708
+ /* "pygame/_sdl2/video.pyx":790
* raise TypeError("the argument is not a rectangle or None")
*
* if dstrect is not None: # <<<<<<<<<<<<<<
@@ -10963,17 +10975,17 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
}
- /* "pygame/_sdl2/video.pyx":720
+ /* "pygame/_sdl2/video.pyx":802
* raise TypeError('dstrect must be a position, rect, or None')
*
* if origin: # <<<<<<<<<<<<<<
* originptr = &corigin
* corigin.x = origin[0]
*/
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_origin); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 720, __pyx_L1_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_origin); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 802, __pyx_L1_error)
if (__pyx_t_10) {
- /* "pygame/_sdl2/video.pyx":721
+ /* "pygame/_sdl2/video.pyx":803
*
* if origin:
* originptr = &corigin # <<<<<<<<<<<<<<
@@ -10982,33 +10994,33 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
*/
__pyx_v_originptr = (&__pyx_v_corigin);
- /* "pygame/_sdl2/video.pyx":722
+ /* "pygame/_sdl2/video.pyx":804
* if origin:
* originptr = &corigin
* corigin.x = origin[0] # <<<<<<<<<<<<<<
* corigin.y = origin[1]
* else:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_corigin.x = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":723
+ /* "pygame/_sdl2/video.pyx":805
* originptr = &corigin
* corigin.x = origin[0]
* corigin.y = origin[1] # <<<<<<<<<<<<<<
* else:
* originptr = NULL
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_corigin.y = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":720
+ /* "pygame/_sdl2/video.pyx":802
* raise TypeError('dstrect must be a position, rect, or None')
*
* if origin: # <<<<<<<<<<<<<<
@@ -11018,7 +11030,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
goto __pyx_L8;
}
- /* "pygame/_sdl2/video.pyx":725
+ /* "pygame/_sdl2/video.pyx":807
* corigin.y = origin[1]
* else:
* originptr = NULL # <<<<<<<<<<<<<<
@@ -11030,7 +11042,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
}
__pyx_L8:;
- /* "pygame/_sdl2/video.pyx":727
+ /* "pygame/_sdl2/video.pyx":809
* originptr = NULL
*
* self.draw_internal(csrcrect, cdstrect, angle, originptr, # <<<<<<<<<<<<<<
@@ -11042,16 +11054,16 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
__pyx_t_13.originptr = __pyx_v_originptr;
__pyx_t_13.flip_x = __pyx_v_flip_x;
__pyx_t_13.flip_y = __pyx_v_flip_y;
- __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->__pyx_vtab)->draw_internal(__pyx_v_self, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
+ __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->__pyx_vtab)->draw_internal(__pyx_v_self, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":684
+ /* "pygame/_sdl2/video.pyx":762
* raise error()
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None, # <<<<<<<<<<<<<<
* bint flip_x=False, bint flip_y=False):
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*/
/* function exit code */
@@ -11072,7 +11084,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_10draw[] = " Copy a portion of the texture to the rendering target.\n\n :param srcrect: source rectangle on the texture, or None for the entire texture.\n :param dstrect: destination rectangle or position on the render target, or None for entire target.\n The texture is stretched to fill dstrect.\n :param float angle: angle (in degrees) to rotate dstrect around (clockwise).\n :param origin: point around which dstrect will be rotated.\n If None, it will equal the center: (dstrect.w/2, dstrect.h/2).\n :param bool flip_x: flip horizontally.\n :param bool flip_y: flip vertically.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_10draw[] = "Copy a portion of the texture to the rendering target\n\n :param srcrect: The source rectangle on the texture, or ``None`` for the\n entire texture.\n :param dstrect: The destination rectangle on the rendering target, or\n ``None`` for the entire rendering target. The texture\n will be stretched to fill ``dstrect``.\n :param float angle: The angle (in degrees) to rotate dstrect around\n (clockwise).\n :param origin: The point around which dstrect will be rotated.\n If ``None``, it will equal the center:\n ``(dstrect.w/2, dstrect.h/2)``.\n :param bool flip_x: Flip the drawn texture portion horizontally (x - axis).\n :param bool flip_y: Flip the drawn texture portion vertically (y - axis).\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_srcrect = 0;
PyObject *__pyx_v_dstrect = 0;
@@ -11150,7 +11162,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 684, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 762, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -11173,33 +11185,33 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_
__pyx_v_srcrect = values[0];
__pyx_v_dstrect = values[1];
if (values[2]) {
- __pyx_v_angle = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L3_error)
+ __pyx_v_angle = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L3_error)
} else {
__pyx_v_angle = ((float)0.0);
}
__pyx_v_origin = values[3];
if (values[4]) {
- __pyx_v_flip_x = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_flip_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L3_error)
+ __pyx_v_flip_x = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_flip_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":685
+ /* "pygame/_sdl2/video.pyx":763
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
* bint flip_x=False, bint flip_y=False): # <<<<<<<<<<<<<<
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*
*/
__pyx_v_flip_x = ((int)0);
}
if (values[5]) {
- __pyx_v_flip_y = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_flip_y == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L3_error)
+ __pyx_v_flip_y = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_flip_y == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L3_error)
} else {
__pyx_v_flip_y = ((int)0);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 684, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 762, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -11207,12 +11219,12 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_srcrect, __pyx_v_dstrect, __pyx_v_angle, __pyx_v_origin, __pyx_v_flip_x, __pyx_v_flip_y);
- /* "pygame/_sdl2/video.pyx":684
+ /* "pygame/_sdl2/video.pyx":762
* raise error()
*
* cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None, # <<<<<<<<<<<<<<
* bint flip_x=False, bint flip_y=False):
- * """ Copy a portion of the texture to the rendering target.
+ * """Copy a portion of the texture to the rendering target
*/
/* function exit code */
@@ -11238,7 +11250,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj
__pyx_t_1.flip_x = __pyx_v_flip_x;
__pyx_t_1.flip_y = __pyx_v_flip_y;
__pyx_vtabptr_6pygame_5_sdl2_5video_Texture->draw(__pyx_v_self, 1, &__pyx_t_1);
- __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -11255,7 +11267,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":730
+/* "pygame/_sdl2/video.pyx":812
* flip_x, flip_y)
*
* def draw_triangle(self, p1_xy, p2_xy, p3_xy, # <<<<<<<<<<<<<<
@@ -11265,7 +11277,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_12draw_triangle[] = " Copy a triangle portion of the texture to the rendering target by vertices coordinates.\n\n :param p1_xy: first vertex coordinate on the render target to be drawn at.\n :param p2_xy: second vertex coordinate on the render target to be drawn at.\n :param p3_xy: third vertex coordinate on the render target to be drawn at.\n :param p1_uv: first vertex coordinate on the texture to be drawn from.\n :param p2_uv: second vertex coordinate on the texture to be drawn from.\n :param p3_uv: third vertex coordinate on the texture to be drawn from.\n :param p1_mod: first vertex color modulation.\n :param p2_mod: second vertex color modulation.\n :param p3_mod: third vertex color modulation.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_12draw_triangle[] = "Copy a triangle portion of the texture to the rendering target using the given coordinates\n\n :param p1_xy: The first vertex coordinate on the rendering target.\n :param p2_xy: The second vertex coordinate on the rendering target.\n :param p3_xy: The third vertex coordinate on the rendering target.\n :param p1_uv: The first UV coordinate of the triangle portion.\n :param p2_uv: The second UV coordinate of the triangle portion.\n :param p3_uv: The third UV coordinate of the triangle portion.\n :param p1_mod: The first vertex color modulation.\n :param p2_mod: The second vertex color modulation.\n :param p3_mod: The third vertex color modulation.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_p1_xy = 0;
PyObject *__pyx_v_p2_xy = 0;
@@ -11286,22 +11298,22 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObjec
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p1_xy,&__pyx_n_s_p2_xy,&__pyx_n_s_p3_xy,&__pyx_n_s_p1_uv,&__pyx_n_s_p2_uv,&__pyx_n_s_p3_uv,&__pyx_n_s_p1_mod,&__pyx_n_s_p2_mod,&__pyx_n_s_p3_mod,0};
PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
- /* "pygame/_sdl2/video.pyx":731
+ /* "pygame/_sdl2/video.pyx":813
*
* def draw_triangle(self, p1_xy, p2_xy, p3_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0), # <<<<<<<<<<<<<<
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)):
- * """ Copy a triangle portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a triangle portion of the texture to the rendering target using the given coordinates
*/
values[3] = ((PyObject *)__pyx_tuple__16);
values[4] = ((PyObject *)__pyx_tuple__17);
values[5] = ((PyObject *)__pyx_tuple__18);
- /* "pygame/_sdl2/video.pyx":732
+ /* "pygame/_sdl2/video.pyx":814
* def draw_triangle(self, p1_xy, p2_xy, p3_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0),
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)): # <<<<<<<<<<<<<<
- * """ Copy a triangle portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a triangle portion of the texture to the rendering target using the given coordinates
*
*/
values[6] = ((PyObject *)__pyx_tuple__19);
@@ -11341,13 +11353,13 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObjec
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2_xy)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, 1); __PYX_ERR(0, 730, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, 1); __PYX_ERR(0, 812, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3_xy)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, 2); __PYX_ERR(0, 730, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, 2); __PYX_ERR(0, 812, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
@@ -11387,7 +11399,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObjec
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_triangle") < 0)) __PYX_ERR(0, 730, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_triangle") < 0)) __PYX_ERR(0, 812, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -11422,7 +11434,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObjec
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 730, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 812, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.draw_triangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -11430,7 +11442,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13draw_triangle(PyObjec
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_p1_xy, __pyx_v_p2_xy, __pyx_v_p3_xy, __pyx_v_p1_uv, __pyx_v_p2_uv, __pyx_v_p3_uv, __pyx_v_p1_mod, __pyx_v_p2_mod, __pyx_v_p3_mod);
- /* "pygame/_sdl2/video.pyx":730
+ /* "pygame/_sdl2/video.pyx":812
* flip_x, flip_y)
*
* def draw_triangle(self, p1_xy, p2_xy, p3_xy, # <<<<<<<<<<<<<<
@@ -11479,8 +11491,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_triangle", 0);
- /* "pygame/_sdl2/video.pyx":745
- * :param p3_mod: third vertex color modulation.
+ /* "pygame/_sdl2/video.pyx":827
+ * :param p3_mod: The third vertex color modulation.
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
* raise error("draw_triangle requires SDL 2.0.18 or newer")
@@ -11489,14 +11501,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__pyx_t_1 = ((!(SDL_VERSION_ATLEAST(2, 0, 18) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":746
+ /* "pygame/_sdl2/video.pyx":828
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18):
* raise error("draw_triangle requires SDL 2.0.18 or newer") # <<<<<<<<<<<<<<
*
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -11510,15 +11522,15 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_draw_triangle_requires_SDL_2_0_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_draw_triangle_requires_SDL_2_0_1);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 746, __pyx_L1_error)
+ __PYX_ERR(0, 828, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":745
- * :param p3_mod: third vertex color modulation.
+ /* "pygame/_sdl2/video.pyx":827
+ * :param p3_mod: The third vertex color modulation.
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
* raise error("draw_triangle requires SDL 2.0.18 or newer")
@@ -11526,7 +11538,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
}
- /* "pygame/_sdl2/video.pyx":749
+ /* "pygame/_sdl2/video.pyx":831
*
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
* SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod) # <<<<<<<<<<<<<<
@@ -11535,7 +11547,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
(void)(SDL_GetTextureColorMod(__pyx_v_self->_tex, (&__pyx_v__r_mod), (&__pyx_v__g_mod), (&__pyx_v__b_mod)));
- /* "pygame/_sdl2/video.pyx":750
+ /* "pygame/_sdl2/video.pyx":832
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
* SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod)
* SDL_GetTextureAlphaMod(self._tex, &_a_mod) # <<<<<<<<<<<<<<
@@ -11544,7 +11556,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
(void)(SDL_GetTextureAlphaMod(__pyx_v_self->_tex, (&__pyx_v__a_mod)));
- /* "pygame/_sdl2/video.pyx":752
+ /* "pygame/_sdl2/video.pyx":834
* SDL_GetTextureAlphaMod(self._tex, &_a_mod)
*
* cdef float r_mod = float(_r_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -11553,7 +11565,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__pyx_v_r_mod = (((double)__pyx_v__r_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":753
+ /* "pygame/_sdl2/video.pyx":835
*
* cdef float r_mod = float(_r_mod) / 255.0
* cdef float g_mod = float(_g_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -11562,7 +11574,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__pyx_v_g_mod = (((double)__pyx_v__g_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":754
+ /* "pygame/_sdl2/video.pyx":836
* cdef float r_mod = float(_r_mod) / 255.0
* cdef float g_mod = float(_g_mod) / 255.0
* cdef float b_mod = float(_b_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -11571,7 +11583,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__pyx_v_b_mod = (((double)__pyx_v__b_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":755
+ /* "pygame/_sdl2/video.pyx":837
* cdef float g_mod = float(_g_mod) / 255.0
* cdef float b_mod = float(_b_mod) / 255.0
* cdef float a_mod = float(_a_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -11580,7 +11592,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__pyx_v_a_mod = (((double)__pyx_v__a_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":758
+ /* "pygame/_sdl2/video.pyx":840
*
* cdef SDL_Vertex vertices[3]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
@@ -11589,7 +11601,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_2 = __pyx_int_0;
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_p1_xy);
__Pyx_GIVEREF(__pyx_v_p1_xy);
@@ -11601,14 +11613,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_GIVEREF(__pyx_v_p1_uv);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_p1_uv);
- /* "pygame/_sdl2/video.pyx":759
+ /* "pygame/_sdl2/video.pyx":841
* cdef SDL_Vertex vertices[3]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv),
* (p2_xy, p2_mod, p2_uv), # <<<<<<<<<<<<<<
* (p3_xy, p3_mod, p3_uv))):
* xy, mod, uv = vert
*/
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error)
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_p2_xy);
__Pyx_GIVEREF(__pyx_v_p2_xy);
@@ -11620,14 +11632,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_GIVEREF(__pyx_v_p2_uv);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_p2_uv);
- /* "pygame/_sdl2/video.pyx":760
+ /* "pygame/_sdl2/video.pyx":842
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv),
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv))): # <<<<<<<<<<<<<<
* xy, mod, uv = vert
* vertices[i].position.x = xy[0]
*/
- __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 760, __pyx_L1_error)
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 842, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_p3_xy);
__Pyx_GIVEREF(__pyx_v_p3_xy);
@@ -11639,14 +11651,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_GIVEREF(__pyx_v_p3_uv);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_p3_uv);
- /* "pygame/_sdl2/video.pyx":758
+ /* "pygame/_sdl2/video.pyx":840
*
* cdef SDL_Vertex vertices[3]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv))):
*/
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
@@ -11662,22 +11674,22 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
for (;;) {
if (__pyx_t_7 >= 3) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 758, __pyx_L1_error)
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 840, __pyx_L1_error)
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_XDECREF_SET(__pyx_v_vert, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "pygame/_sdl2/video.pyx":761
+ /* "pygame/_sdl2/video.pyx":843
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv))):
* xy, mod, uv = vert # <<<<<<<<<<<<<<
@@ -11690,7 +11702,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- __PYX_ERR(0, 761, __pyx_L1_error)
+ __PYX_ERR(0, 843, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
@@ -11706,16 +11718,16 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
#else
- __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 761, __pyx_L1_error)
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 843, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error)
+ __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error)
+ __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
} else {
Py_ssize_t index = -1;
- __pyx_t_8 = PyObject_GetIter(__pyx_v_vert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 761, __pyx_L1_error)
+ __pyx_t_8 = PyObject_GetIter(__pyx_v_vert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 843, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
@@ -11724,7 +11736,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_GOTREF(__pyx_t_4);
index = 2; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 761, __pyx_L1_error)
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
__pyx_t_9 = NULL;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_unpacking_done;
@@ -11732,7 +11744,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- __PYX_ERR(0, 761, __pyx_L1_error)
+ __PYX_ERR(0, 843, __pyx_L1_error)
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_xy, __pyx_t_6);
@@ -11742,149 +11754,149 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_XDECREF_SET(__pyx_v_uv, __pyx_t_3);
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":762
+ /* "pygame/_sdl2/video.pyx":844
* (p3_xy, p3_mod, p3_uv))):
* xy, mod, uv = vert
* vertices[i].position.x = xy[0] # <<<<<<<<<<<<<<
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_xy, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_xy, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 844, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 844, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).position.x = __pyx_t_10;
- /* "pygame/_sdl2/video.pyx":763
+ /* "pygame/_sdl2/video.pyx":845
* xy, mod, uv = vert
* vertices[i].position.x = xy[0]
* vertices[i].position.y = xy[1] # <<<<<<<<<<<<<<
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_xy, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_xy, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 845, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 845, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).position.y = __pyx_t_10;
- /* "pygame/_sdl2/video.pyx":764
+ /* "pygame/_sdl2/video.pyx":846
* vertices[i].position.x = xy[0]
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0] # <<<<<<<<<<<<<<
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2]
*/
- __pyx_t_3 = PyFloat_FromDouble(__pyx_v_r_mod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_r_mod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 846, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 846, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).color.r = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":765
+ /* "pygame/_sdl2/video.pyx":847
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1] # <<<<<<<<<<<<<<
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
*/
- __pyx_t_6 = PyFloat_FromDouble(__pyx_v_g_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 765, __pyx_L1_error)
+ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_g_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 847, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 847, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error)
+ __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 847, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 765, __pyx_L1_error)
+ __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 765, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).color.g = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":766
+ /* "pygame/_sdl2/video.pyx":848
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2] # <<<<<<<<<<<<<<
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0]
*/
- __pyx_t_3 = PyFloat_FromDouble(__pyx_v_b_mod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L1_error)
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_b_mod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 766, __pyx_L1_error)
+ __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 766, __pyx_L1_error)
+ __pyx_t_12 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_12 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 766, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 848, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).color.b = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":767
+ /* "pygame/_sdl2/video.pyx":849
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod # <<<<<<<<<<<<<<
* vertices[i].tex_coord.x = uv[0]
* vertices[i].tex_coord.y = uv[1]
*/
- __pyx_t_11 = PyObject_Length(__pyx_v_mod); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_11 = PyObject_Length(__pyx_v_mod); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 849, __pyx_L1_error)
if (((__pyx_t_11 > 3) != 0)) {
- __pyx_t_6 = PyFloat_FromDouble(__pyx_v_a_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_a_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_mod, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_13 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_13 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_13 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_12 = __pyx_t_13;
} else {
__pyx_t_12 = __pyx_v__a_mod;
}
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 767, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 849, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).color.a = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":768
+ /* "pygame/_sdl2/video.pyx":850
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0] # <<<<<<<<<<<<<<
* vertices[i].tex_coord.y = uv[1]
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_uv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_uv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error)
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).tex_coord.x = __pyx_t_10;
- /* "pygame/_sdl2/video.pyx":769
+ /* "pygame/_sdl2/video.pyx":851
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0]
* vertices[i].tex_coord.y = uv[1] # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0)
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_uv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_uv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 769, __pyx_L1_error)
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 769, __pyx_L1_error)
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_11]).tex_coord.y = __pyx_t_10;
- /* "pygame/_sdl2/video.pyx":758
+ /* "pygame/_sdl2/video.pyx":840
*
* cdef SDL_Vertex vertices[3]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
@@ -11895,7 +11907,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":771
+ /* "pygame/_sdl2/video.pyx":853
* vertices[i].tex_coord.y = uv[1]
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0) # <<<<<<<<<<<<<<
@@ -11904,7 +11916,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
__pyx_v_res = SDL_RenderGeometry(__pyx_v_self->renderer->_renderer, __pyx_v_self->_tex, __pyx_v_vertices, 3, NULL, 0);
- /* "pygame/_sdl2/video.pyx":772
+ /* "pygame/_sdl2/video.pyx":854
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -11914,14 +11926,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":773
+ /* "pygame/_sdl2/video.pyx":855
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy,
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -11935,14 +11947,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 773, __pyx_L1_error)
+ __PYX_ERR(0, 855, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":772
+ /* "pygame/_sdl2/video.pyx":854
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -11951,7 +11963,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
*/
}
- /* "pygame/_sdl2/video.pyx":730
+ /* "pygame/_sdl2/video.pyx":812
* flip_x, flip_y)
*
* def draw_triangle(self, p1_xy, p2_xy, p3_xy, # <<<<<<<<<<<<<<
@@ -11982,7 +11994,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":775
+/* "pygame/_sdl2/video.pyx":857
* raise error()
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy, # <<<<<<<<<<<<<<
@@ -11992,7 +12004,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12draw_triangle(struct
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_14draw_quad[] = " Copy a quad portion of the texture to the rendering target by vertices coordinates.\n\n :param p1_xy: first vertex coordinate on the render target to be drawn at.\n :param p2_xy: second vertex coordinate on the render target to be drawn at.\n :param p3_xy: third vertex coordinate on the render target to be drawn at.\n :param p4_xy: fourth vertex coordinate on the render target to be drawn at.\n :param p1_uv: first vertex coordinate on the texture to be drawn from.\n :param p2_uv: second vertex coordinate on the texture to be drawn from.\n :param p3_uv: third vertex coordinate on the texture to be drawn from.\n :param p4_uv: fourth vertex coordinate on the texture to be drawn from.\n :param p1_mod: first vertex color modulation.\n :param p2_mod: second vertex color modulation.\n :param p3_mod: third vertex color modulation.\n :param p4_mod: fourth vertex color modulation.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_14draw_quad[] = "Copy a quad portion of the texture to the rendering target using the given coordinates\n\n :param p1_xy: The first vertex coordinate on the rendering target.\n :param p2_xy: The second vertex coordinate on the rendering target.\n :param p3_xy: The third vertex coordinate on the rendering target.\n :param p4_xy: The fourth vertex coordinate on the rendering target.\n :param p1_uv: The first UV coordinate of the quad portion.\n :param p2_uv: The second UV coordinate of the quad portion.\n :param p3_uv: The third UV coordinate of the quad portion.\n :param p4_uv: The fourth UV coordinate of the quad portion.\n :param p1_mod: The first vertex color modulation.\n :param p2_mod: The second vertex color modulation.\n :param p3_mod: The third vertex color modulation.\n :param p4_mod: The fourth vertex color modulation.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_p1_xy = 0;
PyObject *__pyx_v_p2_xy = 0;
@@ -12016,7 +12028,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p1_xy,&__pyx_n_s_p2_xy,&__pyx_n_s_p3_xy,&__pyx_n_s_p4_xy,&__pyx_n_s_p1_uv,&__pyx_n_s_p2_uv,&__pyx_n_s_p3_uv,&__pyx_n_s_p4_uv,&__pyx_n_s_p1_mod,&__pyx_n_s_p2_mod,&__pyx_n_s_p3_mod,&__pyx_n_s_p4_mod,0};
PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
- /* "pygame/_sdl2/video.pyx":776
+ /* "pygame/_sdl2/video.pyx":858
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0), # <<<<<<<<<<<<<<
@@ -12028,21 +12040,21 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
values[6] = ((PyObject *)__pyx_tuple__17);
values[7] = ((PyObject *)__pyx_tuple__18);
- /* "pygame/_sdl2/video.pyx":777
+ /* "pygame/_sdl2/video.pyx":859
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0),
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), # <<<<<<<<<<<<<<
* p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)):
- * """ Copy a quad portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a quad portion of the texture to the rendering target using the given coordinates
*/
values[8] = ((PyObject *)__pyx_tuple__19);
values[9] = ((PyObject *)__pyx_tuple__19);
- /* "pygame/_sdl2/video.pyx":778
+ /* "pygame/_sdl2/video.pyx":860
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0),
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255),
* p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)): # <<<<<<<<<<<<<<
- * """ Copy a quad portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a quad portion of the texture to the rendering target using the given coordinates
*
*/
values[10] = ((PyObject *)__pyx_tuple__19);
@@ -12087,19 +12099,19 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2_xy)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 1); __PYX_ERR(0, 775, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 1); __PYX_ERR(0, 857, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3_xy)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 2); __PYX_ERR(0, 775, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 2); __PYX_ERR(0, 857, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p4_xy)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 3); __PYX_ERR(0, 775, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, 3); __PYX_ERR(0, 857, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
@@ -12151,7 +12163,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_quad") < 0)) __PYX_ERR(0, 775, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_quad") < 0)) __PYX_ERR(0, 857, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -12194,7 +12206,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 775, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 0, 4, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 857, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.draw_quad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -12202,7 +12214,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15draw_quad(PyObject *_
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_p1_xy, __pyx_v_p2_xy, __pyx_v_p3_xy, __pyx_v_p4_xy, __pyx_v_p1_uv, __pyx_v_p2_uv, __pyx_v_p3_uv, __pyx_v_p4_uv, __pyx_v_p1_mod, __pyx_v_p2_mod, __pyx_v_p3_mod, __pyx_v_p4_mod);
- /* "pygame/_sdl2/video.pyx":775
+ /* "pygame/_sdl2/video.pyx":857
* raise error()
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy, # <<<<<<<<<<<<<<
@@ -12253,8 +12265,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_quad", 0);
- /* "pygame/_sdl2/video.pyx":794
- * :param p4_mod: fourth vertex color modulation.
+ /* "pygame/_sdl2/video.pyx":876
+ * :param p4_mod: The fourth vertex color modulation.
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
* raise error("draw_quad requires SDL 2.0.18 or newer")
@@ -12263,14 +12275,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__pyx_t_1 = ((!(SDL_VERSION_ATLEAST(2, 0, 18) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":795
+ /* "pygame/_sdl2/video.pyx":877
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18):
* raise error("draw_quad requires SDL 2.0.18 or newer") # <<<<<<<<<<<<<<
*
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -12284,15 +12296,15 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_draw_quad_requires_SDL_2_0_18_or) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_draw_quad_requires_SDL_2_0_18_or);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 795, __pyx_L1_error)
+ __PYX_ERR(0, 877, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":794
- * :param p4_mod: fourth vertex color modulation.
+ /* "pygame/_sdl2/video.pyx":876
+ * :param p4_mod: The fourth vertex color modulation.
* """
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
* raise error("draw_quad requires SDL 2.0.18 or newer")
@@ -12300,7 +12312,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
}
- /* "pygame/_sdl2/video.pyx":798
+ /* "pygame/_sdl2/video.pyx":880
*
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
* SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod) # <<<<<<<<<<<<<<
@@ -12309,7 +12321,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
(void)(SDL_GetTextureColorMod(__pyx_v_self->_tex, (&__pyx_v__r_mod), (&__pyx_v__g_mod), (&__pyx_v__b_mod)));
- /* "pygame/_sdl2/video.pyx":799
+ /* "pygame/_sdl2/video.pyx":881
* cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
* SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod)
* SDL_GetTextureAlphaMod(self._tex, &_a_mod) # <<<<<<<<<<<<<<
@@ -12318,7 +12330,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
(void)(SDL_GetTextureAlphaMod(__pyx_v_self->_tex, (&__pyx_v__a_mod)));
- /* "pygame/_sdl2/video.pyx":801
+ /* "pygame/_sdl2/video.pyx":883
* SDL_GetTextureAlphaMod(self._tex, &_a_mod)
*
* cdef float r_mod = float(_r_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -12327,7 +12339,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__pyx_v_r_mod = (((double)__pyx_v__r_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":802
+ /* "pygame/_sdl2/video.pyx":884
*
* cdef float r_mod = float(_r_mod) / 255.0
* cdef float g_mod = float(_g_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -12336,7 +12348,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__pyx_v_g_mod = (((double)__pyx_v__g_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":803
+ /* "pygame/_sdl2/video.pyx":885
* cdef float r_mod = float(_r_mod) / 255.0
* cdef float g_mod = float(_g_mod) / 255.0
* cdef float b_mod = float(_b_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -12345,7 +12357,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__pyx_v_b_mod = (((double)__pyx_v__b_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":804
+ /* "pygame/_sdl2/video.pyx":886
* cdef float g_mod = float(_g_mod) / 255.0
* cdef float b_mod = float(_b_mod) / 255.0
* cdef float a_mod = float(_a_mod) / 255.0 # <<<<<<<<<<<<<<
@@ -12354,7 +12366,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__pyx_v_a_mod = (((double)__pyx_v__a_mod) / 255.0);
- /* "pygame/_sdl2/video.pyx":807
+ /* "pygame/_sdl2/video.pyx":889
*
* cdef SDL_Vertex vertices[6]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
@@ -12363,7 +12375,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_2 = __pyx_int_0;
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_p1_xy);
__Pyx_GIVEREF(__pyx_v_p1_xy);
@@ -12375,14 +12387,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p1_uv);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_p1_uv);
- /* "pygame/_sdl2/video.pyx":808
+ /* "pygame/_sdl2/video.pyx":890
* cdef SDL_Vertex vertices[6]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv),
* (p2_xy, p2_mod, p2_uv), # <<<<<<<<<<<<<<
* (p3_xy, p3_mod, p3_uv),
* (p3_xy, p3_mod, p3_uv),
*/
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error)
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_p2_xy);
__Pyx_GIVEREF(__pyx_v_p2_xy);
@@ -12394,14 +12406,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p2_uv);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_p2_uv);
- /* "pygame/_sdl2/video.pyx":809
+ /* "pygame/_sdl2/video.pyx":891
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv),
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv), # <<<<<<<<<<<<<<
* (p3_xy, p3_mod, p3_uv),
* (p4_xy, p4_mod, p4_uv),
*/
- __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 809, __pyx_L1_error)
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 891, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_p3_xy);
__Pyx_GIVEREF(__pyx_v_p3_xy);
@@ -12413,14 +12425,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p3_uv);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_p3_uv);
- /* "pygame/_sdl2/video.pyx":810
+ /* "pygame/_sdl2/video.pyx":892
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv),
* (p3_xy, p3_mod, p3_uv), # <<<<<<<<<<<<<<
* (p4_xy, p4_mod, p4_uv),
* (p1_xy, p1_mod, p1_uv))):
*/
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 810, __pyx_L1_error)
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 892, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_p3_xy);
__Pyx_GIVEREF(__pyx_v_p3_xy);
@@ -12432,14 +12444,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p3_uv);
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_p3_uv);
- /* "pygame/_sdl2/video.pyx":811
+ /* "pygame/_sdl2/video.pyx":893
* (p3_xy, p3_mod, p3_uv),
* (p3_xy, p3_mod, p3_uv),
* (p4_xy, p4_mod, p4_uv), # <<<<<<<<<<<<<<
* (p1_xy, p1_mod, p1_uv))):
* xy, mod, uv = vert
*/
- __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 811, __pyx_L1_error)
+ __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 893, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_p4_xy);
__Pyx_GIVEREF(__pyx_v_p4_xy);
@@ -12451,14 +12463,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p4_uv);
PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_p4_uv);
- /* "pygame/_sdl2/video.pyx":812
+ /* "pygame/_sdl2/video.pyx":894
* (p3_xy, p3_mod, p3_uv),
* (p4_xy, p4_mod, p4_uv),
* (p1_xy, p1_mod, p1_uv))): # <<<<<<<<<<<<<<
* xy, mod, uv = vert
* vertices[i].position.x = xy[0]
*/
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 812, __pyx_L1_error)
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 894, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_p1_xy);
__Pyx_GIVEREF(__pyx_v_p1_xy);
@@ -12470,14 +12482,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GIVEREF(__pyx_v_p1_uv);
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_p1_uv);
- /* "pygame/_sdl2/video.pyx":807
+ /* "pygame/_sdl2/video.pyx":889
*
* cdef SDL_Vertex vertices[6]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
* (p2_xy, p2_mod, p2_uv),
* (p3_xy, p3_mod, p3_uv),
*/
- __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 807, __pyx_L1_error)
+ __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
@@ -12502,22 +12514,22 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
for (;;) {
if (__pyx_t_10 >= 6) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 807, __pyx_L1_error)
+ __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 889, __pyx_L1_error)
#else
- __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 807, __pyx_L1_error)
+ __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
#endif
__Pyx_XDECREF_SET(__pyx_v_vert, __pyx_t_9);
__pyx_t_9 = 0;
__Pyx_INCREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 807, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 889, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_9;
__pyx_t_9 = 0;
- /* "pygame/_sdl2/video.pyx":813
+ /* "pygame/_sdl2/video.pyx":895
* (p4_xy, p4_mod, p4_uv),
* (p1_xy, p1_mod, p1_uv))):
* xy, mod, uv = vert # <<<<<<<<<<<<<<
@@ -12530,7 +12542,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- __PYX_ERR(0, 813, __pyx_L1_error)
+ __PYX_ERR(0, 895, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
@@ -12546,16 +12558,16 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 813, __pyx_L1_error)
+ __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 895, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error)
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 895, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 813, __pyx_L1_error)
+ __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 895, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
} else {
Py_ssize_t index = -1;
- __pyx_t_5 = PyObject_GetIter(__pyx_v_vert); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 813, __pyx_L1_error)
+ __pyx_t_5 = PyObject_GetIter(__pyx_v_vert); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 895, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
@@ -12564,7 +12576,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_GOTREF(__pyx_t_7);
index = 2; __pyx_t_6 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_5), 3) < 0) __PYX_ERR(0, 813, __pyx_L1_error)
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_5), 3) < 0) __PYX_ERR(0, 895, __pyx_L1_error)
__pyx_t_11 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L7_unpacking_done;
@@ -12572,7 +12584,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_11 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- __PYX_ERR(0, 813, __pyx_L1_error)
+ __PYX_ERR(0, 895, __pyx_L1_error)
__pyx_L7_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_xy, __pyx_t_9);
@@ -12582,149 +12594,149 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_XDECREF_SET(__pyx_v_uv, __pyx_t_6);
__pyx_t_6 = 0;
- /* "pygame/_sdl2/video.pyx":814
+ /* "pygame/_sdl2/video.pyx":896
* (p1_xy, p1_mod, p1_uv))):
* xy, mod, uv = vert
* vertices[i].position.x = xy[0] # <<<<<<<<<<<<<<
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0]
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_xy, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_xy, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 896, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 814, __pyx_L1_error)
+ __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 896, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 814, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 896, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).position.x = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":815
+ /* "pygame/_sdl2/video.pyx":897
* xy, mod, uv = vert
* vertices[i].position.x = xy[0]
* vertices[i].position.y = xy[1] # <<<<<<<<<<<<<<
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1]
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_xy, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 815, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_xy, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 897, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error)
+ __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 897, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 897, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).position.y = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":816
+ /* "pygame/_sdl2/video.pyx":898
* vertices[i].position.x = xy[0]
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0] # <<<<<<<<<<<<<<
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2]
*/
- __pyx_t_6 = PyFloat_FromDouble(__pyx_v_r_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 816, __pyx_L1_error)
+ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_r_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 898, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 898, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 816, __pyx_L1_error)
+ __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 898, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_9); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_9); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).color.r = __pyx_t_14;
- /* "pygame/_sdl2/video.pyx":817
+ /* "pygame/_sdl2/video.pyx":899
* vertices[i].position.y = xy[1]
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1] # <<<<<<<<<<<<<<
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
*/
- __pyx_t_9 = PyFloat_FromDouble(__pyx_v_g_mod); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 817, __pyx_L1_error)
+ __pyx_t_9 = PyFloat_FromDouble(__pyx_v_g_mod); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 899, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 817, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 899, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error)
+ __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 899, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).color.g = __pyx_t_14;
- /* "pygame/_sdl2/video.pyx":818
+ /* "pygame/_sdl2/video.pyx":900
* vertices[i].color.r = r_mod * mod[0]
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2] # <<<<<<<<<<<<<<
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0]
*/
- __pyx_t_6 = PyFloat_FromDouble(__pyx_v_b_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 818, __pyx_L1_error)
+ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_b_mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 818, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 818, __pyx_L1_error)
+ __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_9); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L1_error)
+ __pyx_t_14 = __Pyx_PyInt_As_Uint8(__pyx_t_9); if (unlikely((__pyx_t_14 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 900, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 900, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).color.b = __pyx_t_14;
- /* "pygame/_sdl2/video.pyx":819
+ /* "pygame/_sdl2/video.pyx":901
* vertices[i].color.g = g_mod * mod[1]
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod # <<<<<<<<<<<<<<
* vertices[i].tex_coord.x = uv[0]
* vertices[i].tex_coord.y = uv[1]
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_mod); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_13 = PyObject_Length(__pyx_v_mod); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 901, __pyx_L1_error)
if (((__pyx_t_13 > 3) != 0)) {
- __pyx_t_9 = PyFloat_FromDouble(__pyx_v_a_mod); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_9 = PyFloat_FromDouble(__pyx_v_a_mod); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 901, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_mod, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 901, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 901, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_15 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_15 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_15 = __Pyx_PyInt_As_Uint8(__pyx_t_6); if (unlikely((__pyx_t_15 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_14 = __pyx_t_15;
} else {
__pyx_t_14 = __pyx_v__a_mod;
}
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).color.a = __pyx_t_14;
- /* "pygame/_sdl2/video.pyx":820
+ /* "pygame/_sdl2/video.pyx":902
* vertices[i].color.b = b_mod * mod[2]
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0] # <<<<<<<<<<<<<<
* vertices[i].tex_coord.y = uv[1]
*
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_uv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 820, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_uv, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 902, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error)
+ __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).tex_coord.x = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":821
+ /* "pygame/_sdl2/video.pyx":903
* vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
* vertices[i].tex_coord.x = uv[0]
* vertices[i].tex_coord.y = uv[1] # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 6, NULL, 0)
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_uv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 821, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_uv, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 903, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L1_error)
+ __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 903, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L1_error)
+ __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 903, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_13]).tex_coord.y = __pyx_t_12;
- /* "pygame/_sdl2/video.pyx":807
+ /* "pygame/_sdl2/video.pyx":889
*
* cdef SDL_Vertex vertices[6]
* for i, vert in enumerate(((p1_xy, p1_mod, p1_uv), # <<<<<<<<<<<<<<
@@ -12735,7 +12747,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":823
+ /* "pygame/_sdl2/video.pyx":905
* vertices[i].tex_coord.y = uv[1]
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 6, NULL, 0) # <<<<<<<<<<<<<<
@@ -12744,7 +12756,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
__pyx_v_res = SDL_RenderGeometry(__pyx_v_self->renderer->_renderer, __pyx_v_self->_tex, __pyx_v_vertices, 6, NULL, 0);
- /* "pygame/_sdl2/video.pyx":824
+ /* "pygame/_sdl2/video.pyx":906
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 6, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -12754,14 +12766,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":825
+ /* "pygame/_sdl2/video.pyx":907
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 6, NULL, 0)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def update(self, surface, area=None):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 825, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 907, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
@@ -12775,14 +12787,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 825, __pyx_L1_error)
+ __PYX_ERR(0, 907, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":824
+ /* "pygame/_sdl2/video.pyx":906
*
* cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 6, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -12791,7 +12803,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
*/
}
- /* "pygame/_sdl2/video.pyx":775
+ /* "pygame/_sdl2/video.pyx":857
* raise error()
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy, # <<<<<<<<<<<<<<
@@ -12824,7 +12836,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":827
+/* "pygame/_sdl2/video.pyx":909
* raise error()
*
* def update(self, surface, area=None): # <<<<<<<<<<<<<<
@@ -12834,7 +12846,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14draw_quad(struct __py
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_16update[] = " Update the texture with Surface.\n This is a fairly slow function, intended for use with static textures that do not change often.\n\n If the texture is intended to be updated often,\n it is preferred to create the texture as streaming and use the locking functions.\n\n While this function will work with streaming textures,\n for optimization reasons you may not get the pixels back if you lock the texture afterward.\n\n :param surface: source Surface.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_16update[] = "Update the texture with Surface (slow operation, use sparingly)\n\n :param Surface surface: The source surface.\n :param area: The rectangular area of the texture to update.\n\n .. note::\n This is a fairly slow function, intended for use with static textures\n that do not change often.\n\n If the texture is intended to be updated often, it is preferred to create\n the texture as streaming and use the locking functions.\n\n While this function will work with streaming textures, for optimization\n reasons you may not get the pixels back if you lock the texture afterward.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_surface = 0;
PyObject *__pyx_v_area = 0;
@@ -12872,7 +12884,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17update(PyObject *__py
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update") < 0)) __PYX_ERR(0, 827, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update") < 0)) __PYX_ERR(0, 909, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -12888,7 +12900,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17update(PyObject *__py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("update", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 827, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("update", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 909, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Texture.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -12923,7 +12935,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("update", 0);
- /* "pygame/_sdl2/video.pyx":842
+ /* "pygame/_sdl2/video.pyx":928
* """
*
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -12933,20 +12945,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":843
+ /* "pygame/_sdl2/video.pyx":929
*
* if not pgSurface_Check(surface):
* raise TypeError("update source should be a Surface.") # <<<<<<<<<<<<<<
*
* cdef SDL_Rect rect
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 843, __pyx_L1_error)
+ __PYX_ERR(0, 929, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":842
+ /* "pygame/_sdl2/video.pyx":928
* """
*
* if not pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -12955,7 +12967,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":846
+ /* "pygame/_sdl2/video.pyx":932
*
* cdef SDL_Rect rect
* cdef SDL_Rect *rectptr = pgRect_FromObject(area, &rect) # <<<<<<<<<<<<<<
@@ -12964,7 +12976,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_rect));
- /* "pygame/_sdl2/video.pyx":847
+ /* "pygame/_sdl2/video.pyx":933
* cdef SDL_Rect rect
* cdef SDL_Rect *rectptr = pgRect_FromObject(area, &rect)
* cdef SDL_Surface *surf = pgSurface_AsSurface(surface) # <<<<<<<<<<<<<<
@@ -12973,7 +12985,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_surf = pgSurface_AsSurface(__pyx_v_surface);
- /* "pygame/_sdl2/video.pyx":850
+ /* "pygame/_sdl2/video.pyx":936
*
* # For converting the surface, if needed
* cdef SDL_Surface *converted_surf = NULL # <<<<<<<<<<<<<<
@@ -12982,7 +12994,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_converted_surf = NULL;
- /* "pygame/_sdl2/video.pyx":851
+ /* "pygame/_sdl2/video.pyx":937
* # For converting the surface, if needed
* cdef SDL_Surface *converted_surf = NULL
* cdef SDL_PixelFormat *pixel_format = NULL # <<<<<<<<<<<<<<
@@ -12991,7 +13003,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_pixel_format = NULL;
- /* "pygame/_sdl2/video.pyx":854
+ /* "pygame/_sdl2/video.pyx":940
* cdef SDL_BlendMode blend
*
* if rectptr == NULL and area is not None: # <<<<<<<<<<<<<<
@@ -13010,20 +13022,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_L5_bool_binop_done:;
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":855
+ /* "pygame/_sdl2/video.pyx":941
*
* if rectptr == NULL and area is not None:
* raise TypeError('area must be a rectangle or None') # <<<<<<<<<<<<<<
*
* cdef Uint32 format_
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 855, __pyx_L1_error)
+ __PYX_ERR(0, 941, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":854
+ /* "pygame/_sdl2/video.pyx":940
* cdef SDL_BlendMode blend
*
* if rectptr == NULL and area is not None: # <<<<<<<<<<<<<<
@@ -13032,7 +13044,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":858
+ /* "pygame/_sdl2/video.pyx":944
*
* cdef Uint32 format_
* if (SDL_QueryTexture(self._tex, &format_, NULL, NULL, NULL) != 0): # <<<<<<<<<<<<<<
@@ -13042,14 +13054,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((SDL_QueryTexture(__pyx_v_self->_tex, (&__pyx_v_format_), NULL, NULL, NULL) != 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":859
+ /* "pygame/_sdl2/video.pyx":945
* cdef Uint32 format_
* if (SDL_QueryTexture(self._tex, &format_, NULL, NULL, NULL) != 0):
* raise error() # <<<<<<<<<<<<<<
*
* cdef int res
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 859, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -13063,14 +13075,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 859, __pyx_L1_error)
+ __PYX_ERR(0, 945, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":858
+ /* "pygame/_sdl2/video.pyx":944
*
* cdef Uint32 format_
* if (SDL_QueryTexture(self._tex, &format_, NULL, NULL, NULL) != 0): # <<<<<<<<<<<<<<
@@ -13079,7 +13091,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":862
+ /* "pygame/_sdl2/video.pyx":948
*
* cdef int res
* if format_ != surf.format.format: # <<<<<<<<<<<<<<
@@ -13089,7 +13101,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((__pyx_v_format_ != __pyx_v_surf->format->format) != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":863
+ /* "pygame/_sdl2/video.pyx":949
* cdef int res
* if format_ != surf.format.format:
* if (SDL_GetSurfaceBlendMode(surf, &blend) != 0): # <<<<<<<<<<<<<<
@@ -13099,14 +13111,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((SDL_GetSurfaceBlendMode(__pyx_v_surf, (&__pyx_v_blend)) != 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":864
+ /* "pygame/_sdl2/video.pyx":950
* if format_ != surf.format.format:
* if (SDL_GetSurfaceBlendMode(surf, &blend) != 0):
* raise error() # <<<<<<<<<<<<<<
*
* pixel_format = SDL_AllocFormat(format_)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -13120,14 +13132,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 864, __pyx_L1_error)
+ __PYX_ERR(0, 950, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":863
+ /* "pygame/_sdl2/video.pyx":949
* cdef int res
* if format_ != surf.format.format:
* if (SDL_GetSurfaceBlendMode(surf, &blend) != 0): # <<<<<<<<<<<<<<
@@ -13136,7 +13148,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":866
+ /* "pygame/_sdl2/video.pyx":952
* raise error()
*
* pixel_format = SDL_AllocFormat(format_) # <<<<<<<<<<<<<<
@@ -13145,7 +13157,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_pixel_format = SDL_AllocFormat(__pyx_v_format_);
- /* "pygame/_sdl2/video.pyx":867
+ /* "pygame/_sdl2/video.pyx":953
*
* pixel_format = SDL_AllocFormat(format_)
* if (pixel_format == NULL): # <<<<<<<<<<<<<<
@@ -13155,14 +13167,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((__pyx_v_pixel_format == NULL) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":868
+ /* "pygame/_sdl2/video.pyx":954
* pixel_format = SDL_AllocFormat(format_)
* if (pixel_format == NULL):
* raise error() # <<<<<<<<<<<<<<
*
* converted_surf = SDL_ConvertSurface(surf, pixel_format, 0)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 868, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -13176,14 +13188,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 868, __pyx_L1_error)
+ __PYX_ERR(0, 954, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":867
+ /* "pygame/_sdl2/video.pyx":953
*
* pixel_format = SDL_AllocFormat(format_)
* if (pixel_format == NULL): # <<<<<<<<<<<<<<
@@ -13192,7 +13204,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":870
+ /* "pygame/_sdl2/video.pyx":956
* raise error()
*
* converted_surf = SDL_ConvertSurface(surf, pixel_format, 0) # <<<<<<<<<<<<<<
@@ -13201,7 +13213,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_converted_surf = SDL_ConvertSurface(__pyx_v_surf, __pyx_v_pixel_format, 0);
- /* "pygame/_sdl2/video.pyx":871
+ /* "pygame/_sdl2/video.pyx":957
*
* converted_surf = SDL_ConvertSurface(surf, pixel_format, 0)
* if (SDL_SetSurfaceBlendMode(converted_surf, blend) != 0): # <<<<<<<<<<<<<<
@@ -13211,7 +13223,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((SDL_SetSurfaceBlendMode(__pyx_v_converted_surf, __pyx_v_blend) != 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":872
+ /* "pygame/_sdl2/video.pyx":958
* converted_surf = SDL_ConvertSurface(surf, pixel_format, 0)
* if (SDL_SetSurfaceBlendMode(converted_surf, blend) != 0):
* SDL_FreeSurface(converted_surf) # <<<<<<<<<<<<<<
@@ -13220,7 +13232,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
SDL_FreeSurface(__pyx_v_converted_surf);
- /* "pygame/_sdl2/video.pyx":873
+ /* "pygame/_sdl2/video.pyx":959
* if (SDL_SetSurfaceBlendMode(converted_surf, blend) != 0):
* SDL_FreeSurface(converted_surf)
* SDL_FreeFormat(pixel_format) # <<<<<<<<<<<<<<
@@ -13229,14 +13241,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
SDL_FreeFormat(__pyx_v_pixel_format);
- /* "pygame/_sdl2/video.pyx":874
+ /* "pygame/_sdl2/video.pyx":960
* SDL_FreeSurface(converted_surf)
* SDL_FreeFormat(pixel_format)
* raise error() # <<<<<<<<<<<<<<
*
* res = SDL_UpdateTexture(self._tex, rectptr, converted_surf.pixels, converted_surf.pitch)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 874, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -13250,14 +13262,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 874, __pyx_L1_error)
+ __PYX_ERR(0, 960, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":871
+ /* "pygame/_sdl2/video.pyx":957
*
* converted_surf = SDL_ConvertSurface(surf, pixel_format, 0)
* if (SDL_SetSurfaceBlendMode(converted_surf, blend) != 0): # <<<<<<<<<<<<<<
@@ -13266,7 +13278,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":876
+ /* "pygame/_sdl2/video.pyx":962
* raise error()
*
* res = SDL_UpdateTexture(self._tex, rectptr, converted_surf.pixels, converted_surf.pitch) # <<<<<<<<<<<<<<
@@ -13275,7 +13287,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
__pyx_v_res = SDL_UpdateTexture(__pyx_v_self->_tex, __pyx_v_rectptr, __pyx_v_converted_surf->pixels, __pyx_v_converted_surf->pitch);
- /* "pygame/_sdl2/video.pyx":877
+ /* "pygame/_sdl2/video.pyx":963
*
* res = SDL_UpdateTexture(self._tex, rectptr, converted_surf.pixels, converted_surf.pitch)
* SDL_FreeSurface(converted_surf) # <<<<<<<<<<<<<<
@@ -13284,7 +13296,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
SDL_FreeSurface(__pyx_v_converted_surf);
- /* "pygame/_sdl2/video.pyx":878
+ /* "pygame/_sdl2/video.pyx":964
* res = SDL_UpdateTexture(self._tex, rectptr, converted_surf.pixels, converted_surf.pitch)
* SDL_FreeSurface(converted_surf)
* SDL_FreeFormat(pixel_format) # <<<<<<<<<<<<<<
@@ -13293,7 +13305,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
SDL_FreeFormat(__pyx_v_pixel_format);
- /* "pygame/_sdl2/video.pyx":862
+ /* "pygame/_sdl2/video.pyx":948
*
* cdef int res
* if format_ != surf.format.format: # <<<<<<<<<<<<<<
@@ -13303,7 +13315,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
goto __pyx_L8;
}
- /* "pygame/_sdl2/video.pyx":880
+ /* "pygame/_sdl2/video.pyx":966
* SDL_FreeFormat(pixel_format)
* else:
* res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch) # <<<<<<<<<<<<<<
@@ -13315,7 +13327,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_L8:;
- /* "pygame/_sdl2/video.pyx":882
+ /* "pygame/_sdl2/video.pyx":968
* res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
*
* if res < 0: # <<<<<<<<<<<<<<
@@ -13325,14 +13337,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":883
+ /* "pygame/_sdl2/video.pyx":969
*
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* cdef class Image:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 883, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 969, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -13346,14 +13358,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
}
__pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 883, __pyx_L1_error)
+ __PYX_ERR(0, 969, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":882
+ /* "pygame/_sdl2/video.pyx":968
* res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
*
* if res < 0: # <<<<<<<<<<<<<<
@@ -13362,7 +13374,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":827
+ /* "pygame/_sdl2/video.pyx":909
* raise error()
*
* def update(self, surface, area=None): # <<<<<<<<<<<<<<
@@ -13385,7 +13397,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16update(struct __pyx_o
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":529
+/* "pygame/_sdl2/video.pxd":535
* cdef SDL_Texture* _tex
* cdef Color _color
* cdef readonly Renderer renderer # <<<<<<<<<<<<<<
@@ -13422,7 +13434,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8renderer___get__(struc
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":530
+/* "pygame/_sdl2/video.pxd":536
* cdef Color _color
* cdef readonly Renderer renderer
* cdef readonly int width # <<<<<<<<<<<<<<
@@ -13452,7 +13464,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 530, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 536, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -13469,7 +13481,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(struct _
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":531
+/* "pygame/_sdl2/video.pxd":537
* cdef readonly Renderer renderer
* cdef readonly int width
* cdef readonly int height # <<<<<<<<<<<<<<
@@ -13499,7 +13511,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 531, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 537, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -13629,7 +13641,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_20__setstate_cython__(C
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":887
+/* "pygame/_sdl2/video.pyx":973
* cdef class Image:
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -13664,7 +13676,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "pygame/_sdl2/video.pyx":888
+ /* "pygame/_sdl2/video.pyx":974
*
* def __cinit__(self):
* self.angle = 0 # <<<<<<<<<<<<<<
@@ -13673,7 +13685,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->angle = 0.0;
- /* "pygame/_sdl2/video.pyx":889
+ /* "pygame/_sdl2/video.pyx":975
* def __cinit__(self):
* self.angle = 0
* self._origin.x = 0 # <<<<<<<<<<<<<<
@@ -13682,7 +13694,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->_origin.x = 0;
- /* "pygame/_sdl2/video.pyx":890
+ /* "pygame/_sdl2/video.pyx":976
* self.angle = 0
* self._origin.x = 0
* self._origin.y = 0 # <<<<<<<<<<<<<<
@@ -13691,7 +13703,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->_origin.y = 0;
- /* "pygame/_sdl2/video.pyx":891
+ /* "pygame/_sdl2/video.pyx":977
* self._origin.x = 0
* self._origin.y = 0
* self._originptr = NULL # <<<<<<<<<<<<<<
@@ -13700,7 +13712,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->_originptr = NULL;
- /* "pygame/_sdl2/video.pyx":892
+ /* "pygame/_sdl2/video.pyx":978
* self._origin.y = 0
* self._originptr = NULL
* self.flip_x = False # <<<<<<<<<<<<<<
@@ -13709,7 +13721,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->flip_x = 0;
- /* "pygame/_sdl2/video.pyx":893
+ /* "pygame/_sdl2/video.pyx":979
* self._originptr = NULL
* self.flip_x = False
* self.flip_y = False # <<<<<<<<<<<<<<
@@ -13718,7 +13730,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
*/
__pyx_v_self->flip_y = 0;
- /* "pygame/_sdl2/video.pyx":895
+ /* "pygame/_sdl2/video.pyx":981
* self.flip_y = False
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255] # <<<<<<<<<<<<<<
@@ -13731,32 +13743,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
__pyx_t_1[3] = 0xFF;
memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_1, sizeof(__pyx_v_defaultColor[0]) * (4));
- /* "pygame/_sdl2/video.pyx":896
+ /* "pygame/_sdl2/video.pyx":982
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._color = pgColor_NewLength(defaultColor, 3) # <<<<<<<<<<<<<<
* self.alpha = 255
*
*/
- __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
+ __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 982, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 896, __pyx_L1_error)
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 982, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_v_self->_color);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_color));
__pyx_v_self->_color = ((pgColorObject *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":897
+ /* "pygame/_sdl2/video.pyx":983
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._color = pgColor_NewLength(defaultColor, 3)
* self.alpha = 255 # <<<<<<<<<<<<<<
*
- * def __init__(self, textureOrImage, srcrect=None):
+ * def __init__(self, texture_or_image, srcrect=None):
*/
__pyx_v_self->alpha = 255.0;
- /* "pygame/_sdl2/video.pyx":887
+ /* "pygame/_sdl2/video.pyx":973
* cdef class Image:
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -13776,18 +13788,22 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pyg
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":899
+/* "pygame/_sdl2/video.pyx":985
* self.alpha = 255
*
- * def __init__(self, textureOrImage, srcrect=None): # <<<<<<<<<<<<<<
- * cdef SDL_Rect temp
- * cdef SDL_Rect *rectptr
+ * def __init__(self, texture_or_image, srcrect=None): # <<<<<<<<<<<<<<
+ * """pygame object that represents a portion of a texture
+ *
*/
/* Python wrapper */
static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_5Image_2__init__[] = "pygame object that represents a portion of a texture\n\n Creates an Image.\n\n :param Texture | Image texture_or_image: The Texture or an existing Image\n object to create the Image from.\n :param srcrect: The rectangular portion of the Texture or Image object\n passed to ``texture_or_image``.\n\n An :class:`Image` object represents a portion of a :class:`Texture`. Specifically,\n they can be used to store and manipulate arguments for :meth:`Texture.draw`\n in a more user-friendly way.\n ";
+#if CYTHON_UPDATE_DESCRIPTOR_DOC
+struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_5Image_2__init__;
+#endif
static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_textureOrImage = 0;
+ PyObject *__pyx_v_texture_or_image = 0;
PyObject *__pyx_v_srcrect = 0;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -13796,7 +13812,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_textureOrImage,&__pyx_n_s_srcrect,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_texture_or_image,&__pyx_n_s_srcrect,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
@@ -13813,7 +13829,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_sel
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_textureOrImage)) != 0)) kw_args--;
+ if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_texture_or_image)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
@@ -13823,7 +13839,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_sel
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 899, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 985, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -13834,25 +13850,25 @@ static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_sel
default: goto __pyx_L5_argtuple_error;
}
}
- __pyx_v_textureOrImage = values[0];
+ __pyx_v_texture_or_image = values[0];
__pyx_v_srcrect = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 899, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 985, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Image.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), __pyx_v_textureOrImage, __pyx_v_srcrect);
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), __pyx_v_texture_or_image, __pyx_v_srcrect);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_textureOrImage, PyObject *__pyx_v_srcrect) {
+static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_texture_or_image, PyObject *__pyx_v_srcrect) {
SDL_Rect __pyx_v_temp;
SDL_Rect *__pyx_v_rectptr;
int __pyx_r;
@@ -13869,72 +13885,72 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "pygame/_sdl2/video.pyx":903
+ /* "pygame/_sdl2/video.pyx":1002
* cdef SDL_Rect *rectptr
*
- * if isinstance(textureOrImage, Image): # <<<<<<<<<<<<<<
- * self.texture = textureOrImage.texture
- * self.srcrect = pgRect_New(&(textureOrImage.srcrect).r)
+ * if isinstance(texture_or_image, Image): # <<<<<<<<<<<<<<
+ * self.texture = texture_or_image.texture
+ * self.srcrect = pgRect_New(&(texture_or_image.srcrect).r)
*/
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_textureOrImage, __pyx_ptype_6pygame_5_sdl2_5video_Image);
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_texture_or_image, __pyx_ptype_6pygame_5_sdl2_5video_Image);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":904
+ /* "pygame/_sdl2/video.pyx":1003
*
- * if isinstance(textureOrImage, Image):
- * self.texture = textureOrImage.texture # <<<<<<<<<<<<<<
- * self.srcrect = pgRect_New(&(textureOrImage.srcrect).r)
+ * if isinstance(texture_or_image, Image):
+ * self.texture = texture_or_image.texture # <<<<<<<<<<<<<<
+ * self.srcrect = pgRect_New(&(texture_or_image.srcrect).r)
* else:
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_texture_or_image, __pyx_n_s_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 904, __pyx_L1_error)
+ if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 1003, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_v_self->texture);
__Pyx_DECREF(((PyObject *)__pyx_v_self->texture));
__pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":905
- * if isinstance(textureOrImage, Image):
- * self.texture = textureOrImage.texture
- * self.srcrect = pgRect_New(&(textureOrImage.srcrect).r) # <<<<<<<<<<<<<<
+ /* "pygame/_sdl2/video.pyx":1004
+ * if isinstance(texture_or_image, Image):
+ * self.texture = texture_or_image.texture
+ * self.srcrect = pgRect_New(&(texture_or_image.srcrect).r) # <<<<<<<<<<<<<<
* else:
- * self.texture = textureOrImage
+ * self.texture = texture_or_image
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_srcrect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_texture_or_image, __pyx_n_s_srcrect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = pgRect_New((&((pgRectObject *)__pyx_t_3)->r)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 905, __pyx_L1_error)
+ __pyx_t_4 = pgRect_New((&((pgRectObject *)__pyx_t_3)->r)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 905, __pyx_L1_error)
+ if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 1004, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->srcrect);
__Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
__pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":903
+ /* "pygame/_sdl2/video.pyx":1002
* cdef SDL_Rect *rectptr
*
- * if isinstance(textureOrImage, Image): # <<<<<<<<<<<<<<
- * self.texture = textureOrImage.texture
- * self.srcrect = pgRect_New(&(textureOrImage.srcrect).r)
+ * if isinstance(texture_or_image, Image): # <<<<<<<<<<<<<<
+ * self.texture = texture_or_image.texture
+ * self.srcrect = pgRect_New(&(texture_or_image.srcrect).r)
*/
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":907
- * self.srcrect = pgRect_New(&(textureOrImage.srcrect).r)
+ /* "pygame/_sdl2/video.pyx":1006
+ * self.srcrect = pgRect_New(&(texture_or_image.srcrect).r)
* else:
- * self.texture = textureOrImage # <<<<<<<<<<<<<<
- * self.srcrect = textureOrImage.get_rect()
- * self.blend_mode = textureOrImage.blend_mode
+ * self.texture = texture_or_image # <<<<<<<<<<<<<<
+ * self.srcrect = texture_or_image.get_rect()
+ * self.blend_mode = texture_or_image.blend_mode
*/
/*else*/ {
- if (!(likely(((__pyx_v_textureOrImage) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_textureOrImage, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 907, __pyx_L1_error)
- __pyx_t_4 = __pyx_v_textureOrImage;
+ if (!(likely(((__pyx_v_texture_or_image) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_texture_or_image, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 1006, __pyx_L1_error)
+ __pyx_t_4 = __pyx_v_texture_or_image;
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->texture);
@@ -13942,14 +13958,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":908
+ /* "pygame/_sdl2/video.pyx":1007
* else:
- * self.texture = textureOrImage
- * self.srcrect = textureOrImage.get_rect() # <<<<<<<<<<<<<<
- * self.blend_mode = textureOrImage.blend_mode
+ * self.texture = texture_or_image
+ * self.srcrect = texture_or_image.get_rect() # <<<<<<<<<<<<<<
+ * self.blend_mode = texture_or_image.blend_mode
*
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_get_rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_texture_or_image, __pyx_n_s_get_rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1007, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
@@ -13963,10 +13979,10 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
}
__pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 908, __pyx_L1_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 908, __pyx_L1_error)
+ if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 1007, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->srcrect);
__Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
@@ -13975,21 +13991,21 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":909
- * self.texture = textureOrImage
- * self.srcrect = textureOrImage.get_rect()
- * self.blend_mode = textureOrImage.blend_mode # <<<<<<<<<<<<<<
+ /* "pygame/_sdl2/video.pyx":1008
+ * self.texture = texture_or_image
+ * self.srcrect = texture_or_image.get_rect()
+ * self.blend_mode = texture_or_image.blend_mode # <<<<<<<<<<<<<<
*
* if srcrect is not None:
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_blend_mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_texture_or_image, __pyx_n_s_blend_mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1008, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 909, __pyx_L1_error)
+ __pyx_t_6 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_self->blend_mode = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":911
- * self.blend_mode = textureOrImage.blend_mode
+ /* "pygame/_sdl2/video.pyx":1010
+ * self.blend_mode = texture_or_image.blend_mode
*
* if srcrect is not None: # <<<<<<<<<<<<<<
* rectptr = pgRect_FromObject(srcrect, &temp)
@@ -13999,7 +14015,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":912
+ /* "pygame/_sdl2/video.pyx":1011
*
* if srcrect is not None:
* rectptr = pgRect_FromObject(srcrect, &temp) # <<<<<<<<<<<<<<
@@ -14008,7 +14024,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
*/
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_temp));
- /* "pygame/_sdl2/video.pyx":913
+ /* "pygame/_sdl2/video.pyx":1012
* if srcrect is not None:
* rectptr = pgRect_FromObject(srcrect, &temp)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -14018,20 +14034,20 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":914
+ /* "pygame/_sdl2/video.pyx":1013
* rectptr = pgRect_FromObject(srcrect, &temp)
* if rectptr == NULL:
* raise TypeError('srcrect must be None or a rectangle') # <<<<<<<<<<<<<<
* temp.x = rectptr.x
* temp.y = rectptr.y
*/
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __PYX_ERR(0, 914, __pyx_L1_error)
+ __PYX_ERR(0, 1013, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":913
+ /* "pygame/_sdl2/video.pyx":1012
* if srcrect is not None:
* rectptr = pgRect_FromObject(srcrect, &temp)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -14040,7 +14056,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
*/
}
- /* "pygame/_sdl2/video.pyx":915
+ /* "pygame/_sdl2/video.pyx":1014
* if rectptr == NULL:
* raise TypeError('srcrect must be None or a rectangle')
* temp.x = rectptr.x # <<<<<<<<<<<<<<
@@ -14050,7 +14066,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_7 = __pyx_v_rectptr->x;
__pyx_v_temp.x = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":916
+ /* "pygame/_sdl2/video.pyx":1015
* raise TypeError('srcrect must be None or a rectangle')
* temp.x = rectptr.x
* temp.y = rectptr.y # <<<<<<<<<<<<<<
@@ -14060,7 +14076,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_7 = __pyx_v_rectptr->y;
__pyx_v_temp.y = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":917
+ /* "pygame/_sdl2/video.pyx":1016
* temp.x = rectptr.x
* temp.y = rectptr.y
* temp.w = rectptr.w # <<<<<<<<<<<<<<
@@ -14070,7 +14086,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_7 = __pyx_v_rectptr->w;
__pyx_v_temp.w = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":918
+ /* "pygame/_sdl2/video.pyx":1017
* temp.y = rectptr.y
* temp.w = rectptr.w
* temp.h = rectptr.h # <<<<<<<<<<<<<<
@@ -14080,7 +14096,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
__pyx_t_7 = __pyx_v_rectptr->h;
__pyx_v_temp.h = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":920
+ /* "pygame/_sdl2/video.pyx":1019
* temp.h = rectptr.h
*
* if temp.x < 0 or temp.y < 0 or \ # <<<<<<<<<<<<<<
@@ -14100,7 +14116,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
goto __pyx_L7_bool_binop_done;
}
- /* "pygame/_sdl2/video.pyx":921
+ /* "pygame/_sdl2/video.pyx":1020
*
* if temp.x < 0 or temp.y < 0 or \
* temp.w < 0 or temp.h < 0 or \ # <<<<<<<<<<<<<<
@@ -14120,21 +14136,21 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
goto __pyx_L7_bool_binop_done;
}
- /* "pygame/_sdl2/video.pyx":922
+ /* "pygame/_sdl2/video.pyx":1021
* if temp.x < 0 or temp.y < 0 or \
* temp.w < 0 or temp.h < 0 or \
* temp.x + temp.w > self.srcrect.w or \ # <<<<<<<<<<<<<<
* temp.y + temp.h > self.srcrect.h:
* raise ValueError('rect values are out of range')
*/
- __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_temp.x + __pyx_v_temp.w)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_temp.x + __pyx_v_temp.w)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 922, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 922, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1021, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!__pyx_t_2) {
} else {
@@ -14142,26 +14158,26 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
goto __pyx_L7_bool_binop_done;
}
- /* "pygame/_sdl2/video.pyx":923
+ /* "pygame/_sdl2/video.pyx":1022
* temp.w < 0 or temp.h < 0 or \
* temp.x + temp.w > self.srcrect.w or \
* temp.y + temp.h > self.srcrect.h: # <<<<<<<<<<<<<<
* raise ValueError('rect values are out of range')
* temp.x += self.srcrect.x
*/
- __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_temp.y + __pyx_v_temp.h)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_temp.y + __pyx_v_temp.h)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1022, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1022, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error)
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1022, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_2;
__pyx_L7_bool_binop_done:;
- /* "pygame/_sdl2/video.pyx":920
+ /* "pygame/_sdl2/video.pyx":1019
* temp.h = rectptr.h
*
* if temp.x < 0 or temp.y < 0 or \ # <<<<<<<<<<<<<<
@@ -14170,20 +14186,20 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
*/
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":924
+ /* "pygame/_sdl2/video.pyx":1023
* temp.x + temp.w > self.srcrect.w or \
* temp.y + temp.h > self.srcrect.h:
* raise ValueError('rect values are out of range') # <<<<<<<<<<<<<<
* temp.x += self.srcrect.x
* temp.y += self.srcrect.y
*/
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1023, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __PYX_ERR(0, 924, __pyx_L1_error)
+ __PYX_ERR(0, 1023, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":920
+ /* "pygame/_sdl2/video.pyx":1019
* temp.h = rectptr.h
*
* if temp.x < 0 or temp.y < 0 or \ # <<<<<<<<<<<<<<
@@ -14192,62 +14208,62 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
*/
}
- /* "pygame/_sdl2/video.pyx":925
+ /* "pygame/_sdl2/video.pyx":1024
* temp.y + temp.h > self.srcrect.h:
* raise ValueError('rect values are out of range')
* temp.x += self.srcrect.x # <<<<<<<<<<<<<<
* temp.y += self.srcrect.y
* self.srcrect = pgRect_New(&temp)
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_temp.x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_temp.x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
+ __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_temp.x = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":926
+ /* "pygame/_sdl2/video.pyx":1025
* raise ValueError('rect values are out of range')
* temp.x += self.srcrect.x
* temp.y += self.srcrect.y # <<<<<<<<<<<<<<
* self.srcrect = pgRect_New(&temp)
*
*/
- __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_temp.y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 926, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_temp.y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1025, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 926, __pyx_L1_error)
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1025, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1025, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_temp.y = __pyx_t_7;
- /* "pygame/_sdl2/video.pyx":927
+ /* "pygame/_sdl2/video.pyx":1026
* temp.x += self.srcrect.x
* temp.y += self.srcrect.y
* self.srcrect = pgRect_New(&temp) # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_t_4 = pgRect_New((&__pyx_v_temp)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 927, __pyx_L1_error)
+ __pyx_t_4 = pgRect_New((&__pyx_v_temp)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1026, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 927, __pyx_L1_error)
+ if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 1026, __pyx_L1_error)
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->srcrect);
__Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
__pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":911
- * self.blend_mode = textureOrImage.blend_mode
+ /* "pygame/_sdl2/video.pyx":1010
+ * self.blend_mode = texture_or_image.blend_mode
*
* if srcrect is not None: # <<<<<<<<<<<<<<
* rectptr = pgRect_FromObject(srcrect, &temp)
@@ -14255,12 +14271,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
*/
}
- /* "pygame/_sdl2/video.pyx":899
+ /* "pygame/_sdl2/video.pyx":985
* self.alpha = 255
*
- * def __init__(self, textureOrImage, srcrect=None): # <<<<<<<<<<<<<<
- * cdef SDL_Rect temp
- * cdef SDL_Rect *rectptr
+ * def __init__(self, texture_or_image, srcrect=None): # <<<<<<<<<<<<<<
+ * """pygame object that represents a portion of a texture
+ *
*/
/* function exit code */
@@ -14277,12 +14293,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pyg
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":930
+/* "pygame/_sdl2/video.pyx":1029
*
* @property
* def color(self): # <<<<<<<<<<<<<<
- * return self._color
- *
+ * """Gets or sets the Image color modifier
+ * """
*/
/* Python wrapper */
@@ -14303,9 +14319,9 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":931
- * @property
- * def color(self):
+ /* "pygame/_sdl2/video.pyx":1032
+ * """Gets or sets the Image color modifier
+ * """
* return self._color # <<<<<<<<<<<<<<
*
* @color.setter
@@ -14315,12 +14331,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __p
__pyx_r = ((PyObject *)__pyx_v_self->_color);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":930
+ /* "pygame/_sdl2/video.pyx":1029
*
* @property
* def color(self): # <<<<<<<<<<<<<<
- * return self._color
- *
+ * """Gets or sets the Image color modifier
+ * """
*/
/* function exit code */
@@ -14330,7 +14346,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":934
+/* "pygame/_sdl2/video.pyx":1035
*
* @color.setter
* def color(self, new_color): # <<<<<<<<<<<<<<
@@ -14360,19 +14376,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":935
+ /* "pygame/_sdl2/video.pyx":1036
* @color.setter
* def color(self, new_color):
* self._color[:3] = new_color[:3] # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_new_color, 0, 3, NULL, NULL, &__pyx_slice__27, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_new_color, 0, 3, NULL, NULL, &__pyx_slice__27, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_color), __pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__27, 0, 1, 1) < 0) __PYX_ERR(0, 935, __pyx_L1_error)
+ if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_color), __pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__27, 0, 1, 1) < 0) __PYX_ERR(0, 1036, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":934
+ /* "pygame/_sdl2/video.pyx":1035
*
* @color.setter
* def color(self, new_color): # <<<<<<<<<<<<<<
@@ -14392,12 +14408,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":938
+/* "pygame/_sdl2/video.pyx":1039
*
* @property
* def origin(self): # <<<<<<<<<<<<<<
- * if self._originptr == NULL:
- * return None
+ * """Get or set the Image's origin of rotation
+ *
*/
/* Python wrapper */
@@ -14425,9 +14441,9 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":939
- * @property
- * def origin(self):
+ /* "pygame/_sdl2/video.pyx":1047
+ * its center.
+ * """
* if self._originptr == NULL: # <<<<<<<<<<<<<<
* return None
* else:
@@ -14435,8 +14451,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
__pyx_t_1 = ((__pyx_v_self->_originptr == NULL) != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":940
- * def origin(self):
+ /* "pygame/_sdl2/video.pyx":1048
+ * """
* if self._originptr == NULL:
* return None # <<<<<<<<<<<<<<
* else:
@@ -14446,16 +14462,16 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":939
- * @property
- * def origin(self):
+ /* "pygame/_sdl2/video.pyx":1047
+ * its center.
+ * """
* if self._originptr == NULL: # <<<<<<<<<<<<<<
* return None
* else:
*/
}
- /* "pygame/_sdl2/video.pyx":942
+ /* "pygame/_sdl2/video.pyx":1050
* return None
* else:
* return (self._origin.x, self._origin.y) # <<<<<<<<<<<<<<
@@ -14464,11 +14480,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
*/
/*else*/ {
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error)
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
@@ -14481,12 +14497,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
goto __pyx_L0;
}
- /* "pygame/_sdl2/video.pyx":938
+ /* "pygame/_sdl2/video.pyx":1039
*
* @property
* def origin(self): # <<<<<<<<<<<<<<
- * if self._originptr == NULL:
- * return None
+ * """Get or set the Image's origin of rotation
+ *
*/
/* function exit code */
@@ -14502,7 +14518,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":945
+/* "pygame/_sdl2/video.pyx":1053
*
* @origin.setter
* def origin(self, new_origin): # <<<<<<<<<<<<<<
@@ -14534,43 +14550,43 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":946
+ /* "pygame/_sdl2/video.pyx":1054
* @origin.setter
* def origin(self, new_origin):
* if new_origin: # <<<<<<<<<<<<<<
* self._origin.x = new_origin[0]
* self._origin.y = new_origin[1]
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_new_origin); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 946, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_new_origin); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1054, __pyx_L1_error)
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":947
+ /* "pygame/_sdl2/video.pyx":1055
* def origin(self, new_origin):
* if new_origin:
* self._origin.x = new_origin[0] # <<<<<<<<<<<<<<
* self._origin.y = new_origin[1]
* self._originptr = &self._origin
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1055, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 947, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1055, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->_origin.x = ((int)__pyx_t_3);
- /* "pygame/_sdl2/video.pyx":948
+ /* "pygame/_sdl2/video.pyx":1056
* if new_origin:
* self._origin.x = new_origin[0]
* self._origin.y = new_origin[1] # <<<<<<<<<<<<<<
* self._originptr = &self._origin
* else:
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1056, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->_origin.y = ((int)__pyx_t_3);
- /* "pygame/_sdl2/video.pyx":949
+ /* "pygame/_sdl2/video.pyx":1057
* self._origin.x = new_origin[0]
* self._origin.y = new_origin[1]
* self._originptr = &self._origin # <<<<<<<<<<<<<<
@@ -14579,7 +14595,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_o
*/
__pyx_v_self->_originptr = (&__pyx_v_self->_origin);
- /* "pygame/_sdl2/video.pyx":946
+ /* "pygame/_sdl2/video.pyx":1054
* @origin.setter
* def origin(self, new_origin):
* if new_origin: # <<<<<<<<<<<<<<
@@ -14589,7 +14605,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_o
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":951
+ /* "pygame/_sdl2/video.pyx":1059
* self._originptr = &self._origin
* else:
* self._originptr = NULL # <<<<<<<<<<<<<<
@@ -14601,7 +14617,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_o
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":945
+ /* "pygame/_sdl2/video.pyx":1053
*
* @origin.setter
* def origin(self, new_origin): # <<<<<<<<<<<<<<
@@ -14621,16 +14637,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_o
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":953
+/* "pygame/_sdl2/video.pyx":1061
* self._originptr = NULL
*
* def get_rect(self): # <<<<<<<<<<<<<<
- * return pgRect_New(&self.srcrect.r)
+ * """Get the rectangular area of the Image
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_5Image_4get_rect[] = "Get the rectangular area of the Image\n\n .. note::\n The returned :class:`Rect` object might contain position information\n relative to the bounds of the :class:`Texture` or Image object it was\n created from.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -14651,25 +14668,25 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_rect", 0);
- /* "pygame/_sdl2/video.pyx":954
- *
- * def get_rect(self):
+ /* "pygame/_sdl2/video.pyx":1069
+ * created from.
+ * """
* return pgRect_New(&self.srcrect.r) # <<<<<<<<<<<<<<
*
* cpdef void draw(self, srcrect=None, dstrect=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = pgRect_New((&__pyx_v_self->srcrect->r)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
+ __pyx_t_1 = pgRect_New((&__pyx_v_self->srcrect->r)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":953
+ /* "pygame/_sdl2/video.pyx":1061
* self._originptr = NULL
*
* def get_rect(self): # <<<<<<<<<<<<<<
- * return pgRect_New(&self.srcrect.r)
+ * """Get the rectangular area of the Image
*
*/
@@ -14684,11 +14701,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":956
+/* "pygame/_sdl2/video.pyx":1071
* return pgRect_New(&self.srcrect.r)
*
* cpdef void draw(self, srcrect=None, dstrect=None): # <<<<<<<<<<<<<<
- * """ Copy a portion of the image to the rendering target.
+ * """Copy a portion of the Image to the rendering target
*
*/
@@ -14734,7 +14751,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw)) {
__Pyx_INCREF(__pyx_t_1);
@@ -14753,7 +14770,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_3)) {
PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_srcrect, __pyx_v_dstrect};
- __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_GOTREF(__pyx_t_2);
} else
@@ -14761,13 +14778,13 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_srcrect, __pyx_v_dstrect};
- __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_GOTREF(__pyx_t_2);
} else
#endif
{
- __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
if (__pyx_t_4) {
__Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
@@ -14778,7 +14795,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__Pyx_INCREF(__pyx_v_dstrect);
__Pyx_GIVEREF(__pyx_v_dstrect);
PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_dstrect);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
@@ -14800,7 +14817,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
#endif
}
- /* "pygame/_sdl2/video.pyx":965
+ /* "pygame/_sdl2/video.pyx":1082
* cdef SDL_Rect src
* cdef SDL_Rect dst
* cdef SDL_Rect *csrcrect = NULL # <<<<<<<<<<<<<<
@@ -14809,7 +14826,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_v_csrcrect = NULL;
- /* "pygame/_sdl2/video.pyx":966
+ /* "pygame/_sdl2/video.pyx":1083
* cdef SDL_Rect dst
* cdef SDL_Rect *csrcrect = NULL
* cdef SDL_Rect *cdstrect = NULL # <<<<<<<<<<<<<<
@@ -14818,7 +14835,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_v_cdstrect = NULL;
- /* "pygame/_sdl2/video.pyx":969
+ /* "pygame/_sdl2/video.pyx":1086
* cdef SDL_Rect *rectptr
*
* if srcrect is None: # <<<<<<<<<<<<<<
@@ -14829,7 +14846,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_8 = (__pyx_t_7 != 0);
if (__pyx_t_8) {
- /* "pygame/_sdl2/video.pyx":970
+ /* "pygame/_sdl2/video.pyx":1087
*
* if srcrect is None:
* csrcrect = &self.srcrect.r # <<<<<<<<<<<<<<
@@ -14838,7 +14855,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_v_csrcrect = (&__pyx_v_self->srcrect->r);
- /* "pygame/_sdl2/video.pyx":969
+ /* "pygame/_sdl2/video.pyx":1086
* cdef SDL_Rect *rectptr
*
* if srcrect is None: # <<<<<<<<<<<<<<
@@ -14848,7 +14865,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":972
+ /* "pygame/_sdl2/video.pyx":1089
* csrcrect = &self.srcrect.r
* else:
* if pgRect_Check(srcrect): # <<<<<<<<<<<<<<
@@ -14859,7 +14876,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_8 = (pgRect_Check(__pyx_v_srcrect) != 0);
if (__pyx_t_8) {
- /* "pygame/_sdl2/video.pyx":973
+ /* "pygame/_sdl2/video.pyx":1090
* else:
* if pgRect_Check(srcrect):
* src = (srcrect).r # <<<<<<<<<<<<<<
@@ -14869,7 +14886,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_9 = ((pgRectObject *)__pyx_v_srcrect)->r;
__pyx_v_src = __pyx_t_9;
- /* "pygame/_sdl2/video.pyx":972
+ /* "pygame/_sdl2/video.pyx":1089
* csrcrect = &self.srcrect.r
* else:
* if pgRect_Check(srcrect): # <<<<<<<<<<<<<<
@@ -14879,7 +14896,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
goto __pyx_L4;
}
- /* "pygame/_sdl2/video.pyx":976
+ /* "pygame/_sdl2/video.pyx":1093
* else:
*
* rectptr = pgRect_FromObject(srcrect, &src) # <<<<<<<<<<<<<<
@@ -14889,7 +14906,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
/*else*/ {
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_src));
- /* "pygame/_sdl2/video.pyx":977
+ /* "pygame/_sdl2/video.pyx":1094
*
* rectptr = pgRect_FromObject(srcrect, &src)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -14899,20 +14916,20 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_8 = ((__pyx_v_rectptr == NULL) != 0);
if (unlikely(__pyx_t_8)) {
- /* "pygame/_sdl2/video.pyx":978
+ /* "pygame/_sdl2/video.pyx":1095
* rectptr = pgRect_FromObject(srcrect, &src)
* if rectptr == NULL:
* raise TypeError('srcrect must be a rect or None') # <<<<<<<<<<<<<<
* src.x = rectptr.x
* src.y = rectptr.y
*/
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 978, __pyx_L1_error)
+ __PYX_ERR(0, 1095, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":977
+ /* "pygame/_sdl2/video.pyx":1094
*
* rectptr = pgRect_FromObject(srcrect, &src)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -14921,7 +14938,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
}
- /* "pygame/_sdl2/video.pyx":979
+ /* "pygame/_sdl2/video.pyx":1096
* if rectptr == NULL:
* raise TypeError('srcrect must be a rect or None')
* src.x = rectptr.x # <<<<<<<<<<<<<<
@@ -14931,7 +14948,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_5 = __pyx_v_rectptr->x;
__pyx_v_src.x = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":980
+ /* "pygame/_sdl2/video.pyx":1097
* raise TypeError('srcrect must be a rect or None')
* src.x = rectptr.x
* src.y = rectptr.y # <<<<<<<<<<<<<<
@@ -14941,7 +14958,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_5 = __pyx_v_rectptr->y;
__pyx_v_src.y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":981
+ /* "pygame/_sdl2/video.pyx":1098
* src.x = rectptr.x
* src.y = rectptr.y
* src.w = rectptr.w # <<<<<<<<<<<<<<
@@ -14951,7 +14968,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_5 = __pyx_v_rectptr->w;
__pyx_v_src.w = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":982
+ /* "pygame/_sdl2/video.pyx":1099
* src.y = rectptr.y
* src.w = rectptr.w
* src.h = rectptr.h # <<<<<<<<<<<<<<
@@ -14963,45 +14980,45 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
}
__pyx_L4:;
- /* "pygame/_sdl2/video.pyx":984
+ /* "pygame/_sdl2/video.pyx":1101
* src.h = rectptr.h
*
* src.x += self.srcrect.x # <<<<<<<<<<<<<<
* src.y += self.srcrect.y
* csrcrect = &src
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_src.x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_src.x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1101, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error)
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 984, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_src.x = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":985
+ /* "pygame/_sdl2/video.pyx":1102
*
* src.x += self.srcrect.x
* src.y += self.srcrect.y # <<<<<<<<<<<<<<
* csrcrect = &src
*
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_src.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_src.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 985, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1102, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_src.y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":986
+ /* "pygame/_sdl2/video.pyx":1103
* src.x += self.srcrect.x
* src.y += self.srcrect.y
* csrcrect = &src # <<<<<<<<<<<<<<
@@ -15012,7 +15029,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":988
+ /* "pygame/_sdl2/video.pyx":1105
* csrcrect = &src
*
* if dstrect is not None: # <<<<<<<<<<<<<<
@@ -15023,7 +15040,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_7 = (__pyx_t_8 != 0);
if (__pyx_t_7) {
- /* "pygame/_sdl2/video.pyx":989
+ /* "pygame/_sdl2/video.pyx":1106
*
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst) # <<<<<<<<<<<<<<
@@ -15032,7 +15049,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_v_cdstrect = pgRect_FromObject(__pyx_v_dstrect, (&__pyx_v_dst));
- /* "pygame/_sdl2/video.pyx":990
+ /* "pygame/_sdl2/video.pyx":1107
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL: # <<<<<<<<<<<<<<
@@ -15042,70 +15059,70 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_7 = ((__pyx_v_cdstrect == NULL) != 0);
if (__pyx_t_7) {
- /* "pygame/_sdl2/video.pyx":991
+ /* "pygame/_sdl2/video.pyx":1108
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL:
* if len(dstrect) == 2: # <<<<<<<<<<<<<<
* dst.x = dstrect[0]
* dst.y = dstrect[1]
*/
- __pyx_t_10 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 991, __pyx_L1_error)
+ __pyx_t_10 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1108, __pyx_L1_error)
__pyx_t_7 = ((__pyx_t_10 == 2) != 0);
if (likely(__pyx_t_7)) {
- /* "pygame/_sdl2/video.pyx":992
+ /* "pygame/_sdl2/video.pyx":1109
* if cdstrect == NULL:
* if len(dstrect) == 2:
* dst.x = dstrect[0] # <<<<<<<<<<<<<<
* dst.y = dstrect[1]
* dst.w = self.srcrect.w
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 992, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1109, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.x = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":993
+ /* "pygame/_sdl2/video.pyx":1110
* if len(dstrect) == 2:
* dst.x = dstrect[0]
* dst.y = dstrect[1] # <<<<<<<<<<<<<<
* dst.w = self.srcrect.w
* dst.h = self.srcrect.h
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1110, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":994
+ /* "pygame/_sdl2/video.pyx":1111
* dst.x = dstrect[0]
* dst.y = dstrect[1]
* dst.w = self.srcrect.w # <<<<<<<<<<<<<<
* dst.h = self.srcrect.h
* cdstrect = &dst
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.w = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":995
+ /* "pygame/_sdl2/video.pyx":1112
* dst.y = dstrect[1]
* dst.w = self.srcrect.w
* dst.h = self.srcrect.h # <<<<<<<<<<<<<<
* cdstrect = &dst
* else:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_dst.h = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":996
+ /* "pygame/_sdl2/video.pyx":1113
* dst.w = self.srcrect.w
* dst.h = self.srcrect.h
* cdstrect = &dst # <<<<<<<<<<<<<<
@@ -15114,7 +15131,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_v_cdstrect = (&__pyx_v_dst);
- /* "pygame/_sdl2/video.pyx":991
+ /* "pygame/_sdl2/video.pyx":1108
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL:
* if len(dstrect) == 2: # <<<<<<<<<<<<<<
@@ -15124,7 +15141,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
goto __pyx_L8;
}
- /* "pygame/_sdl2/video.pyx":998
+ /* "pygame/_sdl2/video.pyx":1115
* cdstrect = &dst
* else:
* raise TypeError('dstrect must be a position, rect, or None') # <<<<<<<<<<<<<<
@@ -15132,15 +15149,15 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
* self.texture.color = self._color
*/
/*else*/ {
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 998, __pyx_L1_error)
+ __PYX_ERR(0, 1115, __pyx_L1_error)
}
__pyx_L8:;
- /* "pygame/_sdl2/video.pyx":990
+ /* "pygame/_sdl2/video.pyx":1107
* if dstrect is not None:
* cdstrect = pgRect_FromObject(dstrect, &dst)
* if cdstrect == NULL: # <<<<<<<<<<<<<<
@@ -15149,7 +15166,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
}
- /* "pygame/_sdl2/video.pyx":988
+ /* "pygame/_sdl2/video.pyx":1105
* csrcrect = &src
*
* if dstrect is not None: # <<<<<<<<<<<<<<
@@ -15158,7 +15175,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
}
- /* "pygame/_sdl2/video.pyx":1000
+ /* "pygame/_sdl2/video.pyx":1117
* raise TypeError('dstrect must be a position, rect, or None')
*
* self.texture.color = self._color # <<<<<<<<<<<<<<
@@ -15167,34 +15184,34 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
*/
__pyx_t_1 = ((PyObject *)__pyx_v_self->_color);
__Pyx_INCREF(__pyx_t_1);
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_color, __pyx_t_1) < 0) __PYX_ERR(0, 1000, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_color, __pyx_t_1) < 0) __PYX_ERR(0, 1117, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1001
+ /* "pygame/_sdl2/video.pyx":1118
*
* self.texture.color = self._color
* self.texture.alpha = self.alpha # <<<<<<<<<<<<<<
* self.texture.blend_mode = self.blend_mode
*
*/
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1001, __pyx_L1_error)
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 1001, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1002
+ /* "pygame/_sdl2/video.pyx":1119
* self.texture.color = self._color
* self.texture.alpha = self.alpha
* self.texture.blend_mode = self.blend_mode # <<<<<<<<<<<<<<
*
* self.texture.draw_internal(csrcrect, cdstrect, self.angle,
*/
- __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_blend_mode, __pyx_t_1) < 0) __PYX_ERR(0, 1002, __pyx_L1_error)
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_blend_mode, __pyx_t_1) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1004
+ /* "pygame/_sdl2/video.pyx":1121
* self.texture.blend_mode = self.blend_mode
*
* self.texture.draw_internal(csrcrect, cdstrect, self.angle, # <<<<<<<<<<<<<<
@@ -15206,15 +15223,15 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
__pyx_t_11.originptr = __pyx_v_self->_originptr;
__pyx_t_11.flip_x = __pyx_v_self->flip_x;
__pyx_t_11.flip_y = __pyx_v_self->flip_y;
- __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->texture->__pyx_vtab)->draw_internal(__pyx_v_self->texture, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
+ __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->texture->__pyx_vtab)->draw_internal(__pyx_v_self->texture, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":956
+ /* "pygame/_sdl2/video.pyx":1071
* return pgRect_New(&self.srcrect.r)
*
* cpdef void draw(self, srcrect=None, dstrect=None): # <<<<<<<<<<<<<<
- * """ Copy a portion of the image to the rendering target.
+ * """Copy a portion of the Image to the rendering target
*
*/
@@ -15233,7 +15250,7 @@ static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_5Image_6draw[] = " Copy a portion of the image to the rendering target.\n\n :param srcrect: source rectangle specifying a sub-image, or None for the entire image.\n :param dstrect: destination rectangle or position on the render target, or None for entire target.\n The image is stretched to fill dstrect.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_5Image_6draw[] = "Copy a portion of the Image to the rendering target\n\n :param srcrect: Source rectangle specifying a sub-Image, or None for the\n entire Image.\n :param dstrect: Destination rectangle or position on the render target,\n or ``None`` for entire target. The Image is stretched to\n fill dstrect.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_srcrect = 0;
PyObject *__pyx_v_dstrect = 0;
@@ -15274,7 +15291,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_s
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 956, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 1071, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -15291,7 +15308,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_s
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 956, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1071, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Image.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -15318,7 +15335,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(struct __pyx_obj_6p
__pyx_t_1.srcrect = __pyx_v_srcrect;
__pyx_t_1.dstrect = __pyx_v_dstrect;
__pyx_vtabptr_6pygame_5_sdl2_5video_Image->draw(__pyx_v_self, 1, &__pyx_t_1);
- __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -15335,7 +15352,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(struct __pyx_obj_6p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":540
+/* "pygame/_sdl2/video.pxd":546
* cdef class Image:
* cdef Color _color
* cdef public float angle # <<<<<<<<<<<<<<
@@ -15365,7 +15382,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5angle___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->angle); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 540, __pyx_L1_error)
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->angle); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 546, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -15403,7 +15420,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(struct __pyx_ob
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 540, __pyx_L1_error)
+ __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 546, __pyx_L1_error)
__pyx_v_self->angle = __pyx_t_1;
/* function exit code */
@@ -15417,7 +15434,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":543
+/* "pygame/_sdl2/video.pxd":549
* cdef SDL_Point _origin
* cdef SDL_Point* _originptr
* cdef public bint flip_x # <<<<<<<<<<<<<<
@@ -15447,7 +15464,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_x___get__(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flip_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 543, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flip_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -15485,7 +15502,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_x_2__set__(struct __pyx_o
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 543, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 549, __pyx_L1_error)
__pyx_v_self->flip_x = __pyx_t_1;
/* function exit code */
@@ -15499,7 +15516,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_x_2__set__(struct __pyx_o
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":544
+/* "pygame/_sdl2/video.pxd":550
* cdef SDL_Point* _originptr
* cdef public bint flip_x
* cdef public bint flip_y # <<<<<<<<<<<<<<
@@ -15529,7 +15546,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_y___get__(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flip_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 544, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flip_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 550, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -15567,7 +15584,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_y_2__set__(struct __pyx_o
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 544, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 550, __pyx_L1_error)
__pyx_v_self->flip_y = __pyx_t_1;
/* function exit code */
@@ -15581,7 +15598,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6flip_y_2__set__(struct __pyx_o
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":545
+/* "pygame/_sdl2/video.pxd":551
* cdef public bint flip_x
* cdef public bint flip_y
* cdef public float alpha # <<<<<<<<<<<<<<
@@ -15611,7 +15628,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 545, __pyx_L1_error)
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -15649,7 +15666,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(struct __pyx_ob
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 545, __pyx_L1_error)
+ __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 551, __pyx_L1_error)
__pyx_v_self->alpha = __pyx_t_1;
/* function exit code */
@@ -15663,7 +15680,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":546
+/* "pygame/_sdl2/video.pxd":552
* cdef public bint flip_y
* cdef public float alpha
* cdef public SDL_BlendMode blend_mode # <<<<<<<<<<<<<<
@@ -15693,7 +15710,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode___get__(stru
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 546, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 552, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -15731,7 +15748,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(struct __
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 546, __pyx_L1_error)
+ __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 552, __pyx_L1_error)
__pyx_v_self->blend_mode = __pyx_t_1;
/* function exit code */
@@ -15745,7 +15762,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":548
+/* "pygame/_sdl2/video.pxd":554
* cdef public SDL_BlendMode blend_mode
*
* cdef public Texture texture # <<<<<<<<<<<<<<
@@ -15803,7 +15820,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_2__set__(struct __pyx_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(2, 548, __pyx_L1_error)
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(2, 554, __pyx_L1_error)
__pyx_t_1 = __pyx_v_value;
__Pyx_INCREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -15853,7 +15870,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_4__del__(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pxd":549
+/* "pygame/_sdl2/video.pxd":555
*
* cdef public Texture texture
* cdef public Rect srcrect # <<<<<<<<<<<<<<
@@ -15911,7 +15928,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(struct __pyx_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(2, 549, __pyx_L1_error)
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(2, 555, __pyx_L1_error)
__pyx_t_1 = __pyx_v_value;
__Pyx_INCREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -16074,111 +16091,189 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(CYT
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1011
+/* "pygame/_sdl2/video.pyx":1128
*
* @classmethod
- * def from_window(cls, Window window): # <<<<<<<<<<<<<<
- * cdef Renderer self = cls.__new__(cls)
- * self._win = window
+ * def from_window(cls, window): # <<<<<<<<<<<<<<
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)):
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window(PyObject *__pyx_v_cls, PyObject *__pyx_v_window); /*proto*/
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window(PyObject *__pyx_v_cls, PyObject *__pyx_v_window) {
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("from_window (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 1011, __pyx_L1_error)
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(((PyTypeObject*)__pyx_v_cls), ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_window));
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_window));
/* function exit code */
- goto __pyx_L0;
- __pyx_L1_error:;
- __pyx_r = NULL;
- __pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window) {
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_window) {
+ pgWindowObject *__pyx_v__window = 0;
struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self = 0;
Uint8 __pyx_v_defaultColor[4];
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_1;
int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- Uint8 __pyx_t_6[4];
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ Uint8 __pyx_t_7[4];
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("from_window", 0);
- /* "pygame/_sdl2/video.pyx":1012
- * @classmethod
- * def from_window(cls, Window window):
- * cdef Renderer self = cls.__new__(cls) # <<<<<<<<<<<<<<
- * self._win = window
- * if window._is_borrowed:
+ /* "pygame/_sdl2/video.pyx":1130
+ * def from_window(cls, window):
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)): # <<<<<<<<<<<<<<
+ * _window = window
+ * else:
*/
- if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
- __PYX_ERR(0, 1012, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_6pygame_5_sdl2_5video__Window);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (!__pyx_t_3) {
+ } else {
+ __pyx_t_1 = __pyx_t_3;
+ goto __pyx_L4_bool_binop_done;
}
- __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Renderer)))) __PYX_ERR(0, 1012, __pyx_L1_error)
- __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_6pygame_5_sdl2_5video_Window);
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (likely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1013
- * def from_window(cls, Window window):
- * cdef Renderer self = cls.__new__(cls)
- * self._win = window # <<<<<<<<<<<<<<
- * if window._is_borrowed:
- * self._is_borrowed=1
+ /* "pygame/_sdl2/video.pyx":1131
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)):
+ * _window = window # <<<<<<<<<<<<<<
+ * else:
+ * raise TypeError(
*/
- __Pyx_INCREF(((PyObject *)__pyx_v_window));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_window));
- __Pyx_GOTREF(__pyx_v_self->_win);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->_win));
- __pyx_v_self->_win = __pyx_v_window;
-
- /* "pygame/_sdl2/video.pyx":1014
+ __pyx_t_4 = __pyx_v_window;
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v__window = ((pgWindowObject *)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "pygame/_sdl2/video.pyx":1130
+ * def from_window(cls, window):
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)): # <<<<<<<<<<<<<<
+ * _window = window
+ * else:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "pygame/_sdl2/video.pyx":1133
+ * _window = window
+ * else:
+ * raise TypeError( # <<<<<<<<<<<<<<
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ */
+ /*else*/ {
+
+ /* "pygame/_sdl2/video.pyx":1135
+ * raise TypeError(
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__ # <<<<<<<<<<<<<<
+ * )
+ * cdef Renderer self = cls.__new__(cls)
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_window_has_incorrect_ty, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "pygame/_sdl2/video.pyx":1133
+ * _window = window
+ * else:
+ * raise TypeError( # <<<<<<<<<<<<<<
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ */
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1133, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 1133, __pyx_L1_error)
+ }
+ __pyx_L3:;
+
+ /* "pygame/_sdl2/video.pyx":1137
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ * )
+ * cdef Renderer self = cls.__new__(cls) # <<<<<<<<<<<<<<
+ * self._win = _window
+ * if self._win._is_borrowed:
+ */
+ if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
+ __PYX_ERR(0, 1137, __pyx_L1_error)
+ }
+ __pyx_t_5 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1137, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_6pygame_5_sdl2_5video_Renderer)))) __PYX_ERR(0, 1137, __pyx_L1_error)
+ __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "pygame/_sdl2/video.pyx":1138
+ * )
+ * cdef Renderer self = cls.__new__(cls)
+ * self._win = _window # <<<<<<<<<<<<<<
+ * if self._win._is_borrowed:
+ * self._is_borrowed=1
+ */
+ __Pyx_INCREF(((PyObject *)__pyx_v__window));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v__window));
+ __Pyx_GOTREF(__pyx_v_self->_win);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->_win));
+ __pyx_v_self->_win = __pyx_v__window;
+
+ /* "pygame/_sdl2/video.pyx":1139
* cdef Renderer self = cls.__new__(cls)
- * self._win = window
- * if window._is_borrowed: # <<<<<<<<<<<<<<
+ * self._win = _window
+ * if self._win._is_borrowed: # <<<<<<<<<<<<<<
* self._is_borrowed=1
* else:
*/
- __pyx_t_2 = (__pyx_v_window->_is_borrowed != 0);
+ __pyx_t_2 = (__pyx_v_self->_win->_is_borrowed != 0);
if (likely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1015
- * self._win = window
- * if window._is_borrowed:
+ /* "pygame/_sdl2/video.pyx":1140
+ * self._win = _window
+ * if self._win._is_borrowed:
* self._is_borrowed=1 # <<<<<<<<<<<<<<
* else:
* raise error()
*/
__pyx_v_self->_is_borrowed = 1;
- /* "pygame/_sdl2/video.pyx":1014
+ /* "pygame/_sdl2/video.pyx":1139
* cdef Renderer self = cls.__new__(cls)
- * self._win = window
- * if window._is_borrowed: # <<<<<<<<<<<<<<
+ * self._win = _window
+ * if self._win._is_borrowed: # <<<<<<<<<<<<<<
* self._is_borrowed=1
* else:
*/
- goto __pyx_L3;
+ goto __pyx_L6;
}
- /* "pygame/_sdl2/video.pyx":1017
+ /* "pygame/_sdl2/video.pyx":1142
* self._is_borrowed=1
* else:
* raise error() # <<<<<<<<<<<<<<
@@ -16186,69 +16281,69 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObje
* raise error()
*/
/*else*/ {
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
- __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
- if (likely(__pyx_t_4)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_4);
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1142, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_3, function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
}
}
- __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1017, __pyx_L1_error)
+ __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1142, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 1142, __pyx_L1_error)
}
- __pyx_L3:;
+ __pyx_L6:;
- /* "pygame/_sdl2/video.pyx":1018
+ /* "pygame/_sdl2/video.pyx":1143
* else:
* raise error()
* if not self._win: # <<<<<<<<<<<<<<
* raise error()
*
*/
- __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_win)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1018, __pyx_L1_error)
- __pyx_t_5 = ((!__pyx_t_2) != 0);
- if (unlikely(__pyx_t_5)) {
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_win)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1143, __pyx_L1_error)
+ __pyx_t_1 = ((!__pyx_t_2) != 0);
+ if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1019
+ /* "pygame/_sdl2/video.pyx":1144
* raise error()
* if not self._win:
* raise error() # <<<<<<<<<<<<<<
*
* self._renderer = SDL_GetRenderer(self._win._win)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1019, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
- __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
- if (likely(__pyx_t_4)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_4);
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_3, function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
}
}
- __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1019, __pyx_L1_error)
+ __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1144, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 1144, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1018
+ /* "pygame/_sdl2/video.pyx":1143
* else:
* raise error()
* if not self._win: # <<<<<<<<<<<<<<
@@ -16257,7 +16352,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObje
*/
}
- /* "pygame/_sdl2/video.pyx":1021
+ /* "pygame/_sdl2/video.pyx":1146
* raise error()
*
* self._renderer = SDL_GetRenderer(self._win._win) # <<<<<<<<<<<<<<
@@ -16266,45 +16361,45 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObje
*/
__pyx_v_self->_renderer = SDL_GetRenderer(__pyx_v_self->_win->_win);
- /* "pygame/_sdl2/video.pyx":1022
+ /* "pygame/_sdl2/video.pyx":1147
*
* self._renderer = SDL_GetRenderer(self._win._win)
* if not self._renderer: # <<<<<<<<<<<<<<
* raise error()
*
*/
- __pyx_t_5 = ((!(__pyx_v_self->_renderer != 0)) != 0);
- if (unlikely(__pyx_t_5)) {
+ __pyx_t_1 = ((!(__pyx_v_self->_renderer != 0)) != 0);
+ if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1023
+ /* "pygame/_sdl2/video.pyx":1148
* self._renderer = SDL_GetRenderer(self._win._win)
* if not self._renderer:
* raise error() # <<<<<<<<<<<<<<
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1023, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
- __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
- if (likely(__pyx_t_4)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_4);
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1148, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_3, function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
}
}
- __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1023, __pyx_L1_error)
+ __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1148, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 1148, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1022
+ /* "pygame/_sdl2/video.pyx":1147
*
* self._renderer = SDL_GetRenderer(self._win._win)
* if not self._renderer: # <<<<<<<<<<<<<<
@@ -16313,36 +16408,36 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObje
*/
}
- /* "pygame/_sdl2/video.pyx":1025
+ /* "pygame/_sdl2/video.pyx":1150
* raise error()
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255] # <<<<<<<<<<<<<<
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None
*/
- __pyx_t_6[0] = 0xFF;
- __pyx_t_6[1] = 0xFF;
- __pyx_t_6[2] = 0xFF;
- __pyx_t_6[3] = 0xFF;
- memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_6, sizeof(__pyx_v_defaultColor[0]) * (4));
+ __pyx_t_7[0] = 0xFF;
+ __pyx_t_7[1] = 0xFF;
+ __pyx_t_7[2] = 0xFF;
+ __pyx_t_7[3] = 0xFF;
+ memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_7, sizeof(__pyx_v_defaultColor[0]) * (4));
- /* "pygame/_sdl2/video.pyx":1026
+ /* "pygame/_sdl2/video.pyx":1151
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._draw_color = pgColor_NewLength(defaultColor, 4) # <<<<<<<<<<<<<<
* self._target = None
* return self
*/
- __pyx_t_1 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 1026, __pyx_L1_error)
- __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_5 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1151, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 1151, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_v_self->_draw_color);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_draw_color));
- __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "pygame/_sdl2/video.pyx":1027
+ /* "pygame/_sdl2/video.pyx":1152
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None # <<<<<<<<<<<<<<
@@ -16355,56 +16450,57 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObje
__Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
__pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
- /* "pygame/_sdl2/video.pyx":1028
+ /* "pygame/_sdl2/video.pyx":1153
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None
* return self # <<<<<<<<<<<<<<
*
- * def __init__(self, Window window, int index=-1,
+ * def __init__(self, window, int index=-1,
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1011
+ /* "pygame/_sdl2/video.pyx":1128
*
* @classmethod
- * def from_window(cls, Window window): # <<<<<<<<<<<<<<
- * cdef Renderer self = cls.__new__(cls)
- * self._win = window
+ * def from_window(cls, window): # <<<<<<<<<<<<<<
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)):
*/
/* function exit code */
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.from_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v__window);
__Pyx_XDECREF((PyObject *)__pyx_v_self);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1030
+/* "pygame/_sdl2/video.pyx":1155
* return self
*
- * def __init__(self, Window window, int index=-1, # <<<<<<<<<<<<<<
+ * def __init__(self, window, int index=-1, # <<<<<<<<<<<<<<
* int accelerated=-1, bint vsync=False,
* bint target_texture=False):
*/
/* Python wrapper */
static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_2__init__[] = " Create a 2D rendering context for a window.\n\n :param Window window: where rendering is displayed.\n :param int index: index of rendering driver to initialize,\n or -1 to init the first supporting requested options.\n :param int accelerated: if 1, the renderer uses hardware acceleration.\n if 0, the renderer is a software fallback.\n -1 gives precedence to renderers using hardware acceleration.\n :param bool vsync: .present() is synchronized with the refresh rate.\n :param bool target_texture: the renderer supports rendering to texture.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_2__init__[] = "pygame object wrapping a 2D rendering context for a window\n\n Creates a 2D rendering context for a window.\n\n :param Window window: The window onto which the rendering context should be\n placed.\n :param int index: The index of rendering driver to initialize, or ``-1`` to init\n the first supporting the requested options.\n :param int accelerated: If 1, the renderer uses hardware acceleration.\n if 0, the renderer is a software fallback.\n ``-1`` gives precedence to renderers using hardware\n acceleration.\n :param bool vsync: If ``True`` :meth:`Renderer.present` is synchronized with\n the refresh rate.\n :param bool target_texture: Whether the renderer should support setting\n :class:`Texture` objects as target textures, to\n enable drawing onto them. \n\n\n :class:`Renderer` objects provide a cross-platform API for rendering 2D\n graphics onto a :class:`Window`, by using either Metal (MacOS), OpenGL\n (MacOS, Windows, Linux) or Direct3D (Windows) rendering drivers, depending\n on what is set or is available on a system during their creation.\n\n They can be used to draw both :class:`Texture` objects and simple points,\n lines and rectangles (which are colored based on :attr:`Renderer.draw_color`).\n\n If configured correctly and supported by an underlying rendering driver, Renderer\n objects can have a :class:`Texture` object temporarily set as a target texture\n (the Texture object must have been created with target texture usage support),\n which allows those textures to be drawn onto. \n\n To present drawn content onto the window, :meth:`Renderer.present` should be\n called. :meth:`Renderer.clear` ""should be called to clear any drawn content\n with the set Renderer draw color.\n\n When things are drawn onto Renderer objects, an internal batching system is\n used by default to batch those \"draw calls\" together, to have all of them be\n processed in one go when :meth:`Renderer.present` is called. This is unlike\n :class:`pygame.Surface` objects, on which modifications via blitting occur\n immediately, but lends well to the behavior of GPUs, as draw calls can be\n expensive on lower-end models.\n ";
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__;
#endif
static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window = 0;
+ PyObject *__pyx_v_window = 0;
int __pyx_v_index;
int __pyx_v_accelerated;
int __pyx_v_vsync;
@@ -16466,7 +16562,7 @@ static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1030, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1155, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -16483,39 +16579,39 @@ static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_
default: goto __pyx_L5_argtuple_error;
}
}
- __pyx_v_window = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)values[0]);
+ __pyx_v_window = values[0];
if (values[1]) {
- __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1030, __pyx_L3_error)
+ __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1155, __pyx_L3_error)
} else {
__pyx_v_index = ((int)-1);
}
if (values[2]) {
- __pyx_v_accelerated = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_accelerated == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1031, __pyx_L3_error)
+ __pyx_v_accelerated = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_accelerated == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
} else {
__pyx_v_accelerated = ((int)-1);
}
if (values[3]) {
- __pyx_v_vsync = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_vsync == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1031, __pyx_L3_error)
+ __pyx_v_vsync = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_vsync == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":1031
+ /* "pygame/_sdl2/video.pyx":1156
*
- * def __init__(self, Window window, int index=-1,
+ * def __init__(self, window, int index=-1,
* int accelerated=-1, bint vsync=False, # <<<<<<<<<<<<<<
* bint target_texture=False):
- * """ Create a 2D rendering context for a window.
+ * """pygame object wrapping a 2D rendering context for a window
*/
__pyx_v_vsync = ((int)0);
}
if (values[4]) {
- __pyx_v_target_texture = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_target_texture == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1032, __pyx_L3_error)
+ __pyx_v_target_texture = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_target_texture == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L3_error)
} else {
- /* "pygame/_sdl2/video.pyx":1032
- * def __init__(self, Window window, int index=-1,
+ /* "pygame/_sdl2/video.pyx":1157
+ * def __init__(self, window, int index=-1,
* int accelerated=-1, bint vsync=False,
* bint target_texture=False): # <<<<<<<<<<<<<<
- * """ Create a 2D rendering context for a window.
+ * """pygame object wrapping a 2D rendering context for a window
*
*/
__pyx_v_target_texture = ((int)0);
@@ -16523,49 +16619,131 @@ static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1030, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1155, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 1030, __pyx_L1_error)
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_window, __pyx_v_index, __pyx_v_accelerated, __pyx_v_vsync, __pyx_v_target_texture);
- /* "pygame/_sdl2/video.pyx":1030
+ /* "pygame/_sdl2/video.pyx":1155
* return self
*
- * def __init__(self, Window window, int index=-1, # <<<<<<<<<<<<<<
+ * def __init__(self, window, int index=-1, # <<<<<<<<<<<<<<
* int accelerated=-1, bint vsync=False,
* bint target_texture=False):
*/
/* function exit code */
- goto __pyx_L0;
- __pyx_L1_error:;
- __pyx_r = -1;
- __pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture) {
+static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture) {
+ pgWindowObject *__pyx_v__window = 0;
PyObject *__pyx_v_flags = NULL;
Uint8 __pyx_v_defaultColor[4];
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- Uint32 __pyx_t_4;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- Uint8 __pyx_t_6[4];
+ Uint32 __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ Uint8 __pyx_t_8[4];
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "pygame/_sdl2/video.pyx":1046
+ /* "pygame/_sdl2/video.pyx":1202
+ * """
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)): # <<<<<<<<<<<<<<
+ * _window = window
+ * else:
+ */
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_6pygame_5_sdl2_5video__Window);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (!__pyx_t_3) {
+ } else {
+ __pyx_t_1 = __pyx_t_3;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_6pygame_5_sdl2_5video_Window);
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (likely(__pyx_t_2)) {
+
+ /* "pygame/_sdl2/video.pyx":1203
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)):
+ * _window = window # <<<<<<<<<<<<<<
+ * else:
+ * raise TypeError(
+ */
+ __pyx_t_4 = __pyx_v_window;
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v__window = ((pgWindowObject *)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "pygame/_sdl2/video.pyx":1202
+ * """
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)): # <<<<<<<<<<<<<<
+ * _window = window
+ * else:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "pygame/_sdl2/video.pyx":1205
+ * _window = window
+ * else:
+ * raise TypeError( # <<<<<<<<<<<<<<
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ */
+ /*else*/ {
+
+ /* "pygame/_sdl2/video.pyx":1207
+ * raise TypeError(
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__ # <<<<<<<<<<<<<<
+ * )
+ *
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_window_has_incorrect_ty, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "pygame/_sdl2/video.pyx":1205
+ * _window = window
+ * else:
+ * raise TypeError( # <<<<<<<<<<<<<<
+ * "Argument 'window' has incorrect type "
+ * "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ */
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 1205, __pyx_L1_error)
+ }
+ __pyx_L3:;
+
+ /* "pygame/_sdl2/video.pyx":1212
* # https://wiki.libsdl.org/SDL_CreateRenderer
* # https://wiki.libsdl.org/SDL_RendererFlags
* flags = 0 # <<<<<<<<<<<<<<
@@ -16575,17 +16753,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
__Pyx_INCREF(__pyx_int_0);
__pyx_v_flags = __pyx_int_0;
- /* "pygame/_sdl2/video.pyx":1047
+ /* "pygame/_sdl2/video.pyx":1213
* # https://wiki.libsdl.org/SDL_RendererFlags
* flags = 0
* if accelerated >= 0: # <<<<<<<<<<<<<<
* flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
* if vsync:
*/
- __pyx_t_1 = ((__pyx_v_accelerated >= 0) != 0);
- if (__pyx_t_1) {
+ __pyx_t_2 = ((__pyx_v_accelerated >= 0) != 0);
+ if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":1048
+ /* "pygame/_sdl2/video.pyx":1214
* flags = 0
* if accelerated >= 0:
* flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE # <<<<<<<<<<<<<<
@@ -16593,23 +16771,23 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
* flags |= _SDL_RENDERER_PRESENTVSYNC
*/
if ((__pyx_v_accelerated != 0)) {
- __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_ACCELERATED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_ACCELERATED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1214, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = 0;
} else {
- __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_SOFTWARE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_SOFTWARE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1214, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = 0;
}
- __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1048, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1214, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":1047
+ /* "pygame/_sdl2/video.pyx":1213
* # https://wiki.libsdl.org/SDL_RendererFlags
* flags = 0
* if accelerated >= 0: # <<<<<<<<<<<<<<
@@ -16618,32 +16796,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
*/
}
- /* "pygame/_sdl2/video.pyx":1049
+ /* "pygame/_sdl2/video.pyx":1215
* if accelerated >= 0:
* flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
* if vsync: # <<<<<<<<<<<<<<
* flags |= _SDL_RENDERER_PRESENTVSYNC
* if target_texture:
*/
- __pyx_t_1 = (__pyx_v_vsync != 0);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_v_vsync != 0);
+ if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":1050
+ /* "pygame/_sdl2/video.pyx":1216
* flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
* if vsync:
* flags |= _SDL_RENDERER_PRESENTVSYNC # <<<<<<<<<<<<<<
* if target_texture:
* flags |= _SDL_RENDERER_TARGETTEXTURE
*/
- __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_PRESENTVSYNC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_PRESENTVSYNC); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1216, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1216, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "pygame/_sdl2/video.pyx":1049
+ /* "pygame/_sdl2/video.pyx":1215
* if accelerated >= 0:
* flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
* if vsync: # <<<<<<<<<<<<<<
@@ -16652,32 +16830,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
*/
}
- /* "pygame/_sdl2/video.pyx":1051
+ /* "pygame/_sdl2/video.pyx":1217
* if vsync:
* flags |= _SDL_RENDERER_PRESENTVSYNC
* if target_texture: # <<<<<<<<<<<<<<
* flags |= _SDL_RENDERER_TARGETTEXTURE
*
*/
- __pyx_t_1 = (__pyx_v_target_texture != 0);
- if (__pyx_t_1) {
+ __pyx_t_2 = (__pyx_v_target_texture != 0);
+ if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":1052
+ /* "pygame/_sdl2/video.pyx":1218
* flags |= _SDL_RENDERER_PRESENTVSYNC
* if target_texture:
* flags |= _SDL_RENDERER_TARGETTEXTURE # <<<<<<<<<<<<<<
*
- * self._renderer = SDL_CreateRenderer(window._win, index, flags)
+ * self._renderer = SDL_CreateRenderer(_window._win, index, flags)
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_TARGETTEXTURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1052, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1052, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_TARGETTEXTURE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1218, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1218, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":1051
+ /* "pygame/_sdl2/video.pyx":1217
* if vsync:
* flags |= _SDL_RENDERER_PRESENTVSYNC
* if target_texture: # <<<<<<<<<<<<<<
@@ -16686,97 +16864,97 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
*/
}
- /* "pygame/_sdl2/video.pyx":1054
+ /* "pygame/_sdl2/video.pyx":1220
* flags |= _SDL_RENDERER_TARGETTEXTURE
*
- * self._renderer = SDL_CreateRenderer(window._win, index, flags) # <<<<<<<<<<<<<<
+ * self._renderer = SDL_CreateRenderer(_window._win, index, flags) # <<<<<<<<<<<<<<
* if not self._renderer:
* raise error()
*/
- __pyx_t_4 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_4 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1054, __pyx_L1_error)
- __pyx_v_self->_renderer = SDL_CreateRenderer(__pyx_v_window->_win, __pyx_v_index, __pyx_t_4);
+ __pyx_t_6 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_6 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1220, __pyx_L1_error)
+ __pyx_v_self->_renderer = SDL_CreateRenderer(__pyx_v__window->_win, __pyx_v_index, __pyx_t_6);
- /* "pygame/_sdl2/video.pyx":1055
+ /* "pygame/_sdl2/video.pyx":1221
*
- * self._renderer = SDL_CreateRenderer(window._win, index, flags)
+ * self._renderer = SDL_CreateRenderer(_window._win, index, flags)
* if not self._renderer: # <<<<<<<<<<<<<<
* raise error()
*
*/
- __pyx_t_1 = ((!(__pyx_v_self->_renderer != 0)) != 0);
- if (unlikely(__pyx_t_1)) {
+ __pyx_t_2 = ((!(__pyx_v_self->_renderer != 0)) != 0);
+ if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1056
- * self._renderer = SDL_CreateRenderer(window._win, index, flags)
+ /* "pygame/_sdl2/video.pyx":1222
+ * self._renderer = SDL_CreateRenderer(_window._win, index, flags)
* if not self._renderer:
* raise error() # <<<<<<<<<<<<<<
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
- __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
- if (likely(__pyx_t_5)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1222, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_2, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
}
}
- __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1056, __pyx_L1_error)
+ __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __PYX_ERR(0, 1222, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1055
+ /* "pygame/_sdl2/video.pyx":1221
*
- * self._renderer = SDL_CreateRenderer(window._win, index, flags)
+ * self._renderer = SDL_CreateRenderer(_window._win, index, flags)
* if not self._renderer: # <<<<<<<<<<<<<<
* raise error()
*
*/
}
- /* "pygame/_sdl2/video.pyx":1058
+ /* "pygame/_sdl2/video.pyx":1224
* raise error()
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255] # <<<<<<<<<<<<<<
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None
*/
- __pyx_t_6[0] = 0xFF;
- __pyx_t_6[1] = 0xFF;
- __pyx_t_6[2] = 0xFF;
- __pyx_t_6[3] = 0xFF;
- memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_6, sizeof(__pyx_v_defaultColor[0]) * (4));
+ __pyx_t_8[0] = 0xFF;
+ __pyx_t_8[1] = 0xFF;
+ __pyx_t_8[2] = 0xFF;
+ __pyx_t_8[3] = 0xFF;
+ memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_8, sizeof(__pyx_v_defaultColor[0]) * (4));
- /* "pygame/_sdl2/video.pyx":1059
+ /* "pygame/_sdl2/video.pyx":1225
*
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._draw_color = pgColor_NewLength(defaultColor, 4) # <<<<<<<<<<<<<<
* self._target = None
- * self._win = window
+ * self._win = _window
*/
- __pyx_t_3 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1059, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 1059, __pyx_L1_error)
- __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_4 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 1225, __pyx_L1_error)
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->_draw_color);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_draw_color));
- __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "pygame/_sdl2/video.pyx":1060
+ /* "pygame/_sdl2/video.pyx":1226
* cdef Uint8[4] defaultColor = [255, 255, 255, 255]
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None # <<<<<<<<<<<<<<
- * self._win = window
+ * self._win = _window
* self._is_borrowed=0
*/
__Pyx_INCREF(Py_None);
@@ -16785,32 +16963,32 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
__Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
__pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
- /* "pygame/_sdl2/video.pyx":1061
+ /* "pygame/_sdl2/video.pyx":1227
* self._draw_color = pgColor_NewLength(defaultColor, 4)
* self._target = None
- * self._win = window # <<<<<<<<<<<<<<
+ * self._win = _window # <<<<<<<<<<<<<<
* self._is_borrowed=0
*
*/
- __Pyx_INCREF(((PyObject *)__pyx_v_window));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_window));
+ __Pyx_INCREF(((PyObject *)__pyx_v__window));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v__window));
__Pyx_GOTREF(__pyx_v_self->_win);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_win));
- __pyx_v_self->_win = __pyx_v_window;
+ __pyx_v_self->_win = __pyx_v__window;
- /* "pygame/_sdl2/video.pyx":1062
+ /* "pygame/_sdl2/video.pyx":1228
* self._target = None
- * self._win = window
+ * self._win = _window
* self._is_borrowed=0 # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
__pyx_v_self->_is_borrowed = 0;
- /* "pygame/_sdl2/video.pyx":1030
+ /* "pygame/_sdl2/video.pyx":1155
* return self
*
- * def __init__(self, Window window, int index=-1, # <<<<<<<<<<<<<<
+ * def __init__(self, window, int index=-1, # <<<<<<<<<<<<<<
* int accelerated=-1, bint vsync=False,
* bint target_texture=False):
*/
@@ -16819,18 +16997,19 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v__window);
__Pyx_XDECREF(__pyx_v_flags);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1064
+/* "pygame/_sdl2/video.pyx":1230
* self._is_borrowed=0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -16854,7 +17033,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "pygame/_sdl2/video.pyx":1065
+ /* "pygame/_sdl2/video.pyx":1231
*
* def __dealloc__(self):
* if self._is_borrowed: # <<<<<<<<<<<<<<
@@ -16864,7 +17043,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
__pyx_t_1 = (__pyx_v_self->_is_borrowed != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":1066
+ /* "pygame/_sdl2/video.pyx":1232
* def __dealloc__(self):
* if self._is_borrowed:
* return # <<<<<<<<<<<<<<
@@ -16873,7 +17052,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
*/
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1065
+ /* "pygame/_sdl2/video.pyx":1231
*
* def __dealloc__(self):
* if self._is_borrowed: # <<<<<<<<<<<<<<
@@ -16882,7 +17061,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":1067
+ /* "pygame/_sdl2/video.pyx":1233
* if self._is_borrowed:
* return
* if self._renderer: # <<<<<<<<<<<<<<
@@ -16892,7 +17071,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
__pyx_t_1 = (__pyx_v_self->_renderer != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":1068
+ /* "pygame/_sdl2/video.pyx":1234
* return
* if self._renderer:
* SDL_DestroyRenderer(self._renderer) # <<<<<<<<<<<<<<
@@ -16901,7 +17080,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
*/
SDL_DestroyRenderer(__pyx_v_self->_renderer);
- /* "pygame/_sdl2/video.pyx":1067
+ /* "pygame/_sdl2/video.pyx":1233
* if self._is_borrowed:
* return
* if self._renderer: # <<<<<<<<<<<<<<
@@ -16910,7 +17089,7 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
*/
}
- /* "pygame/_sdl2/video.pyx":1064
+ /* "pygame/_sdl2/video.pyx":1230
* self._is_borrowed=0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -16923,12 +17102,12 @@ static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_o
__Pyx_RefNannyFinishContext();
}
-/* "pygame/_sdl2/video.pyx":1071
+/* "pygame/_sdl2/video.pyx":1237
*
* @property
* def draw_blend_mode(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
- * cdef SDL_BlendMode blendMode
+ * """Get or set the blend mode used for primitive drawing operations
+ * """
*/
/* Python wrapper */
@@ -16958,7 +17137,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":1074
+ /* "pygame/_sdl2/video.pyx":1242
* # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode) # <<<<<<<<<<<<<<
@@ -16967,7 +17146,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
*/
__pyx_v_res = SDL_GetRenderDrawBlendMode(__pyx_v_self->_renderer, (&__pyx_v_blendMode));
- /* "pygame/_sdl2/video.pyx":1075
+ /* "pygame/_sdl2/video.pyx":1243
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -16977,14 +17156,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1076
+ /* "pygame/_sdl2/video.pyx":1244
* cdef int res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* return blendMode
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1244, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -16998,14 +17177,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1076, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1244, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1076, __pyx_L1_error)
+ __PYX_ERR(0, 1244, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1075
+ /* "pygame/_sdl2/video.pyx":1243
* cdef SDL_BlendMode blendMode
* cdef int res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -17014,7 +17193,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
*/
}
- /* "pygame/_sdl2/video.pyx":1078
+ /* "pygame/_sdl2/video.pyx":1246
* raise error()
*
* return blendMode # <<<<<<<<<<<<<<
@@ -17022,18 +17201,18 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
* @draw_blend_mode.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1078, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1071
+ /* "pygame/_sdl2/video.pyx":1237
*
* @property
* def draw_blend_mode(self): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
- * cdef SDL_BlendMode blendMode
+ * """Get or set the blend mode used for primitive drawing operations
+ * """
*/
/* function exit code */
@@ -17049,7 +17228,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___ge
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1081
+/* "pygame/_sdl2/video.pyx":1249
*
* @draw_blend_mode.setter
* def draw_blend_mode(self, blendMode): # <<<<<<<<<<<<<<
@@ -17084,17 +17263,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":1083
+ /* "pygame/_sdl2/video.pyx":1251
* def draw_blend_mode(self, blendMode):
* # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
* cdef int res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L1_error)
+ __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1251, __pyx_L1_error)
__pyx_v_res = SDL_SetRenderDrawBlendMode(__pyx_v_self->_renderer, __pyx_t_1);
- /* "pygame/_sdl2/video.pyx":1084
+ /* "pygame/_sdl2/video.pyx":1252
* # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
* cdef int res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -17104,14 +17283,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(s
__pyx_t_2 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1085
+ /* "pygame/_sdl2/video.pyx":1253
* cdef int res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1085, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -17125,14 +17304,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(s
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1085, __pyx_L1_error)
+ __PYX_ERR(0, 1253, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1084
+ /* "pygame/_sdl2/video.pyx":1252
* # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
* cdef int res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
* if res < 0: # <<<<<<<<<<<<<<
@@ -17141,7 +17320,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(s
*/
}
- /* "pygame/_sdl2/video.pyx":1081
+ /* "pygame/_sdl2/video.pyx":1249
*
* @draw_blend_mode.setter
* def draw_blend_mode(self, blendMode): # <<<<<<<<<<<<<<
@@ -17163,11 +17342,11 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(s
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1088
+/* "pygame/_sdl2/video.pyx":1256
*
* @property
* def draw_color(self): # <<<<<<<<<<<<<<
- * """ Color used by the drawing functions.
+ * """Get or set the color used for primitive drawing operations
* """
*/
@@ -17189,8 +17368,8 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":1091
- * """ Color used by the drawing functions.
+ /* "pygame/_sdl2/video.pyx":1259
+ * """Get or set the color used for primitive drawing operations
* """
* return self._draw_color # <<<<<<<<<<<<<<
*
@@ -17201,11 +17380,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(s
__pyx_r = ((PyObject *)__pyx_v_self->_draw_color);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1088
+ /* "pygame/_sdl2/video.pyx":1256
*
* @property
* def draw_color(self): # <<<<<<<<<<<<<<
- * """ Color used by the drawing functions.
+ * """Get or set the color used for primitive drawing operations
* """
*/
@@ -17216,12 +17395,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(s
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1094
+/* "pygame/_sdl2/video.pyx":1262
*
* @draw_color.setter
* def draw_color(self, new_value): # <<<<<<<<<<<<<<
- * """ color used by the drawing functions.
- * """
+ * # https://wiki.libsdl.org/SDL_SetRenderDrawColor
+ * self._draw_color[:] = new_value
*/
/* Python wrapper */
@@ -17254,64 +17433,64 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":1098
- * """
+ /* "pygame/_sdl2/video.pyx":1264
+ * def draw_color(self, new_value):
* # https://wiki.libsdl.org/SDL_SetRenderDrawColor
* self._draw_color[:] = new_value # <<<<<<<<<<<<<<
* cdef int res = SDL_SetRenderDrawColor(self._renderer,
* new_value[0],
*/
- if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_draw_color), __pyx_v_new_value, 0, 0, NULL, NULL, &__pyx_slice__31, 0, 0, 1) < 0) __PYX_ERR(0, 1098, __pyx_L1_error)
+ if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_draw_color), __pyx_v_new_value, 0, 0, NULL, NULL, &__pyx_slice__31, 0, 0, 1) < 0) __PYX_ERR(0, 1264, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1100
+ /* "pygame/_sdl2/video.pyx":1266
* self._draw_color[:] = new_value
* cdef int res = SDL_SetRenderDrawColor(self._renderer,
* new_value[0], # <<<<<<<<<<<<<<
* new_value[1],
* new_value[2],
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1100, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1266, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1100, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1266, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1101
+ /* "pygame/_sdl2/video.pyx":1267
* cdef int res = SDL_SetRenderDrawColor(self._renderer,
* new_value[0],
* new_value[1], # <<<<<<<<<<<<<<
* new_value[2],
* new_value[3])
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1101, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1267, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1102
+ /* "pygame/_sdl2/video.pyx":1268
* new_value[0],
* new_value[1],
* new_value[2], # <<<<<<<<<<<<<<
* new_value[3])
* if res < 0:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1102, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1268, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1103
+ /* "pygame/_sdl2/video.pyx":1269
* new_value[1],
* new_value[2],
* new_value[3]) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_5 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_5 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1269, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1099
+ /* "pygame/_sdl2/video.pyx":1265
* # https://wiki.libsdl.org/SDL_SetRenderDrawColor
* self._draw_color[:] = new_value
* cdef int res = SDL_SetRenderDrawColor(self._renderer, # <<<<<<<<<<<<<<
@@ -17320,7 +17499,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
*/
__pyx_v_res = SDL_SetRenderDrawColor(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
- /* "pygame/_sdl2/video.pyx":1104
+ /* "pygame/_sdl2/video.pyx":1270
* new_value[2],
* new_value[3])
* if res < 0: # <<<<<<<<<<<<<<
@@ -17330,14 +17509,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
__pyx_t_6 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_6)) {
- /* "pygame/_sdl2/video.pyx":1105
+ /* "pygame/_sdl2/video.pyx":1271
* new_value[3])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def clear(self):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1105, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1271, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
@@ -17351,14 +17530,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
}
__pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1105, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1105, __pyx_L1_error)
+ __PYX_ERR(0, 1271, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1104
+ /* "pygame/_sdl2/video.pyx":1270
* new_value[2],
* new_value[3])
* if res < 0: # <<<<<<<<<<<<<<
@@ -17367,12 +17546,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
*/
}
- /* "pygame/_sdl2/video.pyx":1094
+ /* "pygame/_sdl2/video.pyx":1262
*
* @draw_color.setter
* def draw_color(self, new_value): # <<<<<<<<<<<<<<
- * """ color used by the drawing functions.
- * """
+ * # https://wiki.libsdl.org/SDL_SetRenderDrawColor
+ * self._draw_color[:] = new_value
*/
/* function exit code */
@@ -17389,17 +17568,17 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1107
+/* "pygame/_sdl2/video.pyx":1273
* raise error()
*
* def clear(self): # <<<<<<<<<<<<<<
- * """ Clear the current rendering target with the drawing color.
+ * """Clear the current rendering target with the drawing color
* """
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_6clear[] = " Clear the current rendering target with the drawing color.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_6clear[] = "Clear the current rendering target with the drawing color\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -17424,7 +17603,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("clear", 0);
- /* "pygame/_sdl2/video.pyx":1111
+ /* "pygame/_sdl2/video.pyx":1277
* """
* # https://wiki.libsdl.org/SDL_RenderClear
* cdef int res = SDL_RenderClear(self._renderer) # <<<<<<<<<<<<<<
@@ -17433,7 +17612,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
*/
__pyx_v_res = SDL_RenderClear(__pyx_v_self->_renderer);
- /* "pygame/_sdl2/video.pyx":1112
+ /* "pygame/_sdl2/video.pyx":1278
* # https://wiki.libsdl.org/SDL_RenderClear
* cdef int res = SDL_RenderClear(self._renderer)
* if res < 0: # <<<<<<<<<<<<<<
@@ -17443,14 +17622,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1113
+ /* "pygame/_sdl2/video.pyx":1279
* cdef int res = SDL_RenderClear(self._renderer)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def present(self):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1113, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -17464,14 +17643,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1113, __pyx_L1_error)
+ __PYX_ERR(0, 1279, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1112
+ /* "pygame/_sdl2/video.pyx":1278
* # https://wiki.libsdl.org/SDL_RenderClear
* cdef int res = SDL_RenderClear(self._renderer)
* if res < 0: # <<<<<<<<<<<<<<
@@ -17480,11 +17659,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
*/
}
- /* "pygame/_sdl2/video.pyx":1107
+ /* "pygame/_sdl2/video.pyx":1273
* raise error()
*
* def clear(self): # <<<<<<<<<<<<<<
- * """ Clear the current rendering target with the drawing color.
+ * """Clear the current rendering target with the drawing color
* """
*/
@@ -17503,17 +17682,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1115
+/* "pygame/_sdl2/video.pyx":1281
* raise error()
*
* def present(self): # <<<<<<<<<<<<<<
- * """ Present the composed backbuffer to the screen.
+ * """Update the screen with any rendering performed since the previous call
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_8present[] = " Present the composed backbuffer to the screen.\n\n Updates the screen with any rendering performed since previous call.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_8present[] = "Update the screen with any rendering performed since the previous call\n\n Presents the composed backbuffer to the screen.\n Updates the screen with any rendering performed since the previous call.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -17530,7 +17709,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("present", 0);
- /* "pygame/_sdl2/video.pyx":1121
+ /* "pygame/_sdl2/video.pyx":1288
* """
* # https://wiki.libsdl.org/SDL_RenderPresent
* SDL_RenderPresent(self._renderer) # <<<<<<<<<<<<<<
@@ -17539,11 +17718,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_
*/
SDL_RenderPresent(__pyx_v_self->_renderer);
- /* "pygame/_sdl2/video.pyx":1115
+ /* "pygame/_sdl2/video.pyx":1281
* raise error()
*
* def present(self): # <<<<<<<<<<<<<<
- * """ Present the composed backbuffer to the screen.
+ * """Update the screen with any rendering performed since the previous call
*
*/
@@ -17554,12 +17733,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1123
+/* "pygame/_sdl2/video.pyx":1290
* SDL_RenderPresent(self._renderer)
*
* cpdef get_viewport(self): # <<<<<<<<<<<<<<
- * """ Returns the drawing area on the target.
- *
+ * """Get the drawing area on the rendering target
+ * """
*/
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
@@ -17584,7 +17763,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __p
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_viewport); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_viewport); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport)) {
__Pyx_XDECREF(__pyx_r);
@@ -17601,7 +17780,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -17622,7 +17801,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __p
#endif
}
- /* "pygame/_sdl2/video.pyx":1130
+ /* "pygame/_sdl2/video.pyx":1295
* # https://wiki.libsdl.org/SDL_RenderGetViewport
* cdef SDL_Rect rect
* SDL_RenderGetViewport(self._renderer, &rect) # <<<<<<<<<<<<<<
@@ -17631,26 +17810,26 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __p
*/
SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_rect));
- /* "pygame/_sdl2/video.pyx":1131
+ /* "pygame/_sdl2/video.pyx":1296
* cdef SDL_Rect rect
* SDL_RenderGetViewport(self._renderer, &rect)
* return pgRect_New(&rect) # <<<<<<<<<<<<<<
*
- * @property
+ * def set_viewport(self, area):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = pgRect_New((&__pyx_v_rect)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1131, __pyx_L1_error)
+ __pyx_t_1 = pgRect_New((&__pyx_v_rect)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1296, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1123
+ /* "pygame/_sdl2/video.pyx":1290
* SDL_RenderPresent(self._renderer)
*
* cpdef get_viewport(self): # <<<<<<<<<<<<<<
- * """ Returns the drawing area on the target.
- *
+ * """Get the drawing area on the rendering target
+ * """
*/
/* function exit code */
@@ -17669,7 +17848,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __p
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_10get_viewport[] = " Returns the drawing area on the target.\n\n :rtype: pygame.Rect\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_10get_viewport[] = "Get the drawing area on the rendering target\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -17690,7 +17869,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_viewport", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
+ __pyx_t_1 = __pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -17707,12 +17886,238 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1134
+/* "pygame/_sdl2/video.pyx":1298
+ * return pgRect_New(&rect)
+ *
+ * def set_viewport(self, area): # <<<<<<<<<<<<<<
+ * """Set the drawing area on the rendering target
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_12set_viewport[] = "Set the drawing area on the rendering target\n\n :param area: A :class:`pygame.Rect` or tuple representing the\n drawing area on the target, or ``None`` to use the\n entire area of the current rendering target. \n ";
+static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("set_viewport (wrapper)", 0);
+ __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_area));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area) {
+ SDL_Rect __pyx_v_tmprect;
+ SDL_Rect *__pyx_v_rectptr;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("set_viewport", 0);
+
+ /* "pygame/_sdl2/video.pyx":1306
+ * """
+ * # https://wiki.libsdl.org/SDL_RenderSetViewport
+ * if area is None: # <<<<<<<<<<<<<<
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
+ * raise error()
+ */
+ __pyx_t_1 = (__pyx_v_area == Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "pygame/_sdl2/video.pyx":1307
+ * # https://wiki.libsdl.org/SDL_RenderSetViewport
+ * if area is None:
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
+ * raise error()
+ * return
+ */
+ __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, NULL) < 0) != 0);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "pygame/_sdl2/video.pyx":1308
+ * if area is None:
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
+ * raise error() # <<<<<<<<<<<<<<
+ * return
+ *
+ */
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1308, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(0, 1308, __pyx_L1_error)
+
+ /* "pygame/_sdl2/video.pyx":1307
+ * # https://wiki.libsdl.org/SDL_RenderSetViewport
+ * if area is None:
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
+ * raise error()
+ * return
+ */
+ }
+
+ /* "pygame/_sdl2/video.pyx":1309
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
+ * raise error()
+ * return # <<<<<<<<<<<<<<
+ *
+ * cdef SDL_Rect tmprect
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+
+ /* "pygame/_sdl2/video.pyx":1306
+ * """
+ * # https://wiki.libsdl.org/SDL_RenderSetViewport
+ * if area is None: # <<<<<<<<<<<<<<
+ * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
+ * raise error()
+ */
+ }
+
+ /* "pygame/_sdl2/video.pyx":1312
+ *
+ * cdef SDL_Rect tmprect
+ * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect) # <<<<<<<<<<<<<<
+ * if rectptr == NULL:
+ * raise TypeError('expected a rectangle')
+ */
+ __pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_tmprect));
+
+ /* "pygame/_sdl2/video.pyx":1313
+ * cdef SDL_Rect tmprect
+ * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
+ * if rectptr == NULL: # <<<<<<<<<<<<<<
+ * raise TypeError('expected a rectangle')
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_rectptr == NULL) != 0);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "pygame/_sdl2/video.pyx":1314
+ * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
+ * if rectptr == NULL:
+ * raise TypeError('expected a rectangle') # <<<<<<<<<<<<<<
+ *
+ * if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
+ */
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(0, 1314, __pyx_L1_error)
+
+ /* "pygame/_sdl2/video.pyx":1313
+ * cdef SDL_Rect tmprect
+ * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
+ * if rectptr == NULL: # <<<<<<<<<<<<<<
+ * raise TypeError('expected a rectangle')
+ *
+ */
+ }
+
+ /* "pygame/_sdl2/video.pyx":1316
+ * raise TypeError('expected a rectangle')
+ *
+ * if SDL_RenderSetViewport(self._renderer, rectptr) < 0: # <<<<<<<<<<<<<<
+ * raise error()
+ *
+ */
+ __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, __pyx_v_rectptr) < 0) != 0);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "pygame/_sdl2/video.pyx":1317
+ *
+ * if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
+ * raise error() # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = NULL;
+ if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(0, 1317, __pyx_L1_error)
+
+ /* "pygame/_sdl2/video.pyx":1316
+ * raise TypeError('expected a rectangle')
+ *
+ * if SDL_RenderSetViewport(self._renderer, rectptr) < 0: # <<<<<<<<<<<<<<
+ * raise error()
+ *
+ */
+ }
+
+ /* "pygame/_sdl2/video.pyx":1298
+ * return pgRect_New(&rect)
+ *
+ * def set_viewport(self, area): # <<<<<<<<<<<<<<
+ * """Set the drawing area on the rendering target
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("pygame._sdl2.video.Renderer.set_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "pygame/_sdl2/video.pyx":1320
*
* @property
* def logical_size(self): # <<<<<<<<<<<<<<
- * cdef int w
- * cdef int h
+ * """Get or set the logical Renderer size (a device independent resolution for rendering)
+ * """
*/
/* Python wrapper */
@@ -17741,7 +18146,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":1137
+ /* "pygame/_sdl2/video.pyx":1325
* cdef int w
* cdef int h
* SDL_RenderGetLogicalSize(self._renderer, &w, &h) # <<<<<<<<<<<<<<
@@ -17750,7 +18155,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__
*/
SDL_RenderGetLogicalSize(__pyx_v_self->_renderer, (&__pyx_v_w), (&__pyx_v_h));
- /* "pygame/_sdl2/video.pyx":1138
+ /* "pygame/_sdl2/video.pyx":1326
* cdef int h
* SDL_RenderGetLogicalSize(self._renderer, &w, &h)
* return (w, h) # <<<<<<<<<<<<<<
@@ -17758,11 +18163,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__
* @logical_size.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
@@ -17774,12 +18179,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1134
+ /* "pygame/_sdl2/video.pyx":1320
*
* @property
* def logical_size(self): # <<<<<<<<<<<<<<
- * cdef int w
- * cdef int h
+ * """Get or set the logical Renderer size (a device independent resolution for rendering)
+ * """
*/
/* function exit code */
@@ -17795,7 +18200,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1141
+/* "pygame/_sdl2/video.pyx":1329
*
* @logical_size.setter
* def logical_size(self, size): # <<<<<<<<<<<<<<
@@ -17831,33 +18236,33 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(stru
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":1142
+ /* "pygame/_sdl2/video.pyx":1330
* @logical_size.setter
* def logical_size(self, size):
* cdef int w = size[0] # <<<<<<<<<<<<<<
* cdef int h = size[1]
* if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1142, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1330, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_w = __pyx_t_2;
- /* "pygame/_sdl2/video.pyx":1143
+ /* "pygame/_sdl2/video.pyx":1331
* def logical_size(self, size):
* cdef int w = size[0]
* cdef int h = size[1] # <<<<<<<<<<<<<<
* if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1143, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1331, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_h = __pyx_t_2;
- /* "pygame/_sdl2/video.pyx":1144
+ /* "pygame/_sdl2/video.pyx":1332
* cdef int w = size[0]
* cdef int h = size[1]
* if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0): # <<<<<<<<<<<<<<
@@ -17867,14 +18272,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(stru
__pyx_t_3 = ((SDL_RenderSetLogicalSize(__pyx_v_self->_renderer, __pyx_v_w, __pyx_v_h) != 0) != 0);
if (unlikely(__pyx_t_3)) {
- /* "pygame/_sdl2/video.pyx":1145
+ /* "pygame/_sdl2/video.pyx":1333
* cdef int h = size[1]
* if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
* raise error() # <<<<<<<<<<<<<<
*
* @property
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1145, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -17888,14 +18293,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(stru
}
__pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1145, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1145, __pyx_L1_error)
+ __PYX_ERR(0, 1333, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1144
+ /* "pygame/_sdl2/video.pyx":1332
* cdef int w = size[0]
* cdef int h = size[1]
* if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0): # <<<<<<<<<<<<<<
@@ -17904,7 +18309,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(stru
*/
}
- /* "pygame/_sdl2/video.pyx":1141
+ /* "pygame/_sdl2/video.pyx":1329
*
* @logical_size.setter
* def logical_size(self, size): # <<<<<<<<<<<<<<
@@ -17926,12 +18331,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(stru
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1148
+/* "pygame/_sdl2/video.pyx":1336
*
* @property
* def scale(self): # <<<<<<<<<<<<<<
- * cdef float x
- * cdef float y
+ * """Get the drawing scale for the current rendering target
+ * """
*/
/* Python wrapper */
@@ -17960,7 +18365,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":1151
+ /* "pygame/_sdl2/video.pyx":1341
* cdef float x
* cdef float y
* SDL_RenderGetScale(self._renderer, &x, &y) # <<<<<<<<<<<<<<
@@ -17969,7 +18374,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct
*/
SDL_RenderGetScale(__pyx_v_self->_renderer, (&__pyx_v_x), (&__pyx_v_y));
- /* "pygame/_sdl2/video.pyx":1152
+ /* "pygame/_sdl2/video.pyx":1342
* cdef float y
* SDL_RenderGetScale(self._renderer, &x, &y)
* return (x, y) # <<<<<<<<<<<<<<
@@ -17977,11 +18382,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct
* @scale.setter
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1152, __pyx_L1_error)
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1152, __pyx_L1_error)
+ __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
@@ -17993,12 +18398,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1148
+ /* "pygame/_sdl2/video.pyx":1336
*
* @property
* def scale(self): # <<<<<<<<<<<<<<
- * cdef float x
- * cdef float y
+ * """Get the drawing scale for the current rendering target
+ * """
*/
/* function exit code */
@@ -18014,7 +18419,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1155
+/* "pygame/_sdl2/video.pyx":1345
*
* @scale.setter
* def scale(self, scale): # <<<<<<<<<<<<<<
@@ -18050,33 +18455,33 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":1156
+ /* "pygame/_sdl2/video.pyx":1346
* @scale.setter
* def scale(self, scale):
* cdef float x = scale[0] # <<<<<<<<<<<<<<
* cdef float y = scale[1]
* if (SDL_RenderSetScale(self._renderer, x, y) != 0):
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1156, __pyx_L1_error)
+ __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1346, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_x = __pyx_t_2;
- /* "pygame/_sdl2/video.pyx":1157
+ /* "pygame/_sdl2/video.pyx":1347
* def scale(self, scale):
* cdef float x = scale[0]
* cdef float y = scale[1] # <<<<<<<<<<<<<<
* if (SDL_RenderSetScale(self._renderer, x, y) != 0):
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L1_error)
+ __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1347, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_y = __pyx_t_2;
- /* "pygame/_sdl2/video.pyx":1158
+ /* "pygame/_sdl2/video.pyx":1348
* cdef float x = scale[0]
* cdef float y = scale[1]
* if (SDL_RenderSetScale(self._renderer, x, y) != 0): # <<<<<<<<<<<<<<
@@ -18086,239 +18491,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx
__pyx_t_3 = ((SDL_RenderSetScale(__pyx_v_self->_renderer, __pyx_v_x, __pyx_v_y) != 0) != 0);
if (unlikely(__pyx_t_3)) {
- /* "pygame/_sdl2/video.pyx":1159
- * cdef float y = scale[1]
- * if (SDL_RenderSetScale(self._renderer, x, y) != 0):
- * raise error() # <<<<<<<<<<<<<<
- *
- * # TODO ifdef
- */
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1159, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
- __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
- if (likely(__pyx_t_5)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_5);
- __Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_4, function);
- }
- }
- __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1159, __pyx_L1_error)
-
- /* "pygame/_sdl2/video.pyx":1158
- * cdef float x = scale[0]
- * cdef float y = scale[1]
- * if (SDL_RenderSetScale(self._renderer, x, y) != 0): # <<<<<<<<<<<<<<
- * raise error()
- *
- */
- }
-
- /* "pygame/_sdl2/video.pyx":1155
- *
- * @scale.setter
- * def scale(self, scale): # <<<<<<<<<<<<<<
- * cdef float x = scale[0]
+ /* "pygame/_sdl2/video.pyx":1349
* cdef float y = scale[1]
- */
-
- /* function exit code */
- __pyx_r = 0;
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("pygame._sdl2.video.Renderer.scale.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = -1;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "pygame/_sdl2/video.pyx":1165
- * # return SDL_RenderGetIntegerScale(self._renderer)
- *
- * def set_viewport(self, area): # <<<<<<<<<<<<<<
- * """ Set the drawing area on the target.
- * If this is set to ``None``, the entire target will be used.
- */
-
-/* Python wrapper */
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_12set_viewport[] = " Set the drawing area on the target.\n If this is set to ``None``, the entire target will be used.\n\n :param area: A ``pygame.Rect`` or tuple representing the\n drawing area on the target, or None.\n ";
-static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area) {
- PyObject *__pyx_r = 0;
- __Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("set_viewport (wrapper)", 0);
- __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_area));
-
- /* function exit code */
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area) {
- SDL_Rect __pyx_v_tmprect;
- SDL_Rect *__pyx_v_rectptr;
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannyDeclarations
- int __pyx_t_1;
- int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("set_viewport", 0);
-
- /* "pygame/_sdl2/video.pyx":1173
- * """
- * # https://wiki.libsdl.org/SDL_RenderSetViewport
- * if area is None: # <<<<<<<<<<<<<<
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
- * raise error()
- */
- __pyx_t_1 = (__pyx_v_area == Py_None);
- __pyx_t_2 = (__pyx_t_1 != 0);
- if (__pyx_t_2) {
-
- /* "pygame/_sdl2/video.pyx":1174
- * # https://wiki.libsdl.org/SDL_RenderSetViewport
- * if area is None:
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
- * raise error()
- * return
- */
- __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, NULL) < 0) != 0);
- if (unlikely(__pyx_t_2)) {
-
- /* "pygame/_sdl2/video.pyx":1175
- * if area is None:
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
- * raise error() # <<<<<<<<<<<<<<
- * return
- *
- */
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1175, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = NULL;
- if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
- __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
- if (likely(__pyx_t_5)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_5);
- __Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_4, function);
- }
- }
- __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1175, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1175, __pyx_L1_error)
-
- /* "pygame/_sdl2/video.pyx":1174
- * # https://wiki.libsdl.org/SDL_RenderSetViewport
- * if area is None:
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
- * raise error()
- * return
- */
- }
-
- /* "pygame/_sdl2/video.pyx":1176
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
- * raise error()
- * return # <<<<<<<<<<<<<<
- *
- * cdef SDL_Rect tmprect
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
-
- /* "pygame/_sdl2/video.pyx":1173
- * """
- * # https://wiki.libsdl.org/SDL_RenderSetViewport
- * if area is None: # <<<<<<<<<<<<<<
- * if SDL_RenderSetViewport(self._renderer, NULL) < 0:
- * raise error()
- */
- }
-
- /* "pygame/_sdl2/video.pyx":1179
- *
- * cdef SDL_Rect tmprect
- * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect) # <<<<<<<<<<<<<<
- * if rectptr == NULL:
- * raise TypeError('expected a rectangle')
- */
- __pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_tmprect));
-
- /* "pygame/_sdl2/video.pyx":1180
- * cdef SDL_Rect tmprect
- * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
- * if rectptr == NULL: # <<<<<<<<<<<<<<
- * raise TypeError('expected a rectangle')
- *
- */
- __pyx_t_2 = ((__pyx_v_rectptr == NULL) != 0);
- if (unlikely(__pyx_t_2)) {
-
- /* "pygame/_sdl2/video.pyx":1181
- * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
- * if rectptr == NULL:
- * raise TypeError('expected a rectangle') # <<<<<<<<<<<<<<
- *
- * if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
- */
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1181, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1181, __pyx_L1_error)
-
- /* "pygame/_sdl2/video.pyx":1180
- * cdef SDL_Rect tmprect
- * cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
- * if rectptr == NULL: # <<<<<<<<<<<<<<
- * raise TypeError('expected a rectangle')
- *
- */
- }
-
- /* "pygame/_sdl2/video.pyx":1183
- * raise TypeError('expected a rectangle')
- *
- * if SDL_RenderSetViewport(self._renderer, rectptr) < 0: # <<<<<<<<<<<<<<
- * raise error()
- *
- */
- __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, __pyx_v_rectptr) < 0) != 0);
- if (unlikely(__pyx_t_2)) {
-
- /* "pygame/_sdl2/video.pyx":1184
- *
- * if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
+ * if (SDL_RenderSetScale(self._renderer, x, y) != 0):
* raise error() # <<<<<<<<<<<<<<
*
- *
+ * # TODO ifdef
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1184, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1349, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -18330,52 +18510,51 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
- __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
+ __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1184, __pyx_L1_error)
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __PYX_ERR(0, 1349, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1183
- * raise TypeError('expected a rectangle')
- *
- * if SDL_RenderSetViewport(self._renderer, rectptr) < 0: # <<<<<<<<<<<<<<
+ /* "pygame/_sdl2/video.pyx":1348
+ * cdef float x = scale[0]
+ * cdef float y = scale[1]
+ * if (SDL_RenderSetScale(self._renderer, x, y) != 0): # <<<<<<<<<<<<<<
* raise error()
*
*/
}
- /* "pygame/_sdl2/video.pyx":1165
- * # return SDL_RenderGetIntegerScale(self._renderer)
+ /* "pygame/_sdl2/video.pyx":1345
*
- * def set_viewport(self, area): # <<<<<<<<<<<<<<
- * """ Set the drawing area on the target.
- * If this is set to ``None``, the entire target will be used.
+ * @scale.setter
+ * def scale(self, scale): # <<<<<<<<<<<<<<
+ * cdef float x = scale[0]
+ * cdef float y = scale[1]
*/
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("pygame._sdl2.video.Renderer.set_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
+ __Pyx_AddTraceback("pygame._sdl2.video.Renderer.scale.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
__pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1188
+/* "pygame/_sdl2/video.pyx":1356
*
* @property
* def target(self): # <<<<<<<<<<<<<<
- * """ The current render target. Set to ``None`` for the default target.
+ * """`Get or set the current rendering target
*
*/
@@ -18397,7 +18576,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
- /* "pygame/_sdl2/video.pyx":1194
+ /* "pygame/_sdl2/video.pyx":1364
* """
* # https://wiki.libsdl.org/SDL_GetRenderTarget
* return self._target # <<<<<<<<<<<<<<
@@ -18409,11 +18588,11 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct
__pyx_r = ((PyObject *)__pyx_v_self->_target);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1188
+ /* "pygame/_sdl2/video.pyx":1356
*
* @property
* def target(self): # <<<<<<<<<<<<<<
- * """ The current render target. Set to ``None`` for the default target.
+ * """`Get or set the current rendering target
*
*/
@@ -18424,7 +18603,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1197
+/* "pygame/_sdl2/video.pyx":1367
*
* @target.setter
* def target(self, newtarget): # <<<<<<<<<<<<<<
@@ -18458,7 +18637,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "pygame/_sdl2/video.pyx":1199
+ /* "pygame/_sdl2/video.pyx":1369
* def target(self, newtarget):
* # https://wiki.libsdl.org/SDL_SetRenderTarget
* if newtarget is None: # <<<<<<<<<<<<<<
@@ -18469,7 +18648,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":1200
+ /* "pygame/_sdl2/video.pyx":1370
* # https://wiki.libsdl.org/SDL_SetRenderTarget
* if newtarget is None:
* self._target = None # <<<<<<<<<<<<<<
@@ -18482,7 +18661,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
__Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
__pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
- /* "pygame/_sdl2/video.pyx":1201
+ /* "pygame/_sdl2/video.pyx":1371
* if newtarget is None:
* self._target = None
* if SDL_SetRenderTarget(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
@@ -18492,14 +18671,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
__pyx_t_2 = ((SDL_SetRenderTarget(__pyx_v_self->_renderer, NULL) < 0) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1202
+ /* "pygame/_sdl2/video.pyx":1372
* self._target = None
* if SDL_SetRenderTarget(self._renderer, NULL) < 0:
* raise error() # <<<<<<<<<<<<<<
* elif isinstance(newtarget, Texture):
* self._target = newtarget
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1202, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1372, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -18513,14 +18692,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1202, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1372, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1202, __pyx_L1_error)
+ __PYX_ERR(0, 1372, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1201
+ /* "pygame/_sdl2/video.pyx":1371
* if newtarget is None:
* self._target = None
* if SDL_SetRenderTarget(self._renderer, NULL) < 0: # <<<<<<<<<<<<<<
@@ -18529,7 +18708,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
*/
}
- /* "pygame/_sdl2/video.pyx":1199
+ /* "pygame/_sdl2/video.pyx":1369
* def target(self, newtarget):
* # https://wiki.libsdl.org/SDL_SetRenderTarget
* if newtarget is None: # <<<<<<<<<<<<<<
@@ -18539,7 +18718,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":1203
+ /* "pygame/_sdl2/video.pyx":1373
* if SDL_SetRenderTarget(self._renderer, NULL) < 0:
* raise error()
* elif isinstance(newtarget, Texture): # <<<<<<<<<<<<<<
@@ -18550,14 +18729,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
__pyx_t_1 = (__pyx_t_2 != 0);
if (likely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1204
+ /* "pygame/_sdl2/video.pyx":1374
* raise error()
* elif isinstance(newtarget, Texture):
* self._target = newtarget # <<<<<<<<<<<<<<
* if SDL_SetRenderTarget(self._renderer,
* self._target._tex) < 0:
*/
- if (!(likely(((__pyx_v_newtarget) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_newtarget, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 1204, __pyx_L1_error)
+ if (!(likely(((__pyx_v_newtarget) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_newtarget, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 1374, __pyx_L1_error)
__pyx_t_3 = __pyx_v_newtarget;
__Pyx_INCREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
@@ -18566,7 +18745,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
__pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":1206
+ /* "pygame/_sdl2/video.pyx":1376
* self._target = newtarget
* if SDL_SetRenderTarget(self._renderer,
* self._target._tex) < 0: # <<<<<<<<<<<<<<
@@ -18575,7 +18754,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
*/
__pyx_t_1 = ((SDL_SetRenderTarget(__pyx_v_self->_renderer, __pyx_v_self->_target->_tex) < 0) != 0);
- /* "pygame/_sdl2/video.pyx":1205
+ /* "pygame/_sdl2/video.pyx":1375
* elif isinstance(newtarget, Texture):
* self._target = newtarget
* if SDL_SetRenderTarget(self._renderer, # <<<<<<<<<<<<<<
@@ -18584,14 +18763,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
*/
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1207
+ /* "pygame/_sdl2/video.pyx":1377
* if SDL_SetRenderTarget(self._renderer,
* self._target._tex) < 0:
* raise error() # <<<<<<<<<<<<<<
* else:
* raise TypeError('target must be a Texture or None')
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1377, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -18605,14 +18784,14 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1207, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1377, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1207, __pyx_L1_error)
+ __PYX_ERR(0, 1377, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1205
+ /* "pygame/_sdl2/video.pyx":1375
* elif isinstance(newtarget, Texture):
* self._target = newtarget
* if SDL_SetRenderTarget(self._renderer, # <<<<<<<<<<<<<<
@@ -18621,7 +18800,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
*/
}
- /* "pygame/_sdl2/video.pyx":1203
+ /* "pygame/_sdl2/video.pyx":1373
* if SDL_SetRenderTarget(self._renderer, NULL) < 0:
* raise error()
* elif isinstance(newtarget, Texture): # <<<<<<<<<<<<<<
@@ -18631,7 +18810,7 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":1209
+ /* "pygame/_sdl2/video.pyx":1379
* raise error()
* else:
* raise TypeError('target must be a Texture or None') # <<<<<<<<<<<<<<
@@ -18639,15 +18818,15 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
* cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):
*/
/*else*/ {
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1209, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1379, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1209, __pyx_L1_error)
+ __PYX_ERR(0, 1379, __pyx_L1_error)
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":1197
+ /* "pygame/_sdl2/video.pyx":1367
*
* @target.setter
* def target(self, newtarget): # <<<<<<<<<<<<<<
@@ -18669,12 +18848,12 @@ static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __py
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1211
+/* "pygame/_sdl2/video.pyx":1381
* raise TypeError('target must be a Texture or None')
*
* cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0): # <<<<<<<<<<<<<<
- * """ Only for compatibility.
- * Textures created by different Renderers cannot shared with each other!
+ * """Draw textures using a Surface-like API
+ *
*/
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
@@ -18719,11 +18898,11 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit)) {
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_special_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_special_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
@@ -18741,7 +18920,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_4)) {
PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_source, ((PyObject *)__pyx_v_dest), ((PyObject *)__pyx_v_area), __pyx_t_3};
- __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -18750,14 +18929,14 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_source, ((PyObject *)__pyx_v_dest), ((PyObject *)__pyx_v_area), __pyx_t_3};
- __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else
#endif
{
- __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
if (__pyx_t_5) {
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
@@ -18774,7 +18953,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
@@ -18797,8 +18976,8 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
#endif
}
- /* "pygame/_sdl2/video.pyx":1219
- * :param special_flags: have no effect at this moment.
+ /* "pygame/_sdl2/video.pyx":1394
+ * .. note:: Textures created by different Renderers cannot shared with each other!
* """
* if isinstance(source, Texture): # <<<<<<<<<<<<<<
* (source).draw(area, dest)
@@ -18808,7 +18987,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__pyx_t_9 = (__pyx_t_8 != 0);
if (__pyx_t_9) {
- /* "pygame/_sdl2/video.pyx":1220
+ /* "pygame/_sdl2/video.pyx":1395
* """
* if isinstance(source, Texture):
* (source).draw(area, dest) # <<<<<<<<<<<<<<
@@ -18820,8 +18999,8 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__pyx_t_10.dstrect = ((PyObject *)__pyx_v_dest);
((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_source)->__pyx_vtab)->draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_source), 0, &__pyx_t_10);
- /* "pygame/_sdl2/video.pyx":1219
- * :param special_flags: have no effect at this moment.
+ /* "pygame/_sdl2/video.pyx":1394
+ * .. note:: Textures created by different Renderers cannot shared with each other!
* """
* if isinstance(source, Texture): # <<<<<<<<<<<<<<
* (source).draw(area, dest)
@@ -18830,7 +19009,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":1221
+ /* "pygame/_sdl2/video.pyx":1396
* if isinstance(source, Texture):
* (source).draw(area, dest)
* elif isinstance(source, Image): # <<<<<<<<<<<<<<
@@ -18841,7 +19020,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__pyx_t_8 = (__pyx_t_9 != 0);
if (__pyx_t_8) {
- /* "pygame/_sdl2/video.pyx":1222
+ /* "pygame/_sdl2/video.pyx":1397
* (source).draw(area, dest)
* elif isinstance(source, Image):
* (source).draw(area, dest) # <<<<<<<<<<<<<<
@@ -18853,7 +19032,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__pyx_t_11.dstrect = ((PyObject *)__pyx_v_dest);
((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image *)((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_source)->__pyx_vtab)->draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_source), 0, &__pyx_t_11);
- /* "pygame/_sdl2/video.pyx":1221
+ /* "pygame/_sdl2/video.pyx":1396
* if isinstance(source, Texture):
* (source).draw(area, dest)
* elif isinstance(source, Image): # <<<<<<<<<<<<<<
@@ -18863,31 +19042,31 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":1223
+ /* "pygame/_sdl2/video.pyx":1398
* elif isinstance(source, Image):
* (source).draw(area, dest)
* elif not hasattr(source, 'draw'): # <<<<<<<<<<<<<<
* raise TypeError('source must be drawable')
* else:
*/
- __pyx_t_8 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1223, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1398, __pyx_L1_error)
__pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
if (unlikely(__pyx_t_9)) {
- /* "pygame/_sdl2/video.pyx":1224
+ /* "pygame/_sdl2/video.pyx":1399
* (source).draw(area, dest)
* elif not hasattr(source, 'draw'):
* raise TypeError('source must be drawable') # <<<<<<<<<<<<<<
* else:
* source.draw(area, dest)
*/
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1224, __pyx_L1_error)
+ __PYX_ERR(0, 1399, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1223
+ /* "pygame/_sdl2/video.pyx":1398
* elif isinstance(source, Image):
* (source).draw(area, dest)
* elif not hasattr(source, 'draw'): # <<<<<<<<<<<<<<
@@ -18896,7 +19075,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
*/
}
- /* "pygame/_sdl2/video.pyx":1226
+ /* "pygame/_sdl2/video.pyx":1401
* raise TypeError('source must be drawable')
* else:
* source.draw(area, dest) # <<<<<<<<<<<<<<
@@ -18904,7 +19083,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
* if not dest:
*/
/*else*/ {
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = NULL;
__pyx_t_6 = 0;
@@ -18921,7 +19100,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_2)) {
PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_area), ((PyObject *)__pyx_v_dest)};
- __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_GOTREF(__pyx_t_1);
} else
@@ -18929,13 +19108,13 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_area), ((PyObject *)__pyx_v_dest)};
- __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_GOTREF(__pyx_t_1);
} else
#endif
{
- __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1226, __pyx_L1_error)
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
if (__pyx_t_4) {
__Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
@@ -18946,7 +19125,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__Pyx_INCREF(((PyObject *)__pyx_v_dest));
__Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_dest));
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
@@ -18955,18 +19134,18 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":1228
+ /* "pygame/_sdl2/video.pyx":1403
* source.draw(area, dest)
*
* if not dest: # <<<<<<<<<<<<<<
* return self.get_viewport()
* return dest
*/
- __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dest)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1228, __pyx_L1_error)
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dest)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1403, __pyx_L1_error)
__pyx_t_8 = ((!__pyx_t_9) != 0);
if (__pyx_t_8) {
- /* "pygame/_sdl2/video.pyx":1229
+ /* "pygame/_sdl2/video.pyx":1404
*
* if not dest:
* return self.get_viewport() # <<<<<<<<<<<<<<
@@ -18974,13 +19153,13 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self->__pyx_vtab)->get_viewport(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
+ __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self->__pyx_vtab)->get_viewport(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1404, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1228
+ /* "pygame/_sdl2/video.pyx":1403
* source.draw(area, dest)
*
* if not dest: # <<<<<<<<<<<<<<
@@ -18989,7 +19168,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
*/
}
- /* "pygame/_sdl2/video.pyx":1230
+ /* "pygame/_sdl2/video.pyx":1405
* if not dest:
* return self.get_viewport()
* return dest # <<<<<<<<<<<<<<
@@ -19001,12 +19180,12 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
__pyx_r = ((PyObject *)__pyx_v_dest);
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1211
+ /* "pygame/_sdl2/video.pyx":1381
* raise TypeError('target must be a Texture or None')
*
* cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0): # <<<<<<<<<<<<<<
- * """ Only for compatibility.
- * Textures created by different Renderers cannot shared with each other!
+ * """Draw textures using a Surface-like API
+ *
*/
/* function exit code */
@@ -19027,7 +19206,7 @@ static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_14blit[] = " Only for compatibility.\n Textures created by different Renderers cannot shared with each other!\n :param source: A Texture or Image to draw.\n :param dest: destination on the render target.\n :param area: the portion of source texture.\n :param special_flags: have no effect at this moment.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_14blit[] = "Draw textures using a Surface-like API\n\n For compatibility purposes. Draws :class:`Texture` objects onto the\n Renderer using a method signature similar to :meth:`pygame.Surface.blit`.\n\n :param source: A :class:`Texture` or :class:`Image` to draw.\n :param dest: The drawing destination on the rendering target.\n :param area: The portion of the source texture or image to draw from.\n :param special_flags: have no effect at this moment.\n\n .. note:: Textures created by different Renderers cannot shared with each other!\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_source = 0;
pgRectObject *__pyx_v_dest = 0;
@@ -19084,7 +19263,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blit") < 0)) __PYX_ERR(0, 1211, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blit") < 0)) __PYX_ERR(0, 1381, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -19103,21 +19282,21 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx
__pyx_v_dest = ((pgRectObject *)values[1]);
__pyx_v_area = ((pgRectObject *)values[2]);
if (values[3]) {
- __pyx_v_special_flags = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_special_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1211, __pyx_L3_error)
+ __pyx_v_special_flags = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_special_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1381, __pyx_L3_error)
} else {
__pyx_v_special_flags = ((int)0);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("blit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1211, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("blit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1381, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "dest", 0))) __PYX_ERR(0, 1211, __pyx_L1_error)
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_area), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "area", 0))) __PYX_ERR(0, 1211, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "dest", 0))) __PYX_ERR(0, 1381, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_area), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "area", 0))) __PYX_ERR(0, 1381, __pyx_L1_error)
__pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_source, __pyx_v_dest, __pyx_v_area, __pyx_v_special_flags);
/* function exit code */
@@ -19143,7 +19322,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_ob
__pyx_t_2.dest = __pyx_v_dest;
__pyx_t_2.area = __pyx_v_area;
__pyx_t_2.special_flags = __pyx_v_special_flags;
- __pyx_t_1 = __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer->blit(__pyx_v_self, __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L1_error)
+ __pyx_t_1 = __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer->blit(__pyx_v_self, __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -19160,16 +19339,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_ob
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1232
+/* "pygame/_sdl2/video.pyx":1407
* return dest
*
* def draw_line(self, p1, p2): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawLine
- * cdef int res = SDL_RenderDrawLine(self._renderer,
+ * """Draw a line
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_16draw_line[] = "Draw a line\n\n :param p1: The line start point.\n :param p2: The line end point.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_p1 = 0;
PyObject *__pyx_v_p2 = 0;
@@ -19202,11 +19382,11 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, 1); __PYX_ERR(0, 1232, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, 1); __PYX_ERR(0, 1407, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_line") < 0)) __PYX_ERR(0, 1232, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_line") < 0)) __PYX_ERR(0, 1407, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -19219,7 +19399,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1232, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1407, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -19249,40 +19429,40 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_line", 0);
- /* "pygame/_sdl2/video.pyx":1235
+ /* "pygame/_sdl2/video.pyx":1415
* # https://wiki.libsdl.org/SDL_RenderDrawLine
* cdef int res = SDL_RenderDrawLine(self._renderer,
* p1[0], p1[1], # <<<<<<<<<<<<<<
* p2[0], p2[1])
* if res < 0:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1235, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1415, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1235, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1415, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1236
+ /* "pygame/_sdl2/video.pyx":1416
* cdef int res = SDL_RenderDrawLine(self._renderer,
* p1[0], p1[1],
* p2[0], p2[1]) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1236, __pyx_L1_error)
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1416, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1236, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1416, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1234
- * def draw_line(self, p1, p2):
+ /* "pygame/_sdl2/video.pyx":1414
+ * """
* # https://wiki.libsdl.org/SDL_RenderDrawLine
* cdef int res = SDL_RenderDrawLine(self._renderer, # <<<<<<<<<<<<<<
* p1[0], p1[1],
@@ -19290,7 +19470,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
*/
__pyx_v_res = SDL_RenderDrawLine(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
- /* "pygame/_sdl2/video.pyx":1237
+ /* "pygame/_sdl2/video.pyx":1417
* p1[0], p1[1],
* p2[0], p2[1])
* if res < 0: # <<<<<<<<<<<<<<
@@ -19300,14 +19480,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
__pyx_t_6 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_6)) {
- /* "pygame/_sdl2/video.pyx":1238
+ /* "pygame/_sdl2/video.pyx":1418
* p2[0], p2[1])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def draw_point(self, point):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1238, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1418, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
@@ -19321,14 +19501,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
}
__pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1238, __pyx_L1_error)
+ __PYX_ERR(0, 1418, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1237
+ /* "pygame/_sdl2/video.pyx":1417
* p1[0], p1[1],
* p2[0], p2[1])
* if res < 0: # <<<<<<<<<<<<<<
@@ -19337,12 +19517,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1232
+ /* "pygame/_sdl2/video.pyx":1407
* return dest
*
* def draw_line(self, p1, p2): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawLine
- * cdef int res = SDL_RenderDrawLine(self._renderer,
+ * """Draw a line
+ *
*/
/* function exit code */
@@ -19360,16 +19540,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1240
+/* "pygame/_sdl2/video.pyx":1420
* raise error()
*
* def draw_point(self, point): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawPoint
- * cdef int res = SDL_RenderDrawPoint(self._renderer,
+ * """Draw a point
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point(PyObject *__pyx_v_self, PyObject *__pyx_v_point); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_18draw_point[] = "Draw a point\n\n :param point: The point's coordinate.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point(PyObject *__pyx_v_self, PyObject *__pyx_v_point) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -19396,24 +19577,24 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_point", 0);
- /* "pygame/_sdl2/video.pyx":1243
+ /* "pygame/_sdl2/video.pyx":1427
* # https://wiki.libsdl.org/SDL_RenderDrawPoint
* cdef int res = SDL_RenderDrawPoint(self._renderer,
* point[0], point[1]) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1243, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1427, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1243, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1427, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1242
- * def draw_point(self, point):
+ /* "pygame/_sdl2/video.pyx":1426
+ * """
* # https://wiki.libsdl.org/SDL_RenderDrawPoint
* cdef int res = SDL_RenderDrawPoint(self._renderer, # <<<<<<<<<<<<<<
* point[0], point[1])
@@ -19421,7 +19602,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
*/
__pyx_v_res = SDL_RenderDrawPoint(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3);
- /* "pygame/_sdl2/video.pyx":1244
+ /* "pygame/_sdl2/video.pyx":1428
* cdef int res = SDL_RenderDrawPoint(self._renderer,
* point[0], point[1])
* if res < 0: # <<<<<<<<<<<<<<
@@ -19431,14 +19612,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
__pyx_t_4 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_4)) {
- /* "pygame/_sdl2/video.pyx":1245
+ /* "pygame/_sdl2/video.pyx":1429
* point[0], point[1])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def draw_rect(self, rect):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1429, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -19452,14 +19633,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
}
__pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1245, __pyx_L1_error)
+ __PYX_ERR(0, 1429, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1244
+ /* "pygame/_sdl2/video.pyx":1428
* cdef int res = SDL_RenderDrawPoint(self._renderer,
* point[0], point[1])
* if res < 0: # <<<<<<<<<<<<<<
@@ -19468,12 +19649,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1240
+ /* "pygame/_sdl2/video.pyx":1420
* raise error()
*
* def draw_point(self, point): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawPoint
- * cdef int res = SDL_RenderDrawPoint(self._renderer,
+ * """Draw a point
+ *
*/
/* function exit code */
@@ -19491,16 +19672,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1247
+/* "pygame/_sdl2/video.pyx":1431
* raise error()
*
* def draw_rect(self, rect): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawRect
- * cdef SDL_Rect _rect
+ * """Draw a rectangle outline
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_20draw_rect[] = "Draw a rectangle outline\n\n :param rect: The :class:`Rect`-like rectangle to draw.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -19527,7 +19709,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_rect", 0);
- /* "pygame/_sdl2/video.pyx":1250
+ /* "pygame/_sdl2/video.pyx":1438
* # https://wiki.libsdl.org/SDL_RenderDrawRect
* cdef SDL_Rect _rect
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect) # <<<<<<<<<<<<<<
@@ -19536,7 +19718,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
*/
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_rect, (&__pyx_v__rect));
- /* "pygame/_sdl2/video.pyx":1252
+ /* "pygame/_sdl2/video.pyx":1440
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
*
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -19546,20 +19728,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
__pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1253
+ /* "pygame/_sdl2/video.pyx":1441
*
* if rectptr == NULL:
* raise TypeError('expected a rectangle') # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderDrawRect(self._renderer, rectptr)
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1441, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1253, __pyx_L1_error)
+ __PYX_ERR(0, 1441, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1252
+ /* "pygame/_sdl2/video.pyx":1440
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
*
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -19568,7 +19750,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1255
+ /* "pygame/_sdl2/video.pyx":1443
* raise TypeError('expected a rectangle')
*
* cdef int res = SDL_RenderDrawRect(self._renderer, rectptr) # <<<<<<<<<<<<<<
@@ -19577,7 +19759,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
*/
__pyx_v_res = SDL_RenderDrawRect(__pyx_v_self->_renderer, __pyx_v_rectptr);
- /* "pygame/_sdl2/video.pyx":1256
+ /* "pygame/_sdl2/video.pyx":1444
*
* cdef int res = SDL_RenderDrawRect(self._renderer, rectptr)
* if res < 0: # <<<<<<<<<<<<<<
@@ -19587,14 +19769,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1257
+ /* "pygame/_sdl2/video.pyx":1445
* cdef int res = SDL_RenderDrawRect(self._renderer, rectptr)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def fill_rect(self, rect):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1257, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -19608,14 +19790,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1257, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1257, __pyx_L1_error)
+ __PYX_ERR(0, 1445, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1256
+ /* "pygame/_sdl2/video.pyx":1444
*
* cdef int res = SDL_RenderDrawRect(self._renderer, rectptr)
* if res < 0: # <<<<<<<<<<<<<<
@@ -19624,12 +19806,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1247
+ /* "pygame/_sdl2/video.pyx":1431
* raise error()
*
* def draw_rect(self, rect): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderDrawRect
- * cdef SDL_Rect _rect
+ * """Draw a rectangle outline
+ *
*/
/* function exit code */
@@ -19647,16 +19829,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1259
+/* "pygame/_sdl2/video.pyx":1447
* raise error()
*
* def fill_rect(self, rect): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderFillRect
- * cdef SDL_Rect _rect
+ * """Draw a filled rectangle
+ *
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect); /*proto*/
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_22fill_rect[] = "Draw a filled rectangle\n\n :param rect: The :class:`Rect`-like rectangle to draw.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -19683,7 +19866,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fill_rect", 0);
- /* "pygame/_sdl2/video.pyx":1262
+ /* "pygame/_sdl2/video.pyx":1454
* # https://wiki.libsdl.org/SDL_RenderFillRect
* cdef SDL_Rect _rect
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect) # <<<<<<<<<<<<<<
@@ -19692,7 +19875,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
*/
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_rect, (&__pyx_v__rect));
- /* "pygame/_sdl2/video.pyx":1264
+ /* "pygame/_sdl2/video.pyx":1456
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
*
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -19702,20 +19885,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
__pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1265
+ /* "pygame/_sdl2/video.pyx":1457
*
* if rectptr == NULL:
* raise TypeError('expected a rectangle') # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderFillRect(self._renderer, rectptr)
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1265, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1457, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1265, __pyx_L1_error)
+ __PYX_ERR(0, 1457, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1264
+ /* "pygame/_sdl2/video.pyx":1456
* cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
*
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -19724,7 +19907,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1267
+ /* "pygame/_sdl2/video.pyx":1459
* raise TypeError('expected a rectangle')
*
* cdef int res = SDL_RenderFillRect(self._renderer, rectptr) # <<<<<<<<<<<<<<
@@ -19733,7 +19916,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
*/
__pyx_v_res = SDL_RenderFillRect(__pyx_v_self->_renderer, __pyx_v_rectptr);
- /* "pygame/_sdl2/video.pyx":1268
+ /* "pygame/_sdl2/video.pyx":1460
*
* cdef int res = SDL_RenderFillRect(self._renderer, rectptr)
* if res < 0: # <<<<<<<<<<<<<<
@@ -19743,14 +19926,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1269
+ /* "pygame/_sdl2/video.pyx":1461
* cdef int res = SDL_RenderFillRect(self._renderer, rectptr)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def draw_triangle(self, p1, p2, p3):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1461, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -19764,14 +19947,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1461, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1269, __pyx_L1_error)
+ __PYX_ERR(0, 1461, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1268
+ /* "pygame/_sdl2/video.pyx":1460
*
* cdef int res = SDL_RenderFillRect(self._renderer, rectptr)
* if res < 0: # <<<<<<<<<<<<<<
@@ -19780,12 +19963,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1259
+ /* "pygame/_sdl2/video.pyx":1447
* raise error()
*
* def fill_rect(self, rect): # <<<<<<<<<<<<<<
- * # https://wiki.libsdl.org/SDL_RenderFillRect
- * cdef SDL_Rect _rect
+ * """Draw a filled rectangle
+ *
*/
/* function exit code */
@@ -19803,7 +19986,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1271
+/* "pygame/_sdl2/video.pyx":1463
* raise error()
*
* def draw_triangle(self, p1, p2, p3): # <<<<<<<<<<<<<<
@@ -19848,17 +20031,17 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25draw_triangle(PyObje
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, 1); __PYX_ERR(0, 1271, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, 1); __PYX_ERR(0, 1463, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, 2); __PYX_ERR(0, 1271, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, 2); __PYX_ERR(0, 1463, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_triangle") < 0)) __PYX_ERR(0, 1271, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_triangle") < 0)) __PYX_ERR(0, 1463, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -19873,7 +20056,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25draw_triangle(PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1271, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_triangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1463, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_triangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -19905,7 +20088,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_triangle", 0);
- /* "pygame/_sdl2/video.pyx":1274
+ /* "pygame/_sdl2/video.pyx":1466
* # https://wiki.libsdl.org/SDL_RenderDrawLines
* cdef SDL_Point points[4]
* for i, pos in enumerate((p1, p2, p3, p1)): # <<<<<<<<<<<<<<
@@ -19914,7 +20097,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
- __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __pyx_L1_error)
+ __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_p1);
__Pyx_GIVEREF(__pyx_v_p1);
@@ -19933,50 +20116,50 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
for (;;) {
if (__pyx_t_4 >= 4) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1274, __pyx_L1_error)
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1466, __pyx_L1_error)
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __pyx_L1_error)
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
__Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_2);
__pyx_t_2 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1274, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_2;
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":1275
+ /* "pygame/_sdl2/video.pyx":1467
* cdef SDL_Point points[4]
* for i, pos in enumerate((p1, p2, p3, p1)):
* points[i].x = pos[0] # <<<<<<<<<<<<<<
* points[i].y = pos[1]
*
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1275, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1275, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1467, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1275, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1467, __pyx_L1_error)
(__pyx_v_points[__pyx_t_6]).x = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":1276
+ /* "pygame/_sdl2/video.pyx":1468
* for i, pos in enumerate((p1, p2, p3, p1)):
* points[i].x = pos[0]
* points[i].y = pos[1] # <<<<<<<<<<<<<<
*
* res = SDL_RenderDrawLines(self._renderer, points, 4)
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1468, __pyx_L1_error)
(__pyx_v_points[__pyx_t_6]).y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":1274
+ /* "pygame/_sdl2/video.pyx":1466
* # https://wiki.libsdl.org/SDL_RenderDrawLines
* cdef SDL_Point points[4]
* for i, pos in enumerate((p1, p2, p3, p1)): # <<<<<<<<<<<<<<
@@ -19987,7 +20170,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1278
+ /* "pygame/_sdl2/video.pyx":1470
* points[i].y = pos[1]
*
* res = SDL_RenderDrawLines(self._renderer, points, 4) # <<<<<<<<<<<<<<
@@ -19996,7 +20179,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
*/
__pyx_v_res = SDL_RenderDrawLines(__pyx_v_self->_renderer, __pyx_v_points, 4);
- /* "pygame/_sdl2/video.pyx":1279
+ /* "pygame/_sdl2/video.pyx":1471
*
* res = SDL_RenderDrawLines(self._renderer, points, 4)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20006,14 +20189,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
__pyx_t_7 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_7)) {
- /* "pygame/_sdl2/video.pyx":1280
+ /* "pygame/_sdl2/video.pyx":1472
* res = SDL_RenderDrawLines(self._renderer, points, 4)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def fill_triangle(self, p1, p2, p3):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -20027,14 +20210,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
}
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1280, __pyx_L1_error)
+ __PYX_ERR(0, 1472, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1279
+ /* "pygame/_sdl2/video.pyx":1471
*
* res = SDL_RenderDrawLines(self._renderer, points, 4)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20043,7 +20226,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
*/
}
- /* "pygame/_sdl2/video.pyx":1271
+ /* "pygame/_sdl2/video.pyx":1463
* raise error()
*
* def draw_triangle(self, p1, p2, p3): # <<<<<<<<<<<<<<
@@ -20068,7 +20251,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24draw_triangle(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1282
+/* "pygame/_sdl2/video.pyx":1474
* raise error()
*
* def fill_triangle(self, p1, p2, p3): # <<<<<<<<<<<<<<
@@ -20113,17 +20296,17 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27fill_triangle(PyObje
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, 1); __PYX_ERR(0, 1282, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, 1); __PYX_ERR(0, 1474, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, 2); __PYX_ERR(0, 1282, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, 2); __PYX_ERR(0, 1474, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_triangle") < 0)) __PYX_ERR(0, 1282, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_triangle") < 0)) __PYX_ERR(0, 1474, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -20138,7 +20321,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27fill_triangle(PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1282, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_triangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1474, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.fill_triangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -20171,7 +20354,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fill_triangle", 0);
- /* "pygame/_sdl2/video.pyx":1284
+ /* "pygame/_sdl2/video.pyx":1476
* def fill_triangle(self, p1, p2, p3):
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
@@ -20181,14 +20364,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
__pyx_t_1 = ((!(SDL_VERSION_ATLEAST(2, 0, 18) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1285
+ /* "pygame/_sdl2/video.pyx":1477
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18):
* raise error("fill_triangle requires SDL 2.0.18 or newer") # <<<<<<<<<<<<<<
*
* cdef SDL_Vertex vertices[3]
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1285, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1477, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -20202,14 +20385,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_fill_triangle_requires_SDL_2_0_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_fill_triangle_requires_SDL_2_0_1);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1285, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1285, __pyx_L1_error)
+ __PYX_ERR(0, 1477, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1284
+ /* "pygame/_sdl2/video.pyx":1476
* def fill_triangle(self, p1, p2, p3):
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
@@ -20218,7 +20401,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
*/
}
- /* "pygame/_sdl2/video.pyx":1288
+ /* "pygame/_sdl2/video.pyx":1480
*
* cdef SDL_Vertex vertices[3]
* for i, pos in enumerate((p1, p2, p3)): # <<<<<<<<<<<<<<
@@ -20227,7 +20410,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_2 = __pyx_int_0;
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1288, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_p1);
__Pyx_GIVEREF(__pyx_v_p1);
@@ -20243,106 +20426,106 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
for (;;) {
if (__pyx_t_5 >= 3) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1288, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1480, __pyx_L1_error)
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1288, __pyx_L1_error)
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1288, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_3;
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":1289
+ /* "pygame/_sdl2/video.pyx":1481
* cdef SDL_Vertex vertices[3]
* for i, pos in enumerate((p1, p2, p3)):
* vertices[i].position.x = pos[0] # <<<<<<<<<<<<<<
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1289, __pyx_L1_error)
+ __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1289, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).position.x = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":1290
+ /* "pygame/_sdl2/video.pyx":1482
* for i, pos in enumerate((p1, p2, p3)):
* vertices[i].position.x = pos[0]
* vertices[i].position.y = pos[1] # <<<<<<<<<<<<<<
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1290, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1290, __pyx_L1_error)
+ __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1290, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1482, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).position.y = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":1291
+ /* "pygame/_sdl2/video.pyx":1483
* vertices[i].position.x = pos[0]
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0] # <<<<<<<<<<<<<<
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2]
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.r = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1292
+ /* "pygame/_sdl2/video.pyx":1484
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1] # <<<<<<<<<<<<<<
* vertices[i].color.b = self._draw_color[2]
* vertices[i].color.a = self._draw_color[3]
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1484, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1292, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1484, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1292, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1484, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.g = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1293
+ /* "pygame/_sdl2/video.pyx":1485
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2] # <<<<<<<<<<<<<<
* vertices[i].color.a = self._draw_color[3]
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1485, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1293, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1485, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1293, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1485, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.b = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1294
+ /* "pygame/_sdl2/video.pyx":1486
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2]
* vertices[i].color.a = self._draw_color[3] # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 3, NULL, 0)
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1294, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1294, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1486, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1294, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1486, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.a = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1288
+ /* "pygame/_sdl2/video.pyx":1480
*
* cdef SDL_Vertex vertices[3]
* for i, pos in enumerate((p1, p2, p3)): # <<<<<<<<<<<<<<
@@ -20353,7 +20536,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":1296
+ /* "pygame/_sdl2/video.pyx":1488
* vertices[i].color.a = self._draw_color[3]
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 3, NULL, 0) # <<<<<<<<<<<<<<
@@ -20362,7 +20545,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
*/
__pyx_v_res = SDL_RenderGeometry(__pyx_v_self->_renderer, NULL, __pyx_v_vertices, 3, NULL, 0);
- /* "pygame/_sdl2/video.pyx":1297
+ /* "pygame/_sdl2/video.pyx":1489
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 3, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20372,14 +20555,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1298
+ /* "pygame/_sdl2/video.pyx":1490
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 3, NULL, 0)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def draw_quad(self, p1, p2, p3, p4):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1298, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1490, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -20393,14 +20576,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1490, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1298, __pyx_L1_error)
+ __PYX_ERR(0, 1490, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1297
+ /* "pygame/_sdl2/video.pyx":1489
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 3, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20409,7 +20592,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
*/
}
- /* "pygame/_sdl2/video.pyx":1282
+ /* "pygame/_sdl2/video.pyx":1474
* raise error()
*
* def fill_triangle(self, p1, p2, p3): # <<<<<<<<<<<<<<
@@ -20434,7 +20617,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26fill_triangle(struct
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1300
+/* "pygame/_sdl2/video.pyx":1492
* raise error()
*
* def draw_quad(self, p1, p2, p3, p4): # <<<<<<<<<<<<<<
@@ -20482,23 +20665,23 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29draw_quad(PyObject *
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 1); __PYX_ERR(0, 1300, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 1); __PYX_ERR(0, 1492, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 2); __PYX_ERR(0, 1300, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 2); __PYX_ERR(0, 1492, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p4)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 3); __PYX_ERR(0, 1300, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, 3); __PYX_ERR(0, 1492, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_quad") < 0)) __PYX_ERR(0, 1300, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_quad") < 0)) __PYX_ERR(0, 1492, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
@@ -20515,7 +20698,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29draw_quad(PyObject *
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1300, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("draw_quad", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1492, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_quad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -20547,7 +20730,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("draw_quad", 0);
- /* "pygame/_sdl2/video.pyx":1303
+ /* "pygame/_sdl2/video.pyx":1495
* # https://wiki.libsdl.org/SDL_RenderDrawLines
* cdef SDL_Point points[5]
* for i, pos in enumerate((p1, p2, p3, p4, p1)): # <<<<<<<<<<<<<<
@@ -20556,7 +20739,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
- __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
+ __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_p1);
__Pyx_GIVEREF(__pyx_v_p1);
@@ -20578,50 +20761,50 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
for (;;) {
if (__pyx_t_4 >= 5) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1303, __pyx_L1_error)
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1495, __pyx_L1_error)
#else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
__Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_2);
__pyx_t_2 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_2;
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":1304
+ /* "pygame/_sdl2/video.pyx":1496
* cdef SDL_Point points[5]
* for i, pos in enumerate((p1, p2, p3, p4, p1)):
* points[i].x = pos[0] # <<<<<<<<<<<<<<
* points[i].y = pos[1]
*
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1304, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1304, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1496, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1304, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1496, __pyx_L1_error)
(__pyx_v_points[__pyx_t_6]).x = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":1305
+ /* "pygame/_sdl2/video.pyx":1497
* for i, pos in enumerate((p1, p2, p3, p4, p1)):
* points[i].x = pos[0]
* points[i].y = pos[1] # <<<<<<<<<<<<<<
*
* res = SDL_RenderDrawLines(self._renderer, points, 5)
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1497, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1305, __pyx_L1_error)
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1497, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1305, __pyx_L1_error)
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1497, __pyx_L1_error)
(__pyx_v_points[__pyx_t_6]).y = __pyx_t_5;
- /* "pygame/_sdl2/video.pyx":1303
+ /* "pygame/_sdl2/video.pyx":1495
* # https://wiki.libsdl.org/SDL_RenderDrawLines
* cdef SDL_Point points[5]
* for i, pos in enumerate((p1, p2, p3, p4, p1)): # <<<<<<<<<<<<<<
@@ -20632,7 +20815,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1307
+ /* "pygame/_sdl2/video.pyx":1499
* points[i].y = pos[1]
*
* res = SDL_RenderDrawLines(self._renderer, points, 5) # <<<<<<<<<<<<<<
@@ -20641,7 +20824,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
*/
__pyx_v_res = SDL_RenderDrawLines(__pyx_v_self->_renderer, __pyx_v_points, 5);
- /* "pygame/_sdl2/video.pyx":1308
+ /* "pygame/_sdl2/video.pyx":1500
*
* res = SDL_RenderDrawLines(self._renderer, points, 5)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20651,14 +20834,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
__pyx_t_7 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_7)) {
- /* "pygame/_sdl2/video.pyx":1309
+ /* "pygame/_sdl2/video.pyx":1501
* res = SDL_RenderDrawLines(self._renderer, points, 5)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def fill_quad(self, p1, p2, p3, p4):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1501, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -20672,14 +20855,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
}
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1309, __pyx_L1_error)
+ __PYX_ERR(0, 1501, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1308
+ /* "pygame/_sdl2/video.pyx":1500
*
* res = SDL_RenderDrawLines(self._renderer, points, 5)
* if res < 0: # <<<<<<<<<<<<<<
@@ -20688,7 +20871,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1300
+ /* "pygame/_sdl2/video.pyx":1492
* raise error()
*
* def draw_quad(self, p1, p2, p3, p4): # <<<<<<<<<<<<<<
@@ -20713,7 +20896,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28draw_quad(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1311
+/* "pygame/_sdl2/video.pyx":1503
* raise error()
*
* def fill_quad(self, p1, p2, p3, p4): # <<<<<<<<<<<<<<
@@ -20761,23 +20944,23 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_31fill_quad(PyObject *
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 1); __PYX_ERR(0, 1311, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 1); __PYX_ERR(0, 1503, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p3)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 2); __PYX_ERR(0, 1311, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 2); __PYX_ERR(0, 1503, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p4)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 3); __PYX_ERR(0, 1311, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, 3); __PYX_ERR(0, 1503, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_quad") < 0)) __PYX_ERR(0, 1311, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_quad") < 0)) __PYX_ERR(0, 1503, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
@@ -20794,7 +20977,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_31fill_quad(PyObject *
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1311, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("fill_quad", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1503, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.fill_quad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -20827,7 +21010,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fill_quad", 0);
- /* "pygame/_sdl2/video.pyx":1313
+ /* "pygame/_sdl2/video.pyx":1505
* def fill_quad(self, p1, p2, p3, p4):
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
@@ -20837,14 +21020,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
__pyx_t_1 = ((!(SDL_VERSION_ATLEAST(2, 0, 18) != 0)) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1314
+ /* "pygame/_sdl2/video.pyx":1506
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18):
* raise error("fill_quad requires SDL 2.0.18 or newer") # <<<<<<<<<<<<<<
*
* cdef SDL_Vertex vertices[6]
*/
- __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
@@ -20858,14 +21041,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_fill_quad_requires_SDL_2_0_18_or) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_fill_quad_requires_SDL_2_0_18_or);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1314, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1314, __pyx_L1_error)
+ __PYX_ERR(0, 1506, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1313
+ /* "pygame/_sdl2/video.pyx":1505
* def fill_quad(self, p1, p2, p3, p4):
* # https://wiki.libsdl.org/SDL_RenderGeometry
* if not SDL_VERSION_ATLEAST(2, 0, 18): # <<<<<<<<<<<<<<
@@ -20874,7 +21057,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1317
+ /* "pygame/_sdl2/video.pyx":1509
*
* cdef SDL_Vertex vertices[6]
* for i, pos in enumerate((p1, p2, p3, p3, p4, p1)): # <<<<<<<<<<<<<<
@@ -20883,7 +21066,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_2 = __pyx_int_0;
- __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_p1);
__Pyx_GIVEREF(__pyx_v_p1);
@@ -20908,106 +21091,106 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
for (;;) {
if (__pyx_t_5 >= 6) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1509, __pyx_L1_error)
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_3;
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":1318
+ /* "pygame/_sdl2/video.pyx":1510
* cdef SDL_Vertex vertices[6]
* for i, pos in enumerate((p1, p2, p3, p3, p4, p1)):
* vertices[i].position.x = pos[0] # <<<<<<<<<<<<<<
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1318, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1510, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1318, __pyx_L1_error)
+ __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1510, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1318, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1510, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).position.x = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":1319
+ /* "pygame/_sdl2/video.pyx":1511
* for i, pos in enumerate((p1, p2, p3, p3, p4, p1)):
* vertices[i].position.x = pos[0]
* vertices[i].position.y = pos[1] # <<<<<<<<<<<<<<
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1]
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pos, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1319, __pyx_L1_error)
+ __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1511, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1319, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1511, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).position.y = __pyx_t_6;
- /* "pygame/_sdl2/video.pyx":1320
+ /* "pygame/_sdl2/video.pyx":1512
* vertices[i].position.x = pos[0]
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0] # <<<<<<<<<<<<<<
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2]
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1512, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1320, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1512, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1320, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1512, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.r = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1321
+ /* "pygame/_sdl2/video.pyx":1513
* vertices[i].position.y = pos[1]
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1] # <<<<<<<<<<<<<<
* vertices[i].color.b = self._draw_color[2]
* vertices[i].color.a = self._draw_color[3]
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1321, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1513, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1321, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1321, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1513, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.g = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1322
+ /* "pygame/_sdl2/video.pyx":1514
* vertices[i].color.r = self._draw_color[0]
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2] # <<<<<<<<<<<<<<
* vertices[i].color.a = self._draw_color[3]
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1322, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1514, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1322, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1322, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1514, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.b = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1323
+ /* "pygame/_sdl2/video.pyx":1515
* vertices[i].color.g = self._draw_color[1]
* vertices[i].color.b = self._draw_color[2]
* vertices[i].color.a = self._draw_color[3] # <<<<<<<<<<<<<<
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 6, NULL, 0)
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1323, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_draw_color), 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L1_error)
+ __pyx_t_8 = __Pyx_PyInt_As_Uint8(__pyx_t_3); if (unlikely((__pyx_t_8 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L1_error)
+ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L1_error)
(__pyx_v_vertices[__pyx_t_7]).color.a = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1317
+ /* "pygame/_sdl2/video.pyx":1509
*
* cdef SDL_Vertex vertices[6]
* for i, pos in enumerate((p1, p2, p3, p3, p4, p1)): # <<<<<<<<<<<<<<
@@ -21018,7 +21201,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":1325
+ /* "pygame/_sdl2/video.pyx":1517
* vertices[i].color.a = self._draw_color[3]
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 6, NULL, 0) # <<<<<<<<<<<<<<
@@ -21027,7 +21210,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
*/
__pyx_v_res = SDL_RenderGeometry(__pyx_v_self->_renderer, NULL, __pyx_v_vertices, 6, NULL, 0);
- /* "pygame/_sdl2/video.pyx":1326
+ /* "pygame/_sdl2/video.pyx":1518
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 6, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -21037,14 +21220,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
__pyx_t_1 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1327
+ /* "pygame/_sdl2/video.pyx":1519
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 6, NULL, 0)
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
*
* def to_surface(self, surface=None, area=None):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1519, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
@@ -21058,14 +21241,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
+ if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1519, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __PYX_ERR(0, 1327, __pyx_L1_error)
+ __PYX_ERR(0, 1519, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1326
+ /* "pygame/_sdl2/video.pyx":1518
*
* cdef int res = SDL_RenderGeometry(self._renderer, NULL, vertices, 6, NULL, 0)
* if res < 0: # <<<<<<<<<<<<<<
@@ -21074,7 +21257,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
*/
}
- /* "pygame/_sdl2/video.pyx":1311
+ /* "pygame/_sdl2/video.pyx":1503
* raise error()
*
* def fill_quad(self, p1, p2, p3, p4): # <<<<<<<<<<<<<<
@@ -21099,17 +21282,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_30fill_quad(struct __p
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1329
+/* "pygame/_sdl2/video.pyx":1521
* raise error()
*
* def to_surface(self, surface=None, area=None): # <<<<<<<<<<<<<<
* # https://wiki.libsdl.org/SDL_RenderReadPixels
- * """
+ * """Read pixels from current rendering target and create a Surface (slow operation, use sparingly)
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_33to_surface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_32to_surface[] = "\n Read pixels from the current rendering target and create a pygame.Surface.\n WARNING: This is a very slow operation, and should not be used frequently.\n\n :param surface: A surface to read the pixel data into.\n It must be large enough to fit the area, or ``ValueError`` is\n raised.\n If ``None``, a new surface is returned.\n :param area: The area of the screen to read pixels from. The area is\n clipped to fit inside the viewport.\n If ``None``, the entire viewport is used.\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_32to_surface[] = "Read pixels from current rendering target and create a Surface (slow operation, use sparingly)\n\n Read pixel data from the current rendering target and return a\n :class:`pygame.Surface` containing it.\n\n :param Surface surface: A :class:`pygame.Surface` object to read the pixel\n data into. It must be large enough to fit the area, otherwise\n ``ValueError`` is raised.\n If set to ``None``, a new surface will be created.\n :param area: The area of the screen to read pixels from. The area is\n clipped to fit inside the viewport.\n If ``None``, the entire viewport is used.\n\n .. note::\n This is a very slow operation, due to the overhead of the VRAM to RAM\n data transfer and the cost of creating a potentially large\n :class:`pygame.Surface`. It should not be used frequently.\n ";
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_33to_surface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_surface = 0;
PyObject *__pyx_v_area = 0;
@@ -21150,7 +21333,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_33to_surface(PyObject
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "to_surface") < 0)) __PYX_ERR(0, 1329, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "to_surface") < 0)) __PYX_ERR(0, 1521, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -21167,7 +21350,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_33to_surface(PyObject
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("to_surface", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1329, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("to_surface", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1521, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.to_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -21203,7 +21386,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__Pyx_RefNannySetupContext("to_surface", 0);
__Pyx_INCREF(__pyx_v_surface);
- /* "pygame/_sdl2/video.pyx":1351
+ /* "pygame/_sdl2/video.pyx":1549
*
* # obtain area to use
* if area is not None: # <<<<<<<<<<<<<<
@@ -21214,7 +21397,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "pygame/_sdl2/video.pyx":1353
+ /* "pygame/_sdl2/video.pyx":1551
* if area is not None:
*
* rectptr = pgRect_FromObject(area, &rarea) # <<<<<<<<<<<<<<
@@ -21223,7 +21406,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_rarea));
- /* "pygame/_sdl2/video.pyx":1354
+ /* "pygame/_sdl2/video.pyx":1552
*
* rectptr = pgRect_FromObject(area, &rarea)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -21233,20 +21416,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_2 = ((__pyx_v_rectptr == NULL) != 0);
if (unlikely(__pyx_t_2)) {
- /* "pygame/_sdl2/video.pyx":1355
+ /* "pygame/_sdl2/video.pyx":1553
* rectptr = pgRect_FromObject(area, &rarea)
* if rectptr == NULL:
* raise TypeError('area must be None or a rect') # <<<<<<<<<<<<<<
*
* # clip area
*/
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1355, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1553, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1355, __pyx_L1_error)
+ __PYX_ERR(0, 1553, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1354
+ /* "pygame/_sdl2/video.pyx":1552
*
* rectptr = pgRect_FromObject(area, &rarea)
* if rectptr == NULL: # <<<<<<<<<<<<<<
@@ -21255,7 +21438,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1358
+ /* "pygame/_sdl2/video.pyx":1556
*
* # clip area
* SDL_RenderGetViewport(self._renderer, &tempviewport) # <<<<<<<<<<<<<<
@@ -21264,7 +21447,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_tempviewport));
- /* "pygame/_sdl2/video.pyx":1359
+ /* "pygame/_sdl2/video.pyx":1557
* # clip area
* SDL_RenderGetViewport(self._renderer, &tempviewport)
* SDL_IntersectRect(rectptr, &tempviewport, rectptr) # <<<<<<<<<<<<<<
@@ -21273,7 +21456,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
(void)(SDL_IntersectRect(__pyx_v_rectptr, (&__pyx_v_tempviewport), __pyx_v_rectptr));
- /* "pygame/_sdl2/video.pyx":1361
+ /* "pygame/_sdl2/video.pyx":1559
* SDL_IntersectRect(rectptr, &tempviewport, rectptr)
*
* areaparam = rectptr # <<<<<<<<<<<<<<
@@ -21282,7 +21465,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_v_areaparam = __pyx_v_rectptr;
- /* "pygame/_sdl2/video.pyx":1362
+ /* "pygame/_sdl2/video.pyx":1560
*
* areaparam = rectptr
* rarea.x = rectptr.x # <<<<<<<<<<<<<<
@@ -21292,7 +21475,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_4 = __pyx_v_rectptr->x;
__pyx_v_rarea.x = __pyx_t_4;
- /* "pygame/_sdl2/video.pyx":1363
+ /* "pygame/_sdl2/video.pyx":1561
* areaparam = rectptr
* rarea.x = rectptr.x
* rarea.y = rectptr.y # <<<<<<<<<<<<<<
@@ -21302,7 +21485,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_4 = __pyx_v_rectptr->y;
__pyx_v_rarea.y = __pyx_t_4;
- /* "pygame/_sdl2/video.pyx":1364
+ /* "pygame/_sdl2/video.pyx":1562
* rarea.x = rectptr.x
* rarea.y = rectptr.y
* rarea.w = rectptr.w # <<<<<<<<<<<<<<
@@ -21312,7 +21495,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_4 = __pyx_v_rectptr->w;
__pyx_v_rarea.w = __pyx_t_4;
- /* "pygame/_sdl2/video.pyx":1365
+ /* "pygame/_sdl2/video.pyx":1563
* rarea.y = rectptr.y
* rarea.w = rectptr.w
* rarea.h = rectptr.h # <<<<<<<<<<<<<<
@@ -21322,7 +21505,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_4 = __pyx_v_rectptr->h;
__pyx_v_rarea.h = __pyx_t_4;
- /* "pygame/_sdl2/video.pyx":1351
+ /* "pygame/_sdl2/video.pyx":1549
*
* # obtain area to use
* if area is not None: # <<<<<<<<<<<<<<
@@ -21332,7 +21515,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
goto __pyx_L3;
}
- /* "pygame/_sdl2/video.pyx":1367
+ /* "pygame/_sdl2/video.pyx":1565
* rarea.h = rectptr.h
* else:
* SDL_RenderGetViewport(self._renderer, &rarea) # <<<<<<<<<<<<<<
@@ -21342,7 +21525,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
/*else*/ {
SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_rarea));
- /* "pygame/_sdl2/video.pyx":1368
+ /* "pygame/_sdl2/video.pyx":1566
* else:
* SDL_RenderGetViewport(self._renderer, &rarea)
* areaparam = NULL # <<<<<<<<<<<<<<
@@ -21353,7 +21536,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
}
__pyx_L3:;
- /* "pygame/_sdl2/video.pyx":1371
+ /* "pygame/_sdl2/video.pyx":1569
*
* # prepare surface
* if surface is None: # <<<<<<<<<<<<<<
@@ -21364,7 +21547,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "pygame/_sdl2/video.pyx":1373
+ /* "pygame/_sdl2/video.pyx":1571
* if surface is None:
* # create a new surface
* format = SDL_GetWindowPixelFormat(self._win._win) # <<<<<<<<<<<<<<
@@ -21373,7 +21556,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_v_format = SDL_GetWindowPixelFormat(__pyx_v_self->_win->_win);
- /* "pygame/_sdl2/video.pyx":1374
+ /* "pygame/_sdl2/video.pyx":1572
* # create a new surface
* format = SDL_GetWindowPixelFormat(self._win._win)
* if format == SDL_PIXELFORMAT_UNKNOWN: # <<<<<<<<<<<<<<
@@ -21383,14 +21566,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_1 = ((__pyx_v_format == SDL_PIXELFORMAT_UNKNOWN) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1375
+ /* "pygame/_sdl2/video.pyx":1573
* format = SDL_GetWindowPixelFormat(self._win._win)
* if format == SDL_PIXELFORMAT_UNKNOWN:
* raise error() # <<<<<<<<<<<<<<
*
* surf = SDL_CreateRGBSurfaceWithFormat(
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1375, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1573, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -21404,14 +21587,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
}
__pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1375, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1573, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1375, __pyx_L1_error)
+ __PYX_ERR(0, 1573, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1374
+ /* "pygame/_sdl2/video.pyx":1572
* # create a new surface
* format = SDL_GetWindowPixelFormat(self._win._win)
* if format == SDL_PIXELFORMAT_UNKNOWN: # <<<<<<<<<<<<<<
@@ -21420,7 +21603,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1377
+ /* "pygame/_sdl2/video.pyx":1575
* raise error()
*
* surf = SDL_CreateRGBSurfaceWithFormat( # <<<<<<<<<<<<<<
@@ -21429,7 +21612,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_v_surf = SDL_CreateRGBSurfaceWithFormat(0, __pyx_v_rarea.w, __pyx_v_rarea.h, SDL_BITSPERPIXEL(__pyx_v_format), __pyx_v_format);
- /* "pygame/_sdl2/video.pyx":1382
+ /* "pygame/_sdl2/video.pyx":1580
* SDL_BITSPERPIXEL(format),
* format)
* if surf == NULL: # <<<<<<<<<<<<<<
@@ -21439,20 +21622,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_1 = ((__pyx_v_surf == NULL) != 0);
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1383
+ /* "pygame/_sdl2/video.pyx":1581
* format)
* if surf == NULL:
* raise MemoryError("not enough memory for the surface") # <<<<<<<<<<<<<<
*
* surface = pgSurface_New2(surf, 1)
*/
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1383, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1383, __pyx_L1_error)
+ __PYX_ERR(0, 1581, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1382
+ /* "pygame/_sdl2/video.pyx":1580
* SDL_BITSPERPIXEL(format),
* format)
* if surf == NULL: # <<<<<<<<<<<<<<
@@ -21461,7 +21644,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1385
+ /* "pygame/_sdl2/video.pyx":1583
* raise MemoryError("not enough memory for the surface")
*
* surface = pgSurface_New2(surf, 1) # <<<<<<<<<<<<<<
@@ -21474,7 +21657,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_3);
__pyx_t_3 = 0;
- /* "pygame/_sdl2/video.pyx":1371
+ /* "pygame/_sdl2/video.pyx":1569
*
* # prepare surface
* if surface is None: # <<<<<<<<<<<<<<
@@ -21484,7 +21667,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
goto __pyx_L5;
}
- /* "pygame/_sdl2/video.pyx":1386
+ /* "pygame/_sdl2/video.pyx":1584
*
* surface = pgSurface_New2(surf, 1)
* elif pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -21494,7 +21677,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_1 = (pgSurface_Check(__pyx_v_surface) != 0);
if (likely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1387
+ /* "pygame/_sdl2/video.pyx":1585
* surface = pgSurface_New2(surf, 1)
* elif pgSurface_Check(surface):
* surf = pgSurface_AsSurface(surface) # <<<<<<<<<<<<<<
@@ -21503,7 +21686,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_v_surf = pgSurface_AsSurface(__pyx_v_surface);
- /* "pygame/_sdl2/video.pyx":1388
+ /* "pygame/_sdl2/video.pyx":1586
* elif pgSurface_Check(surface):
* surf = pgSurface_AsSurface(surface)
* if surf.w < rarea.w or surf.h < rarea.h: # <<<<<<<<<<<<<<
@@ -21521,20 +21704,20 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_L9_bool_binop_done:;
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1389
+ /* "pygame/_sdl2/video.pyx":1587
* surf = pgSurface_AsSurface(surface)
* if surf.w < rarea.w or surf.h < rarea.h:
* raise ValueError("the surface is too small") # <<<<<<<<<<<<<<
* format = surf.format.format
* else:
*/
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1389, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1587, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1389, __pyx_L1_error)
+ __PYX_ERR(0, 1587, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1388
+ /* "pygame/_sdl2/video.pyx":1586
* elif pgSurface_Check(surface):
* surf = pgSurface_AsSurface(surface)
* if surf.w < rarea.w or surf.h < rarea.h: # <<<<<<<<<<<<<<
@@ -21543,7 +21726,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1390
+ /* "pygame/_sdl2/video.pyx":1588
* if surf.w < rarea.w or surf.h < rarea.h:
* raise ValueError("the surface is too small")
* format = surf.format.format # <<<<<<<<<<<<<<
@@ -21553,7 +21736,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_t_8 = __pyx_v_surf->format->format;
__pyx_v_format = __pyx_t_8;
- /* "pygame/_sdl2/video.pyx":1386
+ /* "pygame/_sdl2/video.pyx":1584
*
* surface = pgSurface_New2(surf, 1)
* elif pgSurface_Check(surface): # <<<<<<<<<<<<<<
@@ -21563,7 +21746,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
goto __pyx_L5;
}
- /* "pygame/_sdl2/video.pyx":1392
+ /* "pygame/_sdl2/video.pyx":1590
* format = surf.format.format
* else:
* raise TypeError("'surface' must be a surface or None") # <<<<<<<<<<<<<<
@@ -21571,15 +21754,15 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
* if SDL_RenderReadPixels(self._renderer,
*/
/*else*/ {
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1392, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1392, __pyx_L1_error)
+ __PYX_ERR(0, 1590, __pyx_L1_error)
}
__pyx_L5:;
- /* "pygame/_sdl2/video.pyx":1396
+ /* "pygame/_sdl2/video.pyx":1594
* if SDL_RenderReadPixels(self._renderer,
* areaparam,
* format, surf.pixels, surf.pitch) < 0: # <<<<<<<<<<<<<<
@@ -21588,7 +21771,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
__pyx_t_1 = ((SDL_RenderReadPixels(__pyx_v_self->_renderer, __pyx_v_areaparam, __pyx_v_format, __pyx_v_surf->pixels, __pyx_v_surf->pitch) < 0) != 0);
- /* "pygame/_sdl2/video.pyx":1394
+ /* "pygame/_sdl2/video.pyx":1592
* raise TypeError("'surface' must be a surface or None")
*
* if SDL_RenderReadPixels(self._renderer, # <<<<<<<<<<<<<<
@@ -21597,14 +21780,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
if (unlikely(__pyx_t_1)) {
- /* "pygame/_sdl2/video.pyx":1397
+ /* "pygame/_sdl2/video.pyx":1595
* areaparam,
* format, surf.pixels, surf.pitch) < 0:
* raise error() # <<<<<<<<<<<<<<
* return surface
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1397, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
@@ -21618,14 +21801,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
}
__pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1397, __pyx_L1_error)
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(0, 1397, __pyx_L1_error)
+ __PYX_ERR(0, 1595, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1394
+ /* "pygame/_sdl2/video.pyx":1592
* raise TypeError("'surface' must be a surface or None")
*
* if SDL_RenderReadPixels(self._renderer, # <<<<<<<<<<<<<<
@@ -21634,7 +21817,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
*/
}
- /* "pygame/_sdl2/video.pyx":1398
+ /* "pygame/_sdl2/video.pyx":1596
* format, surf.pixels, surf.pitch) < 0:
* raise error()
* return surface # <<<<<<<<<<<<<<
@@ -21646,12 +21829,12 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
__pyx_r = __pyx_v_surface;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1329
+ /* "pygame/_sdl2/video.pyx":1521
* raise error()
*
* def to_surface(self, surface=None, area=None): # <<<<<<<<<<<<<<
* # https://wiki.libsdl.org/SDL_RenderReadPixels
- * """
+ * """Read pixels from current rendering target and create a Surface (slow operation, use sparingly)
*/
/* function exit code */
@@ -21668,17 +21851,17 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_32to_surface(struct __
return __pyx_r;
}
-/* "pygame/_sdl2/video.pyx":1401
+/* "pygame/_sdl2/video.pyx":1599
*
* @staticmethod
* def compose_custom_blend_mode(color_mode, alpha_mode): # <<<<<<<<<<<<<<
- * """ Use this function to compose a custom blend mode..
+ * """Compose a custom blend mode
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend_mode[] = " Use this function to compose a custom blend mode.. \n\n :param color_mode: A tuple (srcColorFactor, dstColorFactor, colorOperation)\n :param alpha_mode: A tuple (srcAlphaFactor, dstAlphaFactor, alphaOperation)\n :return: A blend mode to be used with Renderer.draw_blend_mode and Texure.blend_mode\n ";
+static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend_mode[] = "Compose a custom blend mode\n\n Compose a custom blend mode.\n See https://wiki.libsdl.org/SDL2/SDL_ComposeCustomBlendMode for more information.\n\n :param color_mode: A tuple ``(srcColorFactor, dstColorFactor, colorOperation)``\n :param alpha_mode: A tuple ``(srcAlphaFactor, dstAlphaFactor, alphaOperation)``\n\n :return: A blend mode to be used with :meth:`Renderer.set_draw_blend_mode` and :meth:`Texture.set_blend_mode`.\n ";
static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode = {"compose_custom_blend_mode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend_mode};
static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_color_mode = 0;
@@ -21712,11 +21895,11 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha_mode)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("compose_custom_blend_mode", 1, 2, 2, 1); __PYX_ERR(0, 1401, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("compose_custom_blend_mode", 1, 2, 2, 1); __PYX_ERR(0, 1599, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compose_custom_blend_mode") < 0)) __PYX_ERR(0, 1401, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compose_custom_blend_mode") < 0)) __PYX_ERR(0, 1599, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -21729,7 +21912,7 @@ static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("compose_custom_blend_mode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1401, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("compose_custom_blend_mode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1599, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("pygame._sdl2.video.Renderer.compose_custom_blend_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -21761,79 +21944,79 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("compose_custom_blend_mode", 0);
- /* "pygame/_sdl2/video.pyx":1409
+ /* "pygame/_sdl2/video.pyx":1611
* """
* # https://wiki.libsdl.org/SDL_ComposeCustomBlendMode
* cdef int res = SDL_ComposeCustomBlendMode(color_mode[0], # <<<<<<<<<<<<<<
* color_mode[1],
* color_mode[2],
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1409, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1409, __pyx_L1_error)
+ __pyx_t_2 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1611, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1410
+ /* "pygame/_sdl2/video.pyx":1612
* # https://wiki.libsdl.org/SDL_ComposeCustomBlendMode
* cdef int res = SDL_ComposeCustomBlendMode(color_mode[0],
* color_mode[1], # <<<<<<<<<<<<<<
* color_mode[2],
* alpha_mode[0],
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1612, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L1_error)
+ __pyx_t_3 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1411
+ /* "pygame/_sdl2/video.pyx":1613
* cdef int res = SDL_ComposeCustomBlendMode(color_mode[0],
* color_mode[1],
* color_mode[2], # <<<<<<<<<<<<<<
* alpha_mode[0],
* alpha_mode[1],
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_color_mode, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = ((SDL_BlendOperation)__Pyx_PyInt_As_SDL_BlendOperation(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1411, __pyx_L1_error)
+ __pyx_t_4 = ((SDL_BlendOperation)__Pyx_PyInt_As_SDL_BlendOperation(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1613, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1412
+ /* "pygame/_sdl2/video.pyx":1614
* color_mode[1],
* color_mode[2],
* alpha_mode[0], # <<<<<<<<<<<<<<
* alpha_mode[1],
* alpha_mode[2])
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1412, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L1_error)
+ __pyx_t_5 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1614, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1413
+ /* "pygame/_sdl2/video.pyx":1615
* color_mode[2],
* alpha_mode[0],
* alpha_mode[1], # <<<<<<<<<<<<<<
* alpha_mode[2])
* if res < 0:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1413, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1615, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1413, __pyx_L1_error)
+ __pyx_t_6 = ((SDL_BlendFactor)__Pyx_PyInt_As_SDL_BlendFactor(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1615, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1414
+ /* "pygame/_sdl2/video.pyx":1616
* alpha_mode[0],
* alpha_mode[1],
* alpha_mode[2]) # <<<<<<<<<<<<<<
* if res < 0:
* raise error()
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_alpha_mode, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1616, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = ((SDL_BlendOperation)__Pyx_PyInt_As_SDL_BlendOperation(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L1_error)
+ __pyx_t_7 = ((SDL_BlendOperation)__Pyx_PyInt_As_SDL_BlendOperation(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1616, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":1409
+ /* "pygame/_sdl2/video.pyx":1611
* """
* # https://wiki.libsdl.org/SDL_ComposeCustomBlendMode
* cdef int res = SDL_ComposeCustomBlendMode(color_mode[0], # <<<<<<<<<<<<<<
@@ -21842,7 +22025,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend
*/
__pyx_v_res = SDL_ComposeCustomBlendMode(__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7);
- /* "pygame/_sdl2/video.pyx":1415
+ /* "pygame/_sdl2/video.pyx":1617
* alpha_mode[1],
* alpha_mode[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -21852,13 +22035,13 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend
__pyx_t_8 = ((__pyx_v_res < 0) != 0);
if (unlikely(__pyx_t_8)) {
- /* "pygame/_sdl2/video.pyx":1416
+ /* "pygame/_sdl2/video.pyx":1618
* alpha_mode[2])
* if res < 0:
* raise error() # <<<<<<<<<<<<<<
* return res
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1416, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1618, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
@@ -21872,14 +22055,14 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend
}
__pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1618, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __PYX_ERR(0, 1416, __pyx_L1_error)
+ __PYX_ERR(0, 1618, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1415
+ /* "pygame/_sdl2/video.pyx":1617
* alpha_mode[1],
* alpha_mode[2])
* if res < 0: # <<<<<<<<<<<<<<
@@ -21888,23 +22071,23 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_34compose_custom_blend
*/
}
- /* "pygame/_sdl2/video.pyx":1417
+ /* "pygame/_sdl2/video.pyx":1619
* if res < 0:
* raise error()
* return res # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1619, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "pygame/_sdl2/video.pyx":1401
+ /* "pygame/_sdl2/video.pyx":1599
*
* @staticmethod
* def compose_custom_blend_mode(color_mode, alpha_mode): # <<<<<<<<<<<<<<
- * """ Use this function to compose a custom blend mode..
+ * """Compose a custom blend mode
*
*/
@@ -22034,7 +22217,7 @@ static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_38__setstate_cython__(
return __pyx_r;
}
-static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video__Window(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
@@ -22045,7 +22228,7 @@ static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject *t, CYTH
return o;
}
-static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Window(PyObject *o) {
+static void __pyx_tp_dealloc_6pygame_5_sdl2_5video__Window(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
@@ -22055,20 +22238,20 @@ static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Window(PyObject *o) {
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
__Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
- __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(o);
+ __pyx_pw_6pygame_5_sdl2_5video_7_Window_27__dealloc__(o);
__Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_grab(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_grab(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_grab(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_grab(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_4grab_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22076,13 +22259,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_grab(PyObject *o, PyObjec
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_relative_mouse(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_relative_mouse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_14relative_mouse_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22090,13 +22273,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject *
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_title(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_title(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_title(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_title(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_5title_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22104,13 +22287,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_title(PyObject *o, PyObje
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_resizable(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_resizable(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_9resizable_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22118,13 +22301,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject *o, Py
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_borderless(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_borderless(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_10borderless_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22132,17 +22315,17 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject *o, P
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_id(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_id(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_2id_1__get__(o);
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_size(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_size(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_4size_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22150,13 +22333,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_size(PyObject *o, PyObjec
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_position(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_position(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_position(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_position(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_8position_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22164,13 +22347,13 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_position(PyObject *o, PyO
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_opacity(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_1__get__(o);
}
-static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_6pygame_5_sdl2_5video_7_Window_opacity(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(o, v);
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_7opacity_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -22178,48 +22361,48 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject *o, PyOb
}
}
-static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_display_index(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(o);
+static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7_Window_display_index(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6pygame_5_sdl2_5video_7_Window_13display_index_1__get__(o);
}
-static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Window[] = {
- {"from_display_module", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module, METH_NOARGS, 0},
- {"set_windowed", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_4set_windowed},
- {"set_fullscreen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_6Window_6set_fullscreen},
- {"destroy", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_8destroy},
- {"hide", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_10hide},
- {"show", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_13show, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_12show},
- {"focus", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_6Window_14focus},
- {"restore", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_16restore},
- {"maximize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_18maximize},
- {"minimize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_20minimize},
- {"set_icon", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon, METH_O, __pyx_doc_6pygame_5_sdl2_5video_6Window_22set_icon},
- {"set_modal_for", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for, METH_O, __pyx_doc_6pygame_5_sdl2_5video_6Window_24set_modal_for},
- {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__, METH_NOARGS, 0},
- {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__, METH_O, 0},
+static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video__Window[] = {
+ {"from_display_module", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_1from_display_module, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_from_display_module},
+ {"set_windowed", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_5set_windowed, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_4set_windowed},
+ {"set_fullscreen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7_Window_7set_fullscreen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_6set_fullscreen},
+ {"destroy", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_9destroy, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_8destroy},
+ {"hide", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_11hide, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_10hide},
+ {"show", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_13show, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_12show},
+ {"focus", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7_Window_15focus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_14focus},
+ {"restore", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_17restore, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_16restore},
+ {"maximize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_19maximize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_18maximize},
+ {"minimize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_21minimize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_7_Window_20minimize},
+ {"set_icon", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_23set_icon, METH_O, __pyx_doc_6pygame_5_sdl2_5video_7_Window_22set_icon},
+ {"set_modal_for", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_25set_modal_for, METH_O, __pyx_doc_6pygame_5_sdl2_5video_7_Window_24set_modal_for},
+ {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_29__reduce_cython__, METH_NOARGS, 0},
+ {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7_Window_31__setstate_cython__, METH_O, 0},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Window[] = {
- {(char *)"grab", __pyx_getprop_6pygame_5_sdl2_5video_6Window_grab, __pyx_setprop_6pygame_5_sdl2_5video_6Window_grab, (char *)" Window's input grab state (``True`` or ``False``).\n\n Set it to ``True`` to grab, ``False`` to release.\n\n When input is grabbed the mouse is confined to the window.\n If the caller enables a grab while another window is currently grabbed,\n the other window loses its grab in favor of the caller's window.\n\n :rtype: bool\n ", 0},
- {(char *)"relative_mouse", __pyx_getprop_6pygame_5_sdl2_5video_6Window_relative_mouse, __pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse, (char *)" Window's relative mouse motion state (``True`` or ``False``).\n\n Set it to ``True`` to enable, ``False`` to disable.\n If mouse.set_visible(True) is set the input will be grabbed,\n and the mouse will enter endless relative motion mode.\n\n :rtype: bool\n ", 0},
- {(char *)"title", __pyx_getprop_6pygame_5_sdl2_5video_6Window_title, __pyx_setprop_6pygame_5_sdl2_5video_6Window_title, (char *)" The title of the window or u\"\" if there is none.\n ", 0},
- {(char *)"resizable", __pyx_getprop_6pygame_5_sdl2_5video_6Window_resizable, __pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable, (char *)" Sets whether the window is resizable.\n ", 0},
- {(char *)"borderless", __pyx_getprop_6pygame_5_sdl2_5video_6Window_borderless, __pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless, (char *)" Add or remove the border from the actual window.\n\n .. note:: You can't change the border state of a fullscreen window.\n ", 0},
- {(char *)"id", __pyx_getprop_6pygame_5_sdl2_5video_6Window_id, 0, (char *)" A unique window ID. *Read-only*.\n\n :rtype: int\n ", 0},
- {(char *)"size", __pyx_getprop_6pygame_5_sdl2_5video_6Window_size, __pyx_setprop_6pygame_5_sdl2_5video_6Window_size, (char *)" The size of the window's client area.", 0},
- {(char *)"position", __pyx_getprop_6pygame_5_sdl2_5video_6Window_position, __pyx_setprop_6pygame_5_sdl2_5video_6Window_position, (char *)" Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED", 0},
- {(char *)"opacity", __pyx_getprop_6pygame_5_sdl2_5video_6Window_opacity, __pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity, (char *)" Window opacity. It ranges between 0.0 (fully transparent)\n and 1.0 (fully opaque).", 0},
- {(char *)"display_index", __pyx_getprop_6pygame_5_sdl2_5video_6Window_display_index, 0, (char *)" The index of the display associated with the window. *Read-only*.\n\n :rtype: int\n ", 0},
+static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video__Window[] = {
+ {(char *)"grab", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_grab, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_grab, (char *)"Get or set the window's input grab state\n\n Gets or sets the window's input grab state.\n When input is grabbed, the mouse is confined to the window.\n If the caller enables a grab while another window is currently grabbed,\n the other window loses its grab in favor of the caller's window.\n ", 0},
+ {(char *)"relative_mouse", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_relative_mouse, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_relative_mouse, (char *)"Get or set the window's relative mouse mode state\n\n Gets or sets the window's relative mouse mode state.\n SDL2 docs: *\"While the mouse is in relative mode, the cursor is hidden,\n the mouse position is constrained to the window, and SDL will report\n continuous relative mouse motion even if the mouse is at the edge of the\n window.*\n\n *This function will flush any pending mouse motion.\"*\n\n Calling :func:`pygame.mouse.set_visible` with argument\n ``True`` will exit relative mouse mode.\n ", 0},
+ {(char *)"title", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_title, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_title, (char *)"Get or set the window title\n\n Gets or sets the window title. An empty string means that no title is set.An empty string means that no title is set.\n ", 0},
+ {(char *)"resizable", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_resizable, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_resizable, (char *)"Get or set whether the window is resizable\n ", 0},
+ {(char *)"borderless", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_borderless, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_borderless, (char *)"Get or set whether the window is borderless\n\n Gets or sets whether the window is borderless.\n\n .. note:: You can't change the border state of a fullscreen window.\n ", 0},
+ {(char *)"id", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_id, 0, (char *)"Get the unique window ID (**read-only**)\n ", 0},
+ {(char *)"size", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_size, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_size, (char *)"Get or set the window size in pixels", 0},
+ {(char *)"position", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_position, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_position, (char *)"Get or set the window position in screen coordinates\n ", 0},
+ {(char *)"opacity", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_opacity, __pyx_setprop_6pygame_5_sdl2_5video_7_Window_opacity, (char *)"Get or set the window opacity, a value between 0.0 (fully transparent) and 1.0 (fully opaque)\n ", 0},
+ {(char *)"display_index", __pyx_getprop_6pygame_5_sdl2_5video_7_Window_display_index, 0, (char *)"Get the index of the display that owns the window\n ", 0},
{0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Window = {
+static PyTypeObject __pyx_type_6pygame_5_sdl2_5video__Window = {
PyVarObject_HEAD_INIT(0, 0)
- "pygame._sdl2.video.Window", /*tp_name*/
- sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Window), /*tp_basicsize*/
+ "pygame._sdl2.video._Window", /*tp_name*/
+ sizeof(struct __pyx_obj_6pygame_5_sdl2_5video__Window), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_6pygame_5_sdl2_5video_Window, /*tp_dealloc*/
+ __pyx_tp_dealloc_6pygame_5_sdl2_5video__Window, /*tp_dealloc*/
#if PY_VERSION_HEX < 0x030800b4
0, /*tp_print*/
#endif
@@ -22252,17 +22435,17 @@ static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Window = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_6pygame_5_sdl2_5video_Window, /*tp_methods*/
+ __pyx_methods_6pygame_5_sdl2_5video__Window, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_6pygame_5_sdl2_5video_Window, /*tp_getset*/
+ __pyx_getsets_6pygame_5_sdl2_5video__Window, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__, /*tp_init*/
+ __pyx_pw_6pygame_5_sdl2_5video_7_Window_3__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_6pygame_5_sdl2_5video_Window, /*tp_new*/
+ __pyx_tp_new_6pygame_5_sdl2_5video__Window, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22300,7 +22483,7 @@ static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Renderer(PyTypeObject *t, CY
p->__pyx_vtab = __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer;
p->_draw_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
p->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
- p->_win = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None); Py_INCREF(Py_None);
+ p->_win = ((pgWindowObject *)Py_None); Py_INCREF(Py_None);
return o;
}
@@ -22351,7 +22534,7 @@ static int __pyx_tp_clear_6pygame_5_sdl2_5video_Renderer(PyObject *o) {
p->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_win);
- p->_win = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None); Py_INCREF(Py_None);
+ p->_win = ((pgWindowObject *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
@@ -22433,10 +22616,10 @@ static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Renderer[] = {
{"get_viewport", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_10get_viewport},
{"set_viewport", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport, METH_O, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_12set_viewport},
{"blit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_14blit},
- {"draw_line", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line, METH_VARARGS|METH_KEYWORDS, 0},
- {"draw_point", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point, METH_O, 0},
- {"draw_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect, METH_O, 0},
- {"fill_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect, METH_O, 0},
+ {"draw_line", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_16draw_line},
+ {"draw_point", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point, METH_O, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_18draw_point},
+ {"draw_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect, METH_O, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_20draw_rect},
+ {"fill_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect, METH_O, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_22fill_rect},
{"draw_triangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25draw_triangle, METH_VARARGS|METH_KEYWORDS, 0},
{"fill_triangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27fill_triangle, METH_VARARGS|METH_KEYWORDS, 0},
{"draw_quad", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29draw_quad, METH_VARARGS|METH_KEYWORDS, 0},
@@ -22449,11 +22632,11 @@ static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Renderer[] = {
};
static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Renderer[] = {
- {(char *)"draw_blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, (char *)0, 0},
- {(char *)"draw_color", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_color, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_color, (char *)" Color used by the drawing functions.\n ", 0},
- {(char *)"logical_size", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_logical_size, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_logical_size, (char *)0, 0},
- {(char *)"scale", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_scale, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_scale, (char *)0, 0},
- {(char *)"target", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_target, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_target, (char *)" The current render target. Set to ``None`` for the default target.\n\n :rtype: Texture, None\n ", 0},
+ {(char *)"draw_blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, (char *)"Get or set the blend mode used for primitive drawing operations\n ", 0},
+ {(char *)"draw_color", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_color, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_color, (char *)"Get or set the color used for primitive drawing operations\n ", 0},
+ {(char *)"logical_size", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_logical_size, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_logical_size, (char *)"Get or set the logical Renderer size (a device independent resolution for rendering)\n ", 0},
+ {(char *)"scale", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_scale, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_scale, (char *)"Get the drawing scale for the current rendering target\n ", 0},
+ {(char *)"target", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_target, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_target, (char *)"`Get or set the current rendering target\n\n Gets or sets the current rendering target.\n A value of ``None`` means that no custom rendering target was set and the\n Renderer's window will be used as the target.\n ", 0},
{0, 0, 0, 0, 0}
};
@@ -22662,9 +22845,9 @@ static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Texture[] = {
};
static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Texture[] = {
- {(char *)"alpha", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_alpha, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_alpha, (char *)0, 0},
- {(char *)"blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_blend_mode, (char *)0, 0},
- {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_color, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_color, (char *)0, 0},
+ {(char *)"alpha", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_alpha, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_alpha, (char *)"Get or set the additional alpha value multiplied into draw operations\n ", 0},
+ {(char *)"blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_blend_mode, (char *)"Get or set the blend mode for texture drawing operations\n\n Gets or sets the blend mode for the texture's drawing operations.\n Valid blend modes are any of the ``BLENDMODE_*`` constants or a custom one. \n ", 0},
+ {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_color, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_color, (char *)"Get or set the additional color value multiplied into texture drawing operations\n ", 0},
{(char *)"renderer", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_renderer, 0, (char *)0, 0},
{(char *)"width", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_width, 0, (char *)0, 0},
{(char *)"height", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_height, 0, (char *)0, 0},
@@ -22934,7 +23117,7 @@ static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_srcrect(PyObject *o, PyObj
}
static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Image[] = {
- {"get_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect, METH_NOARGS, 0},
+ {"get_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_5Image_4get_rect},
{"draw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_5Image_6draw},
{"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_9__reduce_cython__, METH_NOARGS, 0},
{"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_11__setstate_cython__, METH_O, 0},
@@ -22942,8 +23125,8 @@ static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Image[] = {
};
static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Image[] = {
- {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_5Image_color, __pyx_setprop_6pygame_5_sdl2_5video_5Image_color, (char *)0, 0},
- {(char *)"origin", __pyx_getprop_6pygame_5_sdl2_5video_5Image_origin, __pyx_setprop_6pygame_5_sdl2_5video_5Image_origin, (char *)0, 0},
+ {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_5Image_color, __pyx_setprop_6pygame_5_sdl2_5video_5Image_color, (char *)"Gets or sets the Image color modifier\n ", 0},
+ {(char *)"origin", __pyx_getprop_6pygame_5_sdl2_5video_5Image_origin, __pyx_setprop_6pygame_5_sdl2_5video_5Image_origin, (char *)"Get or set the Image's origin of rotation\n\n Gets or sets the Image's origin of rotation, a 2D coordinate relative to the topleft coordinate of the Image's rectangular area.\n\n An origin of ``None`` means no origin was set and the Image will be rotated around\n its center.\n ", 0},
{(char *)"angle", __pyx_getprop_6pygame_5_sdl2_5video_5Image_angle, __pyx_setprop_6pygame_5_sdl2_5video_5Image_angle, (char *)0, 0},
{(char *)"flip_x", __pyx_getprop_6pygame_5_sdl2_5video_5Image_flip_x, __pyx_setprop_6pygame_5_sdl2_5video_5Image_flip_x, (char *)0, 0},
{(char *)"flip_y", __pyx_getprop_6pygame_5_sdl2_5video_5Image_flip_y, __pyx_setprop_6pygame_5_sdl2_5video_5Image_flip_y, (char *)0, 0},
@@ -23182,6 +23365,7 @@ static struct PyModuleDef __pyx_moduledef = {
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_2nd_argument_must_be_a_surface, __pyx_k_2nd_argument_must_be_a_surface, sizeof(__pyx_k_2nd_argument_must_be_a_surface), 0, 0, 1, 0},
+ {&__pyx_kp_s_Argument_window_has_incorrect_ty, __pyx_k_Argument_window_has_incorrect_ty, sizeof(__pyx_k_Argument_window_has_incorrect_ty), 0, 0, 1, 0},
{&__pyx_n_s_DEFAULT_SIZE, __pyx_k_DEFAULT_SIZE, sizeof(__pyx_k_DEFAULT_SIZE), 0, 0, 1, 1},
{&__pyx_n_s_Image, __pyx_k_Image, sizeof(__pyx_k_Image), 0, 0, 1, 1},
{&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
@@ -23202,6 +23386,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_WINDOWPOS_CENTERED, __pyx_k_WINDOWPOS_CENTERED, sizeof(__pyx_k_WINDOWPOS_CENTERED), 0, 0, 1, 1},
{&__pyx_n_s_WINDOWPOS_UNDEFINED, __pyx_k_WINDOWPOS_UNDEFINED, sizeof(__pyx_k_WINDOWPOS_UNDEFINED), 0, 0, 1, 1},
{&__pyx_n_s_Window, __pyx_k_Window, sizeof(__pyx_k_Window), 0, 0, 1, 1},
+ {&__pyx_n_s_Window_2, __pyx_k_Window_2, sizeof(__pyx_k_Window_2), 0, 0, 1, 1},
{&__pyx_n_s_accelerated, __pyx_k_accelerated, sizeof(__pyx_k_accelerated), 0, 0, 1, 1},
{&__pyx_n_s_allow_highdpi, __pyx_k_allow_highdpi, sizeof(__pyx_k_allow_highdpi), 0, 0, 1, 1},
{&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
@@ -23323,11 +23508,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
{&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
{&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1},
- {&__pyx_n_s_pygame, __pyx_k_pygame, sizeof(__pyx_k_pygame), 0, 0, 1, 1},
{&__pyx_n_s_pygame__sdl2_sdl2, __pyx_k_pygame__sdl2_sdl2, sizeof(__pyx_k_pygame__sdl2_sdl2), 0, 0, 1, 1},
{&__pyx_n_s_pygame__sdl2_video, __pyx_k_pygame__sdl2_video, sizeof(__pyx_k_pygame__sdl2_video), 0, 0, 1, 1},
{&__pyx_kp_s_pygame_icon_bmp, __pyx_k_pygame_icon_bmp, sizeof(__pyx_k_pygame_icon_bmp), 0, 0, 1, 0},
{&__pyx_n_s_pygame_pkgdata, __pyx_k_pygame_pkgdata, sizeof(__pyx_k_pygame_pkgdata), 0, 0, 1, 1},
+ {&__pyx_kp_s_pygame_window, __pyx_k_pygame_window, sizeof(__pyx_k_pygame_window), 0, 0, 1, 0},
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
{&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
{&__pyx_kp_s_rect_values_are_out_of_range, __pyx_k_rect_values_are_out_of_range, sizeof(__pyx_k_rect_values_are_out_of_range), 0, 0, 1, 0},
@@ -23376,7 +23561,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_target_texture, __pyx_k_target_texture, sizeof(__pyx_k_target_texture), 0, 0, 1, 1},
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
{&__pyx_n_s_texture, __pyx_k_texture, sizeof(__pyx_k_texture), 0, 0, 1, 1},
- {&__pyx_n_s_textureOrImage, __pyx_k_textureOrImage, sizeof(__pyx_k_textureOrImage), 0, 0, 1, 1},
+ {&__pyx_n_s_texture_or_image, __pyx_k_texture_or_image, sizeof(__pyx_k_texture_or_image), 0, 0, 1, 1},
{&__pyx_kp_s_the_argument_is_not_a_rectangle, __pyx_k_the_argument_is_not_a_rectangle, sizeof(__pyx_k_the_argument_is_not_a_rectangle), 0, 0, 1, 0},
{&__pyx_kp_s_the_surface_is_too_small, __pyx_k_the_surface_is_too_small, sizeof(__pyx_k_the_surface_is_too_small), 0, 0, 1, 0},
{&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
@@ -23397,13 +23582,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 578, __pyx_L1_error)
- __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 121, __pyx_L1_error)
- __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 122, __pyx_L1_error)
- __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 122, __pyx_L1_error)
- __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 218, __pyx_L1_error)
- __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 230, __pyx_L1_error)
- __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 231, __pyx_L1_error)
+ __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 644, __pyx_L1_error)
+ __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 128, __pyx_L1_error)
+ __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 129, __pyx_L1_error)
+ __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 129, __pyx_L1_error)
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 244, __pyx_L1_error)
+ __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 256, __pyx_L1_error)
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 257, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
@@ -23413,36 +23598,36 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
- /* "pygame/_sdl2/video.pyx":67
+ /* "pygame/_sdl2/video.pyx":72
* bint warn=False,
* bint error=False,
* buttons=('OK', ), # <<<<<<<<<<<<<<
* return_button=0,
* escape_button=0):
*/
- __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_OK); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 67, __pyx_L1_error)
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_OK); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 72, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__2);
__Pyx_GIVEREF(__pyx_tuple__2);
- /* "pygame/_sdl2/video.pyx":218
+ /* "pygame/_sdl2/video.pyx":244
* flags = 0
* if fullscreen and fullscreen_desktop:
* raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.") # <<<<<<<<<<<<<<
* if fullscreen:
* flags |= _SDL_WINDOW_FULLSCREEN
*/
- __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_fullscreen_and_fullscreen_deskto); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 218, __pyx_L1_error)
+ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_fullscreen_and_fullscreen_deskto); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 244, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__5);
__Pyx_GIVEREF(__pyx_tuple__5);
- /* "pygame/_sdl2/video.pyx":407
+ /* "pygame/_sdl2/video.pyx":445
* """
* if not pgSurface_Check(surface):
* raise TypeError('surface must be a Surface object') # <<<<<<<<<<<<<<
* SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
*
*/
- __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_Surface_object); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 407, __pyx_L1_error)
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_Surface_object); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__6);
__Pyx_GIVEREF(__pyx_tuple__6);
@@ -23465,141 +23650,141 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__8);
__Pyx_GIVEREF(__pyx_tuple__8);
- /* "pygame/_sdl2/video.pyx":496
+ /* "pygame/_sdl2/video.pyx":535
* Amask = 0xFF << 24
* else:
* raise ValueError("no standard masks exist for given bitdepth with alpha") # <<<<<<<<<<<<<<
* return SDL_MasksToPixelFormatEnum(depth,
* Rmask, Gmask, Bmask, Amask)
*/
- __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_standard_masks_exist_for_give); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 496, __pyx_L1_error)
+ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_standard_masks_exist_for_give); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 535, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__9);
__Pyx_GIVEREF(__pyx_tuple__9);
- /* "pygame/_sdl2/video.pyx":535
+ /* "pygame/_sdl2/video.pyx":601
* cdef int width, height
* if len(size) != 2:
* raise ValueError('size must have two elements') # <<<<<<<<<<<<<<
* width, height = size[0], size[1]
* if width <= 0 or height <= 0:
*/
- __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_size_must_have_two_elements); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 535, __pyx_L1_error)
+ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_size_must_have_two_elements); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 601, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__10);
__Pyx_GIVEREF(__pyx_tuple__10);
- /* "pygame/_sdl2/video.pyx":538
+ /* "pygame/_sdl2/video.pyx":604
* width, height = size[0], size[1]
* if width <= 0 or height <= 0:
* raise ValueError('size must contain two positive values') # <<<<<<<<<<<<<<
*
* cdef int access
*/
- __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_size_must_contain_two_positive_v); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 538, __pyx_L1_error)
+ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_size_must_contain_two_positive_v); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 604, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__11);
__Pyx_GIVEREF(__pyx_tuple__11);
- /* "pygame/_sdl2/video.pyx":543
+ /* "pygame/_sdl2/video.pyx":609
* if static:
* if streaming or target:
* raise ValueError('only one of static, streaming, or target can be true') # <<<<<<<<<<<<<<
* access = _SDL_TEXTUREACCESS_STATIC
* elif streaming:
*/
- __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_only_one_of_static_streaming_or); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 543, __pyx_L1_error)
+ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_only_one_of_static_streaming_or); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__12);
__Pyx_GIVEREF(__pyx_tuple__12);
- /* "pygame/_sdl2/video.pyx":587
+ /* "pygame/_sdl2/video.pyx":653
* # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
* if not pgSurface_Check(surface):
* raise TypeError('2nd argument must be a surface') # <<<<<<<<<<<<<<
* cdef Texture self = Texture.__new__(Texture)
* self.renderer = renderer
*/
- __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_2nd_argument_must_be_a_surface); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 587, __pyx_L1_error)
+ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_2nd_argument_must_be_a_surface); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__13);
__Pyx_GIVEREF(__pyx_tuple__13);
- /* "pygame/_sdl2/video.pyx":706
+ /* "pygame/_sdl2/video.pyx":788
* csrcrect = pgRect_FromObject(srcrect, &src)
* if not csrcrect:
* raise TypeError("the argument is not a rectangle or None") # <<<<<<<<<<<<<<
*
* if dstrect is not None:
*/
- __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_the_argument_is_not_a_rectangle); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 706, __pyx_L1_error)
+ __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_the_argument_is_not_a_rectangle); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 788, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__14);
__Pyx_GIVEREF(__pyx_tuple__14);
- /* "pygame/_sdl2/video.pyx":718
+ /* "pygame/_sdl2/video.pyx":800
* cdstrect = &dst
* else:
* raise TypeError('dstrect must be a position, rect, or None') # <<<<<<<<<<<<<<
*
* if origin:
*/
- __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_dstrect_must_be_a_position_rect); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 718, __pyx_L1_error)
+ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_dstrect_must_be_a_position_rect); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__15);
__Pyx_GIVEREF(__pyx_tuple__15);
- /* "pygame/_sdl2/video.pyx":731
+ /* "pygame/_sdl2/video.pyx":813
*
* def draw_triangle(self, p1_xy, p2_xy, p3_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0), # <<<<<<<<<<<<<<
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)):
- * """ Copy a triangle portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a triangle portion of the texture to the rendering target using the given coordinates
*/
- __pyx_tuple__16 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 731, __pyx_L1_error)
+ __pyx_tuple__16 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 813, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__16);
__Pyx_GIVEREF(__pyx_tuple__16);
- __pyx_tuple__17 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_1_0); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 731, __pyx_L1_error)
+ __pyx_tuple__17 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_1_0); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 813, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__17);
__Pyx_GIVEREF(__pyx_tuple__17);
- __pyx_tuple__18 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_1_0); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 731, __pyx_L1_error)
+ __pyx_tuple__18 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_1_0); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 813, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__18);
__Pyx_GIVEREF(__pyx_tuple__18);
- /* "pygame/_sdl2/video.pyx":732
+ /* "pygame/_sdl2/video.pyx":814
* def draw_triangle(self, p1_xy, p2_xy, p3_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0),
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)): # <<<<<<<<<<<<<<
- * """ Copy a triangle portion of the texture to the rendering target by vertices coordinates.
+ * """Copy a triangle portion of the texture to the rendering target using the given coordinates
*
*/
- __pyx_tuple__19 = PyTuple_Pack(4, __pyx_int_255, __pyx_int_255, __pyx_int_255, __pyx_int_255); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 732, __pyx_L1_error)
+ __pyx_tuple__19 = PyTuple_Pack(4, __pyx_int_255, __pyx_int_255, __pyx_int_255, __pyx_int_255); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__19);
__Pyx_GIVEREF(__pyx_tuple__19);
- /* "pygame/_sdl2/video.pyx":776
+ /* "pygame/_sdl2/video.pyx":858
*
* def draw_quad(self, p1_xy, p2_xy, p3_xy, p4_xy,
* p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0), # <<<<<<<<<<<<<<
* p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255),
* p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)):
*/
- __pyx_tuple__20 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 776, __pyx_L1_error)
+ __pyx_tuple__20 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 858, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__20);
__Pyx_GIVEREF(__pyx_tuple__20);
- /* "pygame/_sdl2/video.pyx":843
+ /* "pygame/_sdl2/video.pyx":929
*
* if not pgSurface_Check(surface):
* raise TypeError("update source should be a Surface.") # <<<<<<<<<<<<<<
*
* cdef SDL_Rect rect
*/
- __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_update_source_should_be_a_Surfac); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 843, __pyx_L1_error)
+ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_update_source_should_be_a_Surfac); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 929, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__21);
__Pyx_GIVEREF(__pyx_tuple__21);
- /* "pygame/_sdl2/video.pyx":855
+ /* "pygame/_sdl2/video.pyx":941
*
* if rectptr == NULL and area is not None:
* raise TypeError('area must be a rectangle or None') # <<<<<<<<<<<<<<
*
* cdef Uint32 format_
*/
- __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_a_rectangle_or_None); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 855, __pyx_L1_error)
+ __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_a_rectangle_or_None); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 941, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__22);
__Pyx_GIVEREF(__pyx_tuple__22);
@@ -23622,47 +23807,47 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__24);
__Pyx_GIVEREF(__pyx_tuple__24);
- /* "pygame/_sdl2/video.pyx":914
+ /* "pygame/_sdl2/video.pyx":1013
* rectptr = pgRect_FromObject(srcrect, &temp)
* if rectptr == NULL:
* raise TypeError('srcrect must be None or a rectangle') # <<<<<<<<<<<<<<
* temp.x = rectptr.x
* temp.y = rectptr.y
*/
- __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_None_or_a_rectan); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_None_or_a_rectan); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1013, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__25);
__Pyx_GIVEREF(__pyx_tuple__25);
- /* "pygame/_sdl2/video.pyx":924
+ /* "pygame/_sdl2/video.pyx":1023
* temp.x + temp.w > self.srcrect.w or \
* temp.y + temp.h > self.srcrect.h:
* raise ValueError('rect values are out of range') # <<<<<<<<<<<<<<
* temp.x += self.srcrect.x
* temp.y += self.srcrect.y
*/
- __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_rect_values_are_out_of_range); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 924, __pyx_L1_error)
+ __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_rect_values_are_out_of_range); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 1023, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__26);
__Pyx_GIVEREF(__pyx_tuple__26);
- /* "pygame/_sdl2/video.pyx":935
+ /* "pygame/_sdl2/video.pyx":1036
* @color.setter
* def color(self, new_color):
* self._color[:3] = new_color[:3] # <<<<<<<<<<<<<<
*
* @property
*/
- __pyx_slice__27 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 935, __pyx_L1_error)
+ __pyx_slice__27 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 1036, __pyx_L1_error)
__Pyx_GOTREF(__pyx_slice__27);
__Pyx_GIVEREF(__pyx_slice__27);
- /* "pygame/_sdl2/video.pyx":978
+ /* "pygame/_sdl2/video.pyx":1095
* rectptr = pgRect_FromObject(srcrect, &src)
* if rectptr == NULL:
* raise TypeError('srcrect must be a rect or None') # <<<<<<<<<<<<<<
* src.x = rectptr.x
* src.y = rectptr.y
*/
- __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_a_rect_or_None); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 978, __pyx_L1_error)
+ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_a_rect_or_None); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1095, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__28);
__Pyx_GIVEREF(__pyx_tuple__28);
@@ -23685,91 +23870,91 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__30);
__Pyx_GIVEREF(__pyx_tuple__30);
- /* "pygame/_sdl2/video.pyx":1098
- * """
+ /* "pygame/_sdl2/video.pyx":1264
+ * def draw_color(self, new_value):
* # https://wiki.libsdl.org/SDL_SetRenderDrawColor
* self._draw_color[:] = new_value # <<<<<<<<<<<<<<
* cdef int res = SDL_SetRenderDrawColor(self._renderer,
* new_value[0],
*/
- __pyx_slice__31 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__31)) __PYX_ERR(0, 1098, __pyx_L1_error)
+ __pyx_slice__31 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__31)) __PYX_ERR(0, 1264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_slice__31);
__Pyx_GIVEREF(__pyx_slice__31);
- /* "pygame/_sdl2/video.pyx":1181
+ /* "pygame/_sdl2/video.pyx":1314
* cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
* if rectptr == NULL:
* raise TypeError('expected a rectangle') # <<<<<<<<<<<<<<
*
* if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
*/
- __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_expected_a_rectangle); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1181, __pyx_L1_error)
+ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_expected_a_rectangle); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__32);
__Pyx_GIVEREF(__pyx_tuple__32);
- /* "pygame/_sdl2/video.pyx":1209
+ /* "pygame/_sdl2/video.pyx":1379
* raise error()
* else:
* raise TypeError('target must be a Texture or None') # <<<<<<<<<<<<<<
*
* cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):
*/
- __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_target_must_be_a_Texture_or_None); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1209, __pyx_L1_error)
+ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_target_must_be_a_Texture_or_None); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1379, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__33);
__Pyx_GIVEREF(__pyx_tuple__33);
- /* "pygame/_sdl2/video.pyx":1224
+ /* "pygame/_sdl2/video.pyx":1399
* (source).draw(area, dest)
* elif not hasattr(source, 'draw'):
* raise TypeError('source must be drawable') # <<<<<<<<<<<<<<
* else:
* source.draw(area, dest)
*/
- __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_source_must_be_drawable); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1224, __pyx_L1_error)
+ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_source_must_be_drawable); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1399, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__34);
__Pyx_GIVEREF(__pyx_tuple__34);
- /* "pygame/_sdl2/video.pyx":1355
+ /* "pygame/_sdl2/video.pyx":1553
* rectptr = pgRect_FromObject(area, &rarea)
* if rectptr == NULL:
* raise TypeError('area must be None or a rect') # <<<<<<<<<<<<<<
*
* # clip area
*/
- __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_None_or_a_rect); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 1355, __pyx_L1_error)
+ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_None_or_a_rect); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 1553, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__35);
__Pyx_GIVEREF(__pyx_tuple__35);
- /* "pygame/_sdl2/video.pyx":1383
+ /* "pygame/_sdl2/video.pyx":1581
* format)
* if surf == NULL:
* raise MemoryError("not enough memory for the surface") # <<<<<<<<<<<<<<
*
* surface = pgSurface_New2(surf, 1)
*/
- __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_not_enough_memory_for_the_surfac); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1383, __pyx_L1_error)
+ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_not_enough_memory_for_the_surfac); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__36);
__Pyx_GIVEREF(__pyx_tuple__36);
- /* "pygame/_sdl2/video.pyx":1389
+ /* "pygame/_sdl2/video.pyx":1587
* surf = pgSurface_AsSurface(surface)
* if surf.w < rarea.w or surf.h < rarea.h:
* raise ValueError("the surface is too small") # <<<<<<<<<<<<<<
* format = surf.format.format
* else:
*/
- __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_the_surface_is_too_small); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 1389, __pyx_L1_error)
+ __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_the_surface_is_too_small); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 1587, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__37);
__Pyx_GIVEREF(__pyx_tuple__37);
- /* "pygame/_sdl2/video.pyx":1392
+ /* "pygame/_sdl2/video.pyx":1590
* format = surf.format.format
* else:
* raise TypeError("'surface' must be a surface or None") # <<<<<<<<<<<<<<
*
* if SDL_RenderReadPixels(self._renderer,
*/
- __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_surface_or_No); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1392, __pyx_L1_error)
+ __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_surface_or_No); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__38);
__Pyx_GIVEREF(__pyx_tuple__38);
@@ -23792,88 +23977,88 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__40);
__Pyx_GIVEREF(__pyx_tuple__40);
- /* "pygame/_sdl2/video.pyx":24
+ /* "pygame/_sdl2/video.pyx":25
*
* class RendererDriverInfo:
* def __repr__(self): # <<<<<<<<<<<<<<
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
* self.__class__.__name__,
*/
- __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__41);
__Pyx_GIVEREF(__pyx_tuple__41);
- __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_repr, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_repr, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 25, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":34
+ /* "pygame/_sdl2/video.pyx":35
* )
*
* def get_drivers(): # <<<<<<<<<<<<<<
- * cdef int num = SDL_GetNumRenderDrivers()
- * cdef SDL_RendererInfo info
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
*/
- __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_info, __pyx_n_s_ind, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_info, __pyx_n_s_ind, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__43);
__Pyx_GIVEREF(__pyx_tuple__43);
- __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_drivers, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_drivers, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 35, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":49
+ /* "pygame/_sdl2/video.pyx":52
*
*
* def get_grabbed_window(): # <<<<<<<<<<<<<<
- * """return the Window with input grab enabled,
- * or None if input isn't grabbed."""
+ * """Get the window with input grab enabled
+ *
*/
- __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_win, __pyx_n_s_ptr); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_win, __pyx_n_s_ptr); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 52, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__44);
__Pyx_GIVEREF(__pyx_tuple__44);
- __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_grabbed_window, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_grabbed_window, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 52, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":62
- *
+ /* "pygame/_sdl2/video.pyx":67
+ * return None
*
* def messagebox(title, message, # <<<<<<<<<<<<<<
* Window window=None,
* bint info=False,
*/
- __pyx_tuple__46 = PyTuple_Pack(17, __pyx_n_s_title, __pyx_n_s_message, __pyx_n_s_window, __pyx_n_s_info, __pyx_n_s_warn, __pyx_n_s_error, __pyx_n_s_buttons, __pyx_n_s_return_button, __pyx_n_s_escape_button, __pyx_n_s_c_buttons, __pyx_n_s_data, __pyx_n_s_button, __pyx_n_s_buttons_utf8, __pyx_n_s_i, __pyx_n_s_but, __pyx_n_s_buttonid, __pyx_n_s_s); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 62, __pyx_L1_error)
+ __pyx_tuple__46 = PyTuple_Pack(17, __pyx_n_s_title, __pyx_n_s_message, __pyx_n_s_window, __pyx_n_s_info, __pyx_n_s_warn, __pyx_n_s_error, __pyx_n_s_buttons, __pyx_n_s_return_button, __pyx_n_s_escape_button, __pyx_n_s_c_buttons, __pyx_n_s_data, __pyx_n_s_button, __pyx_n_s_buttons_utf8, __pyx_n_s_i, __pyx_n_s_but, __pyx_n_s_buttonid, __pyx_n_s_s); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 67, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__46);
__Pyx_GIVEREF(__pyx_tuple__46);
- __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(9, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_messagebox, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 62, __pyx_L1_error)
+ __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(9, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_messagebox, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 67, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":142
+ /* "pygame/_sdl2/video.pyx":150
*
- * cdef class Window:
+ * cdef class _Window:
* DEFAULT_SIZE = 640, 480 # <<<<<<<<<<<<<<
*
* _kwarg_to_flag = {
*/
- __pyx_tuple__48 = PyTuple_Pack(2, __pyx_int_640, __pyx_int_480); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 142, __pyx_L1_error)
+ __pyx_tuple__48 = PyTuple_Pack(2, __pyx_int_640, __pyx_int_480); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__48);
__Pyx_GIVEREF(__pyx_tuple__48);
- /* "pygame/_sdl2/video.pyx":579
+ /* "pygame/_sdl2/video.pyx":645
*
* @staticmethod
* def from_surface(Renderer renderer, surface): # <<<<<<<<<<<<<<
- * """ Create a texture from an existing surface.
+ * """Create a texture from an existing surface
*
*/
- __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_renderer, __pyx_n_s_surface, __pyx_n_s_self, __pyx_n_s_renderer_2, __pyx_n_s_surf_ptr); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 579, __pyx_L1_error)
+ __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_renderer, __pyx_n_s_surface, __pyx_n_s_self, __pyx_n_s_renderer_2, __pyx_n_s_surf_ptr); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 645, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__49);
__Pyx_GIVEREF(__pyx_tuple__49);
- __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_from_surface, 579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 579, __pyx_L1_error)
+ __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_from_surface, 645, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 645, __pyx_L1_error)
- /* "pygame/_sdl2/video.pyx":1401
+ /* "pygame/_sdl2/video.pyx":1599
*
* @staticmethod
* def compose_custom_blend_mode(color_mode, alpha_mode): # <<<<<<<<<<<<<<
- * """ Use this function to compose a custom blend mode..
+ * """Compose a custom blend mode
*
*/
- __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_color_mode, __pyx_n_s_alpha_mode, __pyx_n_s_res); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1401, __pyx_L1_error)
+ __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_color_mode, __pyx_n_s_alpha_mode, __pyx_n_s_res); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__51);
__Pyx_GIVEREF(__pyx_tuple__51);
- __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_compose_custom_blend_mode, 1401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 1401, __pyx_L1_error)
+ __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_compose_custom_blend_mode, 1599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -23932,6 +24117,7 @@ static int __Pyx_modinit_function_export_code(void) {
static int __Pyx_modinit_type_init_code(void) {
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -23943,30 +24129,34 @@ static int __Pyx_modinit_type_init_code(void) {
if (!__pyx_ptype_6pygame_5_sdl2_5video_Color) __PYX_ERR(2, 484, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Rect = __Pyx_ImportType(__pyx_t_1, "pygame", "Rect", sizeof(pgRectObject), __Pyx_ImportType_CheckSize_Warn);
if (!__pyx_ptype_6pygame_5_sdl2_5video_Rect) __PYX_ERR(2, 488, __pyx_L1_error)
- if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
+ __pyx_t_2 = PyImport_ImportModule("pygame._window"); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 492, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_ptype_6pygame_5_sdl2_5video_Window = __Pyx_ImportType(__pyx_t_2, "pygame._window", "Window", sizeof(pgWindowObject), __Pyx_ImportType_CheckSize_Warn);
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Window) __PYX_ERR(2, 492, __pyx_L1_error)
+ if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video__Window) < 0) __PYX_ERR(0, 149, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
- __pyx_type_6pygame_5_sdl2_5video_Window.tp_print = 0;
+ __pyx_type_6pygame_5_sdl2_5video__Window.tp_print = 0;
#endif
- if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Window.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Window.tp_getattro == PyObject_GenericGetAttr)) {
- __pyx_type_6pygame_5_sdl2_5video_Window.tp_getattro = __Pyx_PyObject_GenericGetAttr;
+ if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video__Window.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video__Window.tp_getattro == PyObject_GenericGetAttr)) {
+ __pyx_type_6pygame_5_sdl2_5video__Window.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
#if CYTHON_UPDATE_DESCRIPTOR_DOC
{
- PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Window, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 141, __pyx_L1_error)
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video__Window, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 149, __pyx_L1_error)
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_6Window_2__init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__;
+ __pyx_wrapperbase_6pygame_5_sdl2_5video_7_Window_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_6pygame_5_sdl2_5video_7_Window_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_7_Window_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_7_Window_2__init__;
}
}
#endif
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Window, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
- if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
- __pyx_ptype_6pygame_5_sdl2_5video_Window = &__pyx_type_6pygame_5_sdl2_5video_Window;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Window, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video__Window) < 0) __PYX_ERR(0, 149, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video__Window) < 0) __PYX_ERR(0, 149, __pyx_L1_error)
+ __pyx_ptype_6pygame_5_sdl2_5video__Window = &__pyx_type_6pygame_5_sdl2_5video__Window;
__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer = &__pyx_vtable_6pygame_5_sdl2_5video_Renderer;
__pyx_vtable_6pygame_5_sdl2_5video_Renderer.get_viewport = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, int __pyx_skip_dispatch))__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport;
__pyx_vtable_6pygame_5_sdl2_5video_Renderer.blit = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit;
- if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1008, __pyx_L1_error)
+ if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_6pygame_5_sdl2_5video_Renderer.tp_print = 0;
#endif
@@ -23975,7 +24165,7 @@ static int __Pyx_modinit_type_init_code(void) {
}
#if CYTHON_UPDATE_DESCRIPTOR_DOC
{
- PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1008, __pyx_L1_error)
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1125, __pyx_L1_error)
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_8Renderer_2__init__;
@@ -23983,14 +24173,14 @@ static int __Pyx_modinit_type_init_code(void) {
}
}
#endif
- if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Renderer.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1008, __pyx_L1_error)
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Renderer, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1008, __pyx_L1_error)
- if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1008, __pyx_L1_error)
+ if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Renderer.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Renderer, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Renderer = &__pyx_type_6pygame_5_sdl2_5video_Renderer;
__pyx_vtabptr_6pygame_5_sdl2_5video_Texture = &__pyx_vtable_6pygame_5_sdl2_5video_Texture;
__pyx_vtable_6pygame_5_sdl2_5video_Texture.draw_internal = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, SDL_Rect *, SDL_Rect *, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal;
__pyx_vtable_6pygame_5_sdl2_5video_Texture.draw = (void (*)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_7Texture_draw;
- if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 501, __pyx_L1_error)
+ if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_6pygame_5_sdl2_5video_Texture.tp_print = 0;
#endif
@@ -23999,7 +24189,7 @@ static int __Pyx_modinit_type_init_code(void) {
}
#if CYTHON_UPDATE_DESCRIPTOR_DOC
{
- PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 501, __pyx_L1_error)
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 540, __pyx_L1_error)
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_7Texture_2__init__;
@@ -24007,24 +24197,34 @@ static int __Pyx_modinit_type_init_code(void) {
}
}
#endif
- if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Texture.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 501, __pyx_L1_error)
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Texture, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 501, __pyx_L1_error)
- if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 501, __pyx_L1_error)
+ if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Texture.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Texture, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Texture = &__pyx_type_6pygame_5_sdl2_5video_Texture;
__pyx_vtabptr_6pygame_5_sdl2_5video_Image = &__pyx_vtable_6pygame_5_sdl2_5video_Image;
__pyx_vtable_6pygame_5_sdl2_5video_Image.draw = (void (*)(struct __pyx_obj_6pygame_5_sdl2_5video_Image *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_5Image_draw;
- if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
+ if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 971, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_6pygame_5_sdl2_5video_Image.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Image.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Image.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_6pygame_5_sdl2_5video_Image.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
- if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Image.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Image, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
- if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 885, __pyx_L1_error)
+ #if CYTHON_UPDATE_DESCRIPTOR_DOC
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Image, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 971, __pyx_L1_error)
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_6pygame_5_sdl2_5video_5Image_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_6pygame_5_sdl2_5video_5Image_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_5Image_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_5Image_2__init__;
+ }
+ }
+ #endif
+ if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Image.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 971, __pyx_L1_error)
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Image, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 971, __pyx_L1_error)
+ if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 971, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Image = &__pyx_type_6pygame_5_sdl2_5video_Image;
- if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
+ if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers.tp_print = 0;
#endif
@@ -24033,10 +24233,12 @@ static int __Pyx_modinit_type_init_code(void) {
}
__pyx_ptype_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers = &__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
__Pyx_RefNannyFinishContext();
return -1;
}
@@ -24455,7 +24657,7 @@ if (!__Pyx_RefNanny) {
* import_pygame_color()
* import_pygame_surface() # <<<<<<<<<<<<<<
* import_pygame_rect()
- *
+ * import_pygame_window()
*/
import_pygame_surface();
@@ -24463,442 +24665,463 @@ if (!__Pyx_RefNanny) {
* import_pygame_color()
* import_pygame_surface()
* import_pygame_rect() # <<<<<<<<<<<<<<
+ * import_pygame_window()
*
- * class RendererDriverInfo:
*/
import_pygame_rect();
- /* "pygame/_sdl2/video.pyx":23
+ /* "pygame/_sdl2/video.pyx":22
+ * import_pygame_surface()
* import_pygame_rect()
+ * import_pygame_window() # <<<<<<<<<<<<<<
+ *
+ * class RendererDriverInfo:
+ */
+ import_pygame_window();
+
+ /* "pygame/_sdl2/video.pyx":24
+ * import_pygame_window()
*
* class RendererDriverInfo: # <<<<<<<<<<<<<<
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
*/
- __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_RendererDriverInfo, __pyx_n_s_RendererDriverInfo, (PyObject *) NULL, __pyx_n_s_pygame__sdl2_video, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_RendererDriverInfo, __pyx_n_s_RendererDriverInfo, (PyObject *) NULL, __pyx_n_s_pygame__sdl2_video, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- /* "pygame/_sdl2/video.pyx":24
+ /* "pygame/_sdl2/video.pyx":25
*
* class RendererDriverInfo:
* def __repr__(self): # <<<<<<<<<<<<<<
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
* self.__class__.__name__,
*/
- __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__, 0, __pyx_n_s_RendererDriverInfo___repr, NULL, __pyx_n_s_pygame__sdl2_video, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__, 0, __pyx_n_s_RendererDriverInfo___repr, NULL, __pyx_n_s_pygame__sdl2_video, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
+ if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":23
- * import_pygame_rect()
+ /* "pygame/_sdl2/video.pyx":24
+ * import_pygame_window()
*
* class RendererDriverInfo: # <<<<<<<<<<<<<<
* def __repr__(self):
* return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
*/
- __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_RendererDriverInfo, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_RendererDriverInfo, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_RendererDriverInfo, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RendererDriverInfo, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":34
+ /* "pygame/_sdl2/video.pyx":35
* )
*
* def get_drivers(): # <<<<<<<<<<<<<<
- * cdef int num = SDL_GetNumRenderDrivers()
- * cdef SDL_RendererInfo info
+ * """Yield info about the rendering drivers available for Renderer objects
+ * """
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_1get_drivers, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_1get_drivers, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_drivers, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_drivers, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":49
+ /* "pygame/_sdl2/video.pyx":52
*
*
* def get_grabbed_window(): # <<<<<<<<<<<<<<
- * """return the Window with input grab enabled,
- * or None if input isn't grabbed."""
+ * """Get the window with input grab enabled
+ *
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_4get_grabbed_window, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_4get_grabbed_window, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_grabbed_window, __pyx_t_1) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_grabbed_window, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":62
- *
+ /* "pygame/_sdl2/video.pyx":67
+ * return None
*
* def messagebox(title, message, # <<<<<<<<<<<<<<
* Window window=None,
* bint info=False,
*/
- __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_6messagebox, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_6messagebox, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_messagebox, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "pygame/_sdl2/video.pyx":147
+ * return buttonid
+ *
+ * globals()["Window"]=Window # <<<<<<<<<<<<<<
+ *
+ * cdef class _Window:
+ */
+ __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_messagebox, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
+ if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_Window_2, ((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window)) < 0)) __PYX_ERR(0, 147, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "pygame/_sdl2/video.pyx":142
+ /* "pygame/_sdl2/video.pyx":150
*
- * cdef class Window:
+ * cdef class _Window:
* DEFAULT_SIZE = 640, 480 # <<<<<<<<<<<<<<
*
* _kwarg_to_flag = {
*/
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_DEFAULT_SIZE, __pyx_tuple__48) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
- PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video__Window->tp_dict, __pyx_n_s_DEFAULT_SIZE, __pyx_tuple__48) < 0) __PYX_ERR(0, 150, __pyx_L1_error)
+ PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video__Window);
- /* "pygame/_sdl2/video.pyx":145
+ /* "pygame/_sdl2/video.pyx":153
*
* _kwarg_to_flag = {
* 'opengl': _SDL_WINDOW_OPENGL, # <<<<<<<<<<<<<<
* 'vulkan': _SDL_WINDOW_VULKAN,
* 'hidden': _SDL_WINDOW_HIDDEN,
*/
- __pyx_t_1 = __Pyx_PyDict_NewPresized(18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyDict_NewPresized(18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_OPENGL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_OPENGL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_opengl, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_opengl, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":146
+ /* "pygame/_sdl2/video.pyx":154
* _kwarg_to_flag = {
* 'opengl': _SDL_WINDOW_OPENGL,
* 'vulkan': _SDL_WINDOW_VULKAN, # <<<<<<<<<<<<<<
* 'hidden': _SDL_WINDOW_HIDDEN,
* 'borderless': _SDL_WINDOW_BORDERLESS,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_VULKAN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_VULKAN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_vulkan, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_vulkan, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":147
+ /* "pygame/_sdl2/video.pyx":155
* 'opengl': _SDL_WINDOW_OPENGL,
* 'vulkan': _SDL_WINDOW_VULKAN,
* 'hidden': _SDL_WINDOW_HIDDEN, # <<<<<<<<<<<<<<
* 'borderless': _SDL_WINDOW_BORDERLESS,
* 'resizable': _SDL_WINDOW_RESIZABLE,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_HIDDEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_HIDDEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hidden, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hidden, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":148
+ /* "pygame/_sdl2/video.pyx":156
* 'vulkan': _SDL_WINDOW_VULKAN,
* 'hidden': _SDL_WINDOW_HIDDEN,
* 'borderless': _SDL_WINDOW_BORDERLESS, # <<<<<<<<<<<<<<
* 'resizable': _SDL_WINDOW_RESIZABLE,
* 'minimized': _SDL_WINDOW_MINIMIZED,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_BORDERLESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_BORDERLESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_borderless, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_borderless, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":149
+ /* "pygame/_sdl2/video.pyx":157
* 'hidden': _SDL_WINDOW_HIDDEN,
* 'borderless': _SDL_WINDOW_BORDERLESS,
* 'resizable': _SDL_WINDOW_RESIZABLE, # <<<<<<<<<<<<<<
* 'minimized': _SDL_WINDOW_MINIMIZED,
* 'maximized': _SDL_WINDOW_MAXIMIZED,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_RESIZABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_RESIZABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_resizable, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_resizable, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":150
+ /* "pygame/_sdl2/video.pyx":158
* 'borderless': _SDL_WINDOW_BORDERLESS,
* 'resizable': _SDL_WINDOW_RESIZABLE,
* 'minimized': _SDL_WINDOW_MINIMIZED, # <<<<<<<<<<<<<<
* 'maximized': _SDL_WINDOW_MAXIMIZED,
* 'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MINIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MINIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minimized, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minimized, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":151
+ /* "pygame/_sdl2/video.pyx":159
* 'resizable': _SDL_WINDOW_RESIZABLE,
* 'minimized': _SDL_WINDOW_MINIMIZED,
* 'maximized': _SDL_WINDOW_MAXIMIZED, # <<<<<<<<<<<<<<
* 'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
* 'input_focus': _SDL_WINDOW_INPUT_FOCUS,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MAXIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MAXIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maximized, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maximized, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":152
+ /* "pygame/_sdl2/video.pyx":160
* 'minimized': _SDL_WINDOW_MINIMIZED,
* 'maximized': _SDL_WINDOW_MAXIMIZED,
* 'input_grabbed': _SDL_WINDOW_INPUT_GRABBED, # <<<<<<<<<<<<<<
* 'input_focus': _SDL_WINDOW_INPUT_FOCUS,
* 'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_GRABBED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_GRABBED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_grabbed, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_grabbed, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":153
+ /* "pygame/_sdl2/video.pyx":161
* 'maximized': _SDL_WINDOW_MAXIMIZED,
* 'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
* 'input_focus': _SDL_WINDOW_INPUT_FOCUS, # <<<<<<<<<<<<<<
* 'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
* 'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_focus, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_focus, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":154
+ /* "pygame/_sdl2/video.pyx":162
* 'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
* 'input_focus': _SDL_WINDOW_INPUT_FOCUS,
* 'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS, # <<<<<<<<<<<<<<
* 'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
* 'foreign': _SDL_WINDOW_FOREIGN,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_focus, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_focus, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":155
+ /* "pygame/_sdl2/video.pyx":163
* 'input_focus': _SDL_WINDOW_INPUT_FOCUS,
* 'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
* 'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI, # <<<<<<<<<<<<<<
* 'foreign': _SDL_WINDOW_FOREIGN,
* 'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALLOW_HIGHDPI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALLOW_HIGHDPI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allow_highdpi, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allow_highdpi, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":156
+ /* "pygame/_sdl2/video.pyx":164
* 'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
* 'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
* 'foreign': _SDL_WINDOW_FOREIGN, # <<<<<<<<<<<<<<
* 'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
* 'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FOREIGN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FOREIGN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_foreign, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_foreign, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":157
+ /* "pygame/_sdl2/video.pyx":165
* 'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
* 'foreign': _SDL_WINDOW_FOREIGN,
* 'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE, # <<<<<<<<<<<<<<
* 'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
* 'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_CAPTURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_CAPTURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_capture, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_capture, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":158
+ /* "pygame/_sdl2/video.pyx":166
* 'foreign': _SDL_WINDOW_FOREIGN,
* 'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
* 'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP, # <<<<<<<<<<<<<<
* 'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
* 'utility': _SDL_WINDOW_UTILITY,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALWAYS_ON_TOP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALWAYS_ON_TOP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_always_on_top, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_always_on_top, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":159
+ /* "pygame/_sdl2/video.pyx":167
* 'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
* 'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
* 'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR, # <<<<<<<<<<<<<<
* 'utility': _SDL_WINDOW_UTILITY,
* 'tooltip': _SDL_WINDOW_TOOLTIP,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_SKIP_TASKBAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_SKIP_TASKBAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_skip_taskbar, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_skip_taskbar, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":160
+ /* "pygame/_sdl2/video.pyx":168
* 'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
* 'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
* 'utility': _SDL_WINDOW_UTILITY, # <<<<<<<<<<<<<<
* 'tooltip': _SDL_WINDOW_TOOLTIP,
* 'popup_menu': _SDL_WINDOW_POPUP_MENU,
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_UTILITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_UTILITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_utility, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_utility, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":161
+ /* "pygame/_sdl2/video.pyx":169
* 'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
* 'utility': _SDL_WINDOW_UTILITY,
* 'tooltip': _SDL_WINDOW_TOOLTIP, # <<<<<<<<<<<<<<
* 'popup_menu': _SDL_WINDOW_POPUP_MENU,
* }
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_TOOLTIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_TOOLTIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_tooltip, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_tooltip, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":162
+ /* "pygame/_sdl2/video.pyx":170
* 'utility': _SDL_WINDOW_UTILITY,
* 'tooltip': _SDL_WINDOW_TOOLTIP,
* 'popup_menu': _SDL_WINDOW_POPUP_MENU, # <<<<<<<<<<<<<<
* }
*
*/
- __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_POPUP_MENU); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_POPUP_MENU); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_popup_menu, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_popup_menu, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_kwarg_to_flag, __pyx_t_1) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video__Window->tp_dict, __pyx_n_s_kwarg_to_flag, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
+ PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video__Window);
- /* "pygame/_sdl2/video.pyx":166
+ /* "pygame/_sdl2/video.pyx":174
*
* @classmethod
* def from_display_module(cls): # <<<<<<<<<<<<<<
- * cdef Window self = cls.__new__(cls)
- * cdef SDL_Window* window = pg_GetDefaultWindow()
+ * """Create a Window object using window data from display module
+ *
*/
- __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window, __pyx_n_s_from_display_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
+ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video__Window, __pyx_n_s_from_display_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- /* "pygame/_sdl2/video.pyx":165
+ /* "pygame/_sdl2/video.pyx":173
* }
*
* @classmethod # <<<<<<<<<<<<<<
* def from_display_module(cls):
- * cdef Window self = cls.__new__(cls)
+ * """Create a Window object using window data from display module
*/
- __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_from_display_module, __pyx_t_2) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video__Window->tp_dict, __pyx_n_s_from_display_module, __pyx_t_2) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
+ PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video__Window);
- /* "pygame/_sdl2/video.pyx":177
+ /* "pygame/_sdl2/video.pyx":190
*
- * def __init__(self, title='pygame',
+ * def __init__(self, title='pygame window',
* size=DEFAULT_SIZE, # <<<<<<<<<<<<<<
* position=WINDOWPOS_UNDEFINED,
* bint fullscreen=False,
*/
- __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window, __pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
+ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video__Window, __pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_k__3 = __pyx_t_2;
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":178
- * def __init__(self, title='pygame',
+ /* "pygame/_sdl2/video.pyx":191
+ * def __init__(self, title='pygame window',
* size=DEFAULT_SIZE,
* position=WINDOWPOS_UNDEFINED, # <<<<<<<<<<<<<<
* bint fullscreen=False,
* bint fullscreen_desktop=False, **kwargs):
*/
- __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_k__4 = __pyx_t_2;
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- /* "pygame/_sdl2/video.pyx":579
+ /* "pygame/_sdl2/video.pyx":645
*
* @staticmethod
* def from_surface(Renderer renderer, surface): # <<<<<<<<<<<<<<
- * """ Create a texture from an existing surface.
+ * """Create a texture from an existing surface
*
*/
- __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_7Texture_5from_surface, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_7Texture_5from_surface, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_2) < 0) __PYX_ERR(0, 579, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_2) < 0) __PYX_ERR(0, 645, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Texture);
- /* "pygame/_sdl2/video.pyx":578
+ /* "pygame/_sdl2/video.pyx":644
* self.width, self.height = width, height
*
* @staticmethod # <<<<<<<<<<<<<<
* def from_surface(Renderer renderer, surface):
- * """ Create a texture from an existing surface.
+ * """Create a texture from an existing surface
*/
- __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture, __pyx_n_s_from_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
+ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture, __pyx_n_s_from_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_1) < 0) __PYX_ERR(0, 579, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_1) < 0) __PYX_ERR(0, 645, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Texture);
- /* "pygame/_sdl2/video.pyx":1011
+ /* "pygame/_sdl2/video.pyx":1128
*
* @classmethod
- * def from_window(cls, Window window): # <<<<<<<<<<<<<<
- * cdef Renderer self = cls.__new__(cls)
- * self._win = window
+ * def from_window(cls, window): # <<<<<<<<<<<<<<
+ * cdef Window _window
+ * if isinstance(window,(_Window,Window)):
*/
- __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer, __pyx_n_s_from_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
+ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer, __pyx_n_s_from_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1128, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
- /* "pygame/_sdl2/video.pyx":1010
+ /* "pygame/_sdl2/video.pyx":1127
* cdef class Renderer:
*
* @classmethod # <<<<<<<<<<<<<<
- * def from_window(cls, Window window):
- * cdef Renderer self = cls.__new__(cls)
+ * def from_window(cls, window):
+ * cdef Window _window
*/
- __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_from_window, __pyx_t_2) < 0) __PYX_ERR(0, 1011, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_from_window, __pyx_t_2) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Renderer);
- /* "pygame/_sdl2/video.pyx":1401
+ /* "pygame/_sdl2/video.pyx":1599
*
* @staticmethod
* def compose_custom_blend_mode(color_mode, alpha_mode): # <<<<<<<<<<<<<<
- * """ Use this function to compose a custom blend mode..
+ * """Compose a custom blend mode
*
*/
- __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1401, __pyx_L1_error)
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_8Renderer_35compose_custom_blend_mode, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_compose_custom_blend_mode, __pyx_t_2) < 0) __PYX_ERR(0, 1401, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_compose_custom_blend_mode, __pyx_t_2) < 0) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Renderer);
- /* "pygame/_sdl2/video.pyx":1400
+ /* "pygame/_sdl2/video.pyx":1598
* return surface
*
* @staticmethod # <<<<<<<<<<<<<<
* def compose_custom_blend_mode(color_mode, alpha_mode):
- * """ Use this function to compose a custom blend mode..
+ * """Compose a custom blend mode
*/
- __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer, __pyx_n_s_compose_custom_blend_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1401, __pyx_L1_error)
+ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer, __pyx_n_s_compose_custom_blend_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1400, __pyx_L1_error)
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1598, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_compose_custom_blend_mode, __pyx_t_1) < 0) __PYX_ERR(0, 1401, __pyx_L1_error)
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_compose_custom_blend_mode, __pyx_t_1) < 0) __PYX_ERR(0, 1599, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Renderer);
@@ -28031,6 +28254,51 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj
return result;
}
+/* Globals */
+static PyObject* __Pyx_Globals(void) {
+ Py_ssize_t i;
+ PyObject *names;
+ PyObject *globals = __pyx_d;
+ Py_INCREF(globals);
+ names = PyObject_Dir(__pyx_m);
+ if (!names)
+ goto bad;
+ for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject* name = PySequence_ITEM(names, i);
+ if (!name)
+ goto bad;
+#else
+ PyObject* name = PyList_GET_ITEM(names, i);
+#endif
+ if (!PyDict_Contains(globals, name)) {
+ PyObject* value = __Pyx_GetAttr(__pyx_m, name);
+ if (!value) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ goto bad;
+ }
+ if (PyDict_SetItem(globals, name, value) < 0) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ Py_DECREF(value);
+ goto bad;
+ }
+ }
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ }
+ Py_DECREF(names);
+ return globals;
+bad:
+ Py_XDECREF(names);
+ Py_XDECREF(globals);
+ return NULL;
+}
+
/* ClassMethod */
static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
diff --git a/src_c/_sprite.c b/src_c/_sprite.c
index 68ae18cc03..32051efd9d 100644
--- a/src_c/_sprite.c
+++ b/src_c/_sprite.c
@@ -711,6 +711,37 @@ static CYTHON_INLINE float __PYX_NAN() {
#include "pythread.h"
#include "_pygame.h"
#include "SDL.h"
+
+ #if SDL_VERSION_ATLEAST(2, 0, 18)
+ typedef SDL_FPoint _pgsdlFPoint;
+ typedef SDL_Vertex _pgsdlVertex;
+ #else
+ typedef struct {
+ float x;
+ float y;
+ } _pgsdlFPoint;
+
+ typedef struct {
+ _pgsdlFPoint position;
+ SDL_Color color;
+ _pgsdlFPoint tex_coord;
+ } _pgsdlVertex;
+ #endif
+
+ #if SDL_VERSION_ATLEAST(2,0,12)
+ typedef SDL_ScaleMode _pgsdlScaleMode;
+ #else
+ typedef enum {
+ SDL_ScaleModeNearest,
+ SDL_ScaleModeLinear,
+ SDL_ScaleModeBest,
+ } _pgsdlScaleMode;
+
+ int SDL_SetTextureScaleMode(SDL_Texture * texture, _pgsdlScaleMode scaleMode){
+ return 0;
+ }
+ #endif
+
#include "pygame.h"
#ifdef _OPENMP
#include
@@ -947,7 +978,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal;
struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw;
struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw;
-/* "_sdl2/video.pxd":421
+/* "_sdl2/video.pxd":524
*
* cpdef object get_viewport(self)
* cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*) # <<<<<<<<<<<<<<
@@ -961,7 +992,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit {
int special_flags;
};
-/* "_sdl2/video.pxd":430
+/* "_sdl2/video.pxd":533
* cdef readonly int height
*
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*, # <<<<<<<<<<<<<<
@@ -976,7 +1007,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal {
int flip_y;
};
-/* "_sdl2/video.pxd":432
+/* "_sdl2/video.pxd":535
* cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*,
* bint flip_x=*, bint flip_y=*)
* cpdef void draw(self, srcrect=*, dstrect=*, float angle=*, origin=*, # <<<<<<<<<<<<<<
@@ -993,7 +1024,7 @@ struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw {
int flip_y;
};
-/* "_sdl2/video.pxd":448
+/* "_sdl2/video.pxd":551
* cdef public Rect srcrect
*
* cpdef void draw(self, srcrect=*, dstrect=*) # <<<<<<<<<<<<<<
@@ -1030,7 +1061,7 @@ struct __pyx_opt_args_6pygame_7_sprite_12LayeredDirty_add_internal {
PyObject *layer;
};
-/* "_sdl2/video.pxd":409
+/* "_sdl2/video.pxd":512
*
*
* cdef class Window: # <<<<<<<<<<<<<<
@@ -1044,7 +1075,7 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Window {
};
-/* "_sdl2/video.pxd":413
+/* "_sdl2/video.pxd":516
* cdef int _is_borrowed
*
* cdef class Renderer: # <<<<<<<<<<<<<<
@@ -1062,7 +1093,7 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Renderer {
};
-/* "_sdl2/video.pxd":423
+/* "_sdl2/video.pxd":526
* cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*)
*
* cdef class Texture: # <<<<<<<<<<<<<<
@@ -1080,7 +1111,7 @@ struct __pyx_obj_6pygame_5_sdl2_5video_Texture {
};
-/* "_sdl2/video.pxd":435
+/* "_sdl2/video.pxd":538
* bint flip_x=*, bint flip_y=*)
*
* cdef class Image: # <<<<<<<<<<<<<<
@@ -1217,7 +1248,7 @@ struct __pyx_obj_6pygame_7_sprite_GroupSingle {
-/* "_sdl2/video.pxd":413
+/* "_sdl2/video.pxd":516
* cdef int _is_borrowed
*
* cdef class Renderer: # <<<<<<<<<<<<<<
@@ -1232,7 +1263,7 @@ struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer {
static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer;
-/* "_sdl2/video.pxd":423
+/* "_sdl2/video.pxd":526
* cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*)
*
* cdef class Texture: # <<<<<<<<<<<<<<
@@ -1247,7 +1278,7 @@ struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture {
static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *__pyx_vtabptr_6pygame_5_sdl2_5video_Texture;
-/* "_sdl2/video.pxd":435
+/* "_sdl2/video.pxd":538
* bint flip_x=*, bint flip_y=*)
*
* cdef class Image: # <<<<<<<<<<<<<<
@@ -27342,25 +27373,25 @@ static int __Pyx_modinit_type_import_code(void) {
__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyImport_ImportModule("pygame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 400, __pyx_L1_error)
+ __pyx_t_1 = PyImport_ImportModule("pygame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 484, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_ptype_6pygame_5_sdl2_5video_Color = __Pyx_ImportType(__pyx_t_1, "pygame", "Color", sizeof(pgColorObject), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Color) __PYX_ERR(5, 400, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Color) __PYX_ERR(5, 484, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Rect = __Pyx_ImportType(__pyx_t_1, "pygame", "Rect", sizeof(pgRectObject), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Rect) __PYX_ERR(5, 404, __pyx_L1_error)
- __pyx_t_2 = PyImport_ImportModule("pygame._sdl2.video"); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 409, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Rect) __PYX_ERR(5, 488, __pyx_L1_error)
+ __pyx_t_2 = PyImport_ImportModule("pygame._sdl2.video"); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 512, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_ptype_6pygame_5_sdl2_5video_Window = __Pyx_ImportType(__pyx_t_2, "pygame._sdl2.video", "Window", sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Window), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Window) __PYX_ERR(5, 409, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Window) __PYX_ERR(5, 512, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Renderer = __Pyx_ImportType(__pyx_t_2, "pygame._sdl2.video", "Renderer", sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Renderer) __PYX_ERR(5, 413, __pyx_L1_error)
- __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer)) __PYX_ERR(5, 413, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Renderer) __PYX_ERR(5, 516, __pyx_L1_error)
+ __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer)) __PYX_ERR(5, 516, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Texture = __Pyx_ImportType(__pyx_t_2, "pygame._sdl2.video", "Texture", sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Texture), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Texture) __PYX_ERR(5, 423, __pyx_L1_error)
- __pyx_vtabptr_6pygame_5_sdl2_5video_Texture = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Texture)) __PYX_ERR(5, 423, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Texture) __PYX_ERR(5, 526, __pyx_L1_error)
+ __pyx_vtabptr_6pygame_5_sdl2_5video_Texture = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Texture)) __PYX_ERR(5, 526, __pyx_L1_error)
__pyx_ptype_6pygame_5_sdl2_5video_Image = __Pyx_ImportType(__pyx_t_2, "pygame._sdl2.video", "Image", sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Image), __Pyx_ImportType_CheckSize_Warn);
- if (!__pyx_ptype_6pygame_5_sdl2_5video_Image) __PYX_ERR(5, 435, __pyx_L1_error)
- __pyx_vtabptr_6pygame_5_sdl2_5video_Image = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Image->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Image)) __PYX_ERR(5, 435, __pyx_L1_error)
+ if (!__pyx_ptype_6pygame_5_sdl2_5video_Image) __PYX_ERR(5, 538, __pyx_L1_error)
+ __pyx_vtabptr_6pygame_5_sdl2_5video_Image = (struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image*)__Pyx_GetVtable(__pyx_ptype_6pygame_5_sdl2_5video_Image->tp_dict); if (unlikely(!__pyx_vtabptr_6pygame_5_sdl2_5video_Image)) __PYX_ERR(5, 538, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_RefNannyFinishContext();
@@ -28158,7 +28189,7 @@ if (!__Pyx_RefNanny) {
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "pygame/_sprite.pyx":1
- * ## pygame - Python Game Library # <<<<<<<<<<<<<<
+ * ## pygame-ce - Python Game Library # <<<<<<<<<<<<<<
* ## Copyright (C) 2000-2003, 2007 Pete Shinners
* ## (C) 2004 Joe Wreschnig
*/
diff --git a/src_c/color.c b/src_c/color.c
index f4183b035d..dfff85f605 100644
--- a/src_c/color.c
+++ b/src_c/color.c
@@ -21,8 +21,8 @@
/* The follow bug was reported for the pygame.math module:
*
* Adjust gcc 4.4 optimization for floating point on x86-32 PCs running Linux.
- * This addresses bug 52:
- * https://github.com/pygame/pygame/issues/52
+ * This addresses bug 67:
+ * https://github.com/pygame-community/pygame-ce/issues/67
* With this option, floats have consistent precision regardless of optimize
* level.
*
diff --git a/src_c/constants.c b/src_c/constants.c
index 7bb99137c3..6edafcaeb2 100644
--- a/src_c/constants.c
+++ b/src_c/constants.c
@@ -634,6 +634,9 @@ MODINIT_DEFINE(constants)
// https://github.com/pygame-community/pygame-ce/issues/1845
DEC_CONSTS(IS_CE, 1)
+ DEC_CONSTS(WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED);
+ DEC_CONSTS(WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+
if (PyModule_AddObject(module, "__all__", all_list)) {
Py_DECREF(all_list);
Py_DECREF(module);
diff --git a/src_c/cython/pygame/_sdl2/video.pxd b/src_c/cython/pygame/_sdl2/video.pxd
index 080bda38f7..23d89382eb 100644
--- a/src_c/cython/pygame/_sdl2/video.pxd
+++ b/src_c/cython/pygame/_sdl2/video.pxd
@@ -489,6 +489,10 @@ cdef extern from "pygame.h" nogil:
cdef SDL_Rect r
cdef object weakreflist
+ ctypedef class pygame._window.Window [object pgWindowObject]:
+ cdef SDL_Window *_win
+ cdef SDL_bool _is_borrowed
+
ctypedef struct pgSurfaceObject
int pgSurface_Check(object surf)
@@ -508,8 +512,10 @@ cdef extern from "pygame.h" nogil:
void import_pygame_color()
pgSurfaceObject *pgSurface_New2(SDL_Surface *info, int owner)
+ int pgWindow_Check(object win)
+ void import_pygame_window()
-cdef class Window:
+cdef class _Window:
cdef SDL_Window* _win
cdef int _is_borrowed
diff --git a/src_c/cython/pygame/_sdl2/video.pyx b/src_c/cython/pygame/_sdl2/video.pyx
index 9e933db625..af907e9c61 100644
--- a/src_c/cython/pygame/_sdl2/video.pyx
+++ b/src_c/cython/pygame/_sdl2/video.pyx
@@ -19,6 +19,7 @@ import_pygame_base()
import_pygame_color()
import_pygame_surface()
import_pygame_rect()
+import_pygame_window()
class RendererDriverInfo:
def __repr__(self):
@@ -32,6 +33,8 @@ class RendererDriverInfo:
)
def get_drivers():
+ """Yield info about the rendering drivers available for Renderer objects
+ """
cdef int num = SDL_GetNumRenderDrivers()
cdef SDL_RendererInfo info
cdef int ind
@@ -47,8 +50,11 @@ def get_drivers():
def get_grabbed_window():
- """return the Window with input grab enabled,
- or None if input isn't grabbed."""
+ """Get the window with input grab enabled
+
+ Gets the :class:`Window` with input grab enabled, if input is grabbed,
+ otherwise ``None`` is returned.
+ """
cdef SDL_Window *win = SDL_GetGrabbedWindow()
cdef void *ptr
if win:
@@ -58,7 +64,6 @@ def get_grabbed_window():
return ptr
return None
-
def messagebox(title, message,
Window window=None,
bint info=False,
@@ -67,16 +72,18 @@ def messagebox(title, message,
buttons=('OK', ),
return_button=0,
escape_button=0):
- """ Display a message box.
+ """Create a native GUI message box
- :param str title: A title string or None.
+ Creates a native GUI message box.
+
+ :param str title: A title string, or ``None`` to omit a title.
:param str message: A message string.
:param bool info: If ``True``, display an info message.
:param bool warn: If ``True``, display a warning message.
:param bool error: If ``True``, display an error message.
- :param tuple buttons: An optional sequence of buttons to show to the user (strings).
- :param int return_button: Button index to use if the return key is hit (-1 for none).
- :param int escape_button: Button index to use if the escape key is hit (-1 for none).
+ :param tuple buttons: An optional sequence of button name strings to show to the user.
+ :param int return_button: Button index to use if the return key is hit (``-1`` for none).
+ :param int escape_button: Button index to use if the escape key is hit (``-1`` for none).
:return: The index of the button that was pushed.
"""
# TODO: type check
@@ -137,8 +144,9 @@ def messagebox(title, message,
free(c_buttons)
return buttonid
+globals()["Window"]=Window
-cdef class Window:
+cdef class _Window:
DEFAULT_SIZE = 640, 480
_kwarg_to_flag = {
@@ -164,7 +172,12 @@ cdef class Window:
@classmethod
def from_display_module(cls):
- cdef Window self = cls.__new__(cls)
+ """Create a Window object using window data from display module
+
+ Creates a Window object that uses the same window data from the :mod:`pygame.display` module, created upon calling
+ :func:`pygame.display.set_mode`.
+ """
+ cdef _Window self = cls.__new__(cls)
cdef SDL_Window* window = pg_GetDefaultWindow()
if not window:
raise error()
@@ -173,36 +186,49 @@ cdef class Window:
SDL_SetWindowData(window, "pg_window", self)
return self
- def __init__(self, title='pygame',
+ def __init__(self, title='pygame window',
size=DEFAULT_SIZE,
position=WINDOWPOS_UNDEFINED,
bint fullscreen=False,
bint fullscreen_desktop=False, **kwargs):
- """ Create a window with the specified position, dimensions, and flags.
-
- :param str title: the title of the window, in UTF-8 encoding
- :param tuple size: the size of the window, in screen coordinates (width, height)
- :param position: a tuple specifying the window position, WINDOWPOS_CENTERED, or WINDOWPOS_UNDEFINED.
- :param bool fullscreen: fullscreen window using the window size as the resolution (videomode change)
- :param bool fullscreen_desktop: fullscreen window using the current desktop resolution
- :param bool opengl: Usable with OpenGL context. You will still need to create an OpenGL context.
- :param bool vulkan: usable with a Vulkan instance
- :param bool hidden: window is not visible
- :param bool borderless: no window decoration
- :param bool resizable: window can be resized
- :param bool minimized: window is minimized
- :param bool maximized: window is maximized
- :param bool input_grabbed: window has grabbed input focus
- :param bool input_focus: window has input focus
- :param bool mouse_focus: window has mouse focus
- :param bool foreign: window not created by SDL
- :param bool allow_highdpi: window should be created in high-DPI mode if supported (>= SDL 2.0.1)
- :param bool mouse_capture: window has mouse captured (unrelated to INPUT_GRABBED, >= SDL 2.0.4)
- :param bool always_on_top: window should always be above others (X11 only, >= SDL 2.0.5)
- :param bool skip_taskbar: window should not be added to the taskbar (X11 only, >= SDL 2.0.5)
- :param bool utility: window should be treated as a utility window (X11 only, >= SDL 2.0.5)
- :param bool tooltip: window should be treated as a tooltip (X11 only, >= SDL 2.0.5)
- :param bool popup_menu: window should be treated as a popup menu (X11 only, >= SDL 2.0.5)
+ """pygame object that represents a window
+
+ Creates a window.
+
+ :param str title: The title of the window.
+ :param (int, int) size: The size of the window, in screen coordinates.
+ :param (int, int) or int position: A tuple specifying the window position, or
+ ``WINDOWPOS_CENTERED``, or ``WINDOWPOS_UNDEFINED``.
+ :param bool fullscreen: Create a fullscreen window using the window size as
+ the resolution (videomode change).
+ :param bool fullscreen_desktop: Create a fullscreen window using the current
+ desktop resolution.
+ :param bool opengl: Create a window with support for an OpenGL context. You
+ will still need to create an OpenGL context separately.
+ :param bool vulkan: Create a window with support for a Vulkan instance.
+ :param bool hidden: Create a hidden window.
+ :param bool borderless: Create a window without borders.
+ :param bool resizable: Create a resizable window.
+ :param bool minimized: Create a mimized window.
+ :param bool maximized: Create a maximized window.
+ :param bool input_grabbed: Create a window with a grabbed input focus.
+ :param bool input_focus: Create a window with input focus.
+ :param bool mouse_focus: Create a window with mouse focus.
+ :param bool foreign: Marks a window not created by SDL.
+ :param bool allow_highdpi: Create a window in high-DPI mode if supported
+ (>= SDL 2.0.1).
+ :param bool mouse_capture: Create a window that has the mouse captured
+ (unrelated to INPUT_GRABBED, >= SDL 2.0.4).
+ :param bool always_on_top: Create a window that is always on top
+ (X11 only, >= SDL 2.0.5).
+ :param bool skip_taskbar: Create a window that should not be added to the
+ taskbar (X11 only, >= SDL 2.0.5).
+ :param bool utility: Create a window that should be treated as a utility
+ window (X11 only, >= SDL 2.0.5).
+ :param bool tooltip: Create a window that should be treated as a tooltip
+ (X11 only, >= SDL 2.0.5).
+ :param bool popup_menu: Create a window that should be treated as a popup menu
+ (X11 only, >= SDL 2.0.5).
"""
# https://wiki.libsdl.org/SDL_CreateWindow
# https://wiki.libsdl.org/SDL_WindowFlags
@@ -245,15 +271,12 @@ cdef class Window:
@property
def grab(self):
- """ Window's input grab state (``True`` or ``False``).
-
- Set it to ``True`` to grab, ``False`` to release.
+ """Get or set the window's input grab state
- When input is grabbed the mouse is confined to the window.
+ Gets or sets the window's input grab state.
+ When input is grabbed, the mouse is confined to the window.
If the caller enables a grab while another window is currently grabbed,
the other window loses its grab in favor of the caller's window.
-
- :rtype: bool
"""
return SDL_GetWindowGrab(self._win) != 0
@@ -264,13 +287,18 @@ cdef class Window:
@property
def relative_mouse(self):
- """ Window's relative mouse motion state (``True`` or ``False``).
+ """Get or set the window's relative mouse mode state
+
+ Gets or sets the window's relative mouse mode state.
+ SDL2 docs: *"While the mouse is in relative mode, the cursor is hidden,
+ the mouse position is constrained to the window, and SDL will report
+ continuous relative mouse motion even if the mouse is at the edge of the
+ window.*
- Set it to ``True`` to enable, ``False`` to disable.
- If mouse.set_visible(True) is set the input will be grabbed,
- and the mouse will enter endless relative motion mode.
+ *This function will flush any pending mouse motion."*
- :rtype: bool
+ Calling :func:`pygame.mouse.set_visible` with argument
+ ``True`` will exit relative mouse mode.
"""
return SDL_GetRelativeMouseMode()
@@ -282,10 +310,9 @@ cdef class Window:
SDL_SetRelativeMouseMode(1 if enable else 0)
def set_windowed(self):
- """ Enable windowed mode
+ """Enable windowed mode (exit fullscreen)
.. seealso:: :func:`set_fullscreen`
-
"""
# https://wiki.libsdl.org/SDL_SetWindowFullscreen
if SDL_SetWindowFullscreen(self._win, 0):
@@ -297,12 +324,12 @@ cdef class Window:
# window.fullscreen_desktop = True
# window.windowed = True
def set_fullscreen(self, bint desktop=False):
- """ Enable fullscreen for the window
+ """Enter fullscreen
- :param bool desktop: If ``True``: use the current desktop resolution.
- If ``False``: change the fullscreen resolution to the window size.
+ :param bool desktop: If ``True``, use the current desktop resolution.
+ If ``False``, change the fullscreen resolution to the window size.
- .. seealso:: :func:`set_windowed`
+ .. seealso:: :meth:`set_windowed`.
"""
cdef int flags = 0
if desktop:
@@ -314,22 +341,26 @@ cdef class Window:
@property
def title(self):
- """ The title of the window or u"" if there is none.
+ """Get or set the window title
+
+ Gets or sets the window title. An empty string means that no title is set.An empty string means that no title is set.
"""
# https://wiki.libsdl.org/SDL_GetWindowTitle
return SDL_GetWindowTitle(self._win).decode('utf8')
@title.setter
def title(self, title):
- """ Set the window title.
-
- :param str title: the desired window title in UTF-8.
- """
# https://wiki.libsdl.org/SDL_SetWindowTitle
SDL_SetWindowTitle(self._win, title.encode('utf8'))
def destroy(self):
- """ Destroys the window.
+ """Destroy the window
+
+ Destroys the internal window data of this Window object. This method is
+ called automatically when this Window object is garbage collected, so
+ there usually aren't any reasons to call it manually.
+
+ Other methods that try to manipulate that window data will raise an error.
"""
# https://wiki.libsdl.org/SDL_DestroyWindow
if self._win:
@@ -337,22 +368,25 @@ cdef class Window:
self._win = NULL
def hide(self):
- """ Hide the window.
+ """Hide the window
"""
# https://wiki.libsdl.org/SDL_HideWindow
SDL_HideWindow(self._win)
def show(self):
- """ Show the window.
+ """Show the window
"""
# https://wiki.libsdl.org/SDL_ShowWindow
SDL_ShowWindow(self._win)
def focus(self, input_only=False):
- """ Raise the window above other windows and set the input focus.
+ """Set the window to be focused
+
+ Raises the window above other windows and sets the input focus.
:param bool input_only: if ``True``, the window will be given input focus
but may be completely obscured by other windows.
+ Only supported on X11.
"""
# https://wiki.libsdl.org/SDL_RaiseWindow
if input_only:
@@ -362,23 +396,23 @@ cdef class Window:
SDL_RaiseWindow(self._win)
def restore(self):
- """ Restore the size and position of a minimized or maximized window.
+ """Restore the size and position of a minimized or maximized window
"""
SDL_RestoreWindow(self._win)
def maximize(self):
- """ Maximize the window.
+ """Maximize the window
"""
SDL_MaximizeWindow(self._win)
def minimize(self):
- """ Minimize the window.
+ """Minimize the window
"""
SDL_MinimizeWindow(self._win)
@property
def resizable(self):
- """ Sets whether the window is resizable.
+ """Get or set whether the window is resizable
"""
return SDL_GetWindowFlags(self._win) & _SDL_WINDOW_RESIZABLE != 0
@@ -388,7 +422,9 @@ cdef class Window:
@property
def borderless(self):
- """ Add or remove the border from the actual window.
+ """Get or set whether the window is borderless
+
+ Gets or sets whether the window is borderless.
.. note:: You can't change the border state of a fullscreen window.
"""
@@ -399,7 +435,9 @@ cdef class Window:
SDL_SetWindowBordered(self._win, 0 if enabled else 1)
def set_icon(self, surface):
- """ Set the icon for the window.
+ """Set the window icon
+
+ Sets the window icon.
:param pygame.Surface surface: A Surface to use as the icon.
"""
@@ -409,15 +447,13 @@ cdef class Window:
@property
def id(self):
- """ A unique window ID. *Read-only*.
-
- :rtype: int
+ """Get the unique window ID (**read-only**)
"""
return SDL_GetWindowID(self._win)
@property
def size(self):
- """ The size of the window's client area."""
+ """Get or set the window size in pixels"""
cdef int w, h
SDL_GetWindowSize(self._win, &w, &h)
return (w, h)
@@ -428,7 +464,8 @@ cdef class Window:
@property
def position(self):
- """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
+ """Get or set the window position in screen coordinates
+ """
cdef int x, y
SDL_GetWindowPosition(self._win, &x, &y)
return (x, y)
@@ -446,8 +483,8 @@ cdef class Window:
@property
def opacity(self):
- """ Window opacity. It ranges between 0.0 (fully transparent)
- and 1.0 (fully opaque)."""
+ """Get or set the window opacity, a value between 0.0 (fully transparent) and 1.0 (fully opaque)
+ """
cdef float opacity
if SDL_GetWindowOpacity(self._win, &opacity):
raise error()
@@ -460,9 +497,7 @@ cdef class Window:
@property
def display_index(self):
- """ The index of the display associated with the window. *Read-only*.
-
- :rtype: int
+ """Get the index of the display that owns the window
"""
cdef int index = SDL_GetWindowDisplayIndex(self._win)
if index < 0:
@@ -470,8 +505,12 @@ cdef class Window:
return index
def set_modal_for(self, Window parent):
- """set the window as a modal for a parent window
- This function is only supported on X11."""
+ """Set the window as a modal for a parent window
+
+ :param Window parent: The parent window.
+
+ .. note:: This function is only supported on X11.
+ """
if SDL_SetWindowModalFor(self._win, parent._win):
raise error()
@@ -508,19 +547,46 @@ cdef class Texture:
size, int depth=0,
static=False, streaming=False,
target=False, scale_quality=None):
- """ Create an empty texture.
-
- :param Renderer renderer: Rendering context for the texture.
- :param tuple size: The width and height of the texture.
- :param int depth: The pixel format (0 to use the default).
+ """pygame object that represents a texture
+
+ Creates an empty texture.
+
+ :param Renderer renderer: The rendering context for the texture.
+ :param tuple size: The width and height for the texture.
+ :param int depth: The pixel format (``0`` to use the default).
+ :param bool static: Initialize the texture as static
+ (changes rarely, not lockable).
+ :param bool streaming: Initialize the texture as streaming
+ (changes frequently, lockable).
+ :param bool target: Initialize the texture as target
+ (can be used as a rendering target).
+ :param int scale_quality: Set the texture scale quality. Can be ``0``
+ (nearest pixel sampling), ``1``
+ (linear filtering, supported by OpenGL and Direct3D)
+ and ``2`` (anisotropic filtering, supported by Direct3D).
One of ``static``, ``streaming``, or ``target`` can be set
to ``True``. If all are ``False``, then ``static`` is used.
- :param bool static: Changes rarely, not lockable.
- :param bool streaming: Changes frequently, lockable.
- :param bool target: Can be used as a render target.
- :param scale_quality: The quality of scale.
+
+ :class:`Texture` objects provide a platform-agnostic API for working with GPU textures.
+ They are stored in GPU video memory (VRAM), and are therefore very fast to
+ rotate and resize when drawn onto a :class:`Renderer`
+ (an object that manages a rendering context inside a :class:`Window`) on most GPUs.
+
+ Since textures are stored in GPU video memory, they aren't as easy to modify
+ as the image data of :class:`pygame.Surface` objects, which reside in RAM.
+
+ Textures can be modified in 2 ways:
+
+ * By drawing other textures onto them, achieved by marking them as "target" textures and setting them as the rendering target of their Renderer object (if properly configured and supported).
+
+ * By updating them with a Surface.
+
+ .. note::
+ A :class:`pygame.Surface`-to-:class:`Texture` update is generally
+ considered a slow operation, as it requires image data to be uploaded from
+ RAM to VRAM, which can have a notable overhead cost.
"""
# https://wiki.libsdl.org/SDL_CreateTexture
# TODO: masks
@@ -562,7 +628,7 @@ cdef class Texture:
width, height)
if not self._tex:
raise error()
-
+
if not scale_quality is None:
if SDL_VERSION_ATLEAST(2,0,12):
SDL_SetTextureScaleMode(self._tex,scale_quality)
@@ -577,7 +643,7 @@ cdef class Texture:
@staticmethod
def from_surface(Renderer renderer, surface):
- """ Create a texture from an existing surface.
+ """Create a texture from an existing surface
:param Renderer renderer: Rendering context for the texture.
:param pygame.Surface surface: The surface to create a texture from.
@@ -603,6 +669,8 @@ cdef class Texture:
@property
def alpha(self):
+ """Get or set the additional alpha value multiplied into draw operations
+ """
# https://wiki.libsdl.org/SDL_GetTextureAlphaMod
cdef Uint8 alpha
cdef int res = SDL_GetTextureAlphaMod(self._tex, &alpha)
@@ -620,6 +688,11 @@ cdef class Texture:
@property
def blend_mode(self):
+ """Get or set the blend mode for texture drawing operations
+
+ Gets or sets the blend mode for the texture's drawing operations.
+ Valid blend modes are any of the ``BLENDMODE_*`` constants or a custom one.
+ """
# https://wiki.libsdl.org/SDL_GetTextureBlendMode
cdef SDL_BlendMode blendMode
cdef int res = SDL_GetTextureBlendMode(self._tex, &blendMode)
@@ -637,6 +710,8 @@ cdef class Texture:
@property
def color(self):
+ """Get or set the additional color value multiplied into texture drawing operations
+ """
# https://wiki.libsdl.org/SDL_GetTextureColorMod
cdef int res = SDL_GetTextureColorMod(self._tex,
&self._color.data[0],
@@ -658,9 +733,12 @@ cdef class Texture:
raise error()
def get_rect(self, **kwargs):
- """ Get the rectangular area of the texture.
- like surface.get_rect(), returns a new rectangle covering the entire surface.
- This rectangle will always start at 0, 0 with a width. and height the same size as the texture.
+ """Get the rectangular area of the texture
+
+ Like :meth:`pygame.Surface.get_rect`, this method returns a **new**
+ :class:`pygame.Rect` covering the entire texture. It will always
+ have a ``topleft`` of ``(0, 0)`` with a ``width`` and ``height`` the same size as the
+ texture.
"""
rect = pgRect_New4(0, 0, self.width, self.height)
for key in kwargs:
@@ -683,16 +761,20 @@ cdef class Texture:
cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
bint flip_x=False, bint flip_y=False):
- """ Copy a portion of the texture to the rendering target.
-
- :param srcrect: source rectangle on the texture, or None for the entire texture.
- :param dstrect: destination rectangle or position on the render target, or None for entire target.
- The texture is stretched to fill dstrect.
- :param float angle: angle (in degrees) to rotate dstrect around (clockwise).
- :param origin: point around which dstrect will be rotated.
- If None, it will equal the center: (dstrect.w/2, dstrect.h/2).
- :param bool flip_x: flip horizontally.
- :param bool flip_y: flip vertically.
+ """Copy a portion of the texture to the rendering target
+
+ :param srcrect: The source rectangle on the texture, or ``None`` for the
+ entire texture.
+ :param dstrect: The destination rectangle on the rendering target, or
+ ``None`` for the entire rendering target. The texture
+ will be stretched to fill ``dstrect``.
+ :param float angle: The angle (in degrees) to rotate dstrect around
+ (clockwise).
+ :param origin: The point around which dstrect will be rotated.
+ If ``None``, it will equal the center:
+ ``(dstrect.w/2, dstrect.h/2)``.
+ :param bool flip_x: Flip the drawn texture portion horizontally (x - axis).
+ :param bool flip_y: Flip the drawn texture portion vertically (y - axis).
"""
cdef SDL_Rect src, dst
cdef SDL_Rect *csrcrect = NULL
@@ -730,21 +812,21 @@ cdef class Texture:
def draw_triangle(self, p1_xy, p2_xy, p3_xy,
p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0),
p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)):
- """ Copy a triangle portion of the texture to the rendering target by vertices coordinates.
-
- :param p1_xy: first vertex coordinate on the render target to be drawn at.
- :param p2_xy: second vertex coordinate on the render target to be drawn at.
- :param p3_xy: third vertex coordinate on the render target to be drawn at.
- :param p1_uv: first vertex coordinate on the texture to be drawn from.
- :param p2_uv: second vertex coordinate on the texture to be drawn from.
- :param p3_uv: third vertex coordinate on the texture to be drawn from.
- :param p1_mod: first vertex color modulation.
- :param p2_mod: second vertex color modulation.
- :param p3_mod: third vertex color modulation.
+ """Copy a triangle portion of the texture to the rendering target using the given coordinates
+
+ :param p1_xy: The first vertex coordinate on the rendering target.
+ :param p2_xy: The second vertex coordinate on the rendering target.
+ :param p3_xy: The third vertex coordinate on the rendering target.
+ :param p1_uv: The first UV coordinate of the triangle portion.
+ :param p2_uv: The second UV coordinate of the triangle portion.
+ :param p3_uv: The third UV coordinate of the triangle portion.
+ :param p1_mod: The first vertex color modulation.
+ :param p2_mod: The second vertex color modulation.
+ :param p3_mod: The third vertex color modulation.
"""
if not SDL_VERSION_ATLEAST(2, 0, 18):
raise error("draw_triangle requires SDL 2.0.18 or newer")
-
+
cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod)
SDL_GetTextureAlphaMod(self._tex, &_a_mod)
@@ -767,7 +849,7 @@ cdef class Texture:
vertices[i].color.a = a_mod * mod[3] if len(mod) > 3 else _a_mod
vertices[i].tex_coord.x = uv[0]
vertices[i].tex_coord.y = uv[1]
-
+
cdef int res = SDL_RenderGeometry(self.renderer._renderer, self._tex, vertices, 3, NULL, 0)
if res < 0:
raise error()
@@ -776,24 +858,24 @@ cdef class Texture:
p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0),
p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255),
p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)):
- """ Copy a quad portion of the texture to the rendering target by vertices coordinates.
-
- :param p1_xy: first vertex coordinate on the render target to be drawn at.
- :param p2_xy: second vertex coordinate on the render target to be drawn at.
- :param p3_xy: third vertex coordinate on the render target to be drawn at.
- :param p4_xy: fourth vertex coordinate on the render target to be drawn at.
- :param p1_uv: first vertex coordinate on the texture to be drawn from.
- :param p2_uv: second vertex coordinate on the texture to be drawn from.
- :param p3_uv: third vertex coordinate on the texture to be drawn from.
- :param p4_uv: fourth vertex coordinate on the texture to be drawn from.
- :param p1_mod: first vertex color modulation.
- :param p2_mod: second vertex color modulation.
- :param p3_mod: third vertex color modulation.
- :param p4_mod: fourth vertex color modulation.
+ """Copy a quad portion of the texture to the rendering target using the given coordinates
+
+ :param p1_xy: The first vertex coordinate on the rendering target.
+ :param p2_xy: The second vertex coordinate on the rendering target.
+ :param p3_xy: The third vertex coordinate on the rendering target.
+ :param p4_xy: The fourth vertex coordinate on the rendering target.
+ :param p1_uv: The first UV coordinate of the quad portion.
+ :param p2_uv: The second UV coordinate of the quad portion.
+ :param p3_uv: The third UV coordinate of the quad portion.
+ :param p4_uv: The fourth UV coordinate of the quad portion.
+ :param p1_mod: The first vertex color modulation.
+ :param p2_mod: The second vertex color modulation.
+ :param p3_mod: The third vertex color modulation.
+ :param p4_mod: The fourth vertex color modulation.
"""
if not SDL_VERSION_ATLEAST(2, 0, 18):
raise error("draw_quad requires SDL 2.0.18 or newer")
-
+
cdef Uint8 _r_mod, _g_mod, _b_mod, _a_mod
SDL_GetTextureColorMod(self._tex, &_r_mod, &_g_mod, &_b_mod)
SDL_GetTextureAlphaMod(self._tex, &_a_mod)
@@ -827,16 +909,20 @@ cdef class Texture:
def update(self, surface, area=None):
# https://wiki.libsdl.org/SDL_UpdateTexture
# Should it accept a raw pixel data array too?
- """ Update the texture with Surface.
- This is a fairly slow function, intended for use with static textures that do not change often.
+ """Update the texture with Surface (slow operation, use sparingly)
- If the texture is intended to be updated often,
- it is preferred to create the texture as streaming and use the locking functions.
+ :param Surface surface: The source surface.
+ :param area: The rectangular area of the texture to update.
- While this function will work with streaming textures,
- for optimization reasons you may not get the pixels back if you lock the texture afterward.
+ .. note::
+ This is a fairly slow function, intended for use with static textures
+ that do not change often.
- :param surface: source Surface.
+ If the texture is intended to be updated often, it is preferred to create
+ the texture as streaming and use the locking functions.
+
+ While this function will work with streaming textures, for optimization
+ reasons you may not get the pixels back if you lock the texture afterward.
"""
if not pgSurface_Check(surface):
@@ -896,17 +982,30 @@ cdef class Image:
self._color = pgColor_NewLength(defaultColor, 3)
self.alpha = 255
- def __init__(self, textureOrImage, srcrect=None):
+ def __init__(self, texture_or_image, srcrect=None):
+ """pygame object that represents a portion of a texture
+
+ Creates an Image.
+
+ :param Texture | Image texture_or_image: The Texture or an existing Image
+ object to create the Image from.
+ :param srcrect: The rectangular portion of the Texture or Image object
+ passed to ``texture_or_image``.
+
+ An :class:`Image` object represents a portion of a :class:`Texture`. Specifically,
+ they can be used to store and manipulate arguments for :meth:`Texture.draw`
+ in a more user-friendly way.
+ """
cdef SDL_Rect temp
cdef SDL_Rect *rectptr
- if isinstance(textureOrImage, Image):
- self.texture = textureOrImage.texture
- self.srcrect = pgRect_New(&(textureOrImage.srcrect).r)
+ if isinstance(texture_or_image, Image):
+ self.texture = texture_or_image.texture
+ self.srcrect = pgRect_New(&(texture_or_image.srcrect).r)
else:
- self.texture = textureOrImage
- self.srcrect = textureOrImage.get_rect()
- self.blend_mode = textureOrImage.blend_mode
+ self.texture = texture_or_image
+ self.srcrect = texture_or_image.get_rect()
+ self.blend_mode = texture_or_image.blend_mode
if srcrect is not None:
rectptr = pgRect_FromObject(srcrect, &temp)
@@ -928,6 +1027,8 @@ cdef class Image:
@property
def color(self):
+ """Gets or sets the Image color modifier
+ """
return self._color
@color.setter
@@ -936,6 +1037,13 @@ cdef class Image:
@property
def origin(self):
+ """Get or set the Image's origin of rotation
+
+ Gets or sets the Image's origin of rotation, a 2D coordinate relative to the topleft coordinate of the Image's rectangular area.
+
+ An origin of ``None`` means no origin was set and the Image will be rotated around
+ its center.
+ """
if self._originptr == NULL:
return None
else:
@@ -951,14 +1059,23 @@ cdef class Image:
self._originptr = NULL
def get_rect(self):
+ """Get the rectangular area of the Image
+
+ .. note::
+ The returned :class:`Rect` object might contain position information
+ relative to the bounds of the :class:`Texture` or Image object it was
+ created from.
+ """
return pgRect_New(&self.srcrect.r)
cpdef void draw(self, srcrect=None, dstrect=None):
- """ Copy a portion of the image to the rendering target.
+ """Copy a portion of the Image to the rendering target
- :param srcrect: source rectangle specifying a sub-image, or None for the entire image.
- :param dstrect: destination rectangle or position on the render target, or None for entire target.
- The image is stretched to fill dstrect.
+ :param srcrect: Source rectangle specifying a sub-Image, or None for the
+ entire Image.
+ :param dstrect: Destination rectangle or position on the render target,
+ or ``None`` for entire target. The Image is stretched to
+ fill dstrect.
"""
cdef SDL_Rect src
cdef SDL_Rect dst
@@ -1008,10 +1125,18 @@ cdef class Image:
cdef class Renderer:
@classmethod
- def from_window(cls, Window window):
+ def from_window(cls, window):
+ cdef Window _window
+ if isinstance(window,(_Window,Window)):
+ _window = window
+ else:
+ raise TypeError(
+ "Argument 'window' has incorrect type "
+ "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ )
cdef Renderer self = cls.__new__(cls)
- self._win = window
- if window._is_borrowed:
+ self._win = _window
+ if self._win._is_borrowed:
self._is_borrowed=1
else:
raise error()
@@ -1027,20 +1152,61 @@ cdef class Renderer:
self._target = None
return self
- def __init__(self, Window window, int index=-1,
+ def __init__(self, window, int index=-1,
int accelerated=-1, bint vsync=False,
bint target_texture=False):
- """ Create a 2D rendering context for a window.
+ """pygame object wrapping a 2D rendering context for a window
+
+ Creates a 2D rendering context for a window.
- :param Window window: where rendering is displayed.
- :param int index: index of rendering driver to initialize,
- or -1 to init the first supporting requested options.
- :param int accelerated: if 1, the renderer uses hardware acceleration.
+ :param Window window: The window onto which the rendering context should be
+ placed.
+ :param int index: The index of rendering driver to initialize, or ``-1`` to init
+ the first supporting the requested options.
+ :param int accelerated: If 1, the renderer uses hardware acceleration.
if 0, the renderer is a software fallback.
- -1 gives precedence to renderers using hardware acceleration.
- :param bool vsync: .present() is synchronized with the refresh rate.
- :param bool target_texture: the renderer supports rendering to texture.
+ ``-1`` gives precedence to renderers using hardware
+ acceleration.
+ :param bool vsync: If ``True`` :meth:`Renderer.present` is synchronized with
+ the refresh rate.
+ :param bool target_texture: Whether the renderer should support setting
+ :class:`Texture` objects as target textures, to
+ enable drawing onto them.
+
+
+ :class:`Renderer` objects provide a cross-platform API for rendering 2D
+ graphics onto a :class:`Window`, by using either Metal (MacOS), OpenGL
+ (MacOS, Windows, Linux) or Direct3D (Windows) rendering drivers, depending
+ on what is set or is available on a system during their creation.
+
+ They can be used to draw both :class:`Texture` objects and simple points,
+ lines and rectangles (which are colored based on :attr:`Renderer.draw_color`).
+
+ If configured correctly and supported by an underlying rendering driver, Renderer
+ objects can have a :class:`Texture` object temporarily set as a target texture
+ (the Texture object must have been created with target texture usage support),
+ which allows those textures to be drawn onto.
+
+ To present drawn content onto the window, :meth:`Renderer.present` should be
+ called. :meth:`Renderer.clear` should be called to clear any drawn content
+ with the set Renderer draw color.
+
+ When things are drawn onto Renderer objects, an internal batching system is
+ used by default to batch those "draw calls" together, to have all of them be
+ processed in one go when :meth:`Renderer.present` is called. This is unlike
+ :class:`pygame.Surface` objects, on which modifications via blitting occur
+ immediately, but lends well to the behavior of GPUs, as draw calls can be
+ expensive on lower-end models.
"""
+ cdef Window _window
+ if isinstance(window,(_Window,Window)):
+ _window = window
+ else:
+ raise TypeError(
+ "Argument 'window' has incorrect type "
+ "(expected pygame.Window or pygame._sdl2._Window, got %s)"%window.__class__.__name__
+ )
+
# https://wiki.libsdl.org/SDL_CreateRenderer
# https://wiki.libsdl.org/SDL_RendererFlags
flags = 0
@@ -1051,14 +1217,14 @@ cdef class Renderer:
if target_texture:
flags |= _SDL_RENDERER_TARGETTEXTURE
- self._renderer = SDL_CreateRenderer(window._win, index, flags)
+ self._renderer = SDL_CreateRenderer(_window._win, index, flags)
if not self._renderer:
raise error()
cdef Uint8[4] defaultColor = [255, 255, 255, 255]
self._draw_color = pgColor_NewLength(defaultColor, 4)
self._target = None
- self._win = window
+ self._win = _window
self._is_borrowed=0
def __dealloc__(self):
@@ -1069,6 +1235,8 @@ cdef class Renderer:
@property
def draw_blend_mode(self):
+ """Get or set the blend mode used for primitive drawing operations
+ """
# https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
cdef SDL_BlendMode blendMode
cdef int res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
@@ -1086,14 +1254,12 @@ cdef class Renderer:
@property
def draw_color(self):
- """ Color used by the drawing functions.
+ """Get or set the color used for primitive drawing operations
"""
return self._draw_color
@draw_color.setter
def draw_color(self, new_value):
- """ color used by the drawing functions.
- """
# https://wiki.libsdl.org/SDL_SetRenderDrawColor
self._draw_color[:] = new_value
cdef int res = SDL_SetRenderDrawColor(self._renderer,
@@ -1105,7 +1271,7 @@ cdef class Renderer:
raise error()
def clear(self):
- """ Clear the current rendering target with the drawing color.
+ """Clear the current rendering target with the drawing color
"""
# https://wiki.libsdl.org/SDL_RenderClear
cdef int res = SDL_RenderClear(self._renderer)
@@ -1113,25 +1279,47 @@ cdef class Renderer:
raise error()
def present(self):
- """ Present the composed backbuffer to the screen.
+ """Update the screen with any rendering performed since the previous call
- Updates the screen with any rendering performed since previous call.
+ Presents the composed backbuffer to the screen.
+ Updates the screen with any rendering performed since the previous call.
"""
# https://wiki.libsdl.org/SDL_RenderPresent
SDL_RenderPresent(self._renderer)
cpdef get_viewport(self):
- """ Returns the drawing area on the target.
-
- :rtype: pygame.Rect
+ """Get the drawing area on the rendering target
"""
# https://wiki.libsdl.org/SDL_RenderGetViewport
cdef SDL_Rect rect
SDL_RenderGetViewport(self._renderer, &rect)
return pgRect_New(&rect)
+ def set_viewport(self, area):
+ """Set the drawing area on the rendering target
+
+ :param area: A :class:`pygame.Rect` or tuple representing the
+ drawing area on the target, or ``None`` to use the
+ entire area of the current rendering target.
+ """
+ # https://wiki.libsdl.org/SDL_RenderSetViewport
+ if area is None:
+ if SDL_RenderSetViewport(self._renderer, NULL) < 0:
+ raise error()
+ return
+
+ cdef SDL_Rect tmprect
+ cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
+ if rectptr == NULL:
+ raise TypeError('expected a rectangle')
+
+ if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
+ raise error()
+
@property
def logical_size(self):
+ """Get or set the logical Renderer size (a device independent resolution for rendering)
+ """
cdef int w
cdef int h
SDL_RenderGetLogicalSize(self._renderer, &w, &h)
@@ -1146,6 +1334,8 @@ cdef class Renderer:
@property
def scale(self):
+ """Get the drawing scale for the current rendering target
+ """
cdef float x
cdef float y
SDL_RenderGetScale(self._renderer, &x, &y)
@@ -1162,33 +1352,13 @@ cdef class Renderer:
# def is_integer_scale(self):
# return SDL_RenderGetIntegerScale(self._renderer)
- def set_viewport(self, area):
- """ Set the drawing area on the target.
- If this is set to ``None``, the entire target will be used.
-
- :param area: A ``pygame.Rect`` or tuple representing the
- drawing area on the target, or None.
- """
- # https://wiki.libsdl.org/SDL_RenderSetViewport
- if area is None:
- if SDL_RenderSetViewport(self._renderer, NULL) < 0:
- raise error()
- return
-
- cdef SDL_Rect tmprect
- cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
- if rectptr == NULL:
- raise TypeError('expected a rectangle')
-
- if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
- raise error()
-
-
@property
def target(self):
- """ The current render target. Set to ``None`` for the default target.
+ """`Get or set the current rendering target
- :rtype: Texture, None
+ Gets or sets the current rendering target.
+ A value of ``None`` means that no custom rendering target was set and the
+ Renderer's window will be used as the target.
"""
# https://wiki.libsdl.org/SDL_GetRenderTarget
return self._target
@@ -1209,12 +1379,17 @@ cdef class Renderer:
raise TypeError('target must be a Texture or None')
cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):
- """ Only for compatibility.
- Textures created by different Renderers cannot shared with each other!
- :param source: A Texture or Image to draw.
- :param dest: destination on the render target.
- :param area: the portion of source texture.
+ """Draw textures using a Surface-like API
+
+ For compatibility purposes. Draws :class:`Texture` objects onto the
+ Renderer using a method signature similar to :meth:`pygame.Surface.blit`.
+
+ :param source: A :class:`Texture` or :class:`Image` to draw.
+ :param dest: The drawing destination on the rendering target.
+ :param area: The portion of the source texture or image to draw from.
:param special_flags: have no effect at this moment.
+
+ .. note:: Textures created by different Renderers cannot shared with each other!
"""
if isinstance(source, Texture):
(source).draw(area, dest)
@@ -1230,6 +1405,11 @@ cdef class Renderer:
return dest
def draw_line(self, p1, p2):
+ """Draw a line
+
+ :param p1: The line start point.
+ :param p2: The line end point.
+ """
# https://wiki.libsdl.org/SDL_RenderDrawLine
cdef int res = SDL_RenderDrawLine(self._renderer,
p1[0], p1[1],
@@ -1238,6 +1418,10 @@ cdef class Renderer:
raise error()
def draw_point(self, point):
+ """Draw a point
+
+ :param point: The point's coordinate.
+ """
# https://wiki.libsdl.org/SDL_RenderDrawPoint
cdef int res = SDL_RenderDrawPoint(self._renderer,
point[0], point[1])
@@ -1245,6 +1429,10 @@ cdef class Renderer:
raise error()
def draw_rect(self, rect):
+ """Draw a rectangle outline
+
+ :param rect: The :class:`Rect`-like rectangle to draw.
+ """
# https://wiki.libsdl.org/SDL_RenderDrawRect
cdef SDL_Rect _rect
cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
@@ -1257,6 +1445,10 @@ cdef class Renderer:
raise error()
def fill_rect(self, rect):
+ """Draw a filled rectangle
+
+ :param rect: The :class:`Rect`-like rectangle to draw.
+ """
# https://wiki.libsdl.org/SDL_RenderFillRect
cdef SDL_Rect _rect
cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
@@ -1328,17 +1520,23 @@ cdef class Renderer:
def to_surface(self, surface=None, area=None):
# https://wiki.libsdl.org/SDL_RenderReadPixels
- """
- Read pixels from the current rendering target and create a pygame.Surface.
- WARNING: This is a very slow operation, and should not be used frequently.
+ """Read pixels from current rendering target and create a Surface (slow operation, use sparingly)
+
+ Read pixel data from the current rendering target and return a
+ :class:`pygame.Surface` containing it.
- :param surface: A surface to read the pixel data into.
- It must be large enough to fit the area, or ``ValueError`` is
- raised.
- If ``None``, a new surface is returned.
+ :param Surface surface: A :class:`pygame.Surface` object to read the pixel
+ data into. It must be large enough to fit the area, otherwise
+ ``ValueError`` is raised.
+ If set to ``None``, a new surface will be created.
:param area: The area of the screen to read pixels from. The area is
clipped to fit inside the viewport.
If ``None``, the entire viewport is used.
+
+ .. note::
+ This is a very slow operation, due to the overhead of the VRAM to RAM
+ data transfer and the cost of creating a potentially large
+ :class:`pygame.Surface`. It should not be used frequently.
"""
cdef Uint32 format
cdef SDL_Rect rarea
@@ -1399,11 +1597,15 @@ cdef class Renderer:
@staticmethod
def compose_custom_blend_mode(color_mode, alpha_mode):
- """ Use this function to compose a custom blend mode..
+ """Compose a custom blend mode
+
+ Compose a custom blend mode.
+ See https://wiki.libsdl.org/SDL2/SDL_ComposeCustomBlendMode for more information.
+
+ :param color_mode: A tuple ``(srcColorFactor, dstColorFactor, colorOperation)``
+ :param alpha_mode: A tuple ``(srcAlphaFactor, dstAlphaFactor, alphaOperation)``
- :param color_mode: A tuple (srcColorFactor, dstColorFactor, colorOperation)
- :param alpha_mode: A tuple (srcAlphaFactor, dstAlphaFactor, alphaOperation)
- :return: A blend mode to be used with Renderer.draw_blend_mode and Texure.blend_mode
+ :return: A blend mode to be used with :meth:`Renderer.set_draw_blend_mode` and :meth:`Texture.set_blend_mode`.
"""
# https://wiki.libsdl.org/SDL_ComposeCustomBlendMode
cdef int res = SDL_ComposeCustomBlendMode(color_mode[0],
diff --git a/src_c/display.c b/src_c/display.c
index 9f87549635..c46f4849db 100644
--- a/src_c/display.c
+++ b/src_c/display.c
@@ -267,7 +267,7 @@ pg_get_active(PyObject *self, PyObject *_null)
static void
pg_vidinfo_dealloc(PyObject *self)
{
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
static PyObject *
@@ -1112,7 +1112,8 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
/* set min size to (1,1) to erase any previously set min size
* relevant for windows leaving SCALED, which sets a min size
* only relevant on Windows, I believe.
- * See https://github.com/pygame/pygame/issues/2327 */
+ * See
+ * https://github.com/pygame-community/pygame-ce/issues/1194 */
SDL_SetWindowMinimumSize(win, 1, 1);
/* change existing window.
diff --git a/src_c/doc/mixer_doc.h b/src_c/doc/mixer_doc.h
index 96c81e858a..a589534877 100644
--- a/src_c/doc/mixer_doc.h
+++ b/src_c/doc/mixer_doc.h
@@ -29,6 +29,7 @@
#define DOC_MIXER_CHANNEL_PAUSE "pause() -> None\ntemporarily stop playback of a channel"
#define DOC_MIXER_CHANNEL_UNPAUSE "unpause() -> None\nresume pause playback of a channel"
#define DOC_MIXER_CHANNEL_FADEOUT "fadeout(time) -> None\nstop playback after fading channel out"
+#define DOC_MIXER_CHANNEL_SETSOURCELOCATION "set_source_location(angle,distance) -> None\nset the position of a playing channel"
#define DOC_MIXER_CHANNEL_SETVOLUME "set_volume(value) -> None\nset_volume(left, right) -> None\nset the volume of a playing channel"
#define DOC_MIXER_CHANNEL_GETVOLUME "get_volume() -> value\nget the volume of the playing channel"
#define DOC_MIXER_CHANNEL_GETBUSY "get_busy() -> bool\ncheck if the channel is active"
diff --git a/src_c/doc/sdl2_video_doc.h b/src_c/doc/sdl2_video_doc.h
index fab62e205a..49289ad275 100644
--- a/src_c/doc/sdl2_video_doc.h
+++ b/src_c/doc/sdl2_video_doc.h
@@ -1,71 +1,76 @@
/* Auto generated file: with makeref.py . Docs go in docs/reST/ref/ . */
#define DOC_SDL2VIDEO "Experimental pygame module for porting new SDL video systems"
-#define DOC_SDL2_VIDEO_WINDOW "Window(title="pygame", size=(640, 480), position=None, fullscreen=False, fullscreen_desktop=False, keywords) -> Window\npygame object that represents a window"
-#define DOC_SDL2_VIDEO_WINDOW_FROMDISPLAYMODULE "from_display_module() -> Window\nCreates window using window created by pygame.display.set_mode()."
-#define DOC_SDL2_VIDEO_WINDOW_GRAB "grab -> bool\nGets or sets whether the mouse is confined to the window."
-#define DOC_SDL2_VIDEO_WINDOW_RELATIVEMOUSE "relative_mouse -> bool\nGets or sets the window's relative mouse motion state."
-#define DOC_SDL2_VIDEO_WINDOW_SETWINDOWED "set_windowed() -> None\nEnable windowed mode (exit fullscreen)."
-#define DOC_SDL2_VIDEO_WINDOW_SETFULLSCREEN "set_fullscreen(desktop=False) -> None\nEnter fullscreen."
-#define DOC_SDL2_VIDEO_WINDOW_TITLE "title -> string\nGets or sets whether the window title."
-#define DOC_SDL2_VIDEO_WINDOW_DESTROY "destroy() -> None\nDestroys the window."
-#define DOC_SDL2_VIDEO_WINDOW_HIDE "hide() -> None\nHide the window."
-#define DOC_SDL2_VIDEO_WINDOW_SHOW "show() -> None\nShow the window."
-#define DOC_SDL2_VIDEO_WINDOW_FOCUS "focus(input_only=False) -> None\nRaise the window above other windows and set the input focus. The "input_only" argument is only supported on X11."
-#define DOC_SDL2_VIDEO_WINDOW_RESTORE "restore() -> None\nRestore the size and position of a minimized or maximized window."
-#define DOC_SDL2_VIDEO_WINDOW_MAXIMIZE "maximize() -> None\nMaximize the window."
-#define DOC_SDL2_VIDEO_WINDOW_MINIMIZE "maximize() -> None\nMinimize the window."
-#define DOC_SDL2_VIDEO_WINDOW_RESIZABLE "resizable -> bool\nGets and sets whether the window is resizable."
-#define DOC_SDL2_VIDEO_WINDOW_BORDERLESS "borderless -> bool\nAdd or remove the border from the window."
-#define DOC_SDL2_VIDEO_WINDOW_SETICON "set_icon(surface) -> None\nSet the icon for the window."
-#define DOC_SDL2_VIDEO_WINDOW_ID "id -> int\nGet the unique window ID. *Read-only*"
-#define DOC_SDL2_VIDEO_WINDOW_SIZE "size -> (int, int)\nGets and sets the window size."
-#define DOC_SDL2_VIDEO_WINDOW_POSITION "position -> (int, int) or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED\nGets and sets the window position."
-#define DOC_SDL2_VIDEO_WINDOW_OPACITY "opacity -> float\nGets and sets the window opacity. Between 0.0 (fully transparent) and 1.0 (fully opaque)."
-#define DOC_SDL2_VIDEO_WINDOW_DISPLAYINDEX "display_index -> int\nGet the index of the display that owns the window. *Read-only*"
-#define DOC_SDL2_VIDEO_WINDOW_SETMODALFOR "set_modal_for(Window) -> None\nSet the window as a modal for a parent window. This function is only supported on X11."
-#define DOC_SDL2_VIDEO_TEXTURE "Texture(renderer, size, depth=0, static=False, streaming=False, target=False, scale_quality=None) -> Texture\npygame object that representing a Texture."
-#define DOC_SDL2_VIDEO_TEXTURE_FROMSURFACE "from_surface(renderer, surface) -> Texture\nCreate a texture from an existing surface."
-#define DOC_SDL2_VIDEO_TEXTURE_RENDERER "renderer -> Renderer\nGets the renderer associated with the Texture. *Read-only*"
-#define DOC_SDL2_VIDEO_TEXTURE_WIDTH "width -> int\nGets the width of the Texture. *Read-only*"
-#define DOC_SDL2_VIDEO_TEXTURE_HEIGHT "height -> int\nGets the height of the Texture. *Read-only*"
-#define DOC_SDL2_VIDEO_TEXTURE_ALPHA "alpha -> int\nGets and sets an additional alpha value multiplied into render copy operations."
-#define DOC_SDL2_VIDEO_TEXTURE_BLENDMODE "blend_mode -> int\nGets and sets the blend mode for the Texture."
-#define DOC_SDL2_VIDEO_TEXTURE_COLOR "color -> color\nGets and sets an additional color value multiplied into render copy operations."
-#define DOC_SDL2_VIDEO_TEXTURE_GETRECT "get_rect(**kwargs) -> Rect\nGet the rectangular area of the texture."
-#define DOC_SDL2_VIDEO_TEXTURE_DRAW "draw(srcrect=None, dstrect=None, angle=0, origin=None, flip_x=False, flip_y=False) -> None\nCopy a portion of the texture to the rendering target."
-#define DOC_SDL2_VIDEO_TEXTURE_DRAWTRIANGLE "draw_triangle(p1_xy, p2_xy, p3_xy, p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0), p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)) -> None\nCopy a triangle portion of the texture to the rendering target by vertices coordinates."
-#define DOC_SDL2_VIDEO_TEXTURE_DRAWQUAD "draw_quad(p1_xy, p2_xy, p3_xy, p4_xy, p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0), p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)) -> None\nCopy a quad portion of the texture to the rendering target by vertices coordinates."
-#define DOC_SDL2_VIDEO_TEXTURE_UPDATE "update(surface, area=None) -> None\nUpdate the texture with a Surface. WARNING: Slow operation, use sparingly."
-#define DOC_SDL2_VIDEO_IMAGE "Image(textureOrImage, srcrect=None) -> Image\nEasy way to use a portion of a Texture without worrying about srcrect all the time."
-#define DOC_SDL2_VIDEO_IMAGE_GETRECT "get_rect() -> Rect\nGet the rectangular area of the Image."
-#define DOC_SDL2_VIDEO_IMAGE_DRAW "draw(srcrect=None, dstrect=None) -> None\nCopy a portion of the Image to the rendering target."
-#define DOC_SDL2_VIDEO_IMAGE_ANGLE "angle -> float\nGets and sets the angle the Image draws itself with."
-#define DOC_SDL2_VIDEO_IMAGE_ORIGIN "origin -> (float, float) or None.\nGets and sets the origin. Origin=None means the Image will be rotated around its center."
-#define DOC_SDL2_VIDEO_IMAGE_FLIPX "flip_x -> bool\nGets and sets whether the Image is flipped on the x axis."
-#define DOC_SDL2_VIDEO_IMAGE_FLIPY "flip_y -> bool\nGets and sets whether the Image is flipped on the y axis."
-#define DOC_SDL2_VIDEO_IMAGE_COLOR "color -> Color\nGets and sets the Image color modifier."
-#define DOC_SDL2_VIDEO_IMAGE_ALPHA "alpha -> float\nGets and sets the Image alpha modifier."
-#define DOC_SDL2_VIDEO_IMAGE_BLENDMODE "blend_mode -> int\nGets and sets the blend mode for the Image."
-#define DOC_SDL2_VIDEO_IMAGE_TEXTURE "texture -> Texture\nGets and sets the Texture the Image is based on."
-#define DOC_SDL2_VIDEO_IMAGE_SRCRECT "srcrect -> Rect\nGets and sets the Rect the Image is based on."
-#define DOC_SDL2_VIDEO_RENDERER "Renderer(window, index=-1, accelerated=-1, vsync=False, target_texture=False) -> Renderer\nCreate a 2D rendering context for a window."
-#define DOC_SDL2_VIDEO_RENDERER_FROMWINDOW "from_window(window) -> Renderer\nEasy way to create a Renderer."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWBLENDMODE "draw_blend_mode -> int\nGets and sets the blend mode used by the drawing functions."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWCOLOR "draw_color -> Color\nGets and sets the color used by the drawing functions."
-#define DOC_SDL2_VIDEO_RENDERER_CLEAR "clear() -> None\nClear the current rendering target with the drawing color."
-#define DOC_SDL2_VIDEO_RENDERER_PRESENT "present() -> None\nUpdates the screen with any new rendering since previous call."
-#define DOC_SDL2_VIDEO_RENDERER_GETVIEWPORT "get_viewport() -> Rect\nReturns the drawing area on the target."
-#define DOC_SDL2_VIDEO_RENDERER_SETVIEWPORT "set_viewport(area) -> None\nSet the drawing area on the target. If area is None, the entire target will be used."
-#define DOC_SDL2_VIDEO_RENDERER_LOGICALSIZE "logical_size -> (int width, int height)\nGets and sets the logical size."
-#define DOC_SDL2_VIDEO_RENDERER_SCALE "scale -> (float x_scale, float y_scale)\nGets and sets the scale."
-#define DOC_SDL2_VIDEO_RENDERER_TARGET "target -> Texture or None\nGets and sets the render target. None represents the default target (the renderer)."
-#define DOC_SDL2_VIDEO_RENDERER_BLIT "blit(source, dest, area=None, special_flags=0)-> Rect\nFor compatibility purposes. Textures created by different Renderers cannot be shared!"
-#define DOC_SDL2_VIDEO_RENDERER_DRAWLINE "draw_line(p1, p2) -> None\nDraws a line."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWPOINT "draw_point(point) -> None\nDraws a point."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWRECT "draw_rect(rect)-> None\nDraws a rectangle."
-#define DOC_SDL2_VIDEO_RENDERER_FILLRECT "fill_rect(rect)-> None\nFills a rectangle."
-#define DOC_SDL2_VIDEO_RENDERER_TOSURFACE "to_surface(surface=None, area=None)-> Surface\nRead pixels from current render target and create a pygame.Surface. WARNING: Slow operation, use sparingly."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWTRIANGLE "draw_triangle(p1, p2, p3) -> None\nDraws a triangle."
-#define DOC_SDL2_VIDEO_RENDERER_FILLTRIANGLE "fill_triangle(p1, p2, p3) -> None\nFills a triangle."
-#define DOC_SDL2_VIDEO_RENDERER_DRAWQUAD "draw_quad(p1, p2, p3, p4) -> None\nDraws a quad."
-#define DOC_SDL2_VIDEO_RENDERER_FILLQUAD "fill_quad(p1, p2, p3, p4) -> None\nFills a quad."
+#define DOC_SDL2_VIDEO_MESSAGEBOX "messagebox(title, message, window=None, info=False, warn=False, buttons=('OK',), return_button=0, escape_button=0)\nCreate a native GUI message box"
+#define DOC_SDL2_VIDEO_RENDERERDRIVERINFO "pygame object encapsulating Renderer driver information"
+#define DOC_SDL2_VIDEO_GETDRIVERS "get_drivers() -> Iterator[RendererDriverInfo]\nYield info about the rendering drivers available for Renderer objects"
+#define DOC_SDL2_VIDEO_GETGRABBEDWINDOW "get_grabbed_window() -> Window or None\nGet the window with input grab enabled"
+#define DOC_SDL2_VIDEO_WINDOW "Window(title='pygame window', size=(640, 480), position=None, fullscreen=False, fullscreen_desktop=False, **kwargs) -> Window\npygame object that represents a window"
+#define DOC_SDL2_VIDEO_WINDOW_GRAB "grab -> bool\nGet or set the window's input grab state"
+#define DOC_SDL2_VIDEO_WINDOW_RELATIVEMOUSE "relative_mouse -> bool\nGet or set the window's relative mouse mode state"
+#define DOC_SDL2_VIDEO_WINDOW_TITLE "title -> str\nGet or set the window title"
+#define DOC_SDL2_VIDEO_WINDOW_RESIZABLE "resizable -> bool\nGet or set whether the window is resizable"
+#define DOC_SDL2_VIDEO_WINDOW_BORDERLESS "borderless -> bool\nGet or set whether the window is borderless"
+#define DOC_SDL2_VIDEO_WINDOW_ID "id -> int\nGet the unique window ID (**read-only**)"
+#define DOC_SDL2_VIDEO_WINDOW_SIZE "size -> (int, int)\nGet or set the window size in pixels"
+#define DOC_SDL2_VIDEO_WINDOW_POSITION "position -> (int, int) or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED\nGet or set the window position in screen coordinates"
+#define DOC_SDL2_VIDEO_WINDOW_OPACITY "opacity -> float\nGet or set the window opacity, between 0.0 (fully transparent) and 1.0 (fully opaque)"
+#define DOC_SDL2_VIDEO_WINDOW_DISPLAYINDEX "get_display_index -> int\nGet the index of the display that owns the window (**read-only**)"
+#define DOC_SDL2_VIDEO_WINDOW_FROMDISPLAYMODULE "from_display_module() -> Window\nCreate a Window object using window data from display module"
+#define DOC_SDL2_VIDEO_WINDOW_SETWINDOWED "set_windowed() -> None\nEnable windowed mode (exit fullscreen)"
+#define DOC_SDL2_VIDEO_WINDOW_SETFULLSCREEN "set_fullscreen(desktop=False) -> None\nEnter fullscreen"
+#define DOC_SDL2_VIDEO_WINDOW_DESTROY "destroy() -> None\nDestroy the window"
+#define DOC_SDL2_VIDEO_WINDOW_HIDE "hide() -> None\nHide the window"
+#define DOC_SDL2_VIDEO_WINDOW_SHOW "show() -> None\nShow the window"
+#define DOC_SDL2_VIDEO_WINDOW_FOCUS "focus(input_only=False) -> None\nSet the window to be focused"
+#define DOC_SDL2_VIDEO_WINDOW_RESTORE "restore() -> None\nRestore the size and position of a minimized or maximized window"
+#define DOC_SDL2_VIDEO_WINDOW_MAXIMIZE "maximize() -> None\nMaximize the window"
+#define DOC_SDL2_VIDEO_WINDOW_MINIMIZE "maximize() -> None\nMinimize the window"
+#define DOC_SDL2_VIDEO_WINDOW_SETICON "set_icon(surface) -> None\nSet the window icon"
+#define DOC_SDL2_VIDEO_WINDOW_SETMODALFOR "set_modal_for(parent) -> None\nSet the window as a modal for a parent window"
+#define DOC_SDL2_VIDEO_TEXTURE "Texture(renderer, size, depth=0, static=False, streaming=False, target=False, scale_quality=None) -> Texture\npygame object that represents a texture"
+#define DOC_SDL2_VIDEO_TEXTURE_RENDERER "renderer -> Renderer\nGet the renderer associated with the texture (**read-only**)"
+#define DOC_SDL2_VIDEO_TEXTURE_WIDTH "width -> int\nGet the width of the texture (**read-only**)"
+#define DOC_SDL2_VIDEO_TEXTURE_HEIGHT "height -> int\nGet the height of the texture (**read-only**)"
+#define DOC_SDL2_VIDEO_TEXTURE_ALPHA "alpha -> int\nGet or set the additional alpha value multiplied into draw operations"
+#define DOC_SDL2_VIDEO_TEXTURE_BLENDMODE "blend_mode -> int\nGet or set the blend mode for texture drawing operations"
+#define DOC_SDL2_VIDEO_TEXTURE_COLOR "color -> Color\nGet or set the additional color value multiplied into texture drawing operations"
+#define DOC_SDL2_VIDEO_TEXTURE_FROMSURFACE "from_surface(renderer, surface) -> Texture\nCreate a texture from an existing surface"
+#define DOC_SDL2_VIDEO_TEXTURE_GETRECT "get_rect(**kwargs) -> Rect\nGet the rectangular area of the texture"
+#define DOC_SDL2_VIDEO_TEXTURE_DRAW "draw(srcrect=None, dstrect=None, angle=0, origin=None, flip_x=False, flip_y=False) -> None\nCopy a portion of the texture to the rendering target"
+#define DOC_SDL2_VIDEO_TEXTURE_DRAWTRIANGLE "draw_triangle(p1_xy, p2_xy, p3_xy, p1_uv=(0.0, 0.0), p2_uv=(1.0, 1.0), p3_uv=(0.0, 1.0), p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255)) -> None\nCopy a triangle portion of the texture to the rendering target using the given coordinates"
+#define DOC_SDL2_VIDEO_TEXTURE_DRAWQUAD "draw_quad(p1_xy, p2_xy, p3_xy, p4_xy, p1_uv=(0.0, 0.0), p2_uv=(1.0, 0.0), p3_uv=(1.0, 1.0), p4_uv=(0.0, 1.0), p1_mod=(255, 255, 255, 255), p2_mod=(255, 255, 255, 255), p3_mod=(255, 255, 255, 255), p4_mod=(255, 255, 255, 255)) -> None\nCopy a quad portion of the texture to the rendering target using the given coordinates"
+#define DOC_SDL2_VIDEO_TEXTURE_UPDATE "update(surface, area=None) -> None\nUpdate the texture with Surface (slow operation, use sparingly)"
+#define DOC_SDL2_VIDEO_IMAGE "Image(texture_or_image, srcrect=None) -> Image\npygame object that represents a portion of a texture"
+#define DOC_SDL2_VIDEO_IMAGE_ANGLE "angle -> float\nGet and set the angle the Image draws itself with"
+#define DOC_SDL2_VIDEO_IMAGE_FLIPX "flip_x -> bool\nGet or set whether the Image is flipped on the x axis"
+#define DOC_SDL2_VIDEO_IMAGE_FLIPY "flip_y -> bool\nGet or set whether the Image is flipped on the y axis"
+#define DOC_SDL2_VIDEO_IMAGE_COLOR "color -> Color\nGet or set the Image color modifier"
+#define DOC_SDL2_VIDEO_IMAGE_ALPHA "alpha -> float\nGet or set the Image alpha modifier (0-255)"
+#define DOC_SDL2_VIDEO_IMAGE_BLENDMODE "blend_mode -> int\nGet or set the blend mode for the Image"
+#define DOC_SDL2_VIDEO_IMAGE_TEXTURE "texture -> Texture\nGet or set the Texture the Image is based on"
+#define DOC_SDL2_VIDEO_IMAGE_SRCRECT "srcrect -> Rect\nGet or set the Rect the Image is based on"
+#define DOC_SDL2_VIDEO_IMAGE_ORIGIN "origin -> (float, float) or None\nGet or set the Image's origin of rotation"
+#define DOC_SDL2_VIDEO_IMAGE_GETRECT "get_rect() -> Rect\nGet the rectangular area of the Image"
+#define DOC_SDL2_VIDEO_IMAGE_DRAW "draw(srcrect=None, dstrect=None) -> None\nCopy a portion of the Image to the rendering target"
+#define DOC_SDL2_VIDEO_RENDERER "Renderer(window, index=-1, accelerated=-1, vsync=False, target_texture=False) -> Renderer\npygame object wrapping a 2D rendering context for a window"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWBLENDMODE "draw_blend_mode -> int\nGet or set the blend mode used for primitive drawing operations"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWCOLOR "draw_color -> Color\nGet or set the color used for primitive drawing operations"
+#define DOC_SDL2_VIDEO_RENDERER_LOGICALSIZE "logical_size -> (int width, int height)\nGet or set the logical Renderer size (a device independent resolution for rendering)"
+#define DOC_SDL2_VIDEO_RENDERER_SCALE "scale -> (float, float)\nGet the drawing scale for the current rendering target"
+#define DOC_SDL2_VIDEO_RENDERER_TARGET "target -> Texture or None\nGet or set the current rendering target"
+#define DOC_SDL2_VIDEO_RENDERER_FROMWINDOW "from_window(window) -> Renderer\nCreate a Renderer from an existing window"
+#define DOC_SDL2_VIDEO_RENDERER_CLEAR "clear() -> None\nClear the current rendering target with the drawing color"
+#define DOC_SDL2_VIDEO_RENDERER_PRESENT "present() -> None\nUpdate the screen with any rendering performed since the previous call"
+#define DOC_SDL2_VIDEO_RENDERER_GETVIEWPORT "get_viewport() -> Rect\nGet the drawing area on the rendering target"
+#define DOC_SDL2_VIDEO_RENDERER_SETVIEWPORT "set_viewport(area) -> None\nSet the drawing area on the rendering target"
+#define DOC_SDL2_VIDEO_RENDERER_BLIT "blit(source, dest, area=None, special_flags=0)-> Rect\nDraw textures using a Surface-like API"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWLINE "draw_line(p1, p2) -> None\nDraw a line"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWPOINT "draw_point(point) -> None\nDraw a point"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWRECT "draw_rect(rect)-> None\nDraw a rectangle outline"
+#define DOC_SDL2_VIDEO_RENDERER_FILLRECT "fill_rect(rect)-> None\nDraw a filled rectangle"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWTRIANGLE "draw_triangle(p1, p2, p3) -> None\nDraw a triangle outline"
+#define DOC_SDL2_VIDEO_RENDERER_FILLTRIANGLE "fill_triangle(p1, p2, p3) -> None\nDraw a filled triangle"
+#define DOC_SDL2_VIDEO_RENDERER_DRAWQUAD "draw_quad(p1, p2, p3, p4) -> None\nDraw a quad outline"
+#define DOC_SDL2_VIDEO_RENDERER_FILLQUAD "fill_quad(p1, p2, p3, p4) -> None\nDraw a filled quad"
+#define DOC_SDL2_VIDEO_RENDERER_TOSURFACE "to_surface(surface=None, area=None)-> Surface\nRead pixels from current rendering target and create a Surface (slow operation, use sparingly)"
+#define DOC_SDL2_VIDEO_RENDERER_COMPOSECUSTOMBLENDMODE "compose_custom_blend_mode(color_mode, alpha_mode) -> int\nCompose a custom blend mode"
diff --git a/src_c/draw.c b/src_c/draw.c
index 45ec8396f1..da3a7e9714 100644
--- a/src_c/draw.c
+++ b/src_c/draw.c
@@ -73,6 +73,9 @@ draw_ellipse_thickness(SDL_Surface *surf, int x0, int y0, int width,
static void
draw_fillpoly(SDL_Surface *surf, int *vx, int *vy, Py_ssize_t n, Uint32 color,
int *drawn_area);
+static int
+draw_filltri(SDL_Surface *surf, int *xlist, int *ylist, Uint32 color,
+ int *drawn_area);
static void
draw_rect(SDL_Surface *surf, int x1, int y1, int x2, int y2, int width,
Uint32 color);
@@ -845,7 +848,12 @@ polygon(PyObject *self, PyObject *arg, PyObject *kwargs)
return RAISE(PyExc_RuntimeError, "error locking surface");
}
- draw_fillpoly(surf, xlist, ylist, length, color, drawn_area);
+ if (length != 3) {
+ draw_fillpoly(surf, xlist, ylist, length, color, drawn_area);
+ }
+ else {
+ draw_filltri(surf, xlist, ylist, color, drawn_area);
+ }
PyMem_Free(xlist);
PyMem_Free(ylist);
@@ -1471,6 +1479,66 @@ drawhorzlineclipbounding(SDL_Surface *surf, Uint32 color, int x1, int y1,
drawhorzline(surf, color, x1, y1, x2);
}
+void
+swap_coordinates(int *x1, int *y1, int *x2, int *y2)
+{
+ int temp = *x1;
+ *x1 = *x2;
+ *x2 = temp;
+
+ temp = *y1;
+ *y1 = *y2;
+ *y2 = temp;
+}
+
+static int
+draw_filltri(SDL_Surface *surf, int *xlist, int *ylist, Uint32 color,
+ int *draw_area)
+{
+ int p0x, p0y, p1x, p1y, p2x, p2y;
+
+ p0x = xlist[0];
+ p1x = xlist[1];
+ p2x = xlist[2];
+ p0y = ylist[0];
+ p1y = ylist[1];
+ p2y = ylist[2];
+
+ if (p1y < p0y) {
+ swap_coordinates(&p1x, &p1y, &p0x, &p0y);
+ }
+
+ if (p2y < p1y) {
+ swap_coordinates(&p1x, &p1y, &p2x, &p2y);
+
+ if (p1y < p0y) {
+ swap_coordinates(&p1x, &p1y, &p0x, &p0y);
+ }
+ }
+
+ if ((p0y == p1y) && (p1y == p2y) && (p0x == p1x) && (p1x != p2x)) {
+ swap_coordinates(&p1x, &p1y, &p2x, &p2y);
+ }
+
+ float d1 = (float)((p2x - p0x) / ((p2y - p0y) + 1e-17));
+ float d2 = (float)((p1x - p0x) / ((p1y - p0y) + 1e-17));
+ float d3 = (float)((p2x - p1x) / ((p2y - p1y) + 1e-17));
+ int y;
+ for (y = p0y; y <= p2y; y++) {
+ int x1 = p0x + (int)((y - p0y) * d1);
+
+ int x2;
+ if (y < p1y)
+ x2 = p0x + (int)((y - p0y) * d2);
+ else
+ x2 = p1x + (int)((y - p1y) * d3);
+
+ drawhorzlineclipbounding(surf, color, x1, y, x2, draw_area);
+ }
+
+ return 0;
+}
+
static void
draw_line_width(SDL_Surface *surf, Uint32 color, int x1, int y1, int x2,
int y2, int width, int *drawn_area)
diff --git a/src_c/event.c b/src_c/event.c
index 8bb0580017..ca37221ce5 100644
--- a/src_c/event.c
+++ b/src_c/event.c
@@ -53,9 +53,6 @@
#define PG_GET_LIST_LEN 128
-// Map joystick instance IDs to device ids for partial backwards compatibility
-static PyObject *joy_instance_map = NULL;
-
/* _custom_event stores the next custom user event type that will be
* returned by pygame.event.custom_type() */
#define _PGE_CUSTOM_EVENT_INIT PGE_USEREVENT + 1
@@ -851,51 +848,11 @@ get_joy_guid(int device_index)
return PyUnicode_FromString(strguid);
}
-/** Try to insert the instance ID for a new device into the joystick mapping.
- */
-void
-_joy_map_add(int device_index)
-{
- int instance_id = (int)SDL_JoystickGetDeviceInstanceID(device_index);
- PyObject *k, *v;
- if (instance_id != -1) {
- k = PyLong_FromLong(instance_id);
- v = PyLong_FromLong(device_index);
- if (k != NULL && v != NULL) {
- PyDict_SetItem(joy_instance_map, k, v);
- }
- Py_XDECREF(k);
- Py_XDECREF(v);
- }
-}
-
-/** Look up a device ID for an instance ID. */
-PyObject *
-_joy_map_instance(int instance_id)
-{
- PyObject *v, *k = PyLong_FromLong(instance_id);
- if (!k) {
- Py_RETURN_NONE;
- }
- v = PyDict_GetItem(joy_instance_map, k);
- if (v) {
- Py_DECREF(k);
- Py_INCREF(v);
- return v;
- }
- return k;
-}
-
-/** Discard a joystick from the joystick instance -> device mapping. */
-void
-_joy_map_discard(int instance_id)
+static PyObject *
+get_joy_device_index(int instance_id)
{
- PyObject *k = PyLong_FromLong(instance_id);
-
- if (k) {
- PyDict_DelItem(joy_instance_map, k);
- Py_DECREF(k);
- }
+ int device_index = pgJoystick_GetDeviceIndexByInstanceID(instance_id);
+ return PyLong_FromLong(device_index);
}
static PyObject *
@@ -995,7 +952,7 @@ dict_from_event(SDL_Event *event)
PyBool_FromLong((event->button.which == SDL_TOUCH_MOUSEID)));
break;
case SDL_JOYAXISMOTION:
- _pg_insobj(dict, "joy", _joy_map_instance(event->jaxis.which));
+ _pg_insobj(dict, "joy", get_joy_device_index(event->jaxis.which));
_pg_insobj(dict, "instance_id",
PyLong_FromLong(event->jaxis.which));
_pg_insobj(dict, "axis", PyLong_FromLong(event->jaxis.axis));
@@ -1003,7 +960,7 @@ dict_from_event(SDL_Event *event)
PyFloat_FromDouble(event->jaxis.value / 32767.0));
break;
case SDL_JOYBALLMOTION:
- _pg_insobj(dict, "joy", _joy_map_instance(event->jaxis.which));
+ _pg_insobj(dict, "joy", get_joy_device_index(event->jaxis.which));
_pg_insobj(dict, "instance_id",
PyLong_FromLong(event->jball.which));
_pg_insobj(dict, "ball", PyLong_FromLong(event->jball.ball));
@@ -1011,7 +968,7 @@ dict_from_event(SDL_Event *event)
_pg_insobj(dict, "rel", obj);
break;
case SDL_JOYHATMOTION:
- _pg_insobj(dict, "joy", _joy_map_instance(event->jaxis.which));
+ _pg_insobj(dict, "joy", get_joy_device_index(event->jaxis.which));
_pg_insobj(dict, "instance_id",
PyLong_FromLong(event->jhat.which));
_pg_insobj(dict, "hat", PyLong_FromLong(event->jhat.hat));
@@ -1028,7 +985,7 @@ dict_from_event(SDL_Event *event)
break;
case SDL_JOYBUTTONUP:
case SDL_JOYBUTTONDOWN:
- _pg_insobj(dict, "joy", _joy_map_instance(event->jaxis.which));
+ _pg_insobj(dict, "joy", get_joy_device_index(event->jaxis.which));
_pg_insobj(dict, "instance_id",
PyLong_FromLong(event->jbutton.which));
_pg_insobj(dict, "button", PyLong_FromLong(event->jbutton.button));
@@ -1158,7 +1115,6 @@ dict_from_event(SDL_Event *event)
_pg_insobj(dict, "guid", get_joy_guid(event->jdevice.which));
break;
case SDL_JOYDEVICEADDED:
- _joy_map_add(event->jdevice.which);
_pg_insobj(dict, "device_index",
PyLong_FromLong(event->jdevice.which));
_pg_insobj(dict, "guid", get_joy_guid(event->jdevice.which));
@@ -1170,7 +1126,6 @@ dict_from_event(SDL_Event *event)
PyLong_FromLong(event->cdevice.which));
break;
case SDL_JOYDEVICEREMOVED:
- _joy_map_discard(event->jdevice.which);
_pg_insobj(dict, "instance_id",
PyLong_FromLong(event->jdevice.which));
break;
@@ -1305,7 +1260,7 @@ pg_event_dealloc(PyObject *self)
{
pgEventObject *e = (pgEventObject *)self;
Py_XDECREF(e->dict);
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
#ifdef PYPY_VERSION
@@ -1518,7 +1473,7 @@ pgEvent_New(SDL_Event *event)
e->dict = PyDict_New();
}
if (!e->dict) {
- PyObject_Free(e);
+ Py_TYPE(e)->tp_free(e);
return PyErr_NoMemory();
}
return (PyObject *)e;
@@ -1533,7 +1488,7 @@ pgEvent_New2(int type, PyObject *dict)
return PyErr_NoMemory();
if (_pg_event_populate(e, type, dict) == -1) {
- PyObject_Free(e);
+ Py_TYPE(e)->tp_free(e);
return NULL;
}
return (PyObject *)e;
@@ -2263,6 +2218,11 @@ MODINIT_DEFINE(event)
return NULL;
}
+ import_pygame_joystick();
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
+
/* type preparation */
if (PyType_Ready(&pgEvent_Type) < 0) {
return NULL;
@@ -2274,15 +2234,6 @@ MODINIT_DEFINE(event)
return NULL;
}
- joy_instance_map = PyDict_New();
- /* need to keep a reference for use in the module */
- Py_XINCREF(joy_instance_map);
- if (PyModule_AddObject(module, "_joy_instance_map", joy_instance_map)) {
- Py_XDECREF(joy_instance_map);
- Py_DECREF(module);
- return NULL;
- }
-
Py_INCREF(&pgEvent_Type);
if (PyModule_AddObject(module, "EventType", (PyObject *)&pgEvent_Type)) {
Py_DECREF(&pgEvent_Type);
diff --git a/src_c/font.c b/src_c/font.c
index 7eba2e509f..ad9c858207 100644
--- a/src_c/font.c
+++ b/src_c/font.c
@@ -61,6 +61,10 @@ PyFont_New(TTF_Font *);
#define PyFont_Check(x) ((x)->ob_type == &PyFont_Type)
static unsigned int current_ttf_generation = 0;
+
+#define PgFont_GenerationCheck(x) \
+ (((PyFontObject *)(x))->ttf_init_generation == current_ttf_generation)
+
#if defined(BUILD_STATIC)
// SDL_Init + TTF_Init() are made in main before CPython process the module
// inittab so the emscripten handler knows it will use SDL2 next cycle.
@@ -486,6 +490,11 @@ font_render(PyObject *self, PyObject *args, PyObject *kwds)
const char *astring = "";
int wraplength = 0;
+ if (!PgFont_GenerationCheck(self)) {
+ return RAISE(pgExc_SDLError,
+ "Invalid font (font module quit since font created)");
+ }
+
static char *kwlist[] = {"text", "antialias", "color",
"bgcolor", "wraplength", NULL};
@@ -610,6 +619,11 @@ font_size(PyObject *self, PyObject *text)
int w, h;
const char *string;
+ if (!PgFont_GenerationCheck(self)) {
+ return RAISE(pgExc_SDLError,
+ "Invalid font (font module quit since font created)");
+ }
+
if (PyUnicode_Check(text)) {
PyObject *bytes = PyUnicode_AsEncodedString(text, "utf-8", "strict");
int ecode;
@@ -683,6 +697,11 @@ font_metrics(PyObject *self, PyObject *textobj)
PyObject *temp;
int surrogate;
+ if (!PgFont_GenerationCheck(self)) {
+ return RAISE(pgExc_SDLError,
+ "Invalid font (font module quit since font created)");
+ }
+
if (PyUnicode_Check(textobj)) {
obj = textobj;
Py_INCREF(obj);
diff --git a/src_c/include/_pygame.h b/src_c/include/_pygame.h
index e16f7e4be8..684273039f 100644
--- a/src_c/include/_pygame.h
+++ b/src_c/include/_pygame.h
@@ -57,7 +57,7 @@
/* version macros (defined since version 1.9.5) */
#define PG_MAJOR_VERSION 2
#define PG_MINOR_VERSION 3
-#define PG_PATCH_VERSION 0
+#define PG_PATCH_VERSION 1
#define PG_VERSIONNUM(MAJOR, MINOR, PATCH) \
(1000 * (MAJOR) + 100 * (MINOR) + (PATCH))
#define PG_VERSION_ATLEAST(MAJOR, MINOR, PATCH) \
@@ -229,6 +229,8 @@ typedef struct pgJoystickObject {
#define pgJoystick_Check(x) ((x)->ob_type == &pgJoystick_Type)
#define pgJoystick_New (*(PyObject * (*)(int)) PYGAMEAPI_GET_SLOT(joystick, 1))
+#define pgJoystick_GetDeviceIndexByInstanceID \
+ (*(int (*)(int))PYGAMEAPI_GET_SLOT(joystick, 2))
#define import_pygame_joystick() IMPORT_PYGAME_MODULE(joystick)
#endif
@@ -459,6 +461,21 @@ typedef struct pgColorObject pgColorObject;
#define import_pygame_math() IMPORT_PYGAME_MODULE(math)
#endif /* PYGAMEAPI_MATH_INTERNAL */
+/*
+ * Window module
+ */
+typedef struct {
+ PyObject_HEAD SDL_Window *_win;
+ SDL_bool _is_borrowed;
+} pgWindowObject;
+
+#ifndef PYGAMEAPI_WINDOW_INTERNAL
+#define pgWindow_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(_window, 0))
+#define pgWindow_Check(x) \
+ (PyObject_IsInstance((x), (PyObject *)&pgWindow_Type))
+#define import_pygame_window() IMPORT_PYGAME_MODULE(_window)
+#endif
+
#define IMPORT_PYGAME_MODULE _IMPORT_PYGAME_MODULE
/*
@@ -478,7 +495,8 @@ PYGAMEAPI_DEFINE_SLOTS(rwobject);
PYGAMEAPI_DEFINE_SLOTS(pixelarray);
PYGAMEAPI_DEFINE_SLOTS(color);
PYGAMEAPI_DEFINE_SLOTS(math);
-#else /* ~PYGAME_H */
+PYGAMEAPI_DEFINE_SLOTS(_window);
+#else /* ~PYGAME_H */
PYGAMEAPI_EXTERN_SLOTS(base);
PYGAMEAPI_EXTERN_SLOTS(rect);
PYGAMEAPI_EXTERN_SLOTS(cdrom);
@@ -491,6 +509,8 @@ PYGAMEAPI_EXTERN_SLOTS(rwobject);
PYGAMEAPI_EXTERN_SLOTS(pixelarray);
PYGAMEAPI_EXTERN_SLOTS(color);
PYGAMEAPI_EXTERN_SLOTS(math);
+PYGAMEAPI_EXTERN_SLOTS(_window);
+
#endif /* ~PYGAME_H */
#endif /* PYGAME_H */
diff --git a/src_c/include/sse2neon.h b/src_c/include/sse2neon.h
index a3e3ac0d19..e9b19ae0bf 100644
--- a/src_c/include/sse2neon.h
+++ b/src_c/include/sse2neon.h
@@ -4,8 +4,6 @@
// This header file provides a simple API translation layer
// between SSE intrinsics to their corresponding Arm/Aarch64 NEON versions
//
-// This header file does not yet translate all of the SSE intrinsics.
-//
// Contributors to this work are:
// John W. Ratcliff
// Brandon Rowlett
@@ -13,8 +11,8 @@
// Eric van Beurden
// Alexander Potylitsin
// Hasindu Gamaarachchi
-// Jim Huang
-// Mark Cheng
+// Jim Huang
+// Mark Cheng
// Malcolm James MacLeod
// Devin Hussey (easyaspi314)
// Sebastian Pop
@@ -22,7 +20,13 @@
// Danila Kutenin
// François Turban (JishinMaster)
// Pei-Hsuan Hung
-// Yang-Hao Yuan
+// Yang-Hao Yuan
+// Syoyo Fujita
+// Brecht Van Lommel
+// Jonathan Hue
+// Cuda Chen
+// Aymen Qader
+// Anthony Roberts
/*
* sse2neon is freely redistributable under the MIT License.
@@ -48,72 +52,244 @@
/* Tunable configurations */
-/* Enable precise implementation of _mm_min_ps and _mm_max_ps
+/* Enable precise implementation of math operations
* This would slow down the computation a bit, but gives consistent result with
- * x86 SSE2. (e.g. would solve a hole or NaN pixel in the rendering result)
+ * x86 SSE. (e.g. would solve a hole or NaN pixel in the rendering result)
*/
+/* _mm_min|max_ps|ss|pd|sd */
#ifndef SSE2NEON_PRECISE_MINMAX
#define SSE2NEON_PRECISE_MINMAX (0)
#endif
+/* _mm_rcp_ps and _mm_div_ps */
+#ifndef SSE2NEON_PRECISE_DIV
+#define SSE2NEON_PRECISE_DIV (0)
+#endif
+/* _mm_sqrt_ps and _mm_rsqrt_ps */
+#ifndef SSE2NEON_PRECISE_SQRT
+#define SSE2NEON_PRECISE_SQRT (0)
+#endif
+/* _mm_dp_pd */
+#ifndef SSE2NEON_PRECISE_DP
+#define SSE2NEON_PRECISE_DP (0)
+#endif
+/* Enable inclusion of windows.h on MSVC platforms
+ * This makes _mm_clflush functional on windows, as there is no builtin.
+ */
+#ifndef SSE2NEON_INCLUDE_WINDOWS_H
+#define SSE2NEON_INCLUDE_WINDOWS_H (0)
+#endif
+
+/* compiler specific definitions */
#if defined(__GNUC__) || defined(__clang__)
#pragma push_macro("FORCE_INLINE")
#pragma push_macro("ALIGN_STRUCT")
#define FORCE_INLINE static inline __attribute__((always_inline))
#define ALIGN_STRUCT(x) __attribute__((aligned(x)))
-#else
-#error "Macro name collisions may happen with unsupported compiler."
-#ifdef FORCE_INLINE
-#undef FORCE_INLINE
+#define _sse2neon_likely(x) __builtin_expect(!!(x), 1)
+#define _sse2neon_unlikely(x) __builtin_expect(!!(x), 0)
+#elif defined(_MSC_VER)
+#if _MSVC_TRADITIONAL
+#error Using the traditional MSVC preprocessor is not supported! Use /Zc:preprocessor instead.
#endif
+#ifndef FORCE_INLINE
#define FORCE_INLINE static inline
+#endif
#ifndef ALIGN_STRUCT
#define ALIGN_STRUCT(x) __declspec(align(x))
#endif
+#define _sse2neon_likely(x) (x)
+#define _sse2neon_unlikely(x) (x)
+#else
+#pragma message("Macro name collisions may happen with unsupported compilers.")
+#endif
+
+/* C language does not allow initializing a variable with a function call. */
+#ifdef __cplusplus
+#define _sse2neon_const static const
+#else
+#define _sse2neon_const const
#endif
#include
#include
-// These cause the build to fail on raspberry pi with 'unsupported target'
-// and don't seem to do anything particularly useful
-///* Architecture-specific build options */
-///* FIXME: #pragma GCC push_options is only available on GCC */
-//#if defined(__GNUC__)
-//#if defined(__arm__) && __ARM_ARCH == 7
-///* According to ARM C Language Extensions Architecture specification,
-// * __ARM_NEON is defined to a value indicating the Advanced SIMD (NEON)
-// * architecture supported.
-// */
-//#if !defined(__ARM_NEON) || !defined(__ARM_NEON__)
-//#error "You must enable NEON instructions (e.g. -mfpu=neon) to use SSE2NEON."
-//#endif
-//#pragma GCC push_options
-//#pragma GCC target("fpu=neon")
-//#elif defined(__aarch64__)
-//#pragma GCC push_options
-//#pragma GCC target("+simd")
-//#else
-//#error "Unsupported target. Must be either ARMv7-A+NEON or ARMv8-A."
-//#endif
-//#endif
+#if defined(_WIN32)
+/* Definitions for _mm_{malloc,free} are provided by
+ * from both MinGW-w64 and MSVC.
+ */
+#define SSE2NEON_ALLOC_DEFINED
+#endif
+
+/* If using MSVC */
+#ifdef _MSC_VER
+#include
+#if SSE2NEON_INCLUDE_WINDOWS_H
+#include
+#include
+#endif
+
+#if !defined(__cplusplus)
+#error sse2neon only supports C++ compilation with this compiler
+#endif
+
+#ifdef SSE2NEON_ALLOC_DEFINED
+#include
+#endif
+
+#if (defined(_M_AMD64) || defined(__x86_64__)) || \
+ (defined(_M_ARM64) || defined(__arm64__))
+#define SSE2NEON_HAS_BITSCAN64
+#endif
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+#define _sse2neon_define0(type, s, body) \
+ __extension__({ \
+ type _a = (s); \
+ body \
+ })
+#define _sse2neon_define1(type, s, body) \
+ __extension__({ \
+ type _a = (s); \
+ body \
+ })
+#define _sse2neon_define2(type, a, b, body) \
+ __extension__({ \
+ type _a = (a), _b = (b); \
+ body \
+ })
+#define _sse2neon_return(ret) (ret)
+#else
+#define _sse2neon_define0(type, a, body) [=](type _a) { body }(a)
+#define _sse2neon_define1(type, a, body) [](type _a) { body }(a)
+#define _sse2neon_define2(type, a, b, body) \
+ [](type _a, type _b) { body }((a), (b))
+#define _sse2neon_return(ret) return ret
+#endif
+
+#define _sse2neon_init(...) \
+ { \
+ __VA_ARGS__ \
+ }
+
+/* Compiler barrier */
+#if defined(_MSC_VER)
+#define SSE2NEON_BARRIER() _ReadWriteBarrier()
+#else
+#define SSE2NEON_BARRIER() \
+ do { \
+ __asm__ __volatile__("" ::: "memory"); \
+ (void) 0; \
+ } while (0)
+#endif
+
+/* Memory barriers
+ * __atomic_thread_fence does not include a compiler barrier; instead,
+ * the barrier is part of __atomic_load/__atomic_store's "volatile-like"
+ * semantics.
+ */
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+#include
+#endif
+
+FORCE_INLINE void _sse2neon_smp_mb(void)
+{
+ SSE2NEON_BARRIER();
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
+ !defined(__STDC_NO_ATOMICS__)
+ atomic_thread_fence(memory_order_seq_cst);
+#elif defined(__GNUC__) || defined(__clang__)
+ __atomic_thread_fence(__ATOMIC_SEQ_CST);
+#else /* MSVC */
+ __dmb(_ARM64_BARRIER_ISH);
+#endif
+}
+
+/* Architecture-specific build options */
+/* FIXME: #pragma GCC push_options is only available on GCC */
+#if defined(__GNUC__)
+#if defined(__arm__) && __ARM_ARCH == 7
+/* According to ARM C Language Extensions Architecture specification,
+ * __ARM_NEON is defined to a value indicating the Advanced SIMD (NEON)
+ * architecture supported.
+ */
+#if !defined(__ARM_NEON) || !defined(__ARM_NEON__)
+#error "You must enable NEON instructions (e.g. -mfpu=neon) to use SSE2NEON."
+#endif
+#if !defined(__clang__)
+#pragma GCC push_options
+#pragma GCC target("fpu=neon")
+#endif
+#elif defined(__aarch64__) || defined(_M_ARM64)
+#if !defined(__clang__) && !defined(_MSC_VER)
+#pragma GCC push_options
+#pragma GCC target("+simd")
+#endif
+#elif __ARM_ARCH == 8
+#if !defined(__ARM_NEON) || !defined(__ARM_NEON__)
+#error \
+ "You must enable NEON instructions (e.g. -mfpu=neon-fp-armv8) to use SSE2NEON."
+#endif
+#if !defined(__clang__) && !defined(_MSC_VER)
+#pragma GCC push_options
+#endif
+#else
+#error "Unsupported target. Must be either ARMv7-A+NEON or ARMv8-A."
+#endif
+#endif
#include
+#if (!defined(__aarch64__) && !defined(_M_ARM64)) && (__ARM_ARCH == 8)
+#if defined __has_include && __has_include()
+#include
+#endif
+#endif
+
+/* Apple Silicon cache lines are double of what is commonly used by Intel, AMD
+ * and other Arm microarchtectures use.
+ * From sysctl -a on Apple M1:
+ * hw.cachelinesize: 128
+ */
+#if defined(__APPLE__) && (defined(__aarch64__) || defined(__arm64__))
+#define SSE2NEON_CACHELINE_SIZE 128
+#else
+#define SSE2NEON_CACHELINE_SIZE 64
+#endif
/* Rounding functions require either Aarch64 instructions or libm failback */
-#if !defined(__aarch64__)
+#if !defined(__aarch64__) && !defined(_M_ARM64)
#include
#endif
+/* On ARMv7, some registers, such as PMUSERENR and PMCCNTR, are read-only
+ * or even not accessible in user mode.
+ * To write or access to these registers in user mode,
+ * we have to perform syscall instead.
+ */
+#if (!defined(__aarch64__) && !defined(_M_ARM64))
+#include
+#endif
+
/* "__has_builtin" can be used to query support for built-in functions
* provided by gcc/clang and other compilers that support it.
*/
#ifndef __has_builtin /* GCC prior to 10 or non-clang compilers */
/* Compatibility with gcc <= 9 */
-#if __GNUC__ <= 9
+#if defined(__GNUC__) && (__GNUC__ <= 9)
#define __has_builtin(x) HAS##x
#define HAS__builtin_popcount 1
#define HAS__builtin_popcountll 1
+
+// __builtin_shuffle introduced in GCC 4.7.0
+#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
+#define HAS__builtin_shuffle 1
+#else
+#define HAS__builtin_shuffle 0
+#endif
+
+#define HAS__builtin_shufflevector 0
+#define HAS__builtin_nontemporal_store 0
#else
#define __has_builtin(x) 0
#endif
@@ -130,6 +306,26 @@
#define _MM_SHUFFLE(fp3, fp2, fp1, fp0) \
(((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | ((fp0)))
+#if __has_builtin(__builtin_shufflevector)
+#define _sse2neon_shuffle(type, a, b, ...) \
+ __builtin_shufflevector(a, b, __VA_ARGS__)
+#elif __has_builtin(__builtin_shuffle)
+#define _sse2neon_shuffle(type, a, b, ...) \
+ __extension__({ \
+ type tmp = {__VA_ARGS__}; \
+ __builtin_shuffle(a, b, tmp); \
+ })
+#endif
+
+#ifdef _sse2neon_shuffle
+#define vshuffle_s16(a, b, ...) _sse2neon_shuffle(int16x4_t, a, b, __VA_ARGS__)
+#define vshuffleq_s16(a, b, ...) _sse2neon_shuffle(int16x8_t, a, b, __VA_ARGS__)
+#define vshuffle_s32(a, b, ...) _sse2neon_shuffle(int32x2_t, a, b, __VA_ARGS__)
+#define vshuffleq_s32(a, b, ...) _sse2neon_shuffle(int32x4_t, a, b, __VA_ARGS__)
+#define vshuffle_s64(a, b, ...) _sse2neon_shuffle(int64x1_t, a, b, __VA_ARGS__)
+#define vshuffleq_s64(a, b, ...) _sse2neon_shuffle(int64x2_t, a, b, __VA_ARGS__)
+#endif
+
/* Rounding mode macros. */
#define _MM_FROUND_TO_NEAREST_INT 0x00
#define _MM_FROUND_TO_NEG_INF 0x01
@@ -137,6 +333,25 @@
#define _MM_FROUND_TO_ZERO 0x03
#define _MM_FROUND_CUR_DIRECTION 0x04
#define _MM_FROUND_NO_EXC 0x08
+#define _MM_FROUND_RAISE_EXC 0x00
+#define _MM_FROUND_NINT (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_RAISE_EXC)
+#define _MM_FROUND_FLOOR (_MM_FROUND_TO_NEG_INF | _MM_FROUND_RAISE_EXC)
+#define _MM_FROUND_CEIL (_MM_FROUND_TO_POS_INF | _MM_FROUND_RAISE_EXC)
+#define _MM_FROUND_TRUNC (_MM_FROUND_TO_ZERO | _MM_FROUND_RAISE_EXC)
+#define _MM_FROUND_RINT (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_RAISE_EXC)
+#define _MM_FROUND_NEARBYINT (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC)
+#define _MM_ROUND_NEAREST 0x0000
+#define _MM_ROUND_DOWN 0x2000
+#define _MM_ROUND_UP 0x4000
+#define _MM_ROUND_TOWARD_ZERO 0x6000
+/* Flush zero mode macros. */
+#define _MM_FLUSH_ZERO_MASK 0x8000
+#define _MM_FLUSH_ZERO_ON 0x8000
+#define _MM_FLUSH_ZERO_OFF 0x0000
+/* Denormals are zeros mode macros. */
+#define _MM_DENORMALS_ZERO_MASK 0x0040
+#define _MM_DENORMALS_ZERO_ON 0x0040
+#define _MM_DENORMALS_ZERO_OFF 0x0000
/* indicate immediate constant argument in a given range */
#define __constrange(a, b) const
@@ -152,13 +367,23 @@ typedef float32x4_t __m128; /* 128-bit vector containing 4 floats */
// On ARM 32-bit architecture, the float64x2_t is not supported.
// The data type __m128d should be represented in a different way for related
// intrinsic conversion.
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(_M_ARM64)
typedef float64x2_t __m128d; /* 128-bit vector containing 2 doubles */
#else
typedef float32x4_t __m128d;
#endif
typedef int64x2_t __m128i; /* 128-bit vector containing integers */
+// __int64 is defined in the Intrinsics Guide which maps to different datatype
+// in different data model
+#if !(defined(_WIN32) || defined(_WIN64) || defined(__int64))
+#if (defined(__x86_64__) || defined(__i386__))
+#define __int64 long long
+#else
+#define __int64 int64_t
+#endif
+#endif
+
/* type-safe casting between types */
#define vreinterpretq_m128_f16(x) vreinterpretq_f32_f16(x)
@@ -199,6 +424,9 @@ typedef int64x2_t __m128i; /* 128-bit vector containing integers */
#define vreinterpretq_m128i_u32(x) vreinterpretq_s64_u32(x)
#define vreinterpretq_m128i_u64(x) vreinterpretq_s64_u64(x)
+#define vreinterpretq_f32_m128i(x) vreinterpretq_f32_s64(x)
+#define vreinterpretq_f64_m128i(x) vreinterpretq_f64_s64(x)
+
#define vreinterpretq_s8_m128i(x) vreinterpretq_s8_s64(x)
#define vreinterpretq_s16_m128i(x) vreinterpretq_s16_s64(x)
#define vreinterpretq_s32_m128i(x) vreinterpretq_s32_s64(x)
@@ -235,31 +463,44 @@ typedef int64x2_t __m128i; /* 128-bit vector containing integers */
#define vreinterpret_f32_m64(x) vreinterpret_f32_s64(x)
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(_M_ARM64)
#define vreinterpretq_m128d_s32(x) vreinterpretq_f64_s32(x)
#define vreinterpretq_m128d_s64(x) vreinterpretq_f64_s64(x)
+#define vreinterpretq_m128d_u64(x) vreinterpretq_f64_u64(x)
+
+#define vreinterpretq_m128d_f32(x) vreinterpretq_f64_f32(x)
#define vreinterpretq_m128d_f64(x) (x)
#define vreinterpretq_s64_m128d(x) vreinterpretq_s64_f64(x)
+#define vreinterpretq_u32_m128d(x) vreinterpretq_u32_f64(x)
+#define vreinterpretq_u64_m128d(x) vreinterpretq_u64_f64(x)
+
#define vreinterpretq_f64_m128d(x) (x)
+#define vreinterpretq_f32_m128d(x) vreinterpretq_f32_f64(x)
#else
#define vreinterpretq_m128d_s32(x) vreinterpretq_f32_s32(x)
#define vreinterpretq_m128d_s64(x) vreinterpretq_f32_s64(x)
+#define vreinterpretq_m128d_u32(x) vreinterpretq_f32_u32(x)
+#define vreinterpretq_m128d_u64(x) vreinterpretq_f32_u64(x)
+
#define vreinterpretq_m128d_f32(x) (x)
#define vreinterpretq_s64_m128d(x) vreinterpretq_s64_f32(x)
+#define vreinterpretq_u32_m128d(x) vreinterpretq_u32_f32(x)
+#define vreinterpretq_u64_m128d(x) vreinterpretq_u64_f32(x)
+
#define vreinterpretq_f32_m128d(x) (x)
#endif
// A struct is defined in this header file called 'SIMDVec' which can be used
-// by applications which attempt to access the contents of an _m128 struct
+// by applications which attempt to access the contents of an __m128 struct
// directly. It is important to note that accessing the __m128 struct directly
// is bad coding practice by Microsoft: @see:
-// https://msdn.microsoft.com/en-us/library/ayeb3ayc.aspx
+// https://learn.microsoft.com/en-us/cpp/cpp/m128
//
// However, some legacy source code may try to access the contents of an __m128
// struct directly so the developer can use the SIMDVec as an alias for it. Any
@@ -295,12 +536,49 @@ typedef union ALIGN_STRUCT(16) SIMDVec {
#define vreinterpretq_nth_u32_m128i(x, n) (((SIMDVec *) &x)->m128_u32[n])
#define vreinterpretq_nth_u8_m128i(x, n) (((SIMDVec *) &x)->m128_u8[n])
+/* SSE macros */
+#define _MM_GET_FLUSH_ZERO_MODE _sse2neon_mm_get_flush_zero_mode
+#define _MM_SET_FLUSH_ZERO_MODE _sse2neon_mm_set_flush_zero_mode
+#define _MM_GET_DENORMALS_ZERO_MODE _sse2neon_mm_get_denormals_zero_mode
+#define _MM_SET_DENORMALS_ZERO_MODE _sse2neon_mm_set_denormals_zero_mode
+
+// Function declaration
+// SSE
+FORCE_INLINE unsigned int _MM_GET_ROUNDING_MODE();
+FORCE_INLINE __m128 _mm_move_ss(__m128, __m128);
+FORCE_INLINE __m128 _mm_or_ps(__m128, __m128);
+FORCE_INLINE __m128 _mm_set_ps1(float);
+FORCE_INLINE __m128 _mm_setzero_ps(void);
+// SSE2
+FORCE_INLINE __m128i _mm_and_si128(__m128i, __m128i);
+FORCE_INLINE __m128i _mm_castps_si128(__m128);
+FORCE_INLINE __m128i _mm_cmpeq_epi32(__m128i, __m128i);
+FORCE_INLINE __m128i _mm_cvtps_epi32(__m128);
+FORCE_INLINE __m128d _mm_move_sd(__m128d, __m128d);
+FORCE_INLINE __m128i _mm_or_si128(__m128i, __m128i);
+FORCE_INLINE __m128i _mm_set_epi32(int, int, int, int);
+FORCE_INLINE __m128i _mm_set_epi64x(int64_t, int64_t);
+FORCE_INLINE __m128d _mm_set_pd(double, double);
+FORCE_INLINE __m128i _mm_set1_epi32(int);
+FORCE_INLINE __m128i _mm_setzero_si128();
+// SSE4.1
+FORCE_INLINE __m128d _mm_ceil_pd(__m128d);
+FORCE_INLINE __m128 _mm_ceil_ps(__m128);
+FORCE_INLINE __m128d _mm_floor_pd(__m128d);
+FORCE_INLINE __m128 _mm_floor_ps(__m128);
+FORCE_INLINE __m128d _mm_round_pd(__m128d, int);
+FORCE_INLINE __m128 _mm_round_ps(__m128, int);
+// SSE4.2
+FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t, uint8_t);
+
/* Backwards compatibility for compilers with lack of specific type support */
// Older gcc does not define vld1q_u8_x4 type
-#if defined(__GNUC__) && !defined(__clang__)
-#if __GNUC__ <= 9
-FORCE_INLINE uint8x16x4_t vld1q_u8_x4(const uint8_t *p)
+#if defined(__GNUC__) && !defined(__clang__) && \
+ ((__GNUC__ <= 12 && defined(__arm__)) || \
+ (__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \
+ (__GNUC__ <= 9 && defined(__aarch64__)))
+FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p)
{
uint8x16x4_t ret;
ret.val[0] = vld1q_u8(p + 0);
@@ -309,7 +587,63 @@ FORCE_INLINE uint8x16x4_t vld1q_u8_x4(const uint8_t *p)
ret.val[3] = vld1q_u8(p + 48);
return ret;
}
+#else
+// Wraps vld1q_u8_x4
+FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p)
+{
+ return vld1q_u8_x4(p);
+}
+#endif
+
+#if !defined(__aarch64__) && !defined(_M_ARM64)
+/* emulate vaddv u8 variant */
+FORCE_INLINE uint8_t _sse2neon_vaddv_u8(uint8x8_t v8)
+{
+ const uint64x1_t v1 = vpaddl_u32(vpaddl_u16(vpaddl_u8(v8)));
+ return vget_lane_u8(vreinterpret_u8_u64(v1), 0);
+}
+#else
+// Wraps vaddv_u8
+FORCE_INLINE uint8_t _sse2neon_vaddv_u8(uint8x8_t v8)
+{
+ return vaddv_u8(v8);
+}
+#endif
+
+#if !defined(__aarch64__) && !defined(_M_ARM64)
+/* emulate vaddvq u8 variant */
+FORCE_INLINE uint8_t _sse2neon_vaddvq_u8(uint8x16_t a)
+{
+ uint8x8_t tmp = vpadd_u8(vget_low_u8(a), vget_high_u8(a));
+ uint8_t res = 0;
+ for (int i = 0; i < 8; ++i)
+ res += tmp[i];
+ return res;
+}
+#else
+// Wraps vaddvq_u8
+FORCE_INLINE uint8_t _sse2neon_vaddvq_u8(uint8x16_t a)
+{
+ return vaddvq_u8(a);
+}
#endif
+
+#if !defined(__aarch64__) && !defined(_M_ARM64)
+/* emulate vaddvq u16 variant */
+FORCE_INLINE uint16_t _sse2neon_vaddvq_u16(uint16x8_t a)
+{
+ uint32x4_t m = vpaddlq_u16(a);
+ uint64x2_t n = vpaddlq_u32(m);
+ uint64x1_t o = vget_low_u64(n) + vget_high_u64(n);
+
+ return vget_lane_u32((uint32x2_t) o, 0);
+}
+#else
+// Wraps vaddvq_u16
+FORCE_INLINE uint16_t _sse2neon_vaddvq_u16(uint16x8_t a)
+{
+ return vaddvq_u16(a);
+}
#endif
/* Function Naming Conventions
@@ -346,5144 +680,6559 @@ FORCE_INLINE uint8x16x4_t vld1q_u8_x4(const uint8_t *p)
* 4, 5, 12, 13, 6, 7, 14, 15);
* // Shuffle packed 8-bit integers
* __m128i v_out = _mm_shuffle_epi8(v_in, v_perm); // pshufb
- *
- * Data (Number, Binary, Byte Index):
- +------+------+-------------+------+------+-------------+
- | 1 | 2 | 3 | 4 | Number
- +------+------+------+------+------+------+------+------+
- | 0000 | 0001 | 0000 | 0010 | 0000 | 0011 | 0000 | 0100 | Binary
- +------+------+------+------+------+------+------+------+
- | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Index
- +------+------+------+------+------+------+------+------+
-
- +------+------+------+------+------+------+------+------+
- | 5 | 6 | 7 | 8 | Number
- +------+------+------+------+------+------+------+------+
- | 0000 | 0101 | 0000 | 0110 | 0000 | 0111 | 0000 | 1000 | Binary
- +------+------+------+------+------+------+------+------+
- | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Index
- +------+------+------+------+------+------+------+------+
- * Index (Byte Index):
- +------+------+------+------+------+------+------+------+
- | 1 | 0 | 2 | 3 | 8 | 9 | 10 | 11 |
- +------+------+------+------+------+------+------+------+
-
- +------+------+------+------+------+------+------+------+
- | 4 | 5 | 12 | 13 | 6 | 7 | 14 | 15 |
- +------+------+------+------+------+------+------+------+
- * Result:
- +------+------+------+------+------+------+------+------+
- | 1 | 0 | 2 | 3 | 8 | 9 | 10 | 11 | Index
- +------+------+------+------+------+------+------+------+
- | 0001 | 0000 | 0000 | 0010 | 0000 | 0101 | 0000 | 0110 | Binary
- +------+------+------+------+------+------+------+------+
- | 256 | 2 | 5 | 6 | Number
- +------+------+------+------+------+------+------+------+
-
- +------+------+------+------+------+------+------+------+
- | 4 | 5 | 12 | 13 | 6 | 7 | 14 | 15 | Index
- +------+------+------+------+------+------+------+------+
- | 0000 | 0011 | 0000 | 0111 | 0000 | 0100 | 0000 | 1000 | Binary
- +------+------+------+------+------+------+------+------+
- | 3 | 7 | 4 | 8 | Number
- +------+------+------+------+------+------+-------------+
*/
-/* Set/get methods */
-
-/* Constants for use with _mm_prefetch. */
+/* Constants for use with _mm_prefetch. */
enum _mm_hint {
- _MM_HINT_NTA = 0, /* load data to L1 and L2 cache, mark it as NTA */
- _MM_HINT_T0 = 1, /* load data to L1 and L2 cache */
- _MM_HINT_T1 = 2, /* load data to L2 cache only */
- _MM_HINT_T2 = 3, /* load data to L2 cache only, mark it as NTA */
- _MM_HINT_ENTA = 4, /* exclusive version of _MM_HINT_NTA */
- _MM_HINT_ET0 = 5, /* exclusive version of _MM_HINT_T0 */
- _MM_HINT_ET1 = 6, /* exclusive version of _MM_HINT_T1 */
- _MM_HINT_ET2 = 7 /* exclusive version of _MM_HINT_T2 */
+ _MM_HINT_NTA = 0, /* load data to L1 and L2 cache, mark it as NTA */
+ _MM_HINT_T0 = 1, /* load data to L1 and L2 cache */
+ _MM_HINT_T1 = 2, /* load data to L2 cache only */
+ _MM_HINT_T2 = 3, /* load data to L2 cache only, mark it as NTA */
};
-// Loads one cache line of data from address p to a location closer to the
-// processor. https://msdn.microsoft.com/en-us/library/84szxsww(v=vs.100).aspx
-FORCE_INLINE void _mm_prefetch(const void *p, int i)
-{
- (void) i;
- __builtin_prefetch(p);
-}
+// The bit field mapping to the FPCR(floating-point control register)
+typedef struct {
+ uint16_t res0;
+ uint8_t res1 : 6;
+ uint8_t bit22 : 1;
+ uint8_t bit23 : 1;
+ uint8_t bit24 : 1;
+ uint8_t res2 : 7;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint32_t res3;
+#endif
+} fpcr_bitfield;
-// Copy the lower single-precision (32-bit) floating-point element of a to dst.
-//
-// dst[31:0] := a[31:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtss_f32
-FORCE_INLINE float _mm_cvtss_f32(__m128 a)
+// Takes the upper 64 bits of a and places it in the low end of the result
+// Takes the lower 64 bits of b and places it into the high end of the result.
+FORCE_INLINE __m128 _mm_shuffle_ps_1032(__m128 a, __m128 b)
{
- return vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
+ float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(a32, b10));
}
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 32-bit integer, and store the result in dst.
-//
-// dst[31:0] := Convert_FP32_To_Int32(a[31:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtss_si32
-#define _mm_cvtss_si32(a) _mm_cvt_ss2si(a)
-
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 64-bit integer, and store the result in dst.
-//
-// dst[63:0] := Convert_FP32_To_Int64(a[31:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtss_si64
-FORCE_INLINE int _mm_cvtss_si64(__m128 a)
+// takes the lower two 32-bit values from a and swaps them and places in high
+// end of result takes the higher two 32 bit values from b and swaps them and
+// places in low end of result.
+FORCE_INLINE __m128 _mm_shuffle_ps_2301(__m128 a, __m128 b)
{
-#if defined(__aarch64__)
- return vgetq_lane_s64(
- vreinterpretq_s64_s32(vcvtnq_s32_f32(vreinterpretq_f32_m128(a))), 0);
-#else
- float32_t data = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
- float32_t diff = data - floor(data);
- if (diff > 0.5)
- return (int64_t) ceil(data);
- if (diff == 0.5) {
- int64_t f = (int64_t) floor(data);
- int64_t c = (int64_t) ceil(data);
- return c & 1 ? f : c;
- }
- return (int64_t) floor(data);
-#endif
+ float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
+ float32x2_t b23 = vrev64_f32(vget_high_f32(vreinterpretq_f32_m128(b)));
+ return vreinterpretq_m128_f32(vcombine_f32(a01, b23));
}
-// Convert packed single-precision (32-bit) floating-point elements in a to
-// packed 32-bit integers with truncation, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := 32*j
-// dst[i+31:i] := Convert_FP32_To_Int32_Truncate(a[i+31:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtt_ps2pi
-FORCE_INLINE __m64 _mm_cvtt_ps2pi(__m128 a)
+FORCE_INLINE __m128 _mm_shuffle_ps_0321(__m128 a, __m128 b)
{
- return vreinterpret_m64_s32(
- vget_low_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a))));
+ float32x2_t a21 = vget_high_f32(
+ vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3));
+ float32x2_t b03 = vget_low_f32(
+ vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3));
+ return vreinterpretq_m128_f32(vcombine_f32(a21, b03));
}
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 32-bit integer with truncation, and store the result in dst.
-//
-// dst[31:0] := Convert_FP32_To_Int32_Truncate(a[31:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtt_ss2si
-FORCE_INLINE int _mm_cvtt_ss2si(__m128 a)
+FORCE_INLINE __m128 _mm_shuffle_ps_2103(__m128 a, __m128 b)
{
- return vgetq_lane_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)), 0);
+ float32x2_t a03 = vget_low_f32(
+ vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3));
+ float32x2_t b21 = vget_high_f32(
+ vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3));
+ return vreinterpretq_m128_f32(vcombine_f32(a03, b21));
}
-// Convert packed single-precision (32-bit) floating-point elements in a to
-// packed 32-bit integers with truncation, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := 32*j
-// dst[i+31:i] := Convert_FP32_To_Int32_Truncate(a[i+31:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttps_pi32
-#define _mm_cvttps_pi32(a) _mm_cvtt_ps2pi(a)
-
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 32-bit integer with truncation, and store the result in dst.
-//
-// dst[31:0] := Convert_FP32_To_Int32_Truncate(a[31:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttss_si32
-#define _mm_cvttss_si32(a) _mm_cvtt_ss2si(a)
-
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 64-bit integer with truncation, and store the result in dst.
-//
-// dst[63:0] := Convert_FP32_To_Int64_Truncate(a[31:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttss_si64
-FORCE_INLINE int64_t _mm_cvttss_si64(__m128 a)
+FORCE_INLINE __m128 _mm_shuffle_ps_1010(__m128 a, __m128 b)
{
- return vgetq_lane_s64(
- vmovl_s32(vget_low_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)))), 0);
+ float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(a10, b10));
}
-// Sets the 128-bit value to zero
-// https://msdn.microsoft.com/en-us/library/vstudio/ys7dw0kh(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_setzero_si128(void)
+FORCE_INLINE __m128 _mm_shuffle_ps_1001(__m128 a, __m128 b)
{
- return vreinterpretq_m128i_s32(vdupq_n_s32(0));
+ float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
+ float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(a01, b10));
}
-// Clears the four single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/vstudio/tk1t2tbz(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_setzero_ps(void)
+FORCE_INLINE __m128 _mm_shuffle_ps_0101(__m128 a, __m128 b)
{
- return vreinterpretq_m128_f32(vdupq_n_f32(0));
+ float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
+ float32x2_t b01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(b)));
+ return vreinterpretq_m128_f32(vcombine_f32(a01, b01));
}
-// Return vector of type __m128d with all elements set to zero.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setzero_pd
-FORCE_INLINE __m128d _mm_setzero_pd(void)
+// keeps the low 64 bits of b in the low and puts the high 64 bits of a in the
+// high
+FORCE_INLINE __m128 _mm_shuffle_ps_3210(__m128 a, __m128 b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(vdupq_n_f64(0));
-#else
- return vreinterpretq_m128d_f32(vdupq_n_f32(0));
-#endif
+ float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(a10, b32));
}
-// Sets the four single-precision, floating-point values to w.
-//
-// r0 := r1 := r2 := r3 := w
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/2x1se8ha(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_set1_ps(float _w)
+FORCE_INLINE __m128 _mm_shuffle_ps_0011(__m128 a, __m128 b)
{
- return vreinterpretq_m128_f32(vdupq_n_f32(_w));
+ float32x2_t a11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 1);
+ float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
+ return vreinterpretq_m128_f32(vcombine_f32(a11, b00));
}
-// Sets the four single-precision, floating-point values to w.
-// https://msdn.microsoft.com/en-us/library/vstudio/2x1se8ha(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_set_ps1(float _w)
+FORCE_INLINE __m128 _mm_shuffle_ps_0022(__m128 a, __m128 b)
{
- return vreinterpretq_m128_f32(vdupq_n_f32(_w));
+ float32x2_t a22 =
+ vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0);
+ float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
+ return vreinterpretq_m128_f32(vcombine_f32(a22, b00));
}
-// Sets the four single-precision, floating-point values to the four inputs.
-// https://msdn.microsoft.com/en-us/library/vstudio/afh0zf75(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_set_ps(float w, float z, float y, float x)
+FORCE_INLINE __m128 _mm_shuffle_ps_2200(__m128 a, __m128 b)
{
- float ALIGN_STRUCT(16) data[4] = {x, y, z, w};
- return vreinterpretq_m128_f32(vld1q_f32(data));
+ float32x2_t a00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 0);
+ float32x2_t b22 =
+ vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(b)), 0);
+ return vreinterpretq_m128_f32(vcombine_f32(a00, b22));
}
-// Copy single-precision (32-bit) floating-point element a to the lower element
-// of dst, and zero the upper 3 elements.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_ss
-FORCE_INLINE __m128 _mm_set_ss(float a)
+FORCE_INLINE __m128 _mm_shuffle_ps_3202(__m128 a, __m128 b)
{
- float ALIGN_STRUCT(16) data[4] = {a, 0, 0, 0};
- return vreinterpretq_m128_f32(vld1q_f32(data));
+ float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
+ float32x2_t a22 =
+ vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0);
+ float32x2_t a02 = vset_lane_f32(a0, a22, 1); /* TODO: use vzip ?*/
+ float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(a02, b32));
}
-// Sets the four single-precision, floating-point values to the four inputs in
-// reverse order.
-// https://msdn.microsoft.com/en-us/library/vstudio/d2172ct3(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_setr_ps(float w, float z, float y, float x)
+FORCE_INLINE __m128 _mm_shuffle_ps_1133(__m128 a, __m128 b)
{
- float ALIGN_STRUCT(16) data[4] = {w, z, y, x};
- return vreinterpretq_m128_f32(vld1q_f32(data));
+ float32x2_t a33 =
+ vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 1);
+ float32x2_t b11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 1);
+ return vreinterpretq_m128_f32(vcombine_f32(a33, b11));
+}
+
+FORCE_INLINE __m128 _mm_shuffle_ps_2010(__m128 a, __m128 b)
+{
+ float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
+ float32_t b2 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 2);
+ float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
+ float32x2_t b20 = vset_lane_f32(b2, b00, 1);
+ return vreinterpretq_m128_f32(vcombine_f32(a10, b20));
+}
+
+FORCE_INLINE __m128 _mm_shuffle_ps_2001(__m128 a, __m128 b)
+{
+ float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
+ float32_t b2 = vgetq_lane_f32(b, 2);
+ float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
+ float32x2_t b20 = vset_lane_f32(b2, b00, 1);
+ return vreinterpretq_m128_f32(vcombine_f32(a01, b20));
+}
+
+FORCE_INLINE __m128 _mm_shuffle_ps_2032(__m128 a, __m128 b)
+{
+ float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
+ float32_t b2 = vgetq_lane_f32(b, 2);
+ float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
+ float32x2_t b20 = vset_lane_f32(b2, b00, 1);
+ return vreinterpretq_m128_f32(vcombine_f32(a32, b20));
+}
+
+// For MSVC, we check only if it is ARM64, as every single ARM64 processor
+// supported by WoA has crypto extensions. If this changes in the future,
+// this can be verified via the runtime-only method of:
+// IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)
+#if (defined(_M_ARM64) && !defined(__clang__)) || \
+ (defined(__ARM_FEATURE_CRYPTO) && \
+ (defined(__aarch64__) || __has_builtin(__builtin_arm_crypto_vmullp64)))
+// Wraps vmull_p64
+FORCE_INLINE uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b)
+{
+ poly64_t a = vget_lane_p64(vreinterpret_p64_u64(_a), 0);
+ poly64_t b = vget_lane_p64(vreinterpret_p64_u64(_b), 0);
+#if defined(_MSC_VER)
+ __n64 a1 = {a}, b1 = {b};
+ return vreinterpretq_u64_p128(vmull_p64(a1, b1));
+#else
+ return vreinterpretq_u64_p128(vmull_p64(a, b));
+#endif
+}
+#else // ARMv7 polyfill
+// ARMv7/some A64 lacks vmull_p64, but it has vmull_p8.
+//
+// vmull_p8 calculates 8 8-bit->16-bit polynomial multiplies, but we need a
+// 64-bit->128-bit polynomial multiply.
+//
+// It needs some work and is somewhat slow, but it is still faster than all
+// known scalar methods.
+//
+// Algorithm adapted to C from
+// https://www.workofard.com/2017/07/ghash-for-low-end-cores/, which is adapted
+// from "Fast Software Polynomial Multiplication on ARM Processors Using the
+// NEON Engine" by Danilo Camara, Conrado Gouvea, Julio Lopez and Ricardo Dahab
+// (https://hal.inria.fr/hal-01506572)
+static uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b)
+{
+ poly8x8_t a = vreinterpret_p8_u64(_a);
+ poly8x8_t b = vreinterpret_p8_u64(_b);
+
+ // Masks
+ uint8x16_t k48_32 = vcombine_u8(vcreate_u8(0x0000ffffffffffff),
+ vcreate_u8(0x00000000ffffffff));
+ uint8x16_t k16_00 = vcombine_u8(vcreate_u8(0x000000000000ffff),
+ vcreate_u8(0x0000000000000000));
+
+ // Do the multiplies, rotating with vext to get all combinations
+ uint8x16_t d = vreinterpretq_u8_p16(vmull_p8(a, b)); // D = A0 * B0
+ uint8x16_t e =
+ vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 1))); // E = A0 * B1
+ uint8x16_t f =
+ vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 1), b)); // F = A1 * B0
+ uint8x16_t g =
+ vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 2))); // G = A0 * B2
+ uint8x16_t h =
+ vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 2), b)); // H = A2 * B0
+ uint8x16_t i =
+ vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 3))); // I = A0 * B3
+ uint8x16_t j =
+ vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 3), b)); // J = A3 * B0
+ uint8x16_t k =
+ vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 4))); // L = A0 * B4
+
+ // Add cross products
+ uint8x16_t l = veorq_u8(e, f); // L = E + F
+ uint8x16_t m = veorq_u8(g, h); // M = G + H
+ uint8x16_t n = veorq_u8(i, j); // N = I + J
+
+ // Interleave. Using vzip1 and vzip2 prevents Clang from emitting TBL
+ // instructions.
+#if defined(__aarch64__)
+ uint8x16_t lm_p0 = vreinterpretq_u8_u64(
+ vzip1q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
+ uint8x16_t lm_p1 = vreinterpretq_u8_u64(
+ vzip2q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
+ uint8x16_t nk_p0 = vreinterpretq_u8_u64(
+ vzip1q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
+ uint8x16_t nk_p1 = vreinterpretq_u8_u64(
+ vzip2q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
+#else
+ uint8x16_t lm_p0 = vcombine_u8(vget_low_u8(l), vget_low_u8(m));
+ uint8x16_t lm_p1 = vcombine_u8(vget_high_u8(l), vget_high_u8(m));
+ uint8x16_t nk_p0 = vcombine_u8(vget_low_u8(n), vget_low_u8(k));
+ uint8x16_t nk_p1 = vcombine_u8(vget_high_u8(n), vget_high_u8(k));
+#endif
+ // t0 = (L) (P0 + P1) << 8
+ // t1 = (M) (P2 + P3) << 16
+ uint8x16_t t0t1_tmp = veorq_u8(lm_p0, lm_p1);
+ uint8x16_t t0t1_h = vandq_u8(lm_p1, k48_32);
+ uint8x16_t t0t1_l = veorq_u8(t0t1_tmp, t0t1_h);
+
+ // t2 = (N) (P4 + P5) << 24
+ // t3 = (K) (P6 + P7) << 32
+ uint8x16_t t2t3_tmp = veorq_u8(nk_p0, nk_p1);
+ uint8x16_t t2t3_h = vandq_u8(nk_p1, k16_00);
+ uint8x16_t t2t3_l = veorq_u8(t2t3_tmp, t2t3_h);
+
+ // De-interleave
+#if defined(__aarch64__)
+ uint8x16_t t0 = vreinterpretq_u8_u64(
+ vuzp1q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
+ uint8x16_t t1 = vreinterpretq_u8_u64(
+ vuzp2q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
+ uint8x16_t t2 = vreinterpretq_u8_u64(
+ vuzp1q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
+ uint8x16_t t3 = vreinterpretq_u8_u64(
+ vuzp2q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
+#else
+ uint8x16_t t1 = vcombine_u8(vget_high_u8(t0t1_l), vget_high_u8(t0t1_h));
+ uint8x16_t t0 = vcombine_u8(vget_low_u8(t0t1_l), vget_low_u8(t0t1_h));
+ uint8x16_t t3 = vcombine_u8(vget_high_u8(t2t3_l), vget_high_u8(t2t3_h));
+ uint8x16_t t2 = vcombine_u8(vget_low_u8(t2t3_l), vget_low_u8(t2t3_h));
+#endif
+ // Shift the cross products
+ uint8x16_t t0_shift = vextq_u8(t0, t0, 15); // t0 << 8
+ uint8x16_t t1_shift = vextq_u8(t1, t1, 14); // t1 << 16
+ uint8x16_t t2_shift = vextq_u8(t2, t2, 13); // t2 << 24
+ uint8x16_t t3_shift = vextq_u8(t3, t3, 12); // t3 << 32
+
+ // Accumulate the products
+ uint8x16_t cross1 = veorq_u8(t0_shift, t1_shift);
+ uint8x16_t cross2 = veorq_u8(t2_shift, t3_shift);
+ uint8x16_t mix = veorq_u8(d, cross1);
+ uint8x16_t r = veorq_u8(mix, cross2);
+ return vreinterpretq_u64_u8(r);
+}
+#endif // ARMv7 polyfill
+
+// C equivalent:
+// __m128i _mm_shuffle_epi32_default(__m128i a,
+// __constrange(0, 255) int imm) {
+// __m128i ret;
+// ret[0] = a[imm & 0x3]; ret[1] = a[(imm >> 2) & 0x3];
+// ret[2] = a[(imm >> 4) & 0x03]; ret[3] = a[(imm >> 6) & 0x03];
+// return ret;
+// }
+#define _mm_shuffle_epi32_default(a, imm) \
+ vreinterpretq_m128i_s32(vsetq_lane_s32( \
+ vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 6) & 0x3), \
+ vsetq_lane_s32( \
+ vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 4) & 0x3), \
+ vsetq_lane_s32(vgetq_lane_s32(vreinterpretq_s32_m128i(a), \
+ ((imm) >> 2) & 0x3), \
+ vmovq_n_s32(vgetq_lane_s32( \
+ vreinterpretq_s32_m128i(a), (imm) & (0x3))), \
+ 1), \
+ 2), \
+ 3))
+
+// Takes the upper 64 bits of a and places it in the low end of the result
+// Takes the lower 64 bits of a and places it into the high end of the result.
+FORCE_INLINE __m128i _mm_shuffle_epi_1032(__m128i a)
+{
+ int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a));
+ int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
+ return vreinterpretq_m128i_s32(vcombine_s32(a32, a10));
+}
+
+// takes the lower two 32-bit values from a and swaps them and places in low end
+// of result takes the higher two 32 bit values from a and swaps them and places
+// in high end of result.
+FORCE_INLINE __m128i _mm_shuffle_epi_2301(__m128i a)
+{
+ int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
+ int32x2_t a23 = vrev64_s32(vget_high_s32(vreinterpretq_s32_m128i(a)));
+ return vreinterpretq_m128i_s32(vcombine_s32(a01, a23));
+}
+
+// rotates the least significant 32 bits into the most significant 32 bits, and
+// shifts the rest down
+FORCE_INLINE __m128i _mm_shuffle_epi_0321(__m128i a)
+{
+ return vreinterpretq_m128i_s32(
+ vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 1));
+}
+
+// rotates the most significant 32 bits into the least significant 32 bits, and
+// shifts the rest up
+FORCE_INLINE __m128i _mm_shuffle_epi_2103(__m128i a)
+{
+ return vreinterpretq_m128i_s32(
+ vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 3));
+}
+
+// gets the lower 64 bits of a, and places it in the upper 64 bits
+// gets the lower 64 bits of a and places it in the lower 64 bits
+FORCE_INLINE __m128i _mm_shuffle_epi_1010(__m128i a)
+{
+ int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
+ return vreinterpretq_m128i_s32(vcombine_s32(a10, a10));
+}
+
+// gets the lower 64 bits of a, swaps the 0 and 1 elements, and places it in the
+// lower 64 bits gets the lower 64 bits of a, and places it in the upper 64 bits
+FORCE_INLINE __m128i _mm_shuffle_epi_1001(__m128i a)
+{
+ int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
+ int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
+ return vreinterpretq_m128i_s32(vcombine_s32(a01, a10));
+}
+
+// gets the lower 64 bits of a, swaps the 0 and 1 elements and places it in the
+// upper 64 bits gets the lower 64 bits of a, swaps the 0 and 1 elements, and
+// places it in the lower 64 bits
+FORCE_INLINE __m128i _mm_shuffle_epi_0101(__m128i a)
+{
+ int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
+ return vreinterpretq_m128i_s32(vcombine_s32(a01, a01));
+}
+
+FORCE_INLINE __m128i _mm_shuffle_epi_2211(__m128i a)
+{
+ int32x2_t a11 = vdup_lane_s32(vget_low_s32(vreinterpretq_s32_m128i(a)), 1);
+ int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0);
+ return vreinterpretq_m128i_s32(vcombine_s32(a11, a22));
+}
+
+FORCE_INLINE __m128i _mm_shuffle_epi_0122(__m128i a)
+{
+ int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0);
+ int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
+ return vreinterpretq_m128i_s32(vcombine_s32(a22, a01));
+}
+
+FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a)
+{
+ int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a));
+ int32x2_t a33 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 1);
+ return vreinterpretq_m128i_s32(vcombine_s32(a32, a33));
+}
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+#define _mm_shuffle_epi32_splat(a, imm) \
+ vreinterpretq_m128i_s32(vdupq_laneq_s32(vreinterpretq_s32_m128i(a), (imm)))
+#else
+#define _mm_shuffle_epi32_splat(a, imm) \
+ vreinterpretq_m128i_s32( \
+ vdupq_n_s32(vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm))))
+#endif
+
+// NEON does not support a general purpose permute intrinsic.
+// Shuffle single-precision (32-bit) floating-point elements in a using the
+// control in imm8, and store the results in dst.
+//
+// C equivalent:
+// __m128 _mm_shuffle_ps_default(__m128 a, __m128 b,
+// __constrange(0, 255) int imm) {
+// __m128 ret;
+// ret[0] = a[imm & 0x3]; ret[1] = a[(imm >> 2) & 0x3];
+// ret[2] = b[(imm >> 4) & 0x03]; ret[3] = b[(imm >> 6) & 0x03];
+// return ret;
+// }
+//
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_ps
+#define _mm_shuffle_ps_default(a, b, imm) \
+ vreinterpretq_m128_f32(vsetq_lane_f32( \
+ vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 6) & 0x3), \
+ vsetq_lane_f32( \
+ vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 4) & 0x3), \
+ vsetq_lane_f32( \
+ vgetq_lane_f32(vreinterpretq_f32_m128(a), ((imm) >> 2) & 0x3), \
+ vmovq_n_f32( \
+ vgetq_lane_f32(vreinterpretq_f32_m128(a), (imm) & (0x3))), \
+ 1), \
+ 2), \
+ 3))
+
+// Shuffle 16-bit integers in the low 64 bits of a using the control in imm8.
+// Store the results in the low 64 bits of dst, with the high 64 bits being
+// copied from from a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shufflelo_epi16
+#define _mm_shufflelo_epi16_function(a, imm) \
+ _sse2neon_define1( \
+ __m128i, a, int16x8_t ret = vreinterpretq_s16_m128i(_a); \
+ int16x4_t lowBits = vget_low_s16(ret); \
+ ret = vsetq_lane_s16(vget_lane_s16(lowBits, (imm) & (0x3)), ret, 0); \
+ ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 2) & 0x3), ret, \
+ 1); \
+ ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 4) & 0x3), ret, \
+ 2); \
+ ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 6) & 0x3), ret, \
+ 3); \
+ _sse2neon_return(vreinterpretq_m128i_s16(ret));)
+
+// Shuffle 16-bit integers in the high 64 bits of a using the control in imm8.
+// Store the results in the high 64 bits of dst, with the low 64 bits being
+// copied from from a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shufflehi_epi16
+#define _mm_shufflehi_epi16_function(a, imm) \
+ _sse2neon_define1( \
+ __m128i, a, int16x8_t ret = vreinterpretq_s16_m128i(_a); \
+ int16x4_t highBits = vget_high_s16(ret); \
+ ret = vsetq_lane_s16(vget_lane_s16(highBits, (imm) & (0x3)), ret, 4); \
+ ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 2) & 0x3), ret, \
+ 5); \
+ ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 4) & 0x3), ret, \
+ 6); \
+ ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 6) & 0x3), ret, \
+ 7); \
+ _sse2neon_return(vreinterpretq_m128i_s16(ret));)
+
+/* MMX */
+
+//_mm_empty is a no-op on arm
+FORCE_INLINE void _mm_empty(void) {}
+
+/* SSE */
+
+// Add packed single-precision (32-bit) floating-point elements in a and b, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_ps
+FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_f32(
+ vaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Add the lower single-precision (32-bit) floating-point element in a and b,
+// store the result in the lower element of dst, and copy the upper 3 packed
+// elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_ss
+FORCE_INLINE __m128 _mm_add_ss(__m128 a, __m128 b)
+{
+ float32_t b0 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 0);
+ float32x4_t value = vsetq_lane_f32(b0, vdupq_n_f32(0), 0);
+ // the upper values in the result must be the remnants of .
+ return vreinterpretq_m128_f32(vaddq_f32(a, value));
+}
+
+// Compute the bitwise AND of packed single-precision (32-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_and_ps
+FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_s32(
+ vandq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
+}
+
+// Compute the bitwise NOT of packed single-precision (32-bit) floating-point
+// elements in a and then AND with b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_andnot_ps
+FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_s32(
+ vbicq_s32(vreinterpretq_s32_m128(b),
+ vreinterpretq_s32_m128(a))); // *NOTE* argument swap
+}
+
+// Average packed unsigned 16-bit integers in a and b, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_avg_pu16
+FORCE_INLINE __m64 _mm_avg_pu16(__m64 a, __m64 b)
+{
+ return vreinterpret_m64_u16(
+ vrhadd_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)));
+}
+
+// Average packed unsigned 8-bit integers in a and b, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_avg_pu8
+FORCE_INLINE __m64 _mm_avg_pu8(__m64 a, __m64 b)
+{
+ return vreinterpret_m64_u8(
+ vrhadd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for equality, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_ps
+FORCE_INLINE __m128 _mm_cmpeq_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(
+ vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for equality, store the result in the lower element of dst, and copy the
+// upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_ss
+FORCE_INLINE __m128 _mm_cmpeq_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpeq_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for greater-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpge_ps
+FORCE_INLINE __m128 _mm_cmpge_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(
+ vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for greater-than-or-equal, store the result in the lower element of dst,
+// and copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpge_ss
+FORCE_INLINE __m128 _mm_cmpge_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpge_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for greater-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_ps
+FORCE_INLINE __m128 _mm_cmpgt_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(
+ vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for greater-than, store the result in the lower element of dst, and copy
+// the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_ss
+FORCE_INLINE __m128 _mm_cmpgt_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpgt_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for less-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmple_ps
+FORCE_INLINE __m128 _mm_cmple_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(
+ vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for less-than-or-equal, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmple_ss
+FORCE_INLINE __m128 _mm_cmple_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmple_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for less-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_ps
+FORCE_INLINE __m128 _mm_cmplt_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(
+ vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for less-than, store the result in the lower element of dst, and copy the
+// upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_ss
+FORCE_INLINE __m128 _mm_cmplt_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmplt_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for not-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpneq_ps
+FORCE_INLINE __m128 _mm_cmpneq_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(vmvnq_u32(
+ vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for not-equal, store the result in the lower element of dst, and copy the
+// upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpneq_ss
+FORCE_INLINE __m128 _mm_cmpneq_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpneq_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for not-greater-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnge_ps
+FORCE_INLINE __m128 _mm_cmpnge_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(vmvnq_u32(
+ vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for not-greater-than-or-equal, store the result in the lower element of
+// dst, and copy the upper 3 packed elements from a to the upper elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnge_ss
+FORCE_INLINE __m128 _mm_cmpnge_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpnge_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for not-greater-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpngt_ps
+FORCE_INLINE __m128 _mm_cmpngt_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(vmvnq_u32(
+ vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for not-greater-than, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpngt_ss
+FORCE_INLINE __m128 _mm_cmpngt_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpngt_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for not-less-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnle_ps
+FORCE_INLINE __m128 _mm_cmpnle_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(vmvnq_u32(
+ vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for not-less-than-or-equal, store the result in the lower element of dst,
+// and copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnle_ss
+FORCE_INLINE __m128 _mm_cmpnle_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpnle_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// for not-less-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnlt_ps
+FORCE_INLINE __m128 _mm_cmpnlt_ps(__m128 a, __m128 b)
+{
+ return vreinterpretq_m128_u32(vmvnq_u32(
+ vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b for not-less-than, store the result in the lower element of dst, and copy
+// the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnlt_ss
+FORCE_INLINE __m128 _mm_cmpnlt_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpnlt_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// to see if neither is NaN, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpord_ps
+//
+// See also:
+// http://stackoverflow.com/questions/8627331/what-does-ordered-unordered-comparison-mean
+// http://stackoverflow.com/questions/29349621/neon-isnanval-intrinsics
+FORCE_INLINE __m128 _mm_cmpord_ps(__m128 a, __m128 b)
+{
+ // Note: NEON does not have ordered compare builtin
+ // Need to compare a eq a and b eq b to check for NaN
+ // Do AND of results to get final
+ uint32x4_t ceqaa =
+ vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
+ uint32x4_t ceqbb =
+ vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_u32(vandq_u32(ceqaa, ceqbb));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b to see if neither is NaN, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpord_ss
+FORCE_INLINE __m128 _mm_cmpord_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpord_ps(a, b));
+}
+
+// Compare packed single-precision (32-bit) floating-point elements in a and b
+// to see if either is NaN, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpunord_ps
+FORCE_INLINE __m128 _mm_cmpunord_ps(__m128 a, __m128 b)
+{
+ uint32x4_t f32a =
+ vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
+ uint32x4_t f32b =
+ vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_u32(vmvnq_u32(vandq_u32(f32a, f32b)));
+}
+
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b to see if either is NaN, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpunord_ss
+FORCE_INLINE __m128 _mm_cmpunord_ss(__m128 a, __m128 b)
+{
+ return _mm_move_ss(a, _mm_cmpunord_ps(a, b));
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for equality, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comieq_ss
+FORCE_INLINE int _mm_comieq_ss(__m128 a, __m128 b)
+{
+ uint32x4_t a_eq_b =
+ vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
+ return vgetq_lane_u32(a_eq_b, 0) & 0x1;
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for greater-than-or-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comige_ss
+FORCE_INLINE int _mm_comige_ss(__m128 a, __m128 b)
+{
+ uint32x4_t a_ge_b =
+ vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
+ return vgetq_lane_u32(a_ge_b, 0) & 0x1;
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for greater-than, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comigt_ss
+FORCE_INLINE int _mm_comigt_ss(__m128 a, __m128 b)
+{
+ uint32x4_t a_gt_b =
+ vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
+ return vgetq_lane_u32(a_gt_b, 0) & 0x1;
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for less-than-or-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comile_ss
+FORCE_INLINE int _mm_comile_ss(__m128 a, __m128 b)
+{
+ uint32x4_t a_le_b =
+ vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
+ return vgetq_lane_u32(a_le_b, 0) & 0x1;
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for less-than, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comilt_ss
+FORCE_INLINE int _mm_comilt_ss(__m128 a, __m128 b)
+{
+ uint32x4_t a_lt_b =
+ vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
+ return vgetq_lane_u32(a_lt_b, 0) & 0x1;
+}
+
+// Compare the lower single-precision (32-bit) floating-point element in a and b
+// for not-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comineq_ss
+FORCE_INLINE int _mm_comineq_ss(__m128 a, __m128 b)
+{
+ return !_mm_comieq_ss(a, b);
+}
+
+// Convert packed signed 32-bit integers in b to packed single-precision
+// (32-bit) floating-point elements, store the results in the lower 2 elements
+// of dst, and copy the upper 2 packed elements from a to the upper elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvt_pi2ps
+FORCE_INLINE __m128 _mm_cvt_pi2ps(__m128 a, __m64 b)
+{
+ return vreinterpretq_m128_f32(
+ vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)),
+ vget_high_f32(vreinterpretq_f32_m128(a))));
+}
+
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvt_ps2pi
+FORCE_INLINE __m64 _mm_cvt_ps2pi(__m128 a)
+{
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ return vreinterpret_m64_s32(
+ vget_low_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a)))));
+#else
+ return vreinterpret_m64_s32(vcvt_s32_f32(vget_low_f32(
+ vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)))));
+#endif
+}
+
+// Convert the signed 32-bit integer b to a single-precision (32-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvt_si2ss
+FORCE_INLINE __m128 _mm_cvt_si2ss(__m128 a, int b)
+{
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0));
+}
+
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 32-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvt_ss2si
+FORCE_INLINE int _mm_cvt_ss2si(__m128 a)
+{
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ return vgetq_lane_s32(vcvtnq_s32_f32(vrndiq_f32(vreinterpretq_f32_m128(a))),
+ 0);
+#else
+ float32_t data = vgetq_lane_f32(
+ vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0);
+ return (int32_t) data;
+#endif
+}
+
+// Convert packed 16-bit integers in a to packed single-precision (32-bit)
+// floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpi16_ps
+FORCE_INLINE __m128 _mm_cvtpi16_ps(__m64 a)
+{
+ return vreinterpretq_m128_f32(
+ vcvtq_f32_s32(vmovl_s16(vreinterpret_s16_m64(a))));
+}
+
+// Convert packed 32-bit integers in b to packed single-precision (32-bit)
+// floating-point elements, store the results in the lower 2 elements of dst,
+// and copy the upper 2 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpi32_ps
+FORCE_INLINE __m128 _mm_cvtpi32_ps(__m128 a, __m64 b)
+{
+ return vreinterpretq_m128_f32(
+ vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)),
+ vget_high_f32(vreinterpretq_f32_m128(a))));
+}
+
+// Convert packed signed 32-bit integers in a to packed single-precision
+// (32-bit) floating-point elements, store the results in the lower 2 elements
+// of dst, then convert the packed signed 32-bit integers in b to
+// single-precision (32-bit) floating-point element, and store the results in
+// the upper 2 elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpi32x2_ps
+FORCE_INLINE __m128 _mm_cvtpi32x2_ps(__m64 a, __m64 b)
+{
+ return vreinterpretq_m128_f32(vcvtq_f32_s32(
+ vcombine_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b))));
+}
+
+// Convert the lower packed 8-bit integers in a to packed single-precision
+// (32-bit) floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpi8_ps
+FORCE_INLINE __m128 _mm_cvtpi8_ps(__m64 a)
+{
+ return vreinterpretq_m128_f32(vcvtq_f32_s32(
+ vmovl_s16(vget_low_s16(vmovl_s8(vreinterpret_s8_m64(a))))));
+}
+
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 16-bit integers, and store the results in dst. Note: this intrinsic
+// will generate 0x7FFF, rather than 0x8000, for input values between 0x7FFF and
+// 0x7FFFFFFF.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_pi16
+FORCE_INLINE __m64 _mm_cvtps_pi16(__m128 a)
+{
+ return vreinterpret_m64_s16(
+ vqmovn_s32(vreinterpretq_s32_m128i(_mm_cvtps_epi32(a))));
+}
+
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_pi32
+#define _mm_cvtps_pi32(a) _mm_cvt_ps2pi(a)
+
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 8-bit integers, and store the results in lower 4 elements of dst.
+// Note: this intrinsic will generate 0x7F, rather than 0x80, for input values
+// between 0x7F and 0x7FFFFFFF.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_pi8
+FORCE_INLINE __m64 _mm_cvtps_pi8(__m128 a)
+{
+ return vreinterpret_m64_s8(vqmovn_s16(
+ vcombine_s16(vreinterpret_s16_m64(_mm_cvtps_pi16(a)), vdup_n_s16(0))));
+}
+
+// Convert packed unsigned 16-bit integers in a to packed single-precision
+// (32-bit) floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpu16_ps
+FORCE_INLINE __m128 _mm_cvtpu16_ps(__m64 a)
+{
+ return vreinterpretq_m128_f32(
+ vcvtq_f32_u32(vmovl_u16(vreinterpret_u16_m64(a))));
+}
+
+// Convert the lower packed unsigned 8-bit integers in a to packed
+// single-precision (32-bit) floating-point elements, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpu8_ps
+FORCE_INLINE __m128 _mm_cvtpu8_ps(__m64 a)
+{
+ return vreinterpretq_m128_f32(vcvtq_f32_u32(
+ vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_m64(a))))));
+}
+
+// Convert the signed 32-bit integer b to a single-precision (32-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi32_ss
+#define _mm_cvtsi32_ss(a, b) _mm_cvt_si2ss(a, b)
+
+// Convert the signed 64-bit integer b to a single-precision (32-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi64_ss
+FORCE_INLINE __m128 _mm_cvtsi64_ss(__m128 a, int64_t b)
+{
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0));
}
-// Sets the 8 signed 16-bit integer values in reverse order.
-//
-// Return Value
-// r0 := w0
-// r1 := w1
-// ...
-// r7 := w7
-FORCE_INLINE __m128i _mm_setr_epi16(short w0,
- short w1,
- short w2,
- short w3,
- short w4,
- short w5,
- short w6,
- short w7)
+// Copy the lower single-precision (32-bit) floating-point element of a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtss_f32
+FORCE_INLINE float _mm_cvtss_f32(__m128 a)
{
- int16_t ALIGN_STRUCT(16) data[8] = {w0, w1, w2, w3, w4, w5, w6, w7};
- return vreinterpretq_m128i_s16(vld1q_s16((int16_t *) data));
+ return vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
}
-// Sets the 4 signed 32-bit integer values in reverse order
-// https://technet.microsoft.com/en-us/library/security/27yb3ee5(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_setr_epi32(int i3, int i2, int i1, int i0)
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 32-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtss_si32
+#define _mm_cvtss_si32(a) _mm_cvt_ss2si(a)
+
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 64-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtss_si64
+FORCE_INLINE int64_t _mm_cvtss_si64(__m128 a)
{
- int32_t ALIGN_STRUCT(16) data[4] = {i3, i2, i1, i0};
- return vreinterpretq_m128i_s32(vld1q_s32(data));
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ return (int64_t) vgetq_lane_f32(vrndiq_f32(vreinterpretq_f32_m128(a)), 0);
+#else
+ float32_t data = vgetq_lane_f32(
+ vreinterpretq_f32_m128(_mm_round_ps(a, _MM_FROUND_CUR_DIRECTION)), 0);
+ return (int64_t) data;
+#endif
}
-// Set packed 64-bit integers in dst with the supplied values in reverse order.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_epi64
-FORCE_INLINE __m128i _mm_setr_epi64(__m64 e1, __m64 e0)
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers with truncation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtt_ps2pi
+FORCE_INLINE __m64 _mm_cvtt_ps2pi(__m128 a)
{
- return vreinterpretq_m128i_s64(vcombine_s64(e1, e0));
+ return vreinterpret_m64_s32(
+ vget_low_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a))));
}
-// Sets the 16 signed 8-bit integer values to b.
-//
-// r0 := b
-// r1 := b
-// ...
-// r15 := b
-//
-// https://msdn.microsoft.com/en-us/library/6e14xhyf(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_set1_epi8(signed char w)
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 32-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtt_ss2si
+FORCE_INLINE int _mm_cvtt_ss2si(__m128 a)
{
- return vreinterpretq_m128i_s8(vdupq_n_s8(w));
+ return vgetq_lane_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)), 0);
}
-// Sets the 8 signed 16-bit integer values to w.
-//
-// r0 := w
-// r1 := w
-// ...
-// r7 := w
-//
-// https://msdn.microsoft.com/en-us/library/k0ya3x0e(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_set1_epi16(short w)
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers with truncation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttps_pi32
+#define _mm_cvttps_pi32(a) _mm_cvtt_ps2pi(a)
+
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 32-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttss_si32
+#define _mm_cvttss_si32(a) _mm_cvtt_ss2si(a)
+
+// Convert the lower single-precision (32-bit) floating-point element in a to a
+// 64-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttss_si64
+FORCE_INLINE int64_t _mm_cvttss_si64(__m128 a)
{
- return vreinterpretq_m128i_s16(vdupq_n_s16(w));
+ return (int64_t) vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
}
-// Sets the 16 signed 8-bit integer values.
-// https://msdn.microsoft.com/en-us/library/x0cx8zd3(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_set_epi8(signed char b15,
- signed char b14,
- signed char b13,
- signed char b12,
- signed char b11,
- signed char b10,
- signed char b9,
- signed char b8,
- signed char b7,
- signed char b6,
- signed char b5,
- signed char b4,
- signed char b3,
- signed char b2,
- signed char b1,
- signed char b0)
+// Divide packed single-precision (32-bit) floating-point elements in a by
+// packed elements in b, and store the results in dst.
+// Due to ARMv7-A NEON's lack of a precise division intrinsic, we implement
+// division by multiplying a by b's reciprocal before using the Newton-Raphson
+// method to approximate the results.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_div_ps
+FORCE_INLINE __m128 _mm_div_ps(__m128 a, __m128 b)
{
- int8_t ALIGN_STRUCT(16)
- data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3,
- (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7,
- (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11,
- (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15};
- return (__m128i) vld1q_s8(data);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vdivq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#else
+ float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(b));
+ recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b)));
+ // Additional Netwon-Raphson iteration for accuracy
+ recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(b)));
+ return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(a), recip));
+#endif
}
-// Sets the 8 signed 16-bit integer values.
-// https://msdn.microsoft.com/en-au/library/3e0fek84(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_set_epi16(short i7,
- short i6,
- short i5,
- short i4,
- short i3,
- short i2,
- short i1,
- short i0)
+// Divide the lower single-precision (32-bit) floating-point element in a by the
+// lower single-precision (32-bit) floating-point element in b, store the result
+// in the lower element of dst, and copy the upper 3 packed elements from a to
+// the upper elements of dst.
+// Warning: ARMv7-A does not produce the same result compared to Intel and not
+// IEEE-compliant.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_div_ss
+FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
{
- int16_t ALIGN_STRUCT(16) data[8] = {i0, i1, i2, i3, i4, i5, i6, i7};
- return vreinterpretq_m128i_s16(vld1q_s16(data));
+ float32_t value =
+ vgetq_lane_f32(vreinterpretq_f32_m128(_mm_div_ps(a, b)), 0);
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
}
-// Sets the 16 signed 8-bit integer values in reverse order.
-// https://msdn.microsoft.com/en-us/library/2khb9c7k(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_setr_epi8(signed char b0,
- signed char b1,
- signed char b2,
- signed char b3,
- signed char b4,
- signed char b5,
- signed char b6,
- signed char b7,
- signed char b8,
- signed char b9,
- signed char b10,
- signed char b11,
- signed char b12,
- signed char b13,
- signed char b14,
- signed char b15)
+// Extract a 16-bit integer from a, selected with imm8, and store the result in
+// the lower element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_pi16
+#define _mm_extract_pi16(a, imm) \
+ (int32_t) vget_lane_u16(vreinterpret_u16_m64(a), (imm))
+
+// Free aligned memory that was allocated with _mm_malloc.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_free
+#if !defined(SSE2NEON_ALLOC_DEFINED)
+FORCE_INLINE void _mm_free(void *addr)
{
- int8_t ALIGN_STRUCT(16)
- data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3,
- (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7,
- (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11,
- (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15};
- return (__m128i) vld1q_s8(data);
+ free(addr);
+}
+#endif
+
+FORCE_INLINE uint64_t _sse2neon_get_fpcr()
+{
+ uint64_t value;
+#if defined(_MSC_VER)
+ value = _ReadStatusReg(ARM64_FPCR);
+#else
+ __asm__ __volatile__("mrs %0, FPCR" : "=r"(value)); /* read */
+#endif
+ return value;
+}
+
+FORCE_INLINE void _sse2neon_set_fpcr(uint64_t value)
+{
+#if defined(_MSC_VER)
+ _WriteStatusReg(ARM64_FPCR, value);
+#else
+ __asm__ __volatile__("msr FPCR, %0" ::"r"(value)); /* write */
+#endif
+}
+
+// Macro: Get the flush zero bits from the MXCSR control and status register.
+// The flush zero may contain any of the following flags: _MM_FLUSH_ZERO_ON or
+// _MM_FLUSH_ZERO_OFF
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_MM_GET_FLUSH_ZERO_MODE
+FORCE_INLINE unsigned int _sse2neon_mm_get_flush_zero_mode()
+{
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
+#else
+ uint32_t value;
+#endif
+ } r;
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
+#else
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
+#endif
+
+ return r.field.bit24 ? _MM_FLUSH_ZERO_ON : _MM_FLUSH_ZERO_OFF;
+}
+
+// Macro: Get the rounding mode bits from the MXCSR control and status register.
+// The rounding mode may contain any of the following flags: _MM_ROUND_NEAREST,
+// _MM_ROUND_DOWN, _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_MM_GET_ROUNDING_MODE
+FORCE_INLINE unsigned int _MM_GET_ROUNDING_MODE()
+{
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
+#else
+ uint32_t value;
+#endif
+ } r;
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
+#else
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
+#endif
+
+ if (r.field.bit22) {
+ return r.field.bit23 ? _MM_ROUND_TOWARD_ZERO : _MM_ROUND_UP;
+ } else {
+ return r.field.bit23 ? _MM_ROUND_DOWN : _MM_ROUND_NEAREST;
+ }
+}
+
+// Copy a to dst, and insert the 16-bit integer i into dst at the location
+// specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_insert_pi16
+#define _mm_insert_pi16(a, b, imm) \
+ vreinterpret_m64_s16(vset_lane_s16((b), vreinterpret_s16_m64(a), (imm)))
+
+// Load 128-bits (composed of 4 packed single-precision (32-bit) floating-point
+// elements) from memory into dst. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_ps
+FORCE_INLINE __m128 _mm_load_ps(const float *p)
+{
+ return vreinterpretq_m128_f32(vld1q_f32(p));
}
-// Sets the 4 signed 32-bit integer values to i.
+// Load a single-precision (32-bit) floating-point element from memory into all
+// elements of dst.
//
-// r0 := i
-// r1 := i
-// r2 := i
-// r3 := I
+// dst[31:0] := MEM[mem_addr+31:mem_addr]
+// dst[63:32] := MEM[mem_addr+31:mem_addr]
+// dst[95:64] := MEM[mem_addr+31:mem_addr]
+// dst[127:96] := MEM[mem_addr+31:mem_addr]
//
-// https://msdn.microsoft.com/en-us/library/vstudio/h4xscxat(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_set1_epi32(int _i)
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_ps1
+#define _mm_load_ps1 _mm_load1_ps
+
+// Load a single-precision (32-bit) floating-point element from memory into the
+// lower of dst, and zero the upper 3 elements. mem_addr does not need to be
+// aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_ss
+FORCE_INLINE __m128 _mm_load_ss(const float *p)
{
- return vreinterpretq_m128i_s32(vdupq_n_s32(_i));
+ return vreinterpretq_m128_f32(vsetq_lane_f32(*p, vdupq_n_f32(0), 0));
}
-// Sets the 2 signed 64-bit integer values to i.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/whtfzhzk(v=vs.100)
-FORCE_INLINE __m128i _mm_set1_epi64(__m64 _i)
+// Load a single-precision (32-bit) floating-point element from memory into all
+// elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load1_ps
+FORCE_INLINE __m128 _mm_load1_ps(const float *p)
+{
+ return vreinterpretq_m128_f32(vld1q_dup_f32(p));
+}
+
+// Load 2 single-precision (32-bit) floating-point elements from memory into the
+// upper 2 elements of dst, and copy the lower 2 elements from a to dst.
+// mem_addr does not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadh_pi
+FORCE_INLINE __m128 _mm_loadh_pi(__m128 a, __m64 const *p)
+{
+ return vreinterpretq_m128_f32(
+ vcombine_f32(vget_low_f32(a), vld1_f32((const float32_t *) p)));
+}
+
+// Load 2 single-precision (32-bit) floating-point elements from memory into the
+// lower 2 elements of dst, and copy the upper 2 elements from a to dst.
+// mem_addr does not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadl_pi
+FORCE_INLINE __m128 _mm_loadl_pi(__m128 a, __m64 const *p)
+{
+ return vreinterpretq_m128_f32(
+ vcombine_f32(vld1_f32((const float32_t *) p), vget_high_f32(a)));
+}
+
+// Load 4 single-precision (32-bit) floating-point elements from memory into dst
+// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
+// general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadr_ps
+FORCE_INLINE __m128 _mm_loadr_ps(const float *p)
+{
+ float32x4_t v = vrev64q_f32(vld1q_f32(p));
+ return vreinterpretq_m128_f32(vextq_f32(v, v, 2));
+}
+
+// Load 128-bits (composed of 4 packed single-precision (32-bit) floating-point
+// elements) from memory into dst. mem_addr does not need to be aligned on any
+// particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_ps
+FORCE_INLINE __m128 _mm_loadu_ps(const float *p)
+{
+ // for neon, alignment doesn't matter, so _mm_load_ps and _mm_loadu_ps are
+ // equivalent for neon
+ return vreinterpretq_m128_f32(vld1q_f32(p));
+}
+
+// Load unaligned 16-bit integer from memory into the first element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_si16
+FORCE_INLINE __m128i _mm_loadu_si16(const void *p)
+{
+ return vreinterpretq_m128i_s16(
+ vsetq_lane_s16(*(const int16_t *) p, vdupq_n_s16(0), 0));
+}
+
+// Load unaligned 64-bit integer from memory into the first element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_si64
+FORCE_INLINE __m128i _mm_loadu_si64(const void *p)
+{
+ return vreinterpretq_m128i_s64(
+ vcombine_s64(vld1_s64((const int64_t *) p), vdup_n_s64(0)));
+}
+
+// Allocate size bytes of memory, aligned to the alignment specified in align,
+// and return a pointer to the allocated memory. _mm_free should be used to free
+// memory that is allocated with _mm_malloc.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_malloc
+#if !defined(SSE2NEON_ALLOC_DEFINED)
+FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
+{
+ void *ptr;
+ if (align == 1)
+ return malloc(size);
+ if (align == 2 || (sizeof(void *) == 8 && align == 4))
+ align = sizeof(void *);
+ if (!posix_memalign(&ptr, align, size))
+ return ptr;
+ return NULL;
+}
+#endif
+
+// Conditionally store 8-bit integer elements from a into memory using mask
+// (elements are not stored when the highest bit is not set in the corresponding
+// element) and a non-temporal memory hint.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maskmove_si64
+FORCE_INLINE void _mm_maskmove_si64(__m64 a, __m64 mask, char *mem_addr)
{
- return vreinterpretq_m128i_s64(vdupq_n_s64((int64_t) _i));
+ int8x8_t shr_mask = vshr_n_s8(vreinterpret_s8_m64(mask), 7);
+ __m128 b = _mm_load_ps((const float *) mem_addr);
+ int8x8_t masked =
+ vbsl_s8(vreinterpret_u8_s8(shr_mask), vreinterpret_s8_m64(a),
+ vreinterpret_s8_u64(vget_low_u64(vreinterpretq_u64_m128(b))));
+ vst1_s8((int8_t *) mem_addr, masked);
+}
+
+// Conditionally store 8-bit integer elements from a into memory using mask
+// (elements are not stored when the highest bit is not set in the corresponding
+// element) and a non-temporal memory hint.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_maskmovq
+#define _m_maskmovq(a, mask, mem_addr) _mm_maskmove_si64(a, mask, mem_addr)
+
+// Compare packed signed 16-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_pi16
+FORCE_INLINE __m64 _mm_max_pi16(__m64 a, __m64 b)
+{
+ return vreinterpret_m64_s16(
+ vmax_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
}
-// Sets the 2 signed 64-bit integer values to i.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set1_epi64x
-FORCE_INLINE __m128i _mm_set1_epi64x(int64_t _i)
+// Compare packed single-precision (32-bit) floating-point elements in a and b,
+// and store packed maximum values in dst. dst does not follow the IEEE Standard
+// for Floating-Point Arithmetic (IEEE 754) maximum value when inputs are NaN or
+// signed-zero values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_ps
+FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b)
{
- return vreinterpretq_m128i_s64(vdupq_n_s64(_i));
+#if SSE2NEON_PRECISE_MINMAX
+ float32x4_t _a = vreinterpretq_f32_m128(a);
+ float32x4_t _b = vreinterpretq_f32_m128(b);
+ return vreinterpretq_m128_f32(vbslq_f32(vcgtq_f32(_a, _b), _a, _b));
+#else
+ return vreinterpretq_m128_f32(
+ vmaxq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#endif
}
-// Sets the 4 signed 32-bit integer values.
-// https://msdn.microsoft.com/en-us/library/vstudio/019beekt(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_set_epi32(int i3, int i2, int i1, int i0)
+// Compare packed unsigned 8-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_pu8
+FORCE_INLINE __m64 _mm_max_pu8(__m64 a, __m64 b)
{
- int32_t ALIGN_STRUCT(16) data[4] = {i0, i1, i2, i3};
- return vreinterpretq_m128i_s32(vld1q_s32(data));
+ return vreinterpret_m64_u8(
+ vmax_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
}
-// Returns the __m128i structure with its two 64-bit integer values
-// initialized to the values of the two 64-bit integers passed in.
-// https://msdn.microsoft.com/en-us/library/dk2sdw0h(v=vs.120).aspx
-FORCE_INLINE __m128i _mm_set_epi64x(int64_t i1, int64_t i2)
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b, store the maximum value in the lower element of dst, and copy the upper 3
+// packed elements from a to the upper element of dst. dst does not follow the
+// IEEE Standard for Floating-Point Arithmetic (IEEE 754) maximum value when
+// inputs are NaN or signed-zero values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_ss
+FORCE_INLINE __m128 _mm_max_ss(__m128 a, __m128 b)
{
- int64_t ALIGN_STRUCT(16) data[2] = {i2, i1};
- return vreinterpretq_m128i_s64(vld1q_s64(data));
+ float32_t value = vgetq_lane_f32(_mm_max_ps(a, b), 0);
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
}
-// Returns the __m128i structure with its two 64-bit integer values
-// initialized to the values of the two 64-bit integers passed in.
-// https://msdn.microsoft.com/en-us/library/dk2sdw0h(v=vs.120).aspx
-FORCE_INLINE __m128i _mm_set_epi64(__m64 i1, __m64 i2)
+// Compare packed signed 16-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_pi16
+FORCE_INLINE __m64 _mm_min_pi16(__m64 a, __m64 b)
{
- return _mm_set_epi64x((int64_t) i1, (int64_t) i2);
+ return vreinterpret_m64_s16(
+ vmin_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
}
-// Set packed double-precision (64-bit) floating-point elements in dst with the
-// supplied values.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_set_pd
-FORCE_INLINE __m128d _mm_set_pd(double e1, double e0)
+// Compare packed single-precision (32-bit) floating-point elements in a and b,
+// and store packed minimum values in dst. dst does not follow the IEEE Standard
+// for Floating-Point Arithmetic (IEEE 754) minimum value when inputs are NaN or
+// signed-zero values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_ps
+FORCE_INLINE __m128 _mm_min_ps(__m128 a, __m128 b)
{
- double ALIGN_STRUCT(16) data[2] = {e0, e1};
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(vld1q_f64((float64_t *) data));
+#if SSE2NEON_PRECISE_MINMAX
+ float32x4_t _a = vreinterpretq_f32_m128(a);
+ float32x4_t _b = vreinterpretq_f32_m128(b);
+ return vreinterpretq_m128_f32(vbslq_f32(vcltq_f32(_a, _b), _a, _b));
#else
- return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) data));
+ return vreinterpretq_m128_f32(
+ vminq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
#endif
}
-// Stores four single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/vstudio/s3h4ay6y(v=vs.100).aspx
-FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
+// Compare packed unsigned 8-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_pu8
+FORCE_INLINE __m64 _mm_min_pu8(__m64 a, __m64 b)
{
- vst1q_f32(p, vreinterpretq_f32_m128(a));
+ return vreinterpret_m64_u8(
+ vmin_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
}
-// Stores four single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/44e30x22(v=vs.100).aspx
-FORCE_INLINE void _mm_storeu_ps(float *p, __m128 a)
+// Compare the lower single-precision (32-bit) floating-point elements in a and
+// b, store the minimum value in the lower element of dst, and copy the upper 3
+// packed elements from a to the upper element of dst. dst does not follow the
+// IEEE Standard for Floating-Point Arithmetic (IEEE 754) minimum value when
+// inputs are NaN or signed-zero values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_ss
+FORCE_INLINE __m128 _mm_min_ss(__m128 a, __m128 b)
{
- vst1q_f32(p, vreinterpretq_f32_m128(a));
+ float32_t value = vgetq_lane_f32(_mm_min_ps(a, b), 0);
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
}
-// Stores four 32-bit integer values as (as a __m128i value) at the address p.
-// https://msdn.microsoft.com/en-us/library/vstudio/edk11s13(v=vs.100).aspx
-FORCE_INLINE void _mm_store_si128(__m128i *p, __m128i a)
+// Move the lower single-precision (32-bit) floating-point element from b to the
+// lower element of dst, and copy the upper 3 packed elements from a to the
+// upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_move_ss
+FORCE_INLINE __m128 _mm_move_ss(__m128 a, __m128 b)
{
- vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a));
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32(vgetq_lane_f32(vreinterpretq_f32_m128(b), 0),
+ vreinterpretq_f32_m128(a), 0));
}
-// Stores four 32-bit integer values as (as a __m128i value) at the address p.
-// https://msdn.microsoft.com/en-us/library/vstudio/edk11s13(v=vs.100).aspx
-FORCE_INLINE void _mm_storeu_si128(__m128i *p, __m128i a)
+// Move the upper 2 single-precision (32-bit) floating-point elements from b to
+// the lower 2 elements of dst, and copy the upper 2 elements from a to the
+// upper 2 elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movehl_ps
+FORCE_INLINE __m128 _mm_movehl_ps(__m128 a, __m128 b)
{
- vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a));
+#if defined(aarch64__)
+ return vreinterpretq_m128_u64(
+ vzip2q_u64(vreinterpretq_u64_m128(b), vreinterpretq_u64_m128(a)));
+#else
+ float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(vcombine_f32(b32, a32));
+#endif
}
-// Stores the lower single - precision, floating - point value.
-// https://msdn.microsoft.com/en-us/library/tzz10fbx(v=vs.100).aspx
-FORCE_INLINE void _mm_store_ss(float *p, __m128 a)
+// Move the lower 2 single-precision (32-bit) floating-point elements from b to
+// the upper 2 elements of dst, and copy the lower 2 elements from a to the
+// lower 2 elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movelh_ps
+FORCE_INLINE __m128 _mm_movelh_ps(__m128 __A, __m128 __B)
{
- vst1q_lane_f32(p, vreinterpretq_f32_m128(a), 0);
+ float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(__A));
+ float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(__B));
+ return vreinterpretq_m128_f32(vcombine_f32(a10, b10));
}
-// Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point
-// elements) from a into memory. mem_addr must be aligned on a 16-byte boundary
-// or a general-protection exception may be generated.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_store_pd
-FORCE_INLINE void _mm_store_pd(double *mem_addr, __m128d a)
+// Create mask from the most significant bit of each 8-bit element in a, and
+// store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movemask_pi8
+FORCE_INLINE int _mm_movemask_pi8(__m64 a)
{
-#if defined(__aarch64__)
- vst1q_f64((float64_t *) mem_addr, vreinterpretq_f64_m128d(a));
+ uint8x8_t input = vreinterpret_u8_m64(a);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ static const int8_t shift[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ uint8x8_t tmp = vshr_n_u8(input, 7);
+ return vaddv_u8(vshl_u8(tmp, vld1_s8(shift)));
#else
- vst1q_f32((float32_t *) mem_addr, vreinterpretq_f32_m128d(a));
+ // Refer the implementation of `_mm_movemask_epi8`
+ uint16x4_t high_bits = vreinterpret_u16_u8(vshr_n_u8(input, 7));
+ uint32x2_t paired16 =
+ vreinterpret_u32_u16(vsra_n_u16(high_bits, high_bits, 7));
+ uint8x8_t paired32 =
+ vreinterpret_u8_u32(vsra_n_u32(paired16, paired16, 14));
+ return vget_lane_u8(paired32, 0) | ((int) vget_lane_u8(paired32, 4) << 4);
#endif
}
-// Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point
-// elements) from a into memory. mem_addr does not need to be aligned on any
-// particular boundary.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_storeu_pd
-FORCE_INLINE void _mm_storeu_pd(double *mem_addr, __m128d a)
+// Set each bit of mask dst based on the most significant bit of the
+// corresponding packed single-precision (32-bit) floating-point element in a.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movemask_ps
+FORCE_INLINE int _mm_movemask_ps(__m128 a)
{
- _mm_store_pd(mem_addr, a);
+ uint32x4_t input = vreinterpretq_u32_m128(a);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ static const int32_t shift[4] = {0, 1, 2, 3};
+ uint32x4_t tmp = vshrq_n_u32(input, 31);
+ return vaddvq_u32(vshlq_u32(tmp, vld1q_s32(shift)));
+#else
+ // Uses the exact same method as _mm_movemask_epi8, see that for details.
+ // Shift out everything but the sign bits with a 32-bit unsigned shift
+ // right.
+ uint64x2_t high_bits = vreinterpretq_u64_u32(vshrq_n_u32(input, 31));
+ // Merge the two pairs together with a 64-bit unsigned shift right + add.
+ uint8x16_t paired =
+ vreinterpretq_u8_u64(vsraq_n_u64(high_bits, high_bits, 31));
+ // Extract the result.
+ return vgetq_lane_u8(paired, 0) | (vgetq_lane_u8(paired, 8) << 2);
+#endif
}
-// Reads the lower 64 bits of b and stores them into the lower 64 bits of a.
-// https://msdn.microsoft.com/en-us/library/hhwf428f%28v=vs.90%29.aspx
-FORCE_INLINE void _mm_storel_epi64(__m128i *a, __m128i b)
+// Multiply packed single-precision (32-bit) floating-point elements in a and b,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_ps
+FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b)
{
- uint64x1_t hi = vget_high_u64(vreinterpretq_u64_m128i(*a));
- uint64x1_t lo = vget_low_u64(vreinterpretq_u64_m128i(b));
- *a = vreinterpretq_m128i_u64(vcombine_u64(lo, hi));
+ return vreinterpretq_m128_f32(
+ vmulq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
}
-// Stores the lower two single-precision floating point values of a to the
-// address p.
-//
-// *p0 := a0
-// *p1 := a1
-//
-// https://msdn.microsoft.com/en-us/library/h54t98ks(v=vs.90).aspx
-FORCE_INLINE void _mm_storel_pi(__m64 *p, __m128 a)
+// Multiply the lower single-precision (32-bit) floating-point element in a and
+// b, store the result in the lower element of dst, and copy the upper 3 packed
+// elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_ss
+FORCE_INLINE __m128 _mm_mul_ss(__m128 a, __m128 b)
{
- *p = vreinterpret_m64_f32(vget_low_f32(a));
+ return _mm_move_ss(a, _mm_mul_ps(a, b));
}
-// Stores the upper two single-precision, floating-point values of a to the
-// address p.
-//
-// *p0 := a2
-// *p1 := a3
-//
-// https://msdn.microsoft.com/en-us/library/a7525fs8(v%3dvs.90).aspx
-FORCE_INLINE void _mm_storeh_pi(__m64 *p, __m128 a)
+// Multiply the packed unsigned 16-bit integers in a and b, producing
+// intermediate 32-bit integers, and store the high 16 bits of the intermediate
+// integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhi_pu16
+FORCE_INLINE __m64 _mm_mulhi_pu16(__m64 a, __m64 b)
{
- *p = vreinterpret_m64_f32(vget_high_f32(a));
+ return vreinterpret_m64_u16(vshrn_n_u32(
+ vmull_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)), 16));
}
-// Loads a single single-precision, floating-point value, copying it into all
-// four words
-// https://msdn.microsoft.com/en-us/library/vstudio/5cdkf716(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_load1_ps(const float *p)
+// Compute the bitwise OR of packed single-precision (32-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_or_ps
+FORCE_INLINE __m128 _mm_or_ps(__m128 a, __m128 b)
{
- return vreinterpretq_m128_f32(vld1q_dup_f32(p));
+ return vreinterpretq_m128_s32(
+ vorrq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
}
-// Load a single-precision (32-bit) floating-point element from memory into all
-// elements of dst.
-//
-// dst[31:0] := MEM[mem_addr+31:mem_addr]
-// dst[63:32] := MEM[mem_addr+31:mem_addr]
-// dst[95:64] := MEM[mem_addr+31:mem_addr]
-// dst[127:96] := MEM[mem_addr+31:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_ps1
-#define _mm_load_ps1 _mm_load1_ps
+// Average packed unsigned 8-bit integers in a and b, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pavgb
+#define _m_pavgb(a, b) _mm_avg_pu8(a, b)
-// Sets the lower two single-precision, floating-point values with 64
-// bits of data loaded from the address p; the upper two values are passed
-// through from a.
-//
-// Return Value
-// r0 := *p0
-// r1 := *p1
-// r2 := a2
-// r3 := a3
-//
-// https://msdn.microsoft.com/en-us/library/s57cyak2(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_loadl_pi(__m128 a, __m64 const *p)
-{
- return vreinterpretq_m128_f32(
- vcombine_f32(vld1_f32((const float32_t *) p), vget_high_f32(a)));
-}
+// Average packed unsigned 16-bit integers in a and b, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pavgw
+#define _m_pavgw(a, b) _mm_avg_pu16(a, b)
-// Load 4 single-precision (32-bit) floating-point elements from memory into dst
-// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
-// general-protection exception may be generated.
-//
-// dst[31:0] := MEM[mem_addr+127:mem_addr+96]
-// dst[63:32] := MEM[mem_addr+95:mem_addr+64]
-// dst[95:64] := MEM[mem_addr+63:mem_addr+32]
-// dst[127:96] := MEM[mem_addr+31:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadr_ps
-FORCE_INLINE __m128 _mm_loadr_ps(const float *p)
-{
- float32x4_t v = vrev64q_f32(vld1q_f32(p));
- return vreinterpretq_m128_f32(vextq_f32(v, v, 2));
-}
+// Extract a 16-bit integer from a, selected with imm8, and store the result in
+// the lower element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pextrw
+#define _m_pextrw(a, imm) _mm_extract_pi16(a, imm)
-// Sets the upper two single-precision, floating-point values with 64
-// bits of data loaded from the address p; the lower two values are passed
-// through from a.
-//
-// r0 := a0
-// r1 := a1
-// r2 := *p0
-// r3 := *p1
-//
-// https://msdn.microsoft.com/en-us/library/w92wta0x(v%3dvs.100).aspx
-FORCE_INLINE __m128 _mm_loadh_pi(__m128 a, __m64 const *p)
-{
- return vreinterpretq_m128_f32(
- vcombine_f32(vget_low_f32(a), vld1_f32((const float32_t *) p)));
-}
+// Copy a to dst, and insert the 16-bit integer i into dst at the location
+// specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=m_pinsrw
+#define _m_pinsrw(a, i, imm) _mm_insert_pi16(a, i, imm)
-// Loads four single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/vstudio/zzd50xxt(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_load_ps(const float *p)
-{
- return vreinterpretq_m128_f32(vld1q_f32(p));
-}
+// Compare packed signed 16-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pmaxsw
+#define _m_pmaxsw(a, b) _mm_max_pi16(a, b)
-// Loads four single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/x1b16s7z%28v=vs.90%29.aspx
-FORCE_INLINE __m128 _mm_loadu_ps(const float *p)
-{
- // for neon, alignment doesn't matter, so _mm_load_ps and _mm_loadu_ps are
- // equivalent for neon
- return vreinterpretq_m128_f32(vld1q_f32(p));
-}
+// Compare packed unsigned 8-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pmaxub
+#define _m_pmaxub(a, b) _mm_max_pu8(a, b)
-// Load unaligned 16-bit integer from memory into the first element of dst.
-//
-// dst[15:0] := MEM[mem_addr+15:mem_addr]
-// dst[MAX:16] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si16
-FORCE_INLINE __m128i _mm_loadu_si16(const void *p)
-{
- return vreinterpretq_m128i_s16(
- vsetq_lane_s16(*(const int16_t *) p, vdupq_n_s16(0), 0));
-}
+// Compare packed signed 16-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pminsw
+#define _m_pminsw(a, b) _mm_min_pi16(a, b)
-// Load unaligned 64-bit integer from memory into the first element of dst.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[MAX:64] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si64
-FORCE_INLINE __m128i _mm_loadu_si64(const void *p)
-{
- return vreinterpretq_m128i_s64(
- vcombine_s64(vld1_s64((const int64_t *) p), vdup_n_s64(0)));
-}
+// Compare packed unsigned 8-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pminub
+#define _m_pminub(a, b) _mm_min_pu8(a, b)
-// Load a double-precision (64-bit) floating-point element from memory into the
-// lower of dst, and zero the upper element. mem_addr does not need to be
-// aligned on any particular boundary.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[127:64] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_sd
-FORCE_INLINE __m128d _mm_load_sd(const double *p)
+// Create mask from the most significant bit of each 8-bit element in a, and
+// store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pmovmskb
+#define _m_pmovmskb(a) _mm_movemask_pi8(a)
+
+// Multiply the packed unsigned 16-bit integers in a and b, producing
+// intermediate 32-bit integers, and store the high 16 bits of the intermediate
+// integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pmulhuw
+#define _m_pmulhuw(a, b) _mm_mulhi_pu16(a, b)
+
+// Fetch the line of data from memory that contains address p to a location in
+// the cache heirarchy specified by the locality hint i.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_prefetch
+FORCE_INLINE void _mm_prefetch(char const *p, int i)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(vsetq_lane_f64(*p, vdupq_n_f64(0), 0));
+ (void) i;
+#if defined(_MSC_VER)
+ switch (i) {
+ case _MM_HINT_NTA:
+ __prefetch2(p, 1);
+ break;
+ case _MM_HINT_T0:
+ __prefetch2(p, 0);
+ break;
+ case _MM_HINT_T1:
+ __prefetch2(p, 2);
+ break;
+ case _MM_HINT_T2:
+ __prefetch2(p, 4);
+ break;
+ }
#else
- const float *fp = (const float *) p;
- float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], 0, 0};
- return vreinterpretq_m128d_f32(vld1q_f32(data));
+ switch (i) {
+ case _MM_HINT_NTA:
+ __builtin_prefetch(p, 0, 0);
+ break;
+ case _MM_HINT_T0:
+ __builtin_prefetch(p, 0, 3);
+ break;
+ case _MM_HINT_T1:
+ __builtin_prefetch(p, 0, 2);
+ break;
+ case _MM_HINT_T2:
+ __builtin_prefetch(p, 0, 1);
+ break;
+ }
#endif
}
-// Loads two double-precision from 16-byte aligned memory, floating-point
-// values.
-//
-// dst[127:0] := MEM[mem_addr+127:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_pd
-FORCE_INLINE __m128d _mm_load_pd(const double *p)
+// Compute the absolute differences of packed unsigned 8-bit integers in a and
+// b, then horizontally sum each consecutive 8 differences to produce four
+// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
+// 16 bits of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=m_psadbw
+#define _m_psadbw(a, b) _mm_sad_pu8(a, b)
+
+// Shuffle 16-bit integers in a using the control in imm8, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_m_pshufw
+#define _m_pshufw(a, imm) _mm_shuffle_pi16(a, imm)
+
+// Compute the approximate reciprocal of packed single-precision (32-bit)
+// floating-point elements in a, and store the results in dst. The maximum
+// relative error for this approximation is less than 1.5*2^-12.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_rcp_ps
+FORCE_INLINE __m128 _mm_rcp_ps(__m128 in)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(vld1q_f64(p));
-#else
- const float *fp = (const float *) p;
- float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], fp[2], fp[3]};
- return vreinterpretq_m128d_f32(vld1q_f32(data));
-#endif
+ float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(in));
+ recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in)));
+ return vreinterpretq_m128_f32(recip);
+}
+
+// Compute the approximate reciprocal of the lower single-precision (32-bit)
+// floating-point element in a, store the result in the lower element of dst,
+// and copy the upper 3 packed elements from a to the upper elements of dst. The
+// maximum relative error for this approximation is less than 1.5*2^-12.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_rcp_ss
+FORCE_INLINE __m128 _mm_rcp_ss(__m128 a)
+{
+ return _mm_move_ss(a, _mm_rcp_ps(a));
}
-// Loads two double-precision from unaligned memory, floating-point values.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_pd
-FORCE_INLINE __m128d _mm_loadu_pd(const double *p)
+// Compute the approximate reciprocal square root of packed single-precision
+// (32-bit) floating-point elements in a, and store the results in dst. The
+// maximum relative error for this approximation is less than 1.5*2^-12.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_rsqrt_ps
+FORCE_INLINE __m128 _mm_rsqrt_ps(__m128 in)
{
- return _mm_load_pd(p);
+ float32x4_t out = vrsqrteq_f32(vreinterpretq_f32_m128(in));
+ out = vmulq_f32(
+ out, vrsqrtsq_f32(vmulq_f32(vreinterpretq_f32_m128(in), out), out));
+ return vreinterpretq_m128_f32(out);
}
-// Loads an single - precision, floating - point value into the low word and
-// clears the upper three words.
-// https://msdn.microsoft.com/en-us/library/548bb9h4%28v=vs.90%29.aspx
-FORCE_INLINE __m128 _mm_load_ss(const float *p)
+// Compute the approximate reciprocal square root of the lower single-precision
+// (32-bit) floating-point element in a, store the result in the lower element
+// of dst, and copy the upper 3 packed elements from a to the upper elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_rsqrt_ss
+FORCE_INLINE __m128 _mm_rsqrt_ss(__m128 in)
{
- return vreinterpretq_m128_f32(vsetq_lane_f32(*p, vdupq_n_f32(0), 0));
+ return vsetq_lane_f32(vgetq_lane_f32(_mm_rsqrt_ps(in), 0), in, 0);
}
-FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const *p)
+// Compute the absolute differences of packed unsigned 8-bit integers in a and
+// b, then horizontally sum each consecutive 8 differences to produce four
+// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
+// 16 bits of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sad_pu8
+FORCE_INLINE __m64 _mm_sad_pu8(__m64 a, __m64 b)
{
- /* Load the lower 64 bits of the value pointed to by p into the
- * lower 64 bits of the result, zeroing the upper 64 bits of the result.
- */
- return vreinterpretq_m128i_s32(
- vcombine_s32(vld1_s32((int32_t const *) p), vcreate_s32(0)));
+ uint64x1_t t = vpaddl_u32(vpaddl_u16(
+ vpaddl_u8(vabd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)))));
+ return vreinterpret_m64_u16(
+ vset_lane_u16((int) vget_lane_u64(t, 0), vdup_n_u16(0), 0));
}
-// Load a double-precision (64-bit) floating-point element from memory into the
-// lower element of dst, and copy the upper element from a to dst. mem_addr does
-// not need to be aligned on any particular boundary.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[127:64] := a[127:64]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadl_pd
-FORCE_INLINE __m128d _mm_loadl_pd(__m128d a, const double *p)
+// Macro: Set the flush zero bits of the MXCSR control and status register to
+// the value in unsigned 32-bit integer a. The flush zero may contain any of the
+// following flags: _MM_FLUSH_ZERO_ON or _MM_FLUSH_ZERO_OFF
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_MM_SET_FLUSH_ZERO_MODE
+FORCE_INLINE void _sse2neon_mm_set_flush_zero_mode(unsigned int flag)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(
- vcombine_f64(vld1_f64(p), vget_high_f64(vreinterpretq_f64_m128d(a))));
+ // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting,
+ // regardless of the value of the FZ bit.
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
#else
- return vreinterpretq_m128d_f32(
- vcombine_f32(vld1_f32((const float *) p),
- vget_high_f32(vreinterpretq_f32_m128d(a))));
+ uint32_t value;
#endif
-}
+ } r;
-// Load 2 double-precision (64-bit) floating-point elements from memory into dst
-// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
-// general-protection exception may be generated.
-//
-// dst[63:0] := MEM[mem_addr+127:mem_addr+64]
-// dst[127:64] := MEM[mem_addr+63:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadr_pd
-FORCE_INLINE __m128d _mm_loadr_pd(const double *p)
-{
-#if defined(__aarch64__)
- float64x2_t v = vld1q_f64(p);
- return vreinterpretq_m128d_f64(vextq_f64(v, v, 1));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
#else
- int64x2_t v = vld1q_s64((const int64_t *) p);
- return vreinterpretq_m128d_s64(vextq_s64(v, v, 1));
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
+#endif
+
+ r.field.bit24 = (flag & _MM_FLUSH_ZERO_MASK) == _MM_FLUSH_ZERO_ON;
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+ _sse2neon_set_fpcr(r.value);
+#else
+ __asm__ __volatile__("vmsr FPSCR, %0" ::"r"(r)); /* write */
#endif
}
-// Sets the low word to the single-precision, floating-point value of b
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/35hdzazd(v=vs.100)
-FORCE_INLINE __m128 _mm_move_ss(__m128 a, __m128 b)
+// Set packed single-precision (32-bit) floating-point elements in dst with the
+// supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_ps
+FORCE_INLINE __m128 _mm_set_ps(float w, float z, float y, float x)
{
- return vreinterpretq_m128_f32(
- vsetq_lane_f32(vgetq_lane_f32(vreinterpretq_f32_m128(b), 0),
- vreinterpretq_f32_m128(a), 0));
+ float ALIGN_STRUCT(16) data[4] = {x, y, z, w};
+ return vreinterpretq_m128_f32(vld1q_f32(data));
}
-// Copy the lower 64-bit integer in a to the lower element of dst, and zero the
-// upper element.
-//
-// dst[63:0] := a[63:0]
-// dst[127:64] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_epi64
-FORCE_INLINE __m128i _mm_move_epi64(__m128i a)
+// Broadcast single-precision (32-bit) floating-point value a to all elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_ps1
+FORCE_INLINE __m128 _mm_set_ps1(float _w)
{
- return vreinterpretq_m128i_s64(
- vsetq_lane_s64(0, vreinterpretq_s64_m128i(a), 1));
+ return vreinterpretq_m128_f32(vdupq_n_f32(_w));
}
-// Return vector of type __m128 with undefined elements.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_undefined_ps
-FORCE_INLINE __m128 _mm_undefined_ps(void)
+// Macro: Set the rounding mode bits of the MXCSR control and status register to
+// the value in unsigned 32-bit integer a. The rounding mode may contain any of
+// the following flags: _MM_ROUND_NEAREST, _MM_ROUND_DOWN, _MM_ROUND_UP,
+// _MM_ROUND_TOWARD_ZERO
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_MM_SET_ROUNDING_MODE
+FORCE_INLINE void _MM_SET_ROUNDING_MODE(int rounding)
{
- __m128 a;
- return a;
-}
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
+#else
+ uint32_t value;
+#endif
+ } r;
-/* Logic/Binary operations */
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
+#else
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
+#endif
-// Computes the bitwise AND-NOT of the four single-precision, floating-point
-// values of a and b.
-//
-// r0 := ~a0 & b0
-// r1 := ~a1 & b1
-// r2 := ~a2 & b2
-// r3 := ~a3 & b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/68h7wd02(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_andnot_ps(__m128 a, __m128 b)
-{
- return vreinterpretq_m128_s32(
- vbicq_s32(vreinterpretq_s32_m128(b),
- vreinterpretq_s32_m128(a))); // *NOTE* argument swap
-}
+ switch (rounding) {
+ case _MM_ROUND_TOWARD_ZERO:
+ r.field.bit22 = 1;
+ r.field.bit23 = 1;
+ break;
+ case _MM_ROUND_DOWN:
+ r.field.bit22 = 0;
+ r.field.bit23 = 1;
+ break;
+ case _MM_ROUND_UP:
+ r.field.bit22 = 1;
+ r.field.bit23 = 0;
+ break;
+ default: //_MM_ROUND_NEAREST
+ r.field.bit22 = 0;
+ r.field.bit23 = 0;
+ }
-// Compute the bitwise NOT of packed double-precision (64-bit) floating-point
-// elements in a and then AND with b, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := j*64
-// dst[i+63:i] := ((NOT a[i+63:i]) AND b[i+63:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_andnot_pd
-FORCE_INLINE __m128d _mm_andnot_pd(__m128d a, __m128d b)
-{
- // *NOTE* argument swap
- return vreinterpretq_m128d_s64(
- vbicq_s64(vreinterpretq_s64_m128d(b), vreinterpretq_s64_m128d(a)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ _sse2neon_set_fpcr(r.value);
+#else
+ __asm__ __volatile__("vmsr FPSCR, %0" ::"r"(r)); /* write */
+#endif
}
-// Computes the bitwise AND of the 128-bit value in b and the bitwise NOT of the
-// 128-bit value in a.
-//
-// r := (~a) & b
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/1beaceh8(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_andnot_si128(__m128i a, __m128i b)
+// Copy single-precision (32-bit) floating-point element a to the lower element
+// of dst, and zero the upper 3 elements.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_ss
+FORCE_INLINE __m128 _mm_set_ss(float a)
{
- return vreinterpretq_m128i_s32(
- vbicq_s32(vreinterpretq_s32_m128i(b),
- vreinterpretq_s32_m128i(a))); // *NOTE* argument swap
+ return vreinterpretq_m128_f32(vsetq_lane_f32(a, vdupq_n_f32(0), 0));
}
-// Computes the bitwise AND of the 128-bit value in a and the 128-bit value in
-// b.
-//
-// r := a & b
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/6d1txsa8(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_and_si128(__m128i a, __m128i b)
+// Broadcast single-precision (32-bit) floating-point value a to all elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_ps
+FORCE_INLINE __m128 _mm_set1_ps(float _w)
{
- return vreinterpretq_m128i_s32(
- vandq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ return vreinterpretq_m128_f32(vdupq_n_f32(_w));
}
-// Computes the bitwise AND of the four single-precision, floating-point values
-// of a and b.
-//
-// r0 := a0 & b0
-// r1 := a1 & b1
-// r2 := a2 & b2
-// r3 := a3 & b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/73ck1xc5(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_and_ps(__m128 a, __m128 b)
+// Set the MXCSR control and status register with the value in unsigned 32-bit
+// integer a.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setcsr
+// FIXME: _mm_setcsr() implementation supports changing the rounding mode only.
+FORCE_INLINE void _mm_setcsr(unsigned int a)
{
- return vreinterpretq_m128_s32(
- vandq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
+ _MM_SET_ROUNDING_MODE(a);
}
-// Compute the bitwise AND of packed double-precision (64-bit) floating-point
-// elements in a and b, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := j*64
-// dst[i+63:i] := a[i+63:i] AND b[i+63:i]
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_and_pd
-FORCE_INLINE __m128d _mm_and_pd(__m128d a, __m128d b)
+// Get the unsigned 32-bit value of the MXCSR control and status register.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_getcsr
+// FIXME: _mm_getcsr() implementation supports reading the rounding mode only.
+FORCE_INLINE unsigned int _mm_getcsr()
{
- return vreinterpretq_m128d_s64(
- vandq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b)));
+ return _MM_GET_ROUNDING_MODE();
}
-// Computes the bitwise OR of the four single-precision, floating-point values
-// of a and b.
-// https://msdn.microsoft.com/en-us/library/vstudio/7ctdsyy0(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_or_ps(__m128 a, __m128 b)
+// Set packed single-precision (32-bit) floating-point elements in dst with the
+// supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_ps
+FORCE_INLINE __m128 _mm_setr_ps(float w, float z, float y, float x)
{
- return vreinterpretq_m128_s32(
- vorrq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
+ float ALIGN_STRUCT(16) data[4] = {w, z, y, x};
+ return vreinterpretq_m128_f32(vld1q_f32(data));
}
-// Computes bitwise EXOR (exclusive-or) of the four single-precision,
-// floating-point values of a and b.
-// https://msdn.microsoft.com/en-us/library/ss6k3wk8(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_xor_ps(__m128 a, __m128 b)
+// Return vector of type __m128 with all elements set to zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setzero_ps
+FORCE_INLINE __m128 _mm_setzero_ps(void)
{
- return vreinterpretq_m128_s32(
- veorq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
+ return vreinterpretq_m128_f32(vdupq_n_f32(0));
}
-// Compute the bitwise XOR of packed double-precision (64-bit) floating-point
-// elements in a and b, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := j*64
-// dst[i+63:i] := a[i+63:i] XOR b[i+63:i]
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_xor_pd
-FORCE_INLINE __m128d _mm_xor_pd(__m128d a, __m128d b)
+// Shuffle 16-bit integers in a using the control in imm8, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_pi16
+#ifdef _sse2neon_shuffle
+#define _mm_shuffle_pi16(a, imm) \
+ vreinterpret_m64_s16(vshuffle_s16( \
+ vreinterpret_s16_m64(a), vreinterpret_s16_m64(a), (imm & 0x3), \
+ ((imm >> 2) & 0x3), ((imm >> 4) & 0x3), ((imm >> 6) & 0x3)))
+#else
+#define _mm_shuffle_pi16(a, imm) \
+ _sse2neon_define1( \
+ __m64, a, int16x4_t ret; \
+ ret = vmov_n_s16( \
+ vget_lane_s16(vreinterpret_s16_m64(_a), (imm) & (0x3))); \
+ ret = vset_lane_s16( \
+ vget_lane_s16(vreinterpret_s16_m64(_a), ((imm) >> 2) & 0x3), ret, \
+ 1); \
+ ret = vset_lane_s16( \
+ vget_lane_s16(vreinterpret_s16_m64(_a), ((imm) >> 4) & 0x3), ret, \
+ 2); \
+ ret = vset_lane_s16( \
+ vget_lane_s16(vreinterpret_s16_m64(_a), ((imm) >> 6) & 0x3), ret, \
+ 3); \
+ _sse2neon_return(vreinterpret_m64_s16(ret));)
+#endif
+
+// Perform a serializing operation on all store-to-memory instructions that were
+// issued prior to this instruction. Guarantees that every store instruction
+// that precedes, in program order, is globally visible before any store
+// instruction which follows the fence in program order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sfence
+FORCE_INLINE void _mm_sfence(void)
{
- return vreinterpretq_m128d_s64(
- veorq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b)));
+ _sse2neon_smp_mb();
}
-// Computes the bitwise OR of the 128-bit value in a and the 128-bit value in b.
-//
-// r := a | b
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/ew8ty0db(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_or_si128(__m128i a, __m128i b)
+// Perform a serializing operation on all load-from-memory and store-to-memory
+// instructions that were issued prior to this instruction. Guarantees that
+// every memory access that precedes, in program order, the memory fence
+// instruction is globally visible before any memory instruction which follows
+// the fence in program order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mfence
+FORCE_INLINE void _mm_mfence(void)
{
- return vreinterpretq_m128i_s32(
- vorrq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ _sse2neon_smp_mb();
}
-// Computes the bitwise XOR of the 128-bit value in a and the 128-bit value in
-// b. https://msdn.microsoft.com/en-us/library/fzt08www(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_xor_si128(__m128i a, __m128i b)
+// Perform a serializing operation on all load-from-memory instructions that
+// were issued prior to this instruction. Guarantees that every load instruction
+// that precedes, in program order, is globally visible before any load
+// instruction which follows the fence in program order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_lfence
+FORCE_INLINE void _mm_lfence(void)
{
- return vreinterpretq_m128i_s32(
- veorq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ _sse2neon_smp_mb();
}
-// Duplicate odd-indexed single-precision (32-bit) floating-point elements
-// from a, and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movehdup_ps
-FORCE_INLINE __m128 _mm_movehdup_ps(__m128 a)
-{
-#if __has_builtin(__builtin_shufflevector)
- return vreinterpretq_m128_f32(__builtin_shufflevector(
- vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 1, 1, 3, 3));
-#else
- float32_t a1 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 1);
- float32_t a3 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 3);
- float ALIGN_STRUCT(16) data[4] = {a1, a1, a3, a3};
- return vreinterpretq_m128_f32(vld1q_f32(data));
+// FORCE_INLINE __m128 _mm_shuffle_ps(__m128 a, __m128 b, __constrange(0,255)
+// int imm)
+#ifdef _sse2neon_shuffle
+#define _mm_shuffle_ps(a, b, imm) \
+ __extension__({ \
+ float32x4_t _input1 = vreinterpretq_f32_m128(a); \
+ float32x4_t _input2 = vreinterpretq_f32_m128(b); \
+ float32x4_t _shuf = \
+ vshuffleq_s32(_input1, _input2, (imm) & (0x3), ((imm) >> 2) & 0x3, \
+ (((imm) >> 4) & 0x3) + 4, (((imm) >> 6) & 0x3) + 4); \
+ vreinterpretq_m128_f32(_shuf); \
+ })
+#else // generic
+#define _mm_shuffle_ps(a, b, imm) \
+ _sse2neon_define2( \
+ __m128, a, b, __m128 ret; switch (imm) { \
+ case _MM_SHUFFLE(1, 0, 3, 2): \
+ ret = _mm_shuffle_ps_1032(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 3, 0, 1): \
+ ret = _mm_shuffle_ps_2301(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(0, 3, 2, 1): \
+ ret = _mm_shuffle_ps_0321(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 1, 0, 3): \
+ ret = _mm_shuffle_ps_2103(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(1, 0, 1, 0): \
+ ret = _mm_movelh_ps(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(1, 0, 0, 1): \
+ ret = _mm_shuffle_ps_1001(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(0, 1, 0, 1): \
+ ret = _mm_shuffle_ps_0101(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(3, 2, 1, 0): \
+ ret = _mm_shuffle_ps_3210(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(0, 0, 1, 1): \
+ ret = _mm_shuffle_ps_0011(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(0, 0, 2, 2): \
+ ret = _mm_shuffle_ps_0022(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 2, 0, 0): \
+ ret = _mm_shuffle_ps_2200(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(3, 2, 0, 2): \
+ ret = _mm_shuffle_ps_3202(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(3, 2, 3, 2): \
+ ret = _mm_movehl_ps(_b, _a); \
+ break; \
+ case _MM_SHUFFLE(1, 1, 3, 3): \
+ ret = _mm_shuffle_ps_1133(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 0, 1, 0): \
+ ret = _mm_shuffle_ps_2010(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 0, 0, 1): \
+ ret = _mm_shuffle_ps_2001(_a, _b); \
+ break; \
+ case _MM_SHUFFLE(2, 0, 3, 2): \
+ ret = _mm_shuffle_ps_2032(_a, _b); \
+ break; \
+ default: \
+ ret = _mm_shuffle_ps_default(_a, _b, (imm)); \
+ break; \
+ } _sse2neon_return(ret);)
#endif
-}
-// Duplicate even-indexed single-precision (32-bit) floating-point elements
-// from a, and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_moveldup_ps
-FORCE_INLINE __m128 _mm_moveldup_ps(__m128 a)
+// Compute the square root of packed single-precision (32-bit) floating-point
+// elements in a, and store the results in dst.
+// Due to ARMv7-A NEON's lack of a precise square root intrinsic, we implement
+// square root by multiplying input in with its reciprocal square root before
+// using the Newton-Raphson method to approximate the results.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sqrt_ps
+FORCE_INLINE __m128 _mm_sqrt_ps(__m128 in)
{
-#if __has_builtin(__builtin_shufflevector)
- return vreinterpretq_m128_f32(__builtin_shufflevector(
- vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 0, 0, 2, 2));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(vsqrtq_f32(vreinterpretq_f32_m128(in)));
#else
- float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
- float32_t a2 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 2);
- float ALIGN_STRUCT(16) data[4] = {a0, a0, a2, a2};
- return vreinterpretq_m128_f32(vld1q_f32(data));
+ float32x4_t recip = vrsqrteq_f32(vreinterpretq_f32_m128(in));
+
+ // Test for vrsqrteq_f32(0) -> positive infinity case.
+ // Change to zero, so that s * 1/sqrt(s) result is zero too.
+ const uint32x4_t pos_inf = vdupq_n_u32(0x7F800000);
+ const uint32x4_t div_by_zero =
+ vceqq_u32(pos_inf, vreinterpretq_u32_f32(recip));
+ recip = vreinterpretq_f32_u32(
+ vandq_u32(vmvnq_u32(div_by_zero), vreinterpretq_u32_f32(recip)));
+
+ recip = vmulq_f32(
+ vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)),
+ recip);
+ // Additional Netwon-Raphson iteration for accuracy
+ recip = vmulq_f32(
+ vrsqrtsq_f32(vmulq_f32(recip, recip), vreinterpretq_f32_m128(in)),
+ recip);
+
+ // sqrt(s) = s * 1/sqrt(s)
+ return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(in), recip));
#endif
}
-// Moves the upper two values of B into the lower two values of A.
-//
-// r3 := a3
-// r2 := a2
-// r1 := b3
-// r0 := b2
-FORCE_INLINE __m128 _mm_movehl_ps(__m128 __A, __m128 __B)
-{
- float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(__A));
- float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(__B));
- return vreinterpretq_m128_f32(vcombine_f32(b32, a32));
-}
-
-// Moves the lower two values of B into the upper two values of A.
-//
-// r3 := b1
-// r2 := b0
-// r1 := a1
-// r0 := a0
-FORCE_INLINE __m128 _mm_movelh_ps(__m128 __A, __m128 __B)
+// Compute the square root of the lower single-precision (32-bit) floating-point
+// element in a, store the result in the lower element of dst, and copy the
+// upper 3 packed elements from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sqrt_ss
+FORCE_INLINE __m128 _mm_sqrt_ss(__m128 in)
{
- float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(__A));
- float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(__B));
- return vreinterpretq_m128_f32(vcombine_f32(a10, b10));
+ float32_t value =
+ vgetq_lane_f32(vreinterpretq_f32_m128(_mm_sqrt_ps(in)), 0);
+ return vreinterpretq_m128_f32(
+ vsetq_lane_f32(value, vreinterpretq_f32_m128(in), 0));
}
-// Compute the absolute value of packed signed 32-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 3
-// i := j*32
-// dst[i+31:i] := ABS(a[i+31:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi32
-FORCE_INLINE __m128i _mm_abs_epi32(__m128i a)
+// Store 128-bits (composed of 4 packed single-precision (32-bit) floating-point
+// elements) from a into memory. mem_addr must be aligned on a 16-byte boundary
+// or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_ps
+FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
{
- return vreinterpretq_m128i_s32(vabsq_s32(vreinterpretq_s32_m128i(a)));
+ vst1q_f32(p, vreinterpretq_f32_m128(a));
}
-// Compute the absolute value of packed signed 16-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 7
-// i := j*16
-// dst[i+15:i] := ABS(a[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi16
-FORCE_INLINE __m128i _mm_abs_epi16(__m128i a)
+// Store the lower single-precision (32-bit) floating-point element from a into
+// 4 contiguous elements in memory. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_ps1
+FORCE_INLINE void _mm_store_ps1(float *p, __m128 a)
{
- return vreinterpretq_m128i_s16(vabsq_s16(vreinterpretq_s16_m128i(a)));
+ float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
+ vst1q_f32(p, vdupq_n_f32(a0));
}
-// Compute the absolute value of packed signed 8-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 15
-// i := j*8
-// dst[i+7:i] := ABS(a[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_epi8
-FORCE_INLINE __m128i _mm_abs_epi8(__m128i a)
+// Store the lower single-precision (32-bit) floating-point element from a into
+// memory. mem_addr does not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_ss
+FORCE_INLINE void _mm_store_ss(float *p, __m128 a)
{
- return vreinterpretq_m128i_s8(vabsq_s8(vreinterpretq_s8_m128i(a)));
+ vst1q_lane_f32(p, vreinterpretq_f32_m128(a), 0);
}
-// Compute the absolute value of packed signed 32-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 1
-// i := j*32
-// dst[i+31:i] := ABS(a[i+31:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi32
-FORCE_INLINE __m64 _mm_abs_pi32(__m64 a)
-{
- return vreinterpret_m64_s32(vabs_s32(vreinterpret_s32_m64(a)));
-}
+// Store the lower single-precision (32-bit) floating-point element from a into
+// 4 contiguous elements in memory. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store1_ps
+#define _mm_store1_ps _mm_store_ps1
-// Compute the absolute value of packed signed 16-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := ABS(a[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi16
-FORCE_INLINE __m64 _mm_abs_pi16(__m64 a)
+// Store the upper 2 single-precision (32-bit) floating-point elements from a
+// into memory.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeh_pi
+FORCE_INLINE void _mm_storeh_pi(__m64 *p, __m128 a)
{
- return vreinterpret_m64_s16(vabs_s16(vreinterpret_s16_m64(a)));
+ *p = vreinterpret_m64_f32(vget_high_f32(a));
}
-
-// Compute the absolute value of packed signed 8-bit integers in a, and store
-// the unsigned results in dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := ABS(a[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_abs_pi8
-FORCE_INLINE __m64 _mm_abs_pi8(__m64 a)
+
+// Store the lower 2 single-precision (32-bit) floating-point elements from a
+// into memory.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storel_pi
+FORCE_INLINE void _mm_storel_pi(__m64 *p, __m128 a)
{
- return vreinterpret_m64_s8(vabs_s8(vreinterpret_s8_m64(a)));
+ *p = vreinterpret_m64_f32(vget_low_f32(a));
}
-// Takes the upper 64 bits of a and places it in the low end of the result
-// Takes the lower 64 bits of b and places it into the high end of the result.
-FORCE_INLINE __m128 _mm_shuffle_ps_1032(__m128 a, __m128 b)
+// Store 4 single-precision (32-bit) floating-point elements from a into memory
+// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
+// general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storer_ps
+FORCE_INLINE void _mm_storer_ps(float *p, __m128 a)
{
- float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
- float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(vcombine_f32(a32, b10));
+ float32x4_t tmp = vrev64q_f32(vreinterpretq_f32_m128(a));
+ float32x4_t rev = vextq_f32(tmp, tmp, 2);
+ vst1q_f32(p, rev);
}
-// takes the lower two 32-bit values from a and swaps them and places in high
-// end of result takes the higher two 32 bit values from b and swaps them and
-// places in low end of result.
-FORCE_INLINE __m128 _mm_shuffle_ps_2301(__m128 a, __m128 b)
+// Store 128-bits (composed of 4 packed single-precision (32-bit) floating-point
+// elements) from a into memory. mem_addr does not need to be aligned on any
+// particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_ps
+FORCE_INLINE void _mm_storeu_ps(float *p, __m128 a)
{
- float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
- float32x2_t b23 = vrev64_f32(vget_high_f32(vreinterpretq_f32_m128(b)));
- return vreinterpretq_m128_f32(vcombine_f32(a01, b23));
+ vst1q_f32(p, vreinterpretq_f32_m128(a));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_0321(__m128 a, __m128 b)
+// Stores 16-bits of integer data a at the address p.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_si16
+FORCE_INLINE void _mm_storeu_si16(void *p, __m128i a)
{
- float32x2_t a21 = vget_high_f32(
- vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3));
- float32x2_t b03 = vget_low_f32(
- vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3));
- return vreinterpretq_m128_f32(vcombine_f32(a21, b03));
+ vst1q_lane_s16((int16_t *) p, vreinterpretq_s16_m128i(a), 0);
}
-FORCE_INLINE __m128 _mm_shuffle_ps_2103(__m128 a, __m128 b)
+// Stores 64-bits of integer data a at the address p.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_si64
+FORCE_INLINE void _mm_storeu_si64(void *p, __m128i a)
{
- float32x2_t a03 = vget_low_f32(
- vextq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 3));
- float32x2_t b21 = vget_high_f32(
- vextq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b), 3));
- return vreinterpretq_m128_f32(vcombine_f32(a03, b21));
+ vst1q_lane_s64((int64_t *) p, vreinterpretq_s64_m128i(a), 0);
}
-FORCE_INLINE __m128 _mm_shuffle_ps_1010(__m128 a, __m128 b)
+// Store 64-bits of integer data from a into memory using a non-temporal memory
+// hint.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_pi
+FORCE_INLINE void _mm_stream_pi(__m64 *p, __m64 a)
{
- float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
- float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(vcombine_f32(a10, b10));
+ vst1_s64((int64_t *) p, vreinterpret_s64_m64(a));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_1001(__m128 a, __m128 b)
+// Store 128-bits (composed of 4 packed single-precision (32-bit) floating-
+// point elements) from a into memory using a non-temporal memory hint.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_ps
+FORCE_INLINE void _mm_stream_ps(float *p, __m128 a)
{
- float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
- float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(vcombine_f32(a01, b10));
+#if __has_builtin(__builtin_nontemporal_store)
+ __builtin_nontemporal_store(a, (float32x4_t *) p);
+#else
+ vst1q_f32(p, vreinterpretq_f32_m128(a));
+#endif
}
-FORCE_INLINE __m128 _mm_shuffle_ps_0101(__m128 a, __m128 b)
+// Subtract packed single-precision (32-bit) floating-point elements in b from
+// packed single-precision (32-bit) floating-point elements in a, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_ps
+FORCE_INLINE __m128 _mm_sub_ps(__m128 a, __m128 b)
{
- float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
- float32x2_t b01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(b)));
- return vreinterpretq_m128_f32(vcombine_f32(a01, b01));
+ return vreinterpretq_m128_f32(
+ vsubq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
}
-// keeps the low 64 bits of b in the low and puts the high 64 bits of a in the
-// high
-FORCE_INLINE __m128 _mm_shuffle_ps_3210(__m128 a, __m128 b)
+// Subtract the lower single-precision (32-bit) floating-point element in b from
+// the lower single-precision (32-bit) floating-point element in a, store the
+// result in the lower element of dst, and copy the upper 3 packed elements from
+// a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_ss
+FORCE_INLINE __m128 _mm_sub_ss(__m128 a, __m128 b)
{
- float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
- float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(vcombine_f32(a10, b32));
+ return _mm_move_ss(a, _mm_sub_ps(a, b));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_0011(__m128 a, __m128 b)
+// Macro: Transpose the 4x4 matrix formed by the 4 rows of single-precision
+// (32-bit) floating-point elements in row0, row1, row2, and row3, and store the
+// transposed matrix in these vectors (row0 now contains column 0, etc.).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=MM_TRANSPOSE4_PS
+#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
+ do { \
+ float32x4x2_t ROW01 = vtrnq_f32(row0, row1); \
+ float32x4x2_t ROW23 = vtrnq_f32(row2, row3); \
+ row0 = vcombine_f32(vget_low_f32(ROW01.val[0]), \
+ vget_low_f32(ROW23.val[0])); \
+ row1 = vcombine_f32(vget_low_f32(ROW01.val[1]), \
+ vget_low_f32(ROW23.val[1])); \
+ row2 = vcombine_f32(vget_high_f32(ROW01.val[0]), \
+ vget_high_f32(ROW23.val[0])); \
+ row3 = vcombine_f32(vget_high_f32(ROW01.val[1]), \
+ vget_high_f32(ROW23.val[1])); \
+ } while (0)
+
+// according to the documentation, these intrinsics behave the same as the
+// non-'u' versions. We'll just alias them here.
+#define _mm_ucomieq_ss _mm_comieq_ss
+#define _mm_ucomige_ss _mm_comige_ss
+#define _mm_ucomigt_ss _mm_comigt_ss
+#define _mm_ucomile_ss _mm_comile_ss
+#define _mm_ucomilt_ss _mm_comilt_ss
+#define _mm_ucomineq_ss _mm_comineq_ss
+
+// Return vector of type __m128i with undefined elements.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_undefined_si128
+FORCE_INLINE __m128i _mm_undefined_si128(void)
{
- float32x2_t a11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 1);
- float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
- return vreinterpretq_m128_f32(vcombine_f32(a11, b00));
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+ __m128i a;
+#if defined(_MSC_VER)
+ a = _mm_setzero_si128();
+#endif
+ return a;
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
}
-FORCE_INLINE __m128 _mm_shuffle_ps_0022(__m128 a, __m128 b)
+// Return vector of type __m128 with undefined elements.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_undefined_ps
+FORCE_INLINE __m128 _mm_undefined_ps(void)
{
- float32x2_t a22 =
- vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0);
- float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
- return vreinterpretq_m128_f32(vcombine_f32(a22, b00));
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+ __m128 a;
+#if defined(_MSC_VER)
+ a = _mm_setzero_ps();
+#endif
+ return a;
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
}
-FORCE_INLINE __m128 _mm_shuffle_ps_2200(__m128 a, __m128 b)
+// Unpack and interleave single-precision (32-bit) floating-point elements from
+// the high half a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_ps
+FORCE_INLINE __m128 _mm_unpackhi_ps(__m128 a, __m128 b)
{
- float32x2_t a00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(a)), 0);
- float32x2_t b22 =
- vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(b)), 0);
- return vreinterpretq_m128_f32(vcombine_f32(a00, b22));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vzip2q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#else
+ float32x2_t a1 = vget_high_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b1 = vget_high_f32(vreinterpretq_f32_m128(b));
+ float32x2x2_t result = vzip_f32(a1, b1);
+ return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1]));
+#endif
}
-FORCE_INLINE __m128 _mm_shuffle_ps_3202(__m128 a, __m128 b)
+// Unpack and interleave single-precision (32-bit) floating-point elements from
+// the low half of a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_ps
+FORCE_INLINE __m128 _mm_unpacklo_ps(__m128 a, __m128 b)
{
- float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
- float32x2_t a22 =
- vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 0);
- float32x2_t a02 = vset_lane_f32(a0, a22, 1); /* TODO: use vzip ?*/
- float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(vcombine_f32(a02, b32));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vzip1q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#else
+ float32x2_t a1 = vget_low_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b1 = vget_low_f32(vreinterpretq_f32_m128(b));
+ float32x2x2_t result = vzip_f32(a1, b1);
+ return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1]));
+#endif
}
-FORCE_INLINE __m128 _mm_shuffle_ps_1133(__m128 a, __m128 b)
+// Compute the bitwise XOR of packed single-precision (32-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_xor_ps
+FORCE_INLINE __m128 _mm_xor_ps(__m128 a, __m128 b)
{
- float32x2_t a33 =
- vdup_lane_f32(vget_high_f32(vreinterpretq_f32_m128(a)), 1);
- float32x2_t b11 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 1);
- return vreinterpretq_m128_f32(vcombine_f32(a33, b11));
+ return vreinterpretq_m128_s32(
+ veorq_s32(vreinterpretq_s32_m128(a), vreinterpretq_s32_m128(b)));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_2010(__m128 a, __m128 b)
+/* SSE2 */
+
+// Add packed 16-bit integers in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_epi16
+FORCE_INLINE __m128i _mm_add_epi16(__m128i a, __m128i b)
{
- float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
- float32_t b2 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 2);
- float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
- float32x2_t b20 = vset_lane_f32(b2, b00, 1);
- return vreinterpretq_m128_f32(vcombine_f32(a10, b20));
+ return vreinterpretq_m128i_s16(
+ vaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_2001(__m128 a, __m128 b)
+// Add packed 32-bit integers in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_epi32
+FORCE_INLINE __m128i _mm_add_epi32(__m128i a, __m128i b)
{
- float32x2_t a01 = vrev64_f32(vget_low_f32(vreinterpretq_f32_m128(a)));
- float32_t b2 = vgetq_lane_f32(b, 2);
- float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
- float32x2_t b20 = vset_lane_f32(b2, b00, 1);
- return vreinterpretq_m128_f32(vcombine_f32(a01, b20));
+ return vreinterpretq_m128i_s32(
+ vaddq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-FORCE_INLINE __m128 _mm_shuffle_ps_2032(__m128 a, __m128 b)
+// Add packed 64-bit integers in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_epi64
+FORCE_INLINE __m128i _mm_add_epi64(__m128i a, __m128i b)
{
- float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
- float32_t b2 = vgetq_lane_f32(b, 2);
- float32x2_t b00 = vdup_lane_f32(vget_low_f32(vreinterpretq_f32_m128(b)), 0);
- float32x2_t b20 = vset_lane_f32(b2, b00, 1);
- return vreinterpretq_m128_f32(vcombine_f32(a32, b20));
+ return vreinterpretq_m128i_s64(
+ vaddq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
}
-// NEON does not support a general purpose permute intrinsic
-// Selects four specific single-precision, floating-point values from a and b,
-// based on the mask i.
-//
-// C equivalent:
-// __m128 _mm_shuffle_ps_default(__m128 a, __m128 b,
-// __constrange(0, 255) int imm) {
-// __m128 ret;
-// ret[0] = a[imm & 0x3]; ret[1] = a[(imm >> 2) & 0x3];
-// ret[2] = b[(imm >> 4) & 0x03]; ret[3] = b[(imm >> 6) & 0x03];
-// return ret;
-// }
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/5f0858x0(v=vs.100).aspx
-#define _mm_shuffle_ps_default(a, b, imm) \
- __extension__({ \
- float32x4_t ret; \
- ret = vmovq_n_f32( \
- vgetq_lane_f32(vreinterpretq_f32_m128(a), (imm) & (0x3))); \
- ret = vsetq_lane_f32( \
- vgetq_lane_f32(vreinterpretq_f32_m128(a), ((imm) >> 2) & 0x3), \
- ret, 1); \
- ret = vsetq_lane_f32( \
- vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 4) & 0x3), \
- ret, 2); \
- ret = vsetq_lane_f32( \
- vgetq_lane_f32(vreinterpretq_f32_m128(b), ((imm) >> 6) & 0x3), \
- ret, 3); \
- vreinterpretq_m128_f32(ret); \
- })
+// Add packed 8-bit integers in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_epi8
+FORCE_INLINE __m128i _mm_add_epi8(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_s8(
+ vaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+}
-// FORCE_INLINE __m128 _mm_shuffle_ps(__m128 a, __m128 b, __constrange(0,255)
-// int imm)
-#if __has_builtin(__builtin_shufflevector)
-#define _mm_shuffle_ps(a, b, imm) \
- __extension__({ \
- float32x4_t _input1 = vreinterpretq_f32_m128(a); \
- float32x4_t _input2 = vreinterpretq_f32_m128(b); \
- float32x4_t _shuf = __builtin_shufflevector( \
- _input1, _input2, (imm) & (0x3), ((imm) >> 2) & 0x3, \
- (((imm) >> 4) & 0x3) + 4, (((imm) >> 6) & 0x3) + 4); \
- vreinterpretq_m128_f32(_shuf); \
- })
-#else // generic
-#define _mm_shuffle_ps(a, b, imm) \
- __extension__({ \
- __m128 ret; \
- switch (imm) { \
- case _MM_SHUFFLE(1, 0, 3, 2): \
- ret = _mm_shuffle_ps_1032((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 3, 0, 1): \
- ret = _mm_shuffle_ps_2301((a), (b)); \
- break; \
- case _MM_SHUFFLE(0, 3, 2, 1): \
- ret = _mm_shuffle_ps_0321((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 1, 0, 3): \
- ret = _mm_shuffle_ps_2103((a), (b)); \
- break; \
- case _MM_SHUFFLE(1, 0, 1, 0): \
- ret = _mm_movelh_ps((a), (b)); \
- break; \
- case _MM_SHUFFLE(1, 0, 0, 1): \
- ret = _mm_shuffle_ps_1001((a), (b)); \
- break; \
- case _MM_SHUFFLE(0, 1, 0, 1): \
- ret = _mm_shuffle_ps_0101((a), (b)); \
- break; \
- case _MM_SHUFFLE(3, 2, 1, 0): \
- ret = _mm_shuffle_ps_3210((a), (b)); \
- break; \
- case _MM_SHUFFLE(0, 0, 1, 1): \
- ret = _mm_shuffle_ps_0011((a), (b)); \
- break; \
- case _MM_SHUFFLE(0, 0, 2, 2): \
- ret = _mm_shuffle_ps_0022((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 2, 0, 0): \
- ret = _mm_shuffle_ps_2200((a), (b)); \
- break; \
- case _MM_SHUFFLE(3, 2, 0, 2): \
- ret = _mm_shuffle_ps_3202((a), (b)); \
- break; \
- case _MM_SHUFFLE(3, 2, 3, 2): \
- ret = _mm_movehl_ps((b), (a)); \
- break; \
- case _MM_SHUFFLE(1, 1, 3, 3): \
- ret = _mm_shuffle_ps_1133((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 0, 1, 0): \
- ret = _mm_shuffle_ps_2010((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 0, 0, 1): \
- ret = _mm_shuffle_ps_2001((a), (b)); \
- break; \
- case _MM_SHUFFLE(2, 0, 3, 2): \
- ret = _mm_shuffle_ps_2032((a), (b)); \
- break; \
- default: \
- ret = _mm_shuffle_ps_default((a), (b), (imm)); \
- break; \
- } \
- ret; \
- })
+// Add packed double-precision (64-bit) floating-point elements in a and b, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_pd
+FORCE_INLINE __m128d _mm_add_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[2];
+ c[0] = da[0] + db[0];
+ c[1] = da[1] + db[1];
+ return vld1q_f32((float32_t *) c);
#endif
+}
-// Takes the upper 64 bits of a and places it in the low end of the result
-// Takes the lower 64 bits of a and places it into the high end of the result.
-FORCE_INLINE __m128i _mm_shuffle_epi_1032(__m128i a)
+// Add the lower double-precision (64-bit) floating-point element in a and b,
+// store the result in the lower element of dst, and copy the upper element from
+// a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_sd
+FORCE_INLINE __m128d _mm_add_sd(__m128d a, __m128d b)
{
- int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a));
- int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
- return vreinterpretq_m128i_s32(vcombine_s32(a32, a10));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_add_pd(a, b));
+#else
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[2];
+ c[0] = da[0] + db[0];
+ c[1] = da[1];
+ return vld1q_f32((float32_t *) c);
+#endif
}
-// takes the lower two 32-bit values from a and swaps them and places in low end
-// of result takes the higher two 32 bit values from a and swaps them and places
-// in high end of result.
-FORCE_INLINE __m128i _mm_shuffle_epi_2301(__m128i a)
+// Add 64-bit integers a and b, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_si64
+FORCE_INLINE __m64 _mm_add_si64(__m64 a, __m64 b)
{
- int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
- int32x2_t a23 = vrev64_s32(vget_high_s32(vreinterpretq_s32_m128i(a)));
- return vreinterpretq_m128i_s32(vcombine_s32(a01, a23));
+ return vreinterpret_m64_s64(
+ vadd_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b)));
}
-// rotates the least significant 32 bits into the most signficant 32 bits, and
-// shifts the rest down
-FORCE_INLINE __m128i _mm_shuffle_epi_0321(__m128i a)
+// Add packed signed 16-bit integers in a and b using saturation, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_adds_epi16
+FORCE_INLINE __m128i _mm_adds_epi16(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_s32(
- vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 1));
+ return vreinterpretq_m128i_s16(
+ vqaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// rotates the most significant 32 bits into the least signficant 32 bits, and
-// shifts the rest up
-FORCE_INLINE __m128i _mm_shuffle_epi_2103(__m128i a)
+// Add packed signed 8-bit integers in a and b using saturation, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_adds_epi8
+FORCE_INLINE __m128i _mm_adds_epi8(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_s32(
- vextq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(a), 3));
+ return vreinterpretq_m128i_s8(
+ vqaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
}
-// gets the lower 64 bits of a, and places it in the upper 64 bits
-// gets the lower 64 bits of a and places it in the lower 64 bits
-FORCE_INLINE __m128i _mm_shuffle_epi_1010(__m128i a)
+// Add packed unsigned 16-bit integers in a and b using saturation, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_adds_epu16
+FORCE_INLINE __m128i _mm_adds_epu16(__m128i a, __m128i b)
{
- int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
- return vreinterpretq_m128i_s32(vcombine_s32(a10, a10));
+ return vreinterpretq_m128i_u16(
+ vqaddq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
}
-// gets the lower 64 bits of a, swaps the 0 and 1 elements, and places it in the
-// lower 64 bits gets the lower 64 bits of a, and places it in the upper 64 bits
-FORCE_INLINE __m128i _mm_shuffle_epi_1001(__m128i a)
+// Add packed unsigned 8-bit integers in a and b using saturation, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_adds_epu8
+FORCE_INLINE __m128i _mm_adds_epu8(__m128i a, __m128i b)
{
- int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
- int32x2_t a10 = vget_low_s32(vreinterpretq_s32_m128i(a));
- return vreinterpretq_m128i_s32(vcombine_s32(a01, a10));
+ return vreinterpretq_m128i_u8(
+ vqaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
}
-// gets the lower 64 bits of a, swaps the 0 and 1 elements and places it in the
-// upper 64 bits gets the lower 64 bits of a, swaps the 0 and 1 elements, and
-// places it in the lower 64 bits
-FORCE_INLINE __m128i _mm_shuffle_epi_0101(__m128i a)
+// Compute the bitwise AND of packed double-precision (64-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_and_pd
+FORCE_INLINE __m128d _mm_and_pd(__m128d a, __m128d b)
{
- int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
- return vreinterpretq_m128i_s32(vcombine_s32(a01, a01));
+ return vreinterpretq_m128d_s64(
+ vandq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b)));
}
-FORCE_INLINE __m128i _mm_shuffle_epi_2211(__m128i a)
+// Compute the bitwise AND of 128 bits (representing integer data) in a and b,
+// and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_and_si128
+FORCE_INLINE __m128i _mm_and_si128(__m128i a, __m128i b)
{
- int32x2_t a11 = vdup_lane_s32(vget_low_s32(vreinterpretq_s32_m128i(a)), 1);
- int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0);
- return vreinterpretq_m128i_s32(vcombine_s32(a11, a22));
+ return vreinterpretq_m128i_s32(
+ vandq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-FORCE_INLINE __m128i _mm_shuffle_epi_0122(__m128i a)
+// Compute the bitwise NOT of packed double-precision (64-bit) floating-point
+// elements in a and then AND with b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_andnot_pd
+FORCE_INLINE __m128d _mm_andnot_pd(__m128d a, __m128d b)
{
- int32x2_t a22 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 0);
- int32x2_t a01 = vrev64_s32(vget_low_s32(vreinterpretq_s32_m128i(a)));
- return vreinterpretq_m128i_s32(vcombine_s32(a22, a01));
+ // *NOTE* argument swap
+ return vreinterpretq_m128d_s64(
+ vbicq_s64(vreinterpretq_s64_m128d(b), vreinterpretq_s64_m128d(a)));
}
-FORCE_INLINE __m128i _mm_shuffle_epi_3332(__m128i a)
+// Compute the bitwise NOT of 128 bits (representing integer data) in a and then
+// AND with b, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_andnot_si128
+FORCE_INLINE __m128i _mm_andnot_si128(__m128i a, __m128i b)
{
- int32x2_t a32 = vget_high_s32(vreinterpretq_s32_m128i(a));
- int32x2_t a33 = vdup_lane_s32(vget_high_s32(vreinterpretq_s32_m128i(a)), 1);
- return vreinterpretq_m128i_s32(vcombine_s32(a32, a33));
+ return vreinterpretq_m128i_s32(
+ vbicq_s32(vreinterpretq_s32_m128i(b),
+ vreinterpretq_s32_m128i(a))); // *NOTE* argument swap
}
-// Shuffle packed 8-bit integers in a according to shuffle control mask in the
-// corresponding 8-bit element of b, and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_epi8
-FORCE_INLINE __m128i _mm_shuffle_epi8(__m128i a, __m128i b)
+// Average packed unsigned 16-bit integers in a and b, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_avg_epu16
+FORCE_INLINE __m128i _mm_avg_epu16(__m128i a, __m128i b)
{
- int8x16_t tbl = vreinterpretq_s8_m128i(a); // input a
- uint8x16_t idx = vreinterpretq_u8_m128i(b); // input b
- uint8x16_t idx_masked =
- vandq_u8(idx, vdupq_n_u8(0x8F)); // avoid using meaningless bits
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s8(vqtbl1q_s8(tbl, idx_masked));
-#elif defined(__GNUC__)
- int8x16_t ret;
- // %e and %f represent the even and odd D registers
- // respectively.
- __asm__ __volatile__(
- "vtbl.8 %e[ret], {%e[tbl], %f[tbl]}, %e[idx]\n"
- "vtbl.8 %f[ret], {%e[tbl], %f[tbl]}, %f[idx]\n"
- : [ret] "=&w"(ret)
- : [tbl] "w"(tbl), [idx] "w"(idx_masked));
- return vreinterpretq_m128i_s8(ret);
-#else
- // use this line if testing on aarch64
- int8x8x2_t a_split = {vget_low_s8(tbl), vget_high_s8(tbl)};
- return vreinterpretq_m128i_s8(
- vcombine_s8(vtbl2_s8(a_split, vget_low_u8(idx_masked)),
- vtbl2_s8(a_split, vget_high_u8(idx_masked))));
-#endif
+ return (__m128i) vrhaddq_u16(vreinterpretq_u16_m128i(a),
+ vreinterpretq_u16_m128i(b));
}
-// C equivalent:
-// __m128i _mm_shuffle_epi32_default(__m128i a,
-// __constrange(0, 255) int imm) {
-// __m128i ret;
-// ret[0] = a[imm & 0x3]; ret[1] = a[(imm >> 2) & 0x3];
-// ret[2] = a[(imm >> 4) & 0x03]; ret[3] = a[(imm >> 6) & 0x03];
-// return ret;
-// }
-#define _mm_shuffle_epi32_default(a, imm) \
- __extension__({ \
- int32x4_t ret; \
- ret = vmovq_n_s32( \
- vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm) & (0x3))); \
- ret = vsetq_lane_s32( \
- vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 2) & 0x3), \
- ret, 1); \
- ret = vsetq_lane_s32( \
- vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 4) & 0x3), \
- ret, 2); \
- ret = vsetq_lane_s32( \
- vgetq_lane_s32(vreinterpretq_s32_m128i(a), ((imm) >> 6) & 0x3), \
- ret, 3); \
- vreinterpretq_m128i_s32(ret); \
- })
-
-// FORCE_INLINE __m128i _mm_shuffle_epi32_splat(__m128i a, __constrange(0,255)
-// int imm)
-#if defined(__aarch64__)
-#define _mm_shuffle_epi32_splat(a, imm) \
- __extension__({ \
- vreinterpretq_m128i_s32( \
- vdupq_laneq_s32(vreinterpretq_s32_m128i(a), (imm))); \
- })
-#else
-#define _mm_shuffle_epi32_splat(a, imm) \
- __extension__({ \
- vreinterpretq_m128i_s32( \
- vdupq_n_s32(vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm)))); \
- })
-#endif
-
-// Shuffles the 4 signed or unsigned 32-bit integers in a as specified by imm.
-// https://msdn.microsoft.com/en-us/library/56f67xbk%28v=vs.90%29.aspx
-// FORCE_INLINE __m128i _mm_shuffle_epi32(__m128i a,
-// __constrange(0,255) int imm)
-#if __has_builtin(__builtin_shufflevector)
-#define _mm_shuffle_epi32(a, imm) \
- __extension__({ \
- int32x4_t _input = vreinterpretq_s32_m128i(a); \
- int32x4_t _shuf = __builtin_shufflevector( \
- _input, _input, (imm) & (0x3), ((imm) >> 2) & 0x3, \
- ((imm) >> 4) & 0x3, ((imm) >> 6) & 0x3); \
- vreinterpretq_m128i_s32(_shuf); \
- })
-#else // generic
-#define _mm_shuffle_epi32(a, imm) \
- __extension__({ \
- __m128i ret; \
- switch (imm) { \
- case _MM_SHUFFLE(1, 0, 3, 2): \
- ret = _mm_shuffle_epi_1032((a)); \
- break; \
- case _MM_SHUFFLE(2, 3, 0, 1): \
- ret = _mm_shuffle_epi_2301((a)); \
- break; \
- case _MM_SHUFFLE(0, 3, 2, 1): \
- ret = _mm_shuffle_epi_0321((a)); \
- break; \
- case _MM_SHUFFLE(2, 1, 0, 3): \
- ret = _mm_shuffle_epi_2103((a)); \
- break; \
- case _MM_SHUFFLE(1, 0, 1, 0): \
- ret = _mm_shuffle_epi_1010((a)); \
- break; \
- case _MM_SHUFFLE(1, 0, 0, 1): \
- ret = _mm_shuffle_epi_1001((a)); \
- break; \
- case _MM_SHUFFLE(0, 1, 0, 1): \
- ret = _mm_shuffle_epi_0101((a)); \
- break; \
- case _MM_SHUFFLE(2, 2, 1, 1): \
- ret = _mm_shuffle_epi_2211((a)); \
- break; \
- case _MM_SHUFFLE(0, 1, 2, 2): \
- ret = _mm_shuffle_epi_0122((a)); \
- break; \
- case _MM_SHUFFLE(3, 3, 3, 2): \
- ret = _mm_shuffle_epi_3332((a)); \
- break; \
- case _MM_SHUFFLE(0, 0, 0, 0): \
- ret = _mm_shuffle_epi32_splat((a), 0); \
- break; \
- case _MM_SHUFFLE(1, 1, 1, 1): \
- ret = _mm_shuffle_epi32_splat((a), 1); \
- break; \
- case _MM_SHUFFLE(2, 2, 2, 2): \
- ret = _mm_shuffle_epi32_splat((a), 2); \
- break; \
- case _MM_SHUFFLE(3, 3, 3, 3): \
- ret = _mm_shuffle_epi32_splat((a), 3); \
- break; \
- default: \
- ret = _mm_shuffle_epi32_default((a), (imm)); \
- break; \
- } \
- ret; \
- })
-#endif
-
-// Shuffles the lower 4 signed or unsigned 16-bit integers in a as specified
-// by imm.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/y41dkk37(v=vs.100)
-// FORCE_INLINE __m128i _mm_shufflelo_epi16_function(__m128i a,
-// __constrange(0,255) int
-// imm)
-#define _mm_shufflelo_epi16_function(a, imm) \
- __extension__({ \
- int16x8_t ret = vreinterpretq_s16_m128i(a); \
- int16x4_t lowBits = vget_low_s16(ret); \
- ret = vsetq_lane_s16(vget_lane_s16(lowBits, (imm) & (0x3)), ret, 0); \
- ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 2) & 0x3), ret, \
- 1); \
- ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 4) & 0x3), ret, \
- 2); \
- ret = vsetq_lane_s16(vget_lane_s16(lowBits, ((imm) >> 6) & 0x3), ret, \
- 3); \
- vreinterpretq_m128i_s16(ret); \
- })
-
-// FORCE_INLINE __m128i _mm_shufflelo_epi16(__m128i a,
-// __constrange(0,255) int imm)
-#if __has_builtin(__builtin_shufflevector)
-#define _mm_shufflelo_epi16(a, imm) \
- __extension__({ \
- int16x8_t _input = vreinterpretq_s16_m128i(a); \
- int16x8_t _shuf = __builtin_shufflevector( \
- _input, _input, ((imm) & (0x3)), (((imm) >> 2) & 0x3), \
- (((imm) >> 4) & 0x3), (((imm) >> 6) & 0x3), 4, 5, 6, 7); \
- vreinterpretq_m128i_s16(_shuf); \
- })
-#else // generic
-#define _mm_shufflelo_epi16(a, imm) _mm_shufflelo_epi16_function((a), (imm))
-#endif
-
-// Shuffles the upper 4 signed or unsigned 16-bit integers in a as specified
-// by imm.
-// https://msdn.microsoft.com/en-us/library/13ywktbs(v=vs.100).aspx
-// FORCE_INLINE __m128i _mm_shufflehi_epi16_function(__m128i a,
-// __constrange(0,255) int
-// imm)
-#define _mm_shufflehi_epi16_function(a, imm) \
- __extension__({ \
- int16x8_t ret = vreinterpretq_s16_m128i(a); \
- int16x4_t highBits = vget_high_s16(ret); \
- ret = vsetq_lane_s16(vget_lane_s16(highBits, (imm) & (0x3)), ret, 4); \
- ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 2) & 0x3), ret, \
- 5); \
- ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 4) & 0x3), ret, \
- 6); \
- ret = vsetq_lane_s16(vget_lane_s16(highBits, ((imm) >> 6) & 0x3), ret, \
- 7); \
- vreinterpretq_m128i_s16(ret); \
- })
-
-// FORCE_INLINE __m128i _mm_shufflehi_epi16(__m128i a,
-// __constrange(0,255) int imm)
-#if __has_builtin(__builtin_shufflevector)
-#define _mm_shufflehi_epi16(a, imm) \
- __extension__({ \
- int16x8_t _input = vreinterpretq_s16_m128i(a); \
- int16x8_t _shuf = __builtin_shufflevector( \
- _input, _input, 0, 1, 2, 3, ((imm) & (0x3)) + 4, \
- (((imm) >> 2) & 0x3) + 4, (((imm) >> 4) & 0x3) + 4, \
- (((imm) >> 6) & 0x3) + 4); \
- vreinterpretq_m128i_s16(_shuf); \
- })
-#else // generic
-#define _mm_shufflehi_epi16(a, imm) _mm_shufflehi_epi16_function((a), (imm))
-#endif
-
-// Blend packed 16-bit integers from a and b using control mask imm8, and store
-// the results in dst.
-//
-// FOR j := 0 to 7
-// i := j*16
-// IF imm8[j]
-// dst[i+15:i] := b[i+15:i]
-// ELSE
-// dst[i+15:i] := a[i+15:i]
-// FI
-// ENDFOR
-// FORCE_INLINE __m128i _mm_blend_epi16(__m128i a, __m128i b,
-// __constrange(0,255) int imm)
-#define _mm_blend_epi16(a, b, imm) \
- __extension__({ \
- const uint16_t _mask[8] = {((imm) & (1 << 0)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 1)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 2)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 3)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 4)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 5)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 6)) ? 0xFFFF : 0x0000, \
- ((imm) & (1 << 7)) ? 0xFFFF : 0x0000}; \
- uint16x8_t _mask_vec = vld1q_u16(_mask); \
- uint16x8_t _a = vreinterpretq_u16_m128i(a); \
- uint16x8_t _b = vreinterpretq_u16_m128i(b); \
- vreinterpretq_m128i_u16(vbslq_u16(_mask_vec, _b, _a)); \
- })
-
-// Blend packed 8-bit integers from a and b using mask, and store the results in
+// Average packed unsigned 8-bit integers in a and b, and store the results in
// dst.
-//
-// FOR j := 0 to 15
-// i := j*8
-// IF mask[i+7]
-// dst[i+7:i] := b[i+7:i]
-// ELSE
-// dst[i+7:i] := a[i+7:i]
-// FI
-// ENDFOR
-FORCE_INLINE __m128i _mm_blendv_epi8(__m128i _a, __m128i _b, __m128i _mask)
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_avg_epu8
+FORCE_INLINE __m128i _mm_avg_epu8(__m128i a, __m128i b)
{
- // Use a signed shift right to create a mask with the sign bit
- uint8x16_t mask =
- vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_m128i(_mask), 7));
- uint8x16_t a = vreinterpretq_u8_m128i(_a);
- uint8x16_t b = vreinterpretq_u8_m128i(_b);
- return vreinterpretq_m128i_u8(vbslq_u8(mask, b, a));
+ return vreinterpretq_m128i_u8(
+ vrhaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
}
-/* Shifts */
+// Shift a left by imm8 bytes while shifting in zeros, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_bslli_si128
+#define _mm_bslli_si128(a, imm) _mm_slli_si128(a, imm)
+
+// Shift a right by imm8 bytes while shifting in zeros, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_bsrli_si128
+#define _mm_bsrli_si128(a, imm) _mm_srli_si128(a, imm)
+// Cast vector of type __m128d to type __m128. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castpd_ps
+FORCE_INLINE __m128 _mm_castpd_ps(__m128d a)
+{
+ return vreinterpretq_m128_s64(vreinterpretq_s64_m128d(a));
+}
-// Shift packed 16-bit integers in a right by imm while shifting in sign
-// bits, and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi16
-FORCE_INLINE __m128i _mm_srai_epi16(__m128i a, int imm)
+// Cast vector of type __m128d to type __m128i. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castpd_si128
+FORCE_INLINE __m128i _mm_castpd_si128(__m128d a)
{
- const int count = (imm & ~15) ? 15 : imm;
- return (__m128i) vshlq_s16((int16x8_t) a, vdupq_n_s16(-count));
+ return vreinterpretq_m128i_s64(vreinterpretq_s64_m128d(a));
}
-// Shifts the 8 signed or unsigned 16-bit integers in a left by count bits while
-// shifting in zeros.
-//
-// r0 := a0 << count
-// r1 := a1 << count
-// ...
-// r7 := a7 << count
-//
-// https://msdn.microsoft.com/en-us/library/es73bcsy(v=vs.90).aspx
-#define _mm_slli_epi16(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) <= 0) { \
- ret = a; \
- } else if ((imm) > 15) { \
- ret = _mm_setzero_si128(); \
- } else { \
- ret = vreinterpretq_m128i_s16( \
- vshlq_n_s16(vreinterpretq_s16_m128i(a), (imm))); \
- } \
- ret; \
- })
+// Cast vector of type __m128 to type __m128d. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castps_pd
+FORCE_INLINE __m128d _mm_castps_pd(__m128 a)
+{
+ return vreinterpretq_m128d_s32(vreinterpretq_s32_m128(a));
+}
-// Shifts the 4 signed or unsigned 32-bit integers in a left by count bits while
-// shifting in zeros. :
-// https://msdn.microsoft.com/en-us/library/z2k3bbtb%28v=vs.90%29.aspx
-// FORCE_INLINE __m128i _mm_slli_epi32(__m128i a, __constrange(0,255) int imm)
-FORCE_INLINE __m128i _mm_slli_epi32(__m128i a, int imm)
+// Cast vector of type __m128 to type __m128i. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castps_si128
+FORCE_INLINE __m128i _mm_castps_si128(__m128 a)
{
- if (imm <= 0) /* TODO: add constant range macro: [0, 255] */
- return a;
- if (imm > 31) /* TODO: add unlikely macro */
- return _mm_setzero_si128();
- return vreinterpretq_m128i_s32(
- vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(imm)));
+ return vreinterpretq_m128i_s32(vreinterpretq_s32_m128(a));
}
-// Shift packed 64-bit integers in a left by imm8 while shifting in zeros, and
-// store the results in dst.
-FORCE_INLINE __m128i _mm_slli_epi64(__m128i a, int imm)
+// Cast vector of type __m128i to type __m128d. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castsi128_pd
+FORCE_INLINE __m128d _mm_castsi128_pd(__m128i a)
{
- if (imm <= 0) /* TODO: add constant range macro: [0, 255] */
- return a;
- if (imm > 63) /* TODO: add unlikely macro */
- return _mm_setzero_si128();
- return vreinterpretq_m128i_s64(
- vshlq_s64(vreinterpretq_s64_m128i(a), vdupq_n_s64(imm)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vreinterpretq_f64_m128i(a));
+#else
+ return vreinterpretq_m128d_f32(vreinterpretq_f32_m128i(a));
+#endif
}
-// Shift packed 16-bit integers in a right by imm8 while shifting in zeros, and
-// store the results in dst.
-//
-// FOR j := 0 to 7
-// i := j*16
-// IF imm8[7:0] > 15
-// dst[i+15:i] := 0
-// ELSE
-// dst[i+15:i] := ZeroExtend16(a[i+15:i] >> imm8[7:0])
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi16
-#define _mm_srli_epi16(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) == 0) { \
- ret = a; \
- } else if (0 < (imm) && (imm) < 16) { \
- ret = vreinterpretq_m128i_u16( \
- vshlq_u16(vreinterpretq_u16_m128i(a), vdupq_n_s16(-imm))); \
- } else { \
- ret = _mm_setzero_si128(); \
- } \
- ret; \
- })
+// Cast vector of type __m128i to type __m128. This intrinsic is only used for
+// compilation and does not generate any instructions, thus it has zero latency.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_castsi128_ps
+FORCE_INLINE __m128 _mm_castsi128_ps(__m128i a)
+{
+ return vreinterpretq_m128_s32(vreinterpretq_s32_m128i(a));
+}
-// Shift packed 32-bit integers in a right by imm8 while shifting in zeros, and
-// store the results in dst.
-//
-// FOR j := 0 to 3
-// i := j*32
-// IF imm8[7:0] > 31
-// dst[i+31:i] := 0
-// ELSE
-// dst[i+31:i] := ZeroExtend32(a[i+31:i] >> imm8[7:0])
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi32
-// FORCE_INLINE __m128i _mm_srli_epi32(__m128i a, __constrange(0,255) int imm)
-#define _mm_srli_epi32(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) == 0) { \
- ret = a; \
- } else if (0 < (imm) && (imm) < 32) { \
- ret = vreinterpretq_m128i_u32( \
- vshlq_u32(vreinterpretq_u32_m128i(a), vdupq_n_s32(-imm))); \
- } else { \
- ret = _mm_setzero_si128(); \
- } \
- ret; \
- })
+// Invalidate and flush the cache line that contains p from all levels of the
+// cache hierarchy.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_clflush
+#if defined(__APPLE__)
+#include
+#endif
+FORCE_INLINE void _mm_clflush(void const *p)
+{
+ (void) p;
-// Shift packed 64-bit integers in a right by imm8 while shifting in zeros, and
-// store the results in dst.
-//
-// FOR j := 0 to 1
-// i := j*64
-// IF imm8[7:0] > 63
-// dst[i+63:i] := 0
-// ELSE
-// dst[i+63:i] := ZeroExtend64(a[i+63:i] >> imm8[7:0])
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srli_epi64
-#define _mm_srli_epi64(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) == 0) { \
- ret = a; \
- } else if (0 < (imm) && (imm) < 64) { \
- ret = vreinterpretq_m128i_u64( \
- vshlq_u64(vreinterpretq_u64_m128i(a), vdupq_n_s64(-imm))); \
- } else { \
- ret = _mm_setzero_si128(); \
- } \
- ret; \
- })
+ /* sys_icache_invalidate is supported since macOS 10.5.
+ * However, it does not work on non-jailbroken iOS devices, although the
+ * compilation is successful.
+ */
+#if defined(__APPLE__)
+ sys_icache_invalidate((void *) (uintptr_t) p, SSE2NEON_CACHELINE_SIZE);
+#elif defined(__GNUC__) || defined(__clang__)
+ uintptr_t ptr = (uintptr_t) p;
+ __builtin___clear_cache((char *) ptr,
+ (char *) ptr + SSE2NEON_CACHELINE_SIZE);
+#elif (_MSC_VER) && SSE2NEON_INCLUDE_WINDOWS_H
+ FlushInstructionCache(GetCurrentProcess(), p, SSE2NEON_CACHELINE_SIZE);
+#endif
+}
-// Shift packed 32-bit integers in a right by imm8 while shifting in sign bits,
-// and store the results in dst.
-//
-// FOR j := 0 to 3
-// i := j*32
-// IF imm8[7:0] > 31
-// dst[i+31:i] := (a[i+31] ? 0xFFFFFFFF : 0x0)
-// ELSE
-// dst[i+31:i] := SignExtend32(a[i+31:i] >> imm8[7:0])
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_srai_epi32
-// FORCE_INLINE __m128i _mm_srai_epi32(__m128i a, __constrange(0,255) int imm)
-#define _mm_srai_epi32(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) == 0) { \
- ret = a; \
- } else if (0 < (imm) && (imm) < 32) { \
- ret = vreinterpretq_m128i_s32( \
- vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(-imm))); \
- } else { \
- ret = vreinterpretq_m128i_s32( \
- vshrq_n_s32(vreinterpretq_s32_m128i(a), 31)); \
- } \
- ret; \
- })
+// Compare packed 16-bit integers in a and b for equality, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_epi16
+FORCE_INLINE __m128i _mm_cmpeq_epi16(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u16(
+ vceqq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+}
-// Shifts the 128 - bit value in a right by imm bytes while shifting in
-// zeros.imm must be an immediate.
-//
-// r := srl(a, imm*8)
-//
-// https://msdn.microsoft.com/en-us/library/305w28yz(v=vs.100).aspx
-// FORCE_INLINE _mm_srli_si128(__m128i a, __constrange(0,255) int imm)
-#define _mm_srli_si128(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) <= 0) { \
- ret = a; \
- } else if ((imm) > 15) { \
- ret = _mm_setzero_si128(); \
- } else { \
- ret = vreinterpretq_m128i_s8( \
- vextq_s8(vreinterpretq_s8_m128i(a), vdupq_n_s8(0), (imm))); \
- } \
- ret; \
- })
+// Compare packed 32-bit integers in a and b for equality, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_epi32
+FORCE_INLINE __m128i _mm_cmpeq_epi32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u32(
+ vceqq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+}
-// Shifts the 128-bit value in a left by imm bytes while shifting in zeros. imm
-// must be an immediate.
-//
-// r := a << (imm * 8)
-//
-// https://msdn.microsoft.com/en-us/library/34d3k2kt(v=vs.100).aspx
-// FORCE_INLINE __m128i _mm_slli_si128(__m128i a, __constrange(0,255) int imm)
-#define _mm_slli_si128(a, imm) \
- __extension__({ \
- __m128i ret; \
- if ((imm) <= 0) { \
- ret = a; \
- } else if ((imm) > 15) { \
- ret = _mm_setzero_si128(); \
- } else { \
- ret = vreinterpretq_m128i_s8(vextq_s8( \
- vdupq_n_s8(0), vreinterpretq_s8_m128i(a), 16 - (imm))); \
- } \
- ret; \
- })
+// Compare packed 8-bit integers in a and b for equality, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_epi8
+FORCE_INLINE __m128i _mm_cmpeq_epi8(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u8(
+ vceqq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+}
-// Shifts the 8 signed or unsigned 16-bit integers in a left by count bits while
-// shifting in zeros.
-//
-// r0 := a0 << count
-// r1 := a1 << count
-// ...
-// r7 := a7 << count
-//
-// https://msdn.microsoft.com/en-us/library/c79w388h(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_sll_epi16(__m128i a, __m128i count)
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for equality, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_pd
+FORCE_INLINE __m128d _mm_cmpeq_pd(__m128d a, __m128d b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 15)
- return _mm_setzero_si128();
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(
+ vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi)
+ uint32x4_t cmp =
+ vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b));
+ uint32x4_t swapped = vrev64q_u32(cmp);
+ return vreinterpretq_m128d_u32(vandq_u32(cmp, swapped));
+#endif
+}
- int16x8_t vc = vdupq_n_s16((int16_t) c);
- return vreinterpretq_m128i_s16(vshlq_s16(vreinterpretq_s16_m128i(a), vc));
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for equality, store the result in the lower element of dst, and copy the
+// upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpeq_sd
+FORCE_INLINE __m128d _mm_cmpeq_sd(__m128d a, __m128d b)
+{
+ return _mm_move_sd(a, _mm_cmpeq_pd(a, b));
}
-// Shifts the 4 signed or unsigned 32-bit integers in a left by count bits while
-// shifting in zeros.
-//
-// r0 := a0 << count
-// r1 := a1 << count
-// r2 := a2 << count
-// r3 := a3 << count
-//
-// https://msdn.microsoft.com/en-us/library/6fe5a6s9(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_sll_epi32(__m128i a, __m128i count)
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for greater-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpge_pd
+FORCE_INLINE __m128d _mm_cmpge_pd(__m128d a, __m128d b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 31)
- return _mm_setzero_si128();
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(
+ vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) >= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = (*(double *) &a1) >= (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- int32x4_t vc = vdupq_n_s32((int32_t) c);
- return vreinterpretq_m128i_s32(vshlq_s32(vreinterpretq_s32_m128i(a), vc));
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for greater-than-or-equal, store the result in the lower element of dst,
+// and copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpge_sd
+FORCE_INLINE __m128d _mm_cmpge_sd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmpge_pd(a, b));
+#else
+ // expand "_mm_cmpge_pd()" to reduce unnecessary operations
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) >= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Shifts the 2 signed or unsigned 64-bit integers in a left by count bits while
-// shifting in zeros.
-//
-// r0 := a0 << count
-// r1 := a1 << count
-//
-// https://msdn.microsoft.com/en-us/library/6ta9dffd(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_sll_epi64(__m128i a, __m128i count)
+// Compare packed signed 16-bit integers in a and b for greater-than, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_epi16
+FORCE_INLINE __m128i _mm_cmpgt_epi16(__m128i a, __m128i b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 63)
- return _mm_setzero_si128();
+ return vreinterpretq_m128i_u16(
+ vcgtq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+}
- int64x2_t vc = vdupq_n_s64((int64_t) c);
- return vreinterpretq_m128i_s64(vshlq_s64(vreinterpretq_s64_m128i(a), vc));
+// Compare packed signed 32-bit integers in a and b for greater-than, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_epi32
+FORCE_INLINE __m128i _mm_cmpgt_epi32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u32(
+ vcgtq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-// Shifts the 8 signed or unsigned 16-bit integers in a right by count bits
-// while shifting in zeros.
-//
-// r0 := srl(a0, count)
-// r1 := srl(a1, count)
-// ...
-// r7 := srl(a7, count)
-//
-// https://msdn.microsoft.com/en-us/library/wd5ax830(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_srl_epi16(__m128i a, __m128i count)
+// Compare packed signed 8-bit integers in a and b for greater-than, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_epi8
+FORCE_INLINE __m128i _mm_cmpgt_epi8(__m128i a, __m128i b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 15)
- return _mm_setzero_si128();
+ return vreinterpretq_m128i_u8(
+ vcgtq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+}
- int16x8_t vc = vdupq_n_s16(-(int16_t) c);
- return vreinterpretq_m128i_u16(vshlq_u16(vreinterpretq_u16_m128i(a), vc));
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for greater-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_pd
+FORCE_INLINE __m128d _mm_cmpgt_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(
+ vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) > (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = (*(double *) &a1) > (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Shifts the 4 signed or unsigned 32-bit integers in a right by count bits
-// while shifting in zeros.
-//
-// r0 := srl(a0, count)
-// r1 := srl(a1, count)
-// r2 := srl(a2, count)
-// r3 := srl(a3, count)
-//
-// https://msdn.microsoft.com/en-us/library/a9cbttf4(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_srl_epi32(__m128i a, __m128i count)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for greater-than, store the result in the lower element of dst, and copy
+// the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpgt_sd
+FORCE_INLINE __m128d _mm_cmpgt_sd(__m128d a, __m128d b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 31)
- return _mm_setzero_si128();
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmpgt_pd(a, b));
+#else
+ // expand "_mm_cmpge_pd()" to reduce unnecessary operations
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) > (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- int32x4_t vc = vdupq_n_s32(-(int32_t) c);
- return vreinterpretq_m128i_u32(vshlq_u32(vreinterpretq_u32_m128i(a), vc));
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for less-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmple_pd
+FORCE_INLINE __m128d _mm_cmple_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(
+ vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) <= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = (*(double *) &a1) <= (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Shifts the 2 signed or unsigned 64-bit integers in a right by count bits
-// while shifting in zeros.
-//
-// r0 := srl(a0, count)
-// r1 := srl(a1, count)
-//
-// https://msdn.microsoft.com/en-us/library/yf6cf9k8(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for less-than-or-equal, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmple_sd
+FORCE_INLINE __m128d _mm_cmple_sd(__m128d a, __m128d b)
{
- uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
- if (c > 63)
- return _mm_setzero_si128();
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmple_pd(a, b));
+#else
+ // expand "_mm_cmpge_pd()" to reduce unnecessary operations
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) <= (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- int64x2_t vc = vdupq_n_s64(-(int64_t) c);
- return vreinterpretq_m128i_u64(vshlq_u64(vreinterpretq_u64_m128i(a), vc));
+// Compare packed signed 16-bit integers in a and b for less-than, and store the
+// results in dst. Note: This intrinsic emits the pcmpgtw instruction with the
+// order of the operands switched.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_epi16
+FORCE_INLINE __m128i _mm_cmplt_epi16(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u16(
+ vcltq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// NEON does not provide a version of this function.
-// Creates a 16-bit mask from the most significant bits of the 16 signed or
-// unsigned 8-bit integers in a and zero extends the upper bits.
-// https://msdn.microsoft.com/en-us/library/vstudio/s090c8fk(v=vs.100).aspx
-FORCE_INLINE int _mm_movemask_epi8(__m128i a)
+// Compare packed signed 32-bit integers in a and b for less-than, and store the
+// results in dst. Note: This intrinsic emits the pcmpgtd instruction with the
+// order of the operands switched.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_epi32
+FORCE_INLINE __m128i _mm_cmplt_epi32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- uint8x16_t input = vreinterpretq_u8_m128i(a);
- const int8_t ALIGN_STRUCT(16)
- xr[16] = {-7, -6, -5, -4, -3, -2, -1, 0, -7, -6, -5, -4, -3, -2, -1, 0};
- const uint8x16_t mask_and = vdupq_n_u8(0x80);
- const int8x16_t mask_shift = vld1q_s8(xr);
- const uint8x16_t mask_result =
- vshlq_u8(vandq_u8(input, mask_and), mask_shift);
- uint8x8_t lo = vget_low_u8(mask_result);
- uint8x8_t hi = vget_high_u8(mask_result);
+ return vreinterpretq_m128i_u32(
+ vcltq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+}
+
+// Compare packed signed 8-bit integers in a and b for less-than, and store the
+// results in dst. Note: This intrinsic emits the pcmpgtb instruction with the
+// order of the operands switched.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_epi8
+FORCE_INLINE __m128i _mm_cmplt_epi8(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u8(
+ vcltq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+}
- return vaddv_u8(lo) + (vaddv_u8(hi) << 8);
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for less-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_pd
+FORCE_INLINE __m128d _mm_cmplt_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(
+ vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
#else
- // Use increasingly wide shifts+adds to collect the sign bits
- // together.
- // Since the widening shifts would be rather confusing to follow in little
- // endian, everything will be illustrated in big endian order instead. This
- // has a different result - the bits would actually be reversed on a big
- // endian machine.
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) < (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = (*(double *) &a1) < (*(double *) &b1) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- // Starting input (only half the elements are shown):
- // 89 ff 1d c0 00 10 99 33
- uint8x16_t input = vreinterpretq_u8_m128i(a);
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for less-than, store the result in the lower element of dst, and copy the
+// upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmplt_sd
+FORCE_INLINE __m128d _mm_cmplt_sd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmplt_pd(a, b));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) < (*(double *) &b0) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- // Shift out everything but the sign bits with an unsigned shift right.
- //
- // Bytes of the vector::
- // 89 ff 1d c0 00 10 99 33
- // \ \ \ \ \ \ \ \ high_bits = (uint16x4_t)(input >> 7)
- // | | | | | | | |
- // 01 01 00 01 00 00 01 00
- //
- // Bits of first important lane(s):
- // 10001001 (89)
- // \______
- // |
- // 00000001 (01)
- uint16x8_t high_bits = vreinterpretq_u16_u8(vshrq_n_u8(input, 7));
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for not-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpneq_pd
+FORCE_INLINE __m128d _mm_cmpneq_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_s32(vmvnq_s32(vreinterpretq_s32_u64(
+ vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)))));
+#else
+ // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi)
+ uint32x4_t cmp =
+ vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b));
+ uint32x4_t swapped = vrev64q_u32(cmp);
+ return vreinterpretq_m128d_u32(vmvnq_u32(vandq_u32(cmp, swapped)));
+#endif
+}
- // Merge the even lanes together with a 16-bit unsigned shift right + add.
- // 'xx' represents garbage data which will be ignored in the final result.
- // In the important bytes, the add functions like a binary OR.
- //
- // 01 01 00 01 00 00 01 00
- // \_ | \_ | \_ | \_ | paired16 = (uint32x4_t)(input + (input >> 7))
- // \| \| \| \|
- // xx 03 xx 01 xx 00 xx 02
- //
- // 00000001 00000001 (01 01)
- // \_______ |
- // \|
- // xxxxxxxx xxxxxx11 (xx 03)
- uint32x4_t paired16 =
- vreinterpretq_u32_u16(vsraq_n_u16(high_bits, high_bits, 7));
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for not-equal, store the result in the lower element of dst, and copy the
+// upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpneq_sd
+FORCE_INLINE __m128d _mm_cmpneq_sd(__m128d a, __m128d b)
+{
+ return _mm_move_sd(a, _mm_cmpneq_pd(a, b));
+}
- // Repeat with a wider 32-bit shift + add.
- // xx 03 xx 01 xx 00 xx 02
- // \____ | \____ | paired32 = (uint64x1_t)(paired16 + (paired16 >>
- // 14))
- // \| \|
- // xx xx xx 0d xx xx xx 02
- //
- // 00000011 00000001 (03 01)
- // \\_____ ||
- // '----.\||
- // xxxxxxxx xxxx1101 (xx 0d)
- uint64x2_t paired32 =
- vreinterpretq_u64_u32(vsraq_n_u32(paired16, paired16, 14));
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for not-greater-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnge_pd
+FORCE_INLINE __m128d _mm_cmpnge_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(veorq_u64(
+ vcgeq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)),
+ vdupq_n_u64(UINT64_MAX)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] =
+ !((*(double *) &a0) >= (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] =
+ !((*(double *) &a1) >= (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
+}
- // Last, an even wider 64-bit shift + add to get our result in the low 8 bit
- // lanes. xx xx xx 0d xx xx xx 02
- // \_________ | paired64 = (uint8x8_t)(paired32 + (paired32 >>
- // 28))
- // \|
- // xx xx xx xx xx xx xx d2
- //
- // 00001101 00000010 (0d 02)
- // \ \___ | |
- // '---. \| |
- // xxxxxxxx 11010010 (xx d2)
- uint8x16_t paired64 =
- vreinterpretq_u8_u64(vsraq_n_u64(paired32, paired32, 28));
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for not-greater-than-or-equal, store the result in the lower element of
+// dst, and copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnge_sd
+FORCE_INLINE __m128d _mm_cmpnge_sd(__m128d a, __m128d b)
+{
+ return _mm_move_sd(a, _mm_cmpnge_pd(a, b));
+}
- // Extract the low 8 bits from each 64-bit lane with 2 8-bit extracts.
- // xx xx xx xx xx xx xx d2
- // || return paired64[0]
- // d2
- // Note: Little endian would return the correct value 4b (01001011) instead.
- return vgetq_lane_u8(paired64, 0) | ((int) vgetq_lane_u8(paired64, 8) << 8);
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for not-greater-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_cmpngt_pd
+FORCE_INLINE __m128d _mm_cmpngt_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(veorq_u64(
+ vcgtq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)),
+ vdupq_n_u64(UINT64_MAX)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] =
+ !((*(double *) &a0) > (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] =
+ !((*(double *) &a1) > (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
#endif
}
-// Copy the lower 64-bit integer in a to dst.
-//
-// dst[63:0] := a[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movepi64_pi64
-FORCE_INLINE __m64 _mm_movepi64_pi64(__m128i a)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for not-greater-than, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpngt_sd
+FORCE_INLINE __m128d _mm_cmpngt_sd(__m128d a, __m128d b)
{
- return vreinterpret_m64_s64(vget_low_s64(vreinterpretq_s64_m128i(a)));
+ return _mm_move_sd(a, _mm_cmpngt_pd(a, b));
}
-// Copy the 64-bit integer a to the lower element of dst, and zero the upper
-// element.
-//
-// dst[63:0] := a[63:0]
-// dst[127:64] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_movpi64_epi64
-FORCE_INLINE __m128i _mm_movpi64_epi64(__m64 a)
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for not-less-than-or-equal, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnle_pd
+FORCE_INLINE __m128d _mm_cmpnle_pd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_s64(
- vcombine_s64(vreinterpret_s64_m64(a), vdup_n_s64(0)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(veorq_u64(
+ vcleq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)),
+ vdupq_n_u64(UINT64_MAX)));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] =
+ !((*(double *) &a0) <= (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] =
+ !((*(double *) &a1) <= (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// NEON does not provide this method
-// Creates a 4-bit mask from the most significant bits of the four
-// single-precision, floating-point values.
-// https://msdn.microsoft.com/en-us/library/vstudio/4490ys29(v=vs.100).aspx
-FORCE_INLINE int _mm_movemask_ps(__m128 a)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for not-less-than-or-equal, store the result in the lower element of dst,
+// and copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnle_sd
+FORCE_INLINE __m128d _mm_cmpnle_sd(__m128d a, __m128d b)
{
- uint32x4_t input = vreinterpretq_u32_m128(a);
-#if defined(__aarch64__)
- static const int32x4_t shift = {0, 1, 2, 3};
- uint32x4_t tmp = vshrq_n_u32(input, 31);
- return vaddvq_u32(vshlq_u32(tmp, shift));
+ return _mm_move_sd(a, _mm_cmpnle_pd(a, b));
+}
+
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// for not-less-than, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnlt_pd
+FORCE_INLINE __m128d _mm_cmpnlt_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_u64(veorq_u64(
+ vcltq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)),
+ vdupq_n_u64(UINT64_MAX)));
#else
- // Uses the exact same method as _mm_movemask_epi8, see that for details.
- // Shift out everything but the sign bits with a 32-bit unsigned shift
- // right.
- uint64x2_t high_bits = vreinterpretq_u64_u32(vshrq_n_u32(input, 31));
- // Merge the two pairs together with a 64-bit unsigned shift right + add.
- uint8x16_t paired =
- vreinterpretq_u8_u64(vsraq_n_u64(high_bits, high_bits, 31));
- // Extract the result.
- return vgetq_lane_u8(paired, 0) | (vgetq_lane_u8(paired, 8) << 2);
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] =
+ !((*(double *) &a0) < (*(double *) &b0)) ? ~UINT64_C(0) : UINT64_C(0);
+ d[1] =
+ !((*(double *) &a1) < (*(double *) &b1)) ? ~UINT64_C(0) : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
#endif
}
-// Compute the bitwise NOT of a and then AND with a 128-bit vector containing
-// all 1's, and return 1 if the result is zero, otherwise return 0.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_test_all_ones
-FORCE_INLINE int _mm_test_all_ones(__m128i a)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b for not-less-than, store the result in the lower element of dst, and copy
+// the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpnlt_sd
+FORCE_INLINE __m128d _mm_cmpnlt_sd(__m128d a, __m128d b)
+{
+ return _mm_move_sd(a, _mm_cmpnlt_pd(a, b));
+}
+
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// to see if neither is NaN, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpord_pd
+FORCE_INLINE __m128d _mm_cmpord_pd(__m128d a, __m128d b)
{
- return (uint64_t)(vgetq_lane_s64(a, 0) & vgetq_lane_s64(a, 1)) ==
- ~(uint64_t) 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ // Excluding NaNs, any two floating point numbers can be compared.
+ uint64x2_t not_nan_a =
+ vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a));
+ uint64x2_t not_nan_b =
+ vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b));
+ return vreinterpretq_m128d_u64(vandq_u64(not_nan_a, not_nan_b));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = ((*(double *) &a0) == (*(double *) &a0) &&
+ (*(double *) &b0) == (*(double *) &b0))
+ ? ~UINT64_C(0)
+ : UINT64_C(0);
+ d[1] = ((*(double *) &a1) == (*(double *) &a1) &&
+ (*(double *) &b1) == (*(double *) &b1))
+ ? ~UINT64_C(0)
+ : UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Compute the bitwise AND of 128 bits (representing integer data) in a and
-// mask, and return 1 if the result is zero, otherwise return 0.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_test_all_zeros
-FORCE_INLINE int _mm_test_all_zeros(__m128i a, __m128i mask)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b to see if neither is NaN, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpord_sd
+FORCE_INLINE __m128d _mm_cmpord_sd(__m128d a, __m128d b)
{
- int64x2_t a_and_mask =
- vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(mask));
- return (vgetq_lane_s64(a_and_mask, 0) | vgetq_lane_s64(a_and_mask, 1)) ? 0
- : 1;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmpord_pd(a, b));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t d[2];
+ d[0] = ((*(double *) &a0) == (*(double *) &a0) &&
+ (*(double *) &b0) == (*(double *) &b0))
+ ? ~UINT64_C(0)
+ : UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-/* Math operations */
-
-// Subtracts the four single-precision, floating-point values of a and b.
-//
-// r0 := a0 - b0
-// r1 := a1 - b1
-// r2 := a2 - b2
-// r3 := a3 - b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/1zad2k61(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_sub_ps(__m128 a, __m128 b)
+// Compare packed double-precision (64-bit) floating-point elements in a and b
+// to see if either is NaN, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpunord_pd
+FORCE_INLINE __m128d _mm_cmpunord_pd(__m128d a, __m128d b)
{
- return vreinterpretq_m128_f32(
- vsubq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ // Two NaNs are not equal in comparison operation.
+ uint64x2_t not_nan_a =
+ vceqq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(a));
+ uint64x2_t not_nan_b =
+ vceqq_f64(vreinterpretq_f64_m128d(b), vreinterpretq_f64_m128d(b));
+ return vreinterpretq_m128d_s32(
+ vmvnq_s32(vreinterpretq_s32_u64(vandq_u64(not_nan_a, not_nan_b))));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = ((*(double *) &a0) == (*(double *) &a0) &&
+ (*(double *) &b0) == (*(double *) &b0))
+ ? UINT64_C(0)
+ : ~UINT64_C(0);
+ d[1] = ((*(double *) &a1) == (*(double *) &a1) &&
+ (*(double *) &b1) == (*(double *) &b1))
+ ? UINT64_C(0)
+ : ~UINT64_C(0);
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Subtract the lower single-precision (32-bit) floating-point element in b from
-// the lower single-precision (32-bit) floating-point element in a, store the
-// result in the lower element of dst, and copy the upper 3 packed elements from
-// a to the upper elements of dst.
-//
-// dst[31:0] := a[31:0] - b[31:0]
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_ss
-FORCE_INLINE __m128 _mm_sub_ss(__m128 a, __m128 b)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b to see if either is NaN, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpunord_sd
+FORCE_INLINE __m128d _mm_cmpunord_sd(__m128d a, __m128d b)
{
- return _mm_move_ss(a, _mm_sub_ps(a, b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_cmpunord_pd(a, b));
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t d[2];
+ d[0] = ((*(double *) &a0) == (*(double *) &a0) &&
+ (*(double *) &b0) == (*(double *) &b0))
+ ? UINT64_C(0)
+ : ~UINT64_C(0);
+ d[1] = a1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Subtract 2 packed 64-bit integers in b from 2 packed 64-bit integers in a,
-// and store the results in dst.
-// r0 := a0 - b0
-// r1 := a1 - b1
-FORCE_INLINE __m128i _mm_sub_epi64(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for greater-than-or-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comige_sd
+FORCE_INLINE int _mm_comige_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_s64(
- vsubq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_u64(vcgeq_f64(a, b), 0) & 0x1;
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+
+ return (*(double *) &a0 >= *(double *) &b0);
+#endif
}
-// Subtracts the 4 signed or unsigned 32-bit integers of b from the 4 signed or
-// unsigned 32-bit integers of a.
-//
-// r0 := a0 - b0
-// r1 := a1 - b1
-// r2 := a2 - b2
-// r3 := a3 - b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/fhh866h0(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_sub_epi32(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for greater-than, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comigt_sd
+FORCE_INLINE int _mm_comigt_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_s32(
- vsubq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_u64(vcgtq_f64(a, b), 0) & 0x1;
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+
+ return (*(double *) &a0 > *(double *) &b0);
+#endif
}
-FORCE_INLINE __m128i _mm_sub_epi16(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for less-than-or-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comile_sd
+FORCE_INLINE int _mm_comile_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_s16(
- vsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_u64(vcleq_f64(a, b), 0) & 0x1;
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+
+ return (*(double *) &a0 <= *(double *) &b0);
+#endif
}
-FORCE_INLINE __m128i _mm_sub_epi8(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for less-than, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comilt_sd
+FORCE_INLINE int _mm_comilt_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_s8(
- vsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_u64(vcltq_f64(a, b), 0) & 0x1;
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+
+ return (*(double *) &a0 < *(double *) &b0);
+#endif
}
-// Subtract 64-bit integer b from 64-bit integer a, and store the result in dst.
-//
-// dst[63:0] := a[63:0] - b[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sub_si64
-FORCE_INLINE __m64 _mm_sub_si64(__m64 a, __m64 b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for equality, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comieq_sd
+FORCE_INLINE int _mm_comieq_sd(__m128d a, __m128d b)
{
- return vreinterpret_m64_s64(
- vsub_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_u64(vceqq_f64(a, b), 0) & 0x1;
+#else
+ uint32x4_t a_not_nan =
+ vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(a));
+ uint32x4_t b_not_nan =
+ vceqq_u32(vreinterpretq_u32_m128d(b), vreinterpretq_u32_m128d(b));
+ uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
+ uint32x4_t a_eq_b =
+ vceqq_u32(vreinterpretq_u32_m128d(a), vreinterpretq_u32_m128d(b));
+ uint64x2_t and_results = vandq_u64(vreinterpretq_u64_u32(a_and_b_not_nan),
+ vreinterpretq_u64_u32(a_eq_b));
+ return vgetq_lane_u64(and_results, 0) & 0x1;
+#endif
}
-// Subtracts the 8 unsigned 16-bit integers of bfrom the 8 unsigned 16-bit
-// integers of a and saturates..
-// https://technet.microsoft.com/en-us/subscriptions/index/f44y0s19(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_subs_epu16(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point element in a and b
+// for not-equal, and return the boolean result (0 or 1).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_comineq_sd
+FORCE_INLINE int _mm_comineq_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_u16(
- vqsubq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
+ return !_mm_comieq_sd(a, b);
}
-// Subtracts the 16 unsigned 8-bit integers of b from the 16 unsigned 8-bit
-// integers of a and saturates.
-//
-// r0 := UnsignedSaturate(a0 - b0)
-// r1 := UnsignedSaturate(a1 - b1)
-// ...
-// r15 := UnsignedSaturate(a15 - b15)
-//
-// https://technet.microsoft.com/en-us/subscriptions/yadkxc18(v=vs.90)
-FORCE_INLINE __m128i _mm_subs_epu8(__m128i a, __m128i b)
+// Convert packed signed 32-bit integers in a to packed double-precision
+// (64-bit) floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi32_pd
+FORCE_INLINE __m128d _mm_cvtepi32_pd(__m128i a)
{
- return vreinterpretq_m128i_u8(
- vqsubq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vcvtq_f64_s64(vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a)))));
+#else
+ double a0 = (double) vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0);
+ double a1 = (double) vgetq_lane_s32(vreinterpretq_s32_m128i(a), 1);
+ return _mm_set_pd(a1, a0);
+#endif
}
-// Subtracts the 16 signed 8-bit integers of b from the 16 signed 8-bit integers
-// of a and saturates.
-//
-// r0 := SignedSaturate(a0 - b0)
-// r1 := SignedSaturate(a1 - b1)
-// ...
-// r15 := SignedSaturate(a15 - b15)
-//
-// https://technet.microsoft.com/en-us/subscriptions/by7kzks1(v=vs.90)
-FORCE_INLINE __m128i _mm_subs_epi8(__m128i a, __m128i b)
+// Convert packed signed 32-bit integers in a to packed single-precision
+// (32-bit) floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi32_ps
+FORCE_INLINE __m128 _mm_cvtepi32_ps(__m128i a)
{
- return vreinterpretq_m128i_s8(
- vqsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ return vreinterpretq_m128_f32(vcvtq_f32_s32(vreinterpretq_s32_m128i(a)));
}
-// Subtracts the 8 signed 16-bit integers of b from the 8 signed 16-bit integers
-// of a and saturates.
-//
-// r0 := SignedSaturate(a0 - b0)
-// r1 := SignedSaturate(a1 - b1)
-// ...
-// r7 := SignedSaturate(a7 - b7)
-//
-// https://technet.microsoft.com/en-us/subscriptions/3247z5b8(v=vs.90)
-FORCE_INLINE __m128i _mm_subs_epi16(__m128i a, __m128i b)
+// Convert packed double-precision (64-bit) floating-point elements in a to
+// packed 32-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpd_epi32
+FORCE_INLINE __m128i _mm_cvtpd_epi32(__m128d a)
{
- return vreinterpretq_m128i_s16(
- vqsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+// vrnd32xq_f64 not supported on clang
+#if defined(__ARM_FEATURE_FRINT) && !defined(__clang__)
+ float64x2_t rounded = vrnd32xq_f64(vreinterpretq_f64_m128d(a));
+ int64x2_t integers = vcvtq_s64_f64(rounded);
+ return vreinterpretq_m128i_s32(
+ vcombine_s32(vmovn_s64(integers), vdup_n_s32(0)));
+#else
+ __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION);
+ double d0 = ((double *) &rnd)[0];
+ double d1 = ((double *) &rnd)[1];
+ return _mm_set_epi32(0, 0, (int32_t) d1, (int32_t) d0);
+#endif
}
-FORCE_INLINE __m128i _mm_adds_epu16(__m128i a, __m128i b)
+// Convert packed double-precision (64-bit) floating-point elements in a to
+// packed 32-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpd_pi32
+FORCE_INLINE __m64 _mm_cvtpd_pi32(__m128d a)
{
- return vreinterpretq_m128i_u16(
- vqaddq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
+ __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION);
+ double d0 = ((double *) &rnd)[0];
+ double d1 = ((double *) &rnd)[1];
+ int32_t ALIGN_STRUCT(16) data[2] = {(int32_t) d0, (int32_t) d1};
+ return vreinterpret_m64_s32(vld1_s32(data));
}
-// Negate packed 8-bit integers in a when the corresponding signed
-// 8-bit integer in b is negative, and store the results in dst.
-// Element in dst are zeroed out when the corresponding element
-// in b is zero.
-//
-// for i in 0..15
-// if b[i] < 0
-// r[i] := -a[i]
-// else if b[i] == 0
-// r[i] := 0
-// else
-// r[i] := a[i]
-// fi
-// done
-FORCE_INLINE __m128i _mm_sign_epi8(__m128i _a, __m128i _b)
+// Convert packed double-precision (64-bit) floating-point elements in a to
+// packed single-precision (32-bit) floating-point elements, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpd_ps
+FORCE_INLINE __m128 _mm_cvtpd_ps(__m128d a)
{
- int8x16_t a = vreinterpretq_s8_m128i(_a);
- int8x16_t b = vreinterpretq_s8_m128i(_b);
-
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFF : 0
- uint8x16_t ltMask = vreinterpretq_u8_s8(vshrq_n_s8(b, 7));
-
- // (b == 0) ? 0xFF : 0
-#if defined(__aarch64__)
- int8x16_t zeroMask = vreinterpretq_s8_u8(vceqzq_s8(b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float32x2_t tmp = vcvt_f32_f64(vreinterpretq_f64_m128d(a));
+ return vreinterpretq_m128_f32(vcombine_f32(tmp, vdup_n_f32(0)));
#else
- int8x16_t zeroMask = vreinterpretq_s8_u8(vceqq_s8(b, vdupq_n_s8(0)));
+ float a0 = (float) ((double *) &a)[0];
+ float a1 = (float) ((double *) &a)[1];
+ return _mm_set_ps(0, 0, a1, a0);
#endif
+}
- // bitwise select either a or nagative 'a' (vnegq_s8(a) return nagative 'a')
- // based on ltMask
- int8x16_t masked = vbslq_s8(ltMask, vnegq_s8(a), a);
- // res = masked & (~zeroMask)
- int8x16_t res = vbicq_s8(masked, zeroMask);
-
- return vreinterpretq_m128i_s8(res);
+// Convert packed signed 32-bit integers in a to packed double-precision
+// (64-bit) floating-point elements, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtpi32_pd
+FORCE_INLINE __m128d _mm_cvtpi32_pd(__m64 a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vcvtq_f64_s64(vmovl_s32(vreinterpret_s32_m64(a))));
+#else
+ double a0 = (double) vget_lane_s32(vreinterpret_s32_m64(a), 0);
+ double a1 = (double) vget_lane_s32(vreinterpret_s32_m64(a), 1);
+ return _mm_set_pd(a1, a0);
+#endif
}
-// Negate packed 16-bit integers in a when the corresponding signed
-// 16-bit integer in b is negative, and store the results in dst.
-// Element in dst are zeroed out when the corresponding element
-// in b is zero.
-//
-// for i in 0..7
-// if b[i] < 0
-// r[i] := -a[i]
-// else if b[i] == 0
-// r[i] := 0
-// else
-// r[i] := a[i]
-// fi
-// done
-FORCE_INLINE __m128i _mm_sign_epi16(__m128i _a, __m128i _b)
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_epi32
+// *NOTE*. The default rounding mode on SSE is 'round to even', which ARMv7-A
+// does not support! It is supported on ARMv8-A however.
+FORCE_INLINE __m128i _mm_cvtps_epi32(__m128 a)
{
- int16x8_t a = vreinterpretq_s16_m128i(_a);
- int16x8_t b = vreinterpretq_s16_m128i(_b);
+#if defined(__ARM_FEATURE_FRINT)
+ return vreinterpretq_m128i_s32(vcvtq_s32_f32(vrnd32xq_f32(a)));
+#elif (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ switch (_MM_GET_ROUNDING_MODE()) {
+ case _MM_ROUND_NEAREST:
+ return vreinterpretq_m128i_s32(vcvtnq_s32_f32(a));
+ case _MM_ROUND_DOWN:
+ return vreinterpretq_m128i_s32(vcvtmq_s32_f32(a));
+ case _MM_ROUND_UP:
+ return vreinterpretq_m128i_s32(vcvtpq_s32_f32(a));
+ default: // _MM_ROUND_TOWARD_ZERO
+ return vreinterpretq_m128i_s32(vcvtq_s32_f32(a));
+ }
+#else
+ float *f = (float *) &a;
+ switch (_MM_GET_ROUNDING_MODE()) {
+ case _MM_ROUND_NEAREST: {
+ uint32x4_t signmask = vdupq_n_u32(0x80000000);
+ float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a),
+ vdupq_n_f32(0.5f)); /* +/- 0.5 */
+ int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32(
+ vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/
+ int32x4_t r_trunc = vcvtq_s32_f32(
+ vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */
+ int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32(
+ vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */
+ int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone),
+ vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */
+ float32x4_t delta = vsubq_f32(
+ vreinterpretq_f32_m128(a),
+ vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */
+ uint32x4_t is_delta_half =
+ vceqq_f32(delta, half); /* delta == +/- 0.5 */
+ return vreinterpretq_m128i_s32(
+ vbslq_s32(is_delta_half, r_even, r_normal));
+ }
+ case _MM_ROUND_DOWN:
+ return _mm_set_epi32(floorf(f[3]), floorf(f[2]), floorf(f[1]),
+ floorf(f[0]));
+ case _MM_ROUND_UP:
+ return _mm_set_epi32(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]),
+ ceilf(f[0]));
+ default: // _MM_ROUND_TOWARD_ZERO
+ return _mm_set_epi32((int32_t) f[3], (int32_t) f[2], (int32_t) f[1],
+ (int32_t) f[0]);
+ }
+#endif
+}
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFFFF : 0
- uint16x8_t ltMask = vreinterpretq_u16_s16(vshrq_n_s16(b, 15));
- // (b == 0) ? 0xFFFF : 0
-#if defined(__aarch64__)
- int16x8_t zeroMask = vreinterpretq_s16_u16(vceqzq_s16(b));
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed double-precision (64-bit) floating-point elements, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_pd
+FORCE_INLINE __m128d _mm_cvtps_pd(__m128 a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vcvt_f64_f32(vget_low_f32(vreinterpretq_f32_m128(a))));
#else
- int16x8_t zeroMask = vreinterpretq_s16_u16(vceqq_s16(b, vdupq_n_s16(0)));
+ double a0 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
+ double a1 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 1);
+ return _mm_set_pd(a1, a0);
#endif
+}
- // bitwise select either a or negative 'a' (vnegq_s16(a) equals to negative
- // 'a') based on ltMask
- int16x8_t masked = vbslq_s16(ltMask, vnegq_s16(a), a);
- // res = masked & (~zeroMask)
- int16x8_t res = vbicq_s16(masked, zeroMask);
- return vreinterpretq_m128i_s16(res);
+// Copy the lower double-precision (64-bit) floating-point element of a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsd_f64
+FORCE_INLINE double _mm_cvtsd_f64(__m128d a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return (double) vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0);
+#else
+ return ((double *) &a)[0];
+#endif
}
-// Negate packed 32-bit integers in a when the corresponding signed
-// 32-bit integer in b is negative, and store the results in dst.
-// Element in dst are zeroed out when the corresponding element
-// in b is zero.
-//
-// for i in 0..3
-// if b[i] < 0
-// r[i] := -a[i]
-// else if b[i] == 0
-// r[i] := 0
-// else
-// r[i] := a[i]
-// fi
-// done
-FORCE_INLINE __m128i _mm_sign_epi32(__m128i _a, __m128i _b)
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 32-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsd_si32
+FORCE_INLINE int32_t _mm_cvtsd_si32(__m128d a)
{
- int32x4_t a = vreinterpretq_s32_m128i(_a);
- int32x4_t b = vreinterpretq_s32_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return (int32_t) vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0);
+#else
+ __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION);
+ double ret = ((double *) &rnd)[0];
+ return (int32_t) ret;
+#endif
+}
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFFFFFFFF : 0
- uint32x4_t ltMask = vreinterpretq_u32_s32(vshrq_n_s32(b, 31));
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 64-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsd_si64
+FORCE_INLINE int64_t _mm_cvtsd_si64(__m128d a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return (int64_t) vgetq_lane_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)), 0);
+#else
+ __m128d rnd = _mm_round_pd(a, _MM_FROUND_CUR_DIRECTION);
+ double ret = ((double *) &rnd)[0];
+ return (int64_t) ret;
+#endif
+}
- // (b == 0) ? 0xFFFFFFFF : 0
-#if defined(__aarch64__)
- int32x4_t zeroMask = vreinterpretq_s32_u32(vceqzq_s32(b));
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 64-bit integer, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsd_si64x
+#define _mm_cvtsd_si64x _mm_cvtsd_si64
+
+// Convert the lower double-precision (64-bit) floating-point element in b to a
+// single-precision (32-bit) floating-point element, store the result in the
+// lower element of dst, and copy the upper 3 packed elements from a to the
+// upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsd_ss
+FORCE_INLINE __m128 _mm_cvtsd_ss(__m128 a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(vsetq_lane_f32(
+ vget_lane_f32(vcvt_f32_f64(vreinterpretq_f64_m128d(b)), 0),
+ vreinterpretq_f32_m128(a), 0));
#else
- int32x4_t zeroMask = vreinterpretq_s32_u32(vceqq_s32(b, vdupq_n_s32(0)));
+ return vreinterpretq_m128_f32(vsetq_lane_f32((float) ((double *) &b)[0],
+ vreinterpretq_f32_m128(a), 0));
#endif
+}
- // bitwise select either a or negative 'a' (vnegq_s32(a) equals to negative
- // 'a') based on ltMask
- int32x4_t masked = vbslq_s32(ltMask, vnegq_s32(a), a);
- // res = masked & (~zeroMask)
- int32x4_t res = vbicq_s32(masked, zeroMask);
- return vreinterpretq_m128i_s32(res);
+// Copy the lower 32-bit integer in a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi128_si32
+FORCE_INLINE int _mm_cvtsi128_si32(__m128i a)
+{
+ return vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0);
}
-// Negate packed 16-bit integers in a when the corresponding signed 16-bit
-// integer in b is negative, and store the results in dst. Element in dst are
-// zeroed out when the corresponding element in b is zero.
-//
-// FOR j := 0 to 3
-// i := j*16
-// IF b[i+15:i] < 0
-// dst[i+15:i] := -(a[i+15:i])
-// ELSE IF b[i+15:i] == 0
-// dst[i+15:i] := 0
-// ELSE
-// dst[i+15:i] := a[i+15:i]
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi16
-FORCE_INLINE __m64 _mm_sign_pi16(__m64 _a, __m64 _b)
+// Copy the lower 64-bit integer in a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi128_si64
+FORCE_INLINE int64_t _mm_cvtsi128_si64(__m128i a)
{
- int16x4_t a = vreinterpret_s16_m64(_a);
- int16x4_t b = vreinterpret_s16_m64(_b);
+ return vgetq_lane_s64(vreinterpretq_s64_m128i(a), 0);
+}
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFFFF : 0
- uint16x4_t ltMask = vreinterpret_u16_s16(vshr_n_s16(b, 15));
+// Copy the lower 64-bit integer in a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi128_si64x
+#define _mm_cvtsi128_si64x(a) _mm_cvtsi128_si64(a)
- // (b == 0) ? 0xFFFF : 0
-#if defined(__aarch64__)
- int16x4_t zeroMask = vreinterpret_s16_u16(vceqz_s16(b));
+// Convert the signed 32-bit integer b to a double-precision (64-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi32_sd
+FORCE_INLINE __m128d _mm_cvtsi32_sd(__m128d a, int32_t b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vsetq_lane_f64((double) b, vreinterpretq_f64_m128d(a), 0));
#else
- int16x4_t zeroMask = vreinterpret_s16_u16(vceq_s16(b, vdup_n_s16(0)));
+ double bf = (double) b;
+ return vreinterpretq_m128d_s64(
+ vsetq_lane_s64(*(int64_t *) &bf, vreinterpretq_s64_m128d(a), 0));
#endif
+}
- // bitwise select either a or nagative 'a' (vneg_s16(a) return nagative 'a')
- // based on ltMask
- int16x4_t masked = vbsl_s16(ltMask, vneg_s16(a), a);
- // res = masked & (~zeroMask)
- int16x4_t res = vbic_s16(masked, zeroMask);
+// Copy the lower 64-bit integer in a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi128_si64x
+#define _mm_cvtsi128_si64x(a) _mm_cvtsi128_si64(a)
- return vreinterpret_m64_s16(res);
+// Copy 32-bit integer a to the lower elements of dst, and zero the upper
+// elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi32_si128
+FORCE_INLINE __m128i _mm_cvtsi32_si128(int a)
+{
+ return vreinterpretq_m128i_s32(vsetq_lane_s32(a, vdupq_n_s32(0), 0));
}
-// Negate packed 32-bit integers in a when the corresponding signed 32-bit
-// integer in b is negative, and store the results in dst. Element in dst are
-// zeroed out when the corresponding element in b is zero.
-//
-// FOR j := 0 to 1
-// i := j*32
-// IF b[i+31:i] < 0
-// dst[i+31:i] := -(a[i+31:i])
-// ELSE IF b[i+31:i] == 0
-// dst[i+31:i] := 0
-// ELSE
-// dst[i+31:i] := a[i+31:i]
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi32
-FORCE_INLINE __m64 _mm_sign_pi32(__m64 _a, __m64 _b)
+// Convert the signed 64-bit integer b to a double-precision (64-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi64_sd
+FORCE_INLINE __m128d _mm_cvtsi64_sd(__m128d a, int64_t b)
{
- int32x2_t a = vreinterpret_s32_m64(_a);
- int32x2_t b = vreinterpret_s32_m64(_b);
-
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFFFFFFFF : 0
- uint32x2_t ltMask = vreinterpret_u32_s32(vshr_n_s32(b, 31));
-
- // (b == 0) ? 0xFFFFFFFF : 0
-#if defined(__aarch64__)
- int32x2_t zeroMask = vreinterpret_s32_u32(vceqz_s32(b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vsetq_lane_f64((double) b, vreinterpretq_f64_m128d(a), 0));
#else
- int32x2_t zeroMask = vreinterpret_s32_u32(vceq_s32(b, vdup_n_s32(0)));
+ double bf = (double) b;
+ return vreinterpretq_m128d_s64(
+ vsetq_lane_s64(*(int64_t *) &bf, vreinterpretq_s64_m128d(a), 0));
#endif
-
- // bitwise select either a or nagative 'a' (vneg_s32(a) return nagative 'a')
- // based on ltMask
- int32x2_t masked = vbsl_s32(ltMask, vneg_s32(a), a);
- // res = masked & (~zeroMask)
- int32x2_t res = vbic_s32(masked, zeroMask);
-
- return vreinterpret_m64_s32(res);
}
-// Negate packed 8-bit integers in a when the corresponding signed 8-bit integer
-// in b is negative, and store the results in dst. Element in dst are zeroed out
-// when the corresponding element in b is zero.
-//
-// FOR j := 0 to 7
-// i := j*8
-// IF b[i+7:i] < 0
-// dst[i+7:i] := -(a[i+7:i])
-// ELSE IF b[i+7:i] == 0
-// dst[i+7:i] := 0
-// ELSE
-// dst[i+7:i] := a[i+7:i]
-// FI
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sign_pi8
-FORCE_INLINE __m64 _mm_sign_pi8(__m64 _a, __m64 _b)
+// Copy 64-bit integer a to the lower element of dst, and zero the upper
+// element.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi64_si128
+FORCE_INLINE __m128i _mm_cvtsi64_si128(int64_t a)
{
- int8x8_t a = vreinterpret_s8_m64(_a);
- int8x8_t b = vreinterpret_s8_m64(_b);
+ return vreinterpretq_m128i_s64(vsetq_lane_s64(a, vdupq_n_s64(0), 0));
+}
- // signed shift right: faster than vclt
- // (b < 0) ? 0xFF : 0
- uint8x8_t ltMask = vreinterpret_u8_s8(vshr_n_s8(b, 7));
+// Copy 64-bit integer a to the lower element of dst, and zero the upper
+// element.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi64x_si128
+#define _mm_cvtsi64x_si128(a) _mm_cvtsi64_si128(a)
- // (b == 0) ? 0xFF : 0
-#if defined(__aarch64__)
- int8x8_t zeroMask = vreinterpret_s8_u8(vceqz_s8(b));
+// Convert the signed 64-bit integer b to a double-precision (64-bit)
+// floating-point element, store the result in the lower element of dst, and
+// copy the upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi64x_sd
+#define _mm_cvtsi64x_sd(a, b) _mm_cvtsi64_sd(a, b)
+
+// Convert the lower single-precision (32-bit) floating-point element in b to a
+// double-precision (64-bit) floating-point element, store the result in the
+// lower element of dst, and copy the upper element from a to the upper element
+// of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtss_sd
+FORCE_INLINE __m128d _mm_cvtss_sd(__m128d a, __m128 b)
+{
+ double d = (double) vgetq_lane_f32(vreinterpretq_f32_m128(b), 0);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vsetq_lane_f64(d, vreinterpretq_f64_m128d(a), 0));
#else
- int8x8_t zeroMask = vreinterpret_s8_u8(vceq_s8(b, vdup_n_s8(0)));
+ return vreinterpretq_m128d_s64(
+ vsetq_lane_s64(*(int64_t *) &d, vreinterpretq_s64_m128d(a), 0));
#endif
-
- // bitwise select either a or nagative 'a' (vneg_s8(a) return nagative 'a')
- // based on ltMask
- int8x8_t masked = vbsl_s8(ltMask, vneg_s8(a), a);
- // res = masked & (~zeroMask)
- int8x8_t res = vbic_s8(masked, zeroMask);
-
- return vreinterpret_m64_s8(res);
}
-// Average packed unsigned 16-bit integers in a and b, and store the results in
-// dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := (a[i+15:i] + b[i+15:i] + 1) >> 1
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_avg_pu16
-FORCE_INLINE __m64 _mm_avg_pu16(__m64 a, __m64 b)
+// Convert packed double-precision (64-bit) floating-point elements in a to
+// packed 32-bit integers with truncation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttpd_epi32
+FORCE_INLINE __m128i _mm_cvttpd_epi32(__m128d a)
{
- return vreinterpret_m64_u16(
- vrhadd_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)));
+ double a0 = ((double *) &a)[0];
+ double a1 = ((double *) &a)[1];
+ return _mm_set_epi32(0, 0, (int32_t) a1, (int32_t) a0);
}
-// Average packed unsigned 8-bit integers in a and b, and store the results in
-// dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := (a[i+7:i] + b[i+7:i] + 1) >> 1
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_avg_pu8
-FORCE_INLINE __m64 _mm_avg_pu8(__m64 a, __m64 b)
+// Convert packed double-precision (64-bit) floating-point elements in a to
+// packed 32-bit integers with truncation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttpd_pi32
+FORCE_INLINE __m64 _mm_cvttpd_pi32(__m128d a)
{
- return vreinterpret_m64_u8(
- vrhadd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
+ double a0 = ((double *) &a)[0];
+ double a1 = ((double *) &a)[1];
+ int32_t ALIGN_STRUCT(16) data[2] = {(int32_t) a0, (int32_t) a1};
+ return vreinterpret_m64_s32(vld1_s32(data));
}
-// Average packed unsigned 8-bit integers in a and b, and store the results in
-// dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := (a[i+7:i] + b[i+7:i] + 1) >> 1
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_m_pavgb
-#define _m_pavgb(a, b) _mm_avg_pu8(a, b)
-
-// Average packed unsigned 16-bit integers in a and b, and store the results in
-// dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := (a[i+15:i] + b[i+15:i] + 1) >> 1
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_m_pavgw
-#define _m_pavgw(a, b) _mm_avg_pu16(a, b)
-
-// Computes the average of the 16 unsigned 8-bit integers in a and the 16
-// unsigned 8-bit integers in b and rounds.
-//
-// r0 := (a0 + b0) / 2
-// r1 := (a1 + b1) / 2
-// ...
-// r15 := (a15 + b15) / 2
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/8zwh554a(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_avg_epu8(__m128i a, __m128i b)
+// Convert packed single-precision (32-bit) floating-point elements in a to
+// packed 32-bit integers with truncation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttps_epi32
+FORCE_INLINE __m128i _mm_cvttps_epi32(__m128 a)
{
- return vreinterpretq_m128i_u8(
- vrhaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
+ return vreinterpretq_m128i_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)));
}
-// Computes the average of the 8 unsigned 16-bit integers in a and the 8
-// unsigned 16-bit integers in b and rounds.
-//
-// r0 := (a0 + b0) / 2
-// r1 := (a1 + b1) / 2
-// ...
-// r7 := (a7 + b7) / 2
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/y13ca3c8(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_avg_epu16(__m128i a, __m128i b)
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 32-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttsd_si32
+FORCE_INLINE int32_t _mm_cvttsd_si32(__m128d a)
{
- return (__m128i) vrhaddq_u16(vreinterpretq_u16_m128i(a),
- vreinterpretq_u16_m128i(b));
+ double ret = *((double *) &a);
+ return (int32_t) ret;
}
-// Adds the four single-precision, floating-point values of a and b.
-//
-// r0 := a0 + b0
-// r1 := a1 + b1
-// r2 := a2 + b2
-// r3 := a3 + b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/c9848chc(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_add_ps(__m128 a, __m128 b)
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 64-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttsd_si64
+FORCE_INLINE int64_t _mm_cvttsd_si64(__m128d a)
{
- return vreinterpretq_m128_f32(
- vaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vgetq_lane_s64(vcvtq_s64_f64(vreinterpretq_f64_m128d(a)), 0);
+#else
+ double ret = *((double *) &a);
+ return (int64_t) ret;
+#endif
}
-// Add packed double-precision (64-bit) floating-point elements in a and b, and
-// store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_add_pd
-FORCE_INLINE __m128d _mm_add_pd(__m128d a, __m128d b)
+// Convert the lower double-precision (64-bit) floating-point element in a to a
+// 64-bit integer with truncation, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvttsd_si64x
+#define _mm_cvttsd_si64x(a) _mm_cvttsd_si64(a)
+
+// Divide packed double-precision (64-bit) floating-point elements in a by
+// packed elements in b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_div_pd
+FORCE_INLINE __m128d _mm_div_pd(__m128d a, __m128d b)
{
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(_M_ARM64)
return vreinterpretq_m128d_f64(
- vaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+ vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
#else
double *da = (double *) &a;
double *db = (double *) &b;
double c[2];
- c[0] = da[0] + db[0];
- c[1] = da[1] + db[1];
+ c[0] = da[0] / db[0];
+ c[1] = da[1] / db[1];
return vld1q_f32((float32_t *) c);
#endif
}
-// Add 64-bit integers a and b, and store the result in dst.
-//
-// dst[63:0] := a[63:0] + b[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_add_si64
-FORCE_INLINE __m64 _mm_add_si64(__m64 a, __m64 b)
+// Divide the lower double-precision (64-bit) floating-point element in a by the
+// lower double-precision (64-bit) floating-point element in b, store the result
+// in the lower element of dst, and copy the upper element from a to the upper
+// element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_div_sd
+FORCE_INLINE __m128d _mm_div_sd(__m128d a, __m128d b)
{
- return vreinterpret_m64_s64(
- vadd_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float64x2_t tmp =
+ vdivq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b));
+ return vreinterpretq_m128d_f64(
+ vsetq_lane_f64(vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1), tmp, 1));
+#else
+ return _mm_move_sd(a, _mm_div_pd(a, b));
+#endif
}
-// adds the scalar single-precision floating point values of a and b.
-// https://msdn.microsoft.com/en-us/library/be94x2y6(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_add_ss(__m128 a, __m128 b)
+// Extract a 16-bit integer from a, selected with imm8, and store the result in
+// the lower element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_epi16
+// FORCE_INLINE int _mm_extract_epi16(__m128i a, __constrange(0,8) int imm)
+#define _mm_extract_epi16(a, imm) \
+ vgetq_lane_u16(vreinterpretq_u16_m128i(a), (imm))
+
+// Copy a to dst, and insert the 16-bit integer i into dst at the location
+// specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_insert_epi16
+// FORCE_INLINE __m128i _mm_insert_epi16(__m128i a, int b,
+// __constrange(0,8) int imm)
+#define _mm_insert_epi16(a, b, imm) \
+ vreinterpretq_m128i_s16( \
+ vsetq_lane_s16((b), vreinterpretq_s16_m128i(a), (imm)))
+
+// Load 128-bits (composed of 2 packed double-precision (64-bit) floating-point
+// elements) from memory into dst. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_pd
+FORCE_INLINE __m128d _mm_load_pd(const double *p)
{
- float32_t b0 = vgetq_lane_f32(vreinterpretq_f32_m128(b), 0);
- float32x4_t value = vsetq_lane_f32(b0, vdupq_n_f32(0), 0);
- // the upper values in the result must be the remnants of .
- return vreinterpretq_m128_f32(vaddq_f32(a, value));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vld1q_f64(p));
+#else
+ const float *fp = (const float *) p;
+ float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], fp[2], fp[3]};
+ return vreinterpretq_m128d_f32(vld1q_f32(data));
+#endif
}
-// Adds the 4 signed or unsigned 64-bit integers in a to the 4 signed or
-// unsigned 32-bit integers in b.
-// https://msdn.microsoft.com/en-us/library/vstudio/09xs4fkk(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_add_epi64(__m128i a, __m128i b)
+// Load a double-precision (64-bit) floating-point element from memory into both
+// elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_pd1
+#define _mm_load_pd1 _mm_load1_pd
+
+// Load a double-precision (64-bit) floating-point element from memory into the
+// lower of dst, and zero the upper element. mem_addr does not need to be
+// aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_sd
+FORCE_INLINE __m128d _mm_load_sd(const double *p)
{
- return vreinterpretq_m128i_s64(
- vaddq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vsetq_lane_f64(*p, vdupq_n_f64(0), 0));
+#else
+ const float *fp = (const float *) p;
+ float ALIGN_STRUCT(16) data[4] = {fp[0], fp[1], 0, 0};
+ return vreinterpretq_m128d_f32(vld1q_f32(data));
+#endif
}
-// Adds the 4 signed or unsigned 32-bit integers in a to the 4 signed or
-// unsigned 32-bit integers in b.
-//
-// r0 := a0 + b0
-// r1 := a1 + b1
-// r2 := a2 + b2
-// r3 := a3 + b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/09xs4fkk(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_add_epi32(__m128i a, __m128i b)
+// Load 128-bits of integer data from memory into dst. mem_addr must be aligned
+// on a 16-byte boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_si128
+FORCE_INLINE __m128i _mm_load_si128(const __m128i *p)
+{
+ return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p));
+}
+
+// Load a double-precision (64-bit) floating-point element from memory into both
+// elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load1_pd
+FORCE_INLINE __m128d _mm_load1_pd(const double *p)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vld1q_dup_f64(p));
+#else
+ return vreinterpretq_m128d_s64(vdupq_n_s64(*(const int64_t *) p));
+#endif
+}
+
+// Load a double-precision (64-bit) floating-point element from memory into the
+// upper element of dst, and copy the lower element from a to dst. mem_addr does
+// not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadh_pd
+FORCE_INLINE __m128d _mm_loadh_pd(__m128d a, const double *p)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vcombine_f64(vget_low_f64(vreinterpretq_f64_m128d(a)), vld1_f64(p)));
+#else
+ return vreinterpretq_m128d_f32(vcombine_f32(
+ vget_low_f32(vreinterpretq_f32_m128d(a)), vld1_f32((const float *) p)));
+#endif
+}
+
+// Load 64-bit integer from memory into the first element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadl_epi64
+FORCE_INLINE __m128i _mm_loadl_epi64(__m128i const *p)
{
+ /* Load the lower 64 bits of the value pointed to by p into the
+ * lower 64 bits of the result, zeroing the upper 64 bits of the result.
+ */
return vreinterpretq_m128i_s32(
- vaddq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ vcombine_s32(vld1_s32((int32_t const *) p), vcreate_s32(0)));
}
-// Adds the 8 signed or unsigned 16-bit integers in a to the 8 signed or
-// unsigned 16-bit integers in b.
-// https://msdn.microsoft.com/en-us/library/fceha5k4(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_add_epi16(__m128i a, __m128i b)
+// Load a double-precision (64-bit) floating-point element from memory into the
+// lower element of dst, and copy the upper element from a to dst. mem_addr does
+// not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadl_pd
+FORCE_INLINE __m128d _mm_loadl_pd(__m128d a, const double *p)
{
- return vreinterpretq_m128i_s16(
- vaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vcombine_f64(vld1_f64(p), vget_high_f64(vreinterpretq_f64_m128d(a))));
+#else
+ return vreinterpretq_m128d_f32(
+ vcombine_f32(vld1_f32((const float *) p),
+ vget_high_f32(vreinterpretq_f32_m128d(a))));
+#endif
+}
+
+// Load 2 double-precision (64-bit) floating-point elements from memory into dst
+// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
+// general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadr_pd
+FORCE_INLINE __m128d _mm_loadr_pd(const double *p)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float64x2_t v = vld1q_f64(p);
+ return vreinterpretq_m128d_f64(vextq_f64(v, v, 1));
+#else
+ int64x2_t v = vld1q_s64((const int64_t *) p);
+ return vreinterpretq_m128d_s64(vextq_s64(v, v, 1));
+#endif
+}
+
+// Loads two double-precision from unaligned memory, floating-point values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_pd
+FORCE_INLINE __m128d _mm_loadu_pd(const double *p)
+{
+ return _mm_load_pd(p);
}
-// Adds the 16 signed or unsigned 8-bit integers in a to the 16 signed or
-// unsigned 8-bit integers in b.
-// https://technet.microsoft.com/en-us/subscriptions/yc7tcyzs(v=vs.90)
-FORCE_INLINE __m128i _mm_add_epi8(__m128i a, __m128i b)
+// Load 128-bits of integer data from memory into dst. mem_addr does not need to
+// be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_si128
+FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p)
{
- return vreinterpretq_m128i_s8(
- vaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p));
}
-// Adds the 8 signed 16-bit integers in a to the 8 signed 16-bit integers in b
-// and saturates.
-//
-// r0 := SignedSaturate(a0 + b0)
-// r1 := SignedSaturate(a1 + b1)
-// ...
-// r7 := SignedSaturate(a7 + b7)
-//
-// https://msdn.microsoft.com/en-us/library/1a306ef8(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_adds_epi16(__m128i a, __m128i b)
+// Load unaligned 32-bit integer from memory into the first element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadu_si32
+FORCE_INLINE __m128i _mm_loadu_si32(const void *p)
{
- return vreinterpretq_m128i_s16(
- vqaddq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+ return vreinterpretq_m128i_s32(
+ vsetq_lane_s32(*(const int32_t *) p, vdupq_n_s32(0), 0));
}
-// Add packed signed 8-bit integers in a and b using saturation, and store the
-// results in dst.
-//
-// FOR j := 0 to 15
-// i := j*8
-// dst[i+7:i] := Saturate8( a[i+7:i] + b[i+7:i] )
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_adds_epi8
-FORCE_INLINE __m128i _mm_adds_epi8(__m128i a, __m128i b)
+// Multiply packed signed 16-bit integers in a and b, producing intermediate
+// signed 32-bit integers. Horizontally add adjacent pairs of intermediate
+// 32-bit integers, and pack the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_madd_epi16
+FORCE_INLINE __m128i _mm_madd_epi16(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_s8(
- vqaddq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ int32x4_t low = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)),
+ vget_low_s16(vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int32x4_t high =
+ vmull_high_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b));
+
+ return vreinterpretq_m128i_s32(vpaddq_s32(low, high));
+#else
+ int32x4_t high = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)),
+ vget_high_s16(vreinterpretq_s16_m128i(b)));
+
+ int32x2_t low_sum = vpadd_s32(vget_low_s32(low), vget_high_s32(low));
+ int32x2_t high_sum = vpadd_s32(vget_low_s32(high), vget_high_s32(high));
+
+ return vreinterpretq_m128i_s32(vcombine_s32(low_sum, high_sum));
+#endif
}
-// Adds the 16 unsigned 8-bit integers in a to the 16 unsigned 8-bit integers in
-// b and saturates..
-// https://msdn.microsoft.com/en-us/library/9hahyddy(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_adds_epu8(__m128i a, __m128i b)
+// Conditionally store 8-bit integer elements from a into memory using mask
+// (elements are not stored when the highest bit is not set in the corresponding
+// element) and a non-temporal memory hint. mem_addr does not need to be aligned
+// on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maskmoveu_si128
+FORCE_INLINE void _mm_maskmoveu_si128(__m128i a, __m128i mask, char *mem_addr)
{
- return vreinterpretq_m128i_u8(
- vqaddq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
+ int8x16_t shr_mask = vshrq_n_s8(vreinterpretq_s8_m128i(mask), 7);
+ __m128 b = _mm_load_ps((const float *) mem_addr);
+ int8x16_t masked =
+ vbslq_s8(vreinterpretq_u8_s8(shr_mask), vreinterpretq_s8_m128i(a),
+ vreinterpretq_s8_m128(b));
+ vst1q_s8((int8_t *) mem_addr, masked);
}
-// Multiplies the 8 signed or unsigned 16-bit integers from a by the 8 signed or
-// unsigned 16-bit integers from b.
-//
-// r0 := (a0 * b0)[15:0]
-// r1 := (a1 * b1)[15:0]
-// ...
-// r7 := (a7 * b7)[15:0]
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/9ks1472s(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_mullo_epi16(__m128i a, __m128i b)
+// Compare packed signed 16-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epi16
+FORCE_INLINE __m128i _mm_max_epi16(__m128i a, __m128i b)
{
return vreinterpretq_m128i_s16(
- vmulq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+ vmaxq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// Multiplies the 4 signed or unsigned 32-bit integers from a by the 4 signed or
-// unsigned 32-bit integers from b.
-// https://msdn.microsoft.com/en-us/library/vstudio/bb531409(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_mullo_epi32(__m128i a, __m128i b)
+// Compare packed unsigned 8-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epu8
+FORCE_INLINE __m128i _mm_max_epu8(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_s32(
- vmulq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ return vreinterpretq_m128i_u8(
+ vmaxq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
}
-// Multiply the packed unsigned 16-bit integers in a and b, producing
-// intermediate 32-bit integers, and store the high 16 bits of the intermediate
-// integers in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// tmp[31:0] := a[i+15:i] * b[i+15:i]
-// dst[i+15:i] := tmp[31:16]
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_m_pmulhuw
-#define _m_pmulhuw(a, b) _mm_mulhi_pu16(a, b)
-
-// Multiplies the four single-precision, floating-point values of a and b.
-//
-// r0 := a0 * b0
-// r1 := a1 * b1
-// r2 := a2 * b2
-// r3 := a3 * b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/22kbk6t9(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_mul_ps(__m128 a, __m128 b)
+// Compare packed double-precision (64-bit) floating-point elements in a and b,
+// and store packed maximum values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_pd
+FORCE_INLINE __m128d _mm_max_pd(__m128d a, __m128d b)
{
- return vreinterpretq_m128_f32(
- vmulq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+#if SSE2NEON_PRECISE_MINMAX
+ float64x2_t _a = vreinterpretq_f64_m128d(a);
+ float64x2_t _b = vreinterpretq_f64_m128d(b);
+ return vreinterpretq_m128d_f64(vbslq_f64(vcgtq_f64(_a, _b), _a, _b));
+#else
+ return vreinterpretq_m128d_f64(
+ vmaxq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#endif
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) > (*(double *) &b0) ? a0 : b0;
+ d[1] = (*(double *) &a1) > (*(double *) &b1) ? a1 : b1;
+
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Multiply packed double-precision (64-bit) floating-point elements in a and b,
-// and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_pd
-FORCE_INLINE __m128d _mm_mul_pd(__m128d a, __m128d b)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b, store the maximum value in the lower element of dst, and copy the upper
+// element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_sd
+FORCE_INLINE __m128d _mm_max_sd(__m128d a, __m128d b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(
- vmulq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_max_pd(a, b));
#else
double *da = (double *) &a;
double *db = (double *) &b;
- double c[2];
- c[0] = da[0] * db[0];
- c[1] = da[1] * db[1];
- return vld1q_f32((float32_t *) c);
+ double c[2] = {da[0] > db[0] ? da[0] : db[0], da[1]};
+ return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) c));
#endif
}
-// Multiply the lower single-precision (32-bit) floating-point element in a and
-// b, store the result in the lower element of dst, and copy the upper 3 packed
-// elements from a to the upper elements of dst.
-//
-// dst[31:0] := a[31:0] * b[31:0]
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_ss
-FORCE_INLINE __m128 _mm_mul_ss(__m128 a, __m128 b)
+// Compare packed signed 16-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_epi16
+FORCE_INLINE __m128i _mm_min_epi16(__m128i a, __m128i b)
{
- return _mm_move_ss(a, _mm_mul_ps(a, b));
+ return vreinterpretq_m128i_s16(
+ vminq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// Multiply the low unsigned 32-bit integers from each packed 64-bit element in
-// a and b, and store the unsigned 64-bit results in dst.
-//
-// r0 := (a0 & 0xFFFFFFFF) * (b0 & 0xFFFFFFFF)
-// r1 := (a2 & 0xFFFFFFFF) * (b2 & 0xFFFFFFFF)
-FORCE_INLINE __m128i _mm_mul_epu32(__m128i a, __m128i b)
+// Compare packed unsigned 8-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_epu8
+FORCE_INLINE __m128i _mm_min_epu8(__m128i a, __m128i b)
{
- // vmull_u32 upcasts instead of masking, so we downcast.
- uint32x2_t a_lo = vmovn_u64(vreinterpretq_u64_m128i(a));
- uint32x2_t b_lo = vmovn_u64(vreinterpretq_u64_m128i(b));
- return vreinterpretq_m128i_u64(vmull_u32(a_lo, b_lo));
+ return vreinterpretq_m128i_u8(
+ vminq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
}
-// Multiply the low unsigned 32-bit integers from a and b, and store the
-// unsigned 64-bit result in dst.
-//
-// dst[63:0] := a[31:0] * b[31:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mul_su32
-FORCE_INLINE __m64 _mm_mul_su32(__m64 a, __m64 b)
+// Compare packed double-precision (64-bit) floating-point elements in a and b,
+// and store packed minimum values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_pd
+FORCE_INLINE __m128d _mm_min_pd(__m128d a, __m128d b)
{
- return vreinterpret_m64_u64(vget_low_u64(
- vmull_u32(vreinterpret_u32_m64(a), vreinterpret_u32_m64(b))));
+#if defined(__aarch64__) || defined(_M_ARM64)
+#if SSE2NEON_PRECISE_MINMAX
+ float64x2_t _a = vreinterpretq_f64_m128d(a);
+ float64x2_t _b = vreinterpretq_f64_m128d(b);
+ return vreinterpretq_m128d_f64(vbslq_f64(vcltq_f64(_a, _b), _a, _b));
+#else
+ return vreinterpretq_m128d_f64(
+ vminq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#endif
+#else
+ uint64_t a0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(a));
+ uint64_t a1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(a));
+ uint64_t b0 = (uint64_t) vget_low_u64(vreinterpretq_u64_m128d(b));
+ uint64_t b1 = (uint64_t) vget_high_u64(vreinterpretq_u64_m128d(b));
+ uint64_t d[2];
+ d[0] = (*(double *) &a0) < (*(double *) &b0) ? a0 : b0;
+ d[1] = (*(double *) &a1) < (*(double *) &b1) ? a1 : b1;
+ return vreinterpretq_m128d_u64(vld1q_u64(d));
+#endif
}
-// Multiply the low signed 32-bit integers from each packed 64-bit element in
-// a and b, and store the signed 64-bit results in dst.
-//
-// r0 := (int64_t)(int32_t)a0 * (int64_t)(int32_t)b0
-// r1 := (int64_t)(int32_t)a2 * (int64_t)(int32_t)b2
-FORCE_INLINE __m128i _mm_mul_epi32(__m128i a, __m128i b)
+// Compare the lower double-precision (64-bit) floating-point elements in a and
+// b, store the minimum value in the lower element of dst, and copy the upper
+// element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_sd
+FORCE_INLINE __m128d _mm_min_sd(__m128d a, __m128d b)
{
- // vmull_s32 upcasts instead of masking, so we downcast.
- int32x2_t a_lo = vmovn_s64(vreinterpretq_s64_m128i(a));
- int32x2_t b_lo = vmovn_s64(vreinterpretq_s64_m128i(b));
- return vreinterpretq_m128i_s64(vmull_s32(a_lo, b_lo));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_min_pd(a, b));
+#else
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[2] = {da[0] < db[0] ? da[0] : db[0], da[1]};
+ return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) c));
+#endif
}
-// Multiplies the 8 signed 16-bit integers from a by the 8 signed 16-bit
-// integers from b.
-//
-// r0 := (a0 * b0) + (a1 * b1)
-// r1 := (a2 * b2) + (a3 * b3)
-// r2 := (a4 * b4) + (a5 * b5)
-// r3 := (a6 * b6) + (a7 * b7)
-// https://msdn.microsoft.com/en-us/library/yht36sa6(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_madd_epi16(__m128i a, __m128i b)
+// Copy the lower 64-bit integer in a to the lower element of dst, and zero the
+// upper element.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_move_epi64
+FORCE_INLINE __m128i _mm_move_epi64(__m128i a)
{
- int32x4_t low = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)),
- vget_low_s16(vreinterpretq_s16_m128i(b)));
- int32x4_t high = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)),
- vget_high_s16(vreinterpretq_s16_m128i(b)));
-
- int32x2_t low_sum = vpadd_s32(vget_low_s32(low), vget_high_s32(low));
- int32x2_t high_sum = vpadd_s32(vget_low_s32(high), vget_high_s32(high));
+ return vreinterpretq_m128i_s64(
+ vsetq_lane_s64(0, vreinterpretq_s64_m128i(a), 1));
+}
- return vreinterpretq_m128i_s32(vcombine_s32(low_sum, high_sum));
+// Move the lower double-precision (64-bit) floating-point element from b to the
+// lower element of dst, and copy the upper element from a to the upper element
+// of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_move_sd
+FORCE_INLINE __m128d _mm_move_sd(__m128d a, __m128d b)
+{
+ return vreinterpretq_m128d_f32(
+ vcombine_f32(vget_low_f32(vreinterpretq_f32_m128d(b)),
+ vget_high_f32(vreinterpretq_f32_m128d(a))));
}
-// Multiply packed signed 16-bit integers in a and b, producing intermediate
-// signed 32-bit integers. Shift right by 15 bits while rounding up, and store
-// the packed 16-bit integers in dst.
-//
-// r0 := Round(((int32_t)a0 * (int32_t)b0) >> 15)
-// r1 := Round(((int32_t)a1 * (int32_t)b1) >> 15)
-// r2 := Round(((int32_t)a2 * (int32_t)b2) >> 15)
-// ...
-// r7 := Round(((int32_t)a7 * (int32_t)b7) >> 15)
-FORCE_INLINE __m128i _mm_mulhrs_epi16(__m128i a, __m128i b)
+// Create mask from the most significant bit of each 8-bit element in a, and
+// store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movemask_epi8
+FORCE_INLINE int _mm_movemask_epi8(__m128i a)
{
- // Has issues due to saturation
- // return vreinterpretq_m128i_s16(vqrdmulhq_s16(a, b));
+ // Use increasingly wide shifts+adds to collect the sign bits
+ // together.
+ // Since the widening shifts would be rather confusing to follow in little
+ // endian, everything will be illustrated in big endian order instead. This
+ // has a different result - the bits would actually be reversed on a big
+ // endian machine.
- // Multiply
- int32x4_t mul_lo = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)),
- vget_low_s16(vreinterpretq_s16_m128i(b)));
- int32x4_t mul_hi = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)),
- vget_high_s16(vreinterpretq_s16_m128i(b)));
+ // Starting input (only half the elements are shown):
+ // 89 ff 1d c0 00 10 99 33
+ uint8x16_t input = vreinterpretq_u8_m128i(a);
- // Rounding narrowing shift right
- // narrow = (int16_t)((mul + 16384) >> 15);
- int16x4_t narrow_lo = vrshrn_n_s32(mul_lo, 15);
- int16x4_t narrow_hi = vrshrn_n_s32(mul_hi, 15);
+ // Shift out everything but the sign bits with an unsigned shift right.
+ //
+ // Bytes of the vector::
+ // 89 ff 1d c0 00 10 99 33
+ // \ \ \ \ \ \ \ \ high_bits = (uint16x4_t)(input >> 7)
+ // | | | | | | | |
+ // 01 01 00 01 00 00 01 00
+ //
+ // Bits of first important lane(s):
+ // 10001001 (89)
+ // \______
+ // |
+ // 00000001 (01)
+ uint16x8_t high_bits = vreinterpretq_u16_u8(vshrq_n_u8(input, 7));
- // Join together
- return vreinterpretq_m128i_s16(vcombine_s16(narrow_lo, narrow_hi));
-}
+ // Merge the even lanes together with a 16-bit unsigned shift right + add.
+ // 'xx' represents garbage data which will be ignored in the final result.
+ // In the important bytes, the add functions like a binary OR.
+ //
+ // 01 01 00 01 00 00 01 00
+ // \_ | \_ | \_ | \_ | paired16 = (uint32x4_t)(input + (input >> 7))
+ // \| \| \| \|
+ // xx 03 xx 01 xx 00 xx 02
+ //
+ // 00000001 00000001 (01 01)
+ // \_______ |
+ // \|
+ // xxxxxxxx xxxxxx11 (xx 03)
+ uint32x4_t paired16 =
+ vreinterpretq_u32_u16(vsraq_n_u16(high_bits, high_bits, 7));
-// Vertically multiply each unsigned 8-bit integer from a with the corresponding
-// signed 8-bit integer from b, producing intermediate signed 16-bit integers.
-// Horizontally add adjacent pairs of intermediate signed 16-bit integers,
-// and pack the saturated results in dst.
-//
-// FOR j := 0 to 7
-// i := j*16
-// dst[i+15:i] := Saturate_To_Int16( a[i+15:i+8]*b[i+15:i+8] +
-// a[i+7:i]*b[i+7:i] )
-// ENDFOR
-FORCE_INLINE __m128i _mm_maddubs_epi16(__m128i _a, __m128i _b)
-{
-#if defined(__aarch64__)
- uint8x16_t a = vreinterpretq_u8_m128i(_a);
- int8x16_t b = vreinterpretq_s8_m128i(_b);
- int16x8_t tl = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(a))),
- vmovl_s8(vget_low_s8(b)));
- int16x8_t th = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(a))),
- vmovl_s8(vget_high_s8(b)));
- return vreinterpretq_m128i_s16(
- vqaddq_s16(vuzp1q_s16(tl, th), vuzp2q_s16(tl, th)));
-#else
- // This would be much simpler if x86 would choose to zero extend OR sign
- // extend, not both. This could probably be optimized better.
- uint16x8_t a = vreinterpretq_u16_m128i(_a);
- int16x8_t b = vreinterpretq_s16_m128i(_b);
+ // Repeat with a wider 32-bit shift + add.
+ // xx 03 xx 01 xx 00 xx 02
+ // \____ | \____ | paired32 = (uint64x1_t)(paired16 + (paired16 >>
+ // 14))
+ // \| \|
+ // xx xx xx 0d xx xx xx 02
+ //
+ // 00000011 00000001 (03 01)
+ // \\_____ ||
+ // '----.\||
+ // xxxxxxxx xxxx1101 (xx 0d)
+ uint64x2_t paired32 =
+ vreinterpretq_u64_u32(vsraq_n_u32(paired16, paired16, 14));
+
+ // Last, an even wider 64-bit shift + add to get our result in the low 8 bit
+ // lanes. xx xx xx 0d xx xx xx 02
+ // \_________ | paired64 = (uint8x8_t)(paired32 + (paired32 >>
+ // 28))
+ // \|
+ // xx xx xx xx xx xx xx d2
+ //
+ // 00001101 00000010 (0d 02)
+ // \ \___ | |
+ // '---. \| |
+ // xxxxxxxx 11010010 (xx d2)
+ uint8x16_t paired64 =
+ vreinterpretq_u8_u64(vsraq_n_u64(paired32, paired32, 28));
- // Zero extend a
- int16x8_t a_odd = vreinterpretq_s16_u16(vshrq_n_u16(a, 8));
- int16x8_t a_even = vreinterpretq_s16_u16(vbicq_u16(a, vdupq_n_u16(0xff00)));
+ // Extract the low 8 bits from each 64-bit lane with 2 8-bit extracts.
+ // xx xx xx xx xx xx xx d2
+ // || return paired64[0]
+ // d2
+ // Note: Little endian would return the correct value 4b (01001011) instead.
+ return vgetq_lane_u8(paired64, 0) | ((int) vgetq_lane_u8(paired64, 8) << 8);
+}
- // Sign extend by shifting left then shifting right.
- int16x8_t b_even = vshrq_n_s16(vshlq_n_s16(b, 8), 8);
- int16x8_t b_odd = vshrq_n_s16(b, 8);
+// Set each bit of mask dst based on the most significant bit of the
+// corresponding packed double-precision (64-bit) floating-point element in a.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movemask_pd
+FORCE_INLINE int _mm_movemask_pd(__m128d a)
+{
+ uint64x2_t input = vreinterpretq_u64_m128d(a);
+ uint64x2_t high_bits = vshrq_n_u64(input, 63);
+ return (int) (vgetq_lane_u64(high_bits, 0) |
+ (vgetq_lane_u64(high_bits, 1) << 1));
+}
- // multiply
- int16x8_t prod1 = vmulq_s16(a_even, b_even);
- int16x8_t prod2 = vmulq_s16(a_odd, b_odd);
+// Copy the lower 64-bit integer in a to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movepi64_pi64
+FORCE_INLINE __m64 _mm_movepi64_pi64(__m128i a)
+{
+ return vreinterpret_m64_s64(vget_low_s64(vreinterpretq_s64_m128i(a)));
+}
- // saturated add
- return vreinterpretq_m128i_s16(vqaddq_s16(prod1, prod2));
-#endif
+// Copy the 64-bit integer a to the lower element of dst, and zero the upper
+// element.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movpi64_epi64
+FORCE_INLINE __m128i _mm_movpi64_epi64(__m64 a)
+{
+ return vreinterpretq_m128i_s64(
+ vcombine_s64(vreinterpret_s64_m64(a), vdup_n_s64(0)));
}
-// Computes the fused multiple add product of 32-bit floating point numbers.
-//
-// Return Value
-// Multiplies A and B, and adds C to the temporary result before returning it.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_fmadd
-FORCE_INLINE __m128 _mm_fmadd_ps(__m128 a, __m128 b, __m128 c)
+// Multiply the low unsigned 32-bit integers from each packed 64-bit element in
+// a and b, and store the unsigned 64-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_epu32
+FORCE_INLINE __m128i _mm_mul_epu32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(vfmaq_f32(vreinterpretq_f32_m128(c),
- vreinterpretq_f32_m128(b),
- vreinterpretq_f32_m128(a)));
+ // vmull_u32 upcasts instead of masking, so we downcast.
+ uint32x2_t a_lo = vmovn_u64(vreinterpretq_u64_m128i(a));
+ uint32x2_t b_lo = vmovn_u64(vreinterpretq_u64_m128i(b));
+ return vreinterpretq_m128i_u64(vmull_u32(a_lo, b_lo));
+}
+
+// Multiply packed double-precision (64-bit) floating-point elements in a and b,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_pd
+FORCE_INLINE __m128d _mm_mul_pd(__m128d a, __m128d b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vmulq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
#else
- return _mm_add_ps(_mm_mul_ps(a, b), c);
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[2];
+ c[0] = da[0] * db[0];
+ c[1] = da[1] * db[1];
+ return vld1q_f32((float32_t *) c);
#endif
}
-// Alternatively add and subtract packed single-precision (32-bit)
-// floating-point elements in a to/from packed elements in b, and store the
-// results in dst.
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=addsub_ps
-FORCE_INLINE __m128 _mm_addsub_ps(__m128 a, __m128 b)
+// Multiply the lower double-precision (64-bit) floating-point element in a and
+// b, store the result in the lower element of dst, and copy the upper element
+// from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_mul_sd
+FORCE_INLINE __m128d _mm_mul_sd(__m128d a, __m128d b)
{
- __m128 mask = {-1.0f, 1.0f, -1.0f, 1.0f};
- return _mm_fmadd_ps(b, mask, a);
+ return _mm_move_sd(a, _mm_mul_pd(a, b));
}
-// Compute the absolute differences of packed unsigned 8-bit integers in a and
-// b, then horizontally sum each consecutive 8 differences to produce two
-// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
-// 16 bits of 64-bit elements in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sad_epu8
-FORCE_INLINE __m128i _mm_sad_epu8(__m128i a, __m128i b)
+// Multiply the low unsigned 32-bit integers from a and b, and store the
+// unsigned 64-bit result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_su32
+FORCE_INLINE __m64 _mm_mul_su32(__m64 a, __m64 b)
{
- uint16x8_t t = vpaddlq_u8(vabdq_u8((uint8x16_t) a, (uint8x16_t) b));
- uint16_t r0 = t[0] + t[1] + t[2] + t[3];
- uint16_t r4 = t[4] + t[5] + t[6] + t[7];
- uint16x8_t r = vsetq_lane_u16(r0, vdupq_n_u16(0), 0);
- return (__m128i) vsetq_lane_u16(r4, r, 4);
+ return vreinterpret_m64_u64(vget_low_u64(
+ vmull_u32(vreinterpret_u32_m64(a), vreinterpret_u32_m64(b))));
}
-// Compute the absolute differences of packed unsigned 8-bit integers in a and
-// b, then horizontally sum each consecutive 8 differences to produce four
-// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
-// 16 bits of dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sad_pu8
-FORCE_INLINE __m64 _mm_sad_pu8(__m64 a, __m64 b)
+// Multiply the packed signed 16-bit integers in a and b, producing intermediate
+// 32-bit integers, and store the high 16 bits of the intermediate integers in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhi_epi16
+FORCE_INLINE __m128i _mm_mulhi_epi16(__m128i a, __m128i b)
{
- uint16x4_t t =
- vpaddl_u8(vabd_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
- uint16_t r0 = t[0] + t[1] + t[2] + t[3];
- return vreinterpret_m64_u16(vset_lane_u16(r0, vdup_n_u16(0), 0));
+ /* FIXME: issue with large values because of result saturation */
+ // int16x8_t ret = vqdmulhq_s16(vreinterpretq_s16_m128i(a),
+ // vreinterpretq_s16_m128i(b)); /* =2*a*b */ return
+ // vreinterpretq_m128i_s16(vshrq_n_s16(ret, 1));
+ int16x4_t a3210 = vget_low_s16(vreinterpretq_s16_m128i(a));
+ int16x4_t b3210 = vget_low_s16(vreinterpretq_s16_m128i(b));
+ int32x4_t ab3210 = vmull_s16(a3210, b3210); /* 3333222211110000 */
+ int16x4_t a7654 = vget_high_s16(vreinterpretq_s16_m128i(a));
+ int16x4_t b7654 = vget_high_s16(vreinterpretq_s16_m128i(b));
+ int32x4_t ab7654 = vmull_s16(a7654, b7654); /* 7777666655554444 */
+ uint16x8x2_t r =
+ vuzpq_u16(vreinterpretq_u16_s32(ab3210), vreinterpretq_u16_s32(ab7654));
+ return vreinterpretq_m128i_u16(r.val[1]);
}
-// Compute the absolute differences of packed unsigned 8-bit integers in a and
-// b, then horizontally sum each consecutive 8 differences to produce four
-// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
-// 16 bits of dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// tmp[i+7:i] := ABS(a[i+7:i] - b[i+7:i])
-// ENDFOR
-// dst[15:0] := tmp[7:0] + tmp[15:8] + tmp[23:16] + tmp[31:24] + tmp[39:32] +
-// tmp[47:40] + tmp[55:48] + tmp[63:56] dst[63:16] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_m_psadbw
-#define _m_psadbw(a, b) _mm_sad_pu8(a, b)
-
-// Divides the four single-precision, floating-point values of a and b.
-//
-// r0 := a0 / b0
-// r1 := a1 / b1
-// r2 := a2 / b2
-// r3 := a3 / b3
-//
-// https://msdn.microsoft.com/en-us/library/edaw8147(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_div_ps(__m128 a, __m128 b)
+// Multiply the packed unsigned 16-bit integers in a and b, producing
+// intermediate 32-bit integers, and store the high 16 bits of the intermediate
+// integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhi_epu16
+FORCE_INLINE __m128i _mm_mulhi_epu16(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(
- vdivq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ uint16x4_t a3210 = vget_low_u16(vreinterpretq_u16_m128i(a));
+ uint16x4_t b3210 = vget_low_u16(vreinterpretq_u16_m128i(b));
+ uint32x4_t ab3210 = vmull_u16(a3210, b3210);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint32x4_t ab7654 =
+ vmull_high_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b));
+ uint16x8_t r = vuzp2q_u16(vreinterpretq_u16_u32(ab3210),
+ vreinterpretq_u16_u32(ab7654));
+ return vreinterpretq_m128i_u16(r);
#else
- float32x4_t recip0 = vrecpeq_f32(vreinterpretq_f32_m128(b));
- float32x4_t recip1 =
- vmulq_f32(recip0, vrecpsq_f32(recip0, vreinterpretq_f32_m128(b)));
- return vreinterpretq_m128_f32(vmulq_f32(vreinterpretq_f32_m128(a), recip1));
+ uint16x4_t a7654 = vget_high_u16(vreinterpretq_u16_m128i(a));
+ uint16x4_t b7654 = vget_high_u16(vreinterpretq_u16_m128i(b));
+ uint32x4_t ab7654 = vmull_u16(a7654, b7654);
+ uint16x8x2_t r =
+ vuzpq_u16(vreinterpretq_u16_u32(ab3210), vreinterpretq_u16_u32(ab7654));
+ return vreinterpretq_m128i_u16(r.val[1]);
#endif
}
-// Divides the scalar single-precision floating point value of a by b.
-// https://msdn.microsoft.com/en-us/library/4y73xa49(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
+// Multiply the packed 16-bit integers in a and b, producing intermediate 32-bit
+// integers, and store the low 16 bits of the intermediate integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mullo_epi16
+FORCE_INLINE __m128i _mm_mullo_epi16(__m128i a, __m128i b)
{
- float32_t value =
- vgetq_lane_f32(vreinterpretq_f32_m128(_mm_div_ps(a, b)), 0);
- return vreinterpretq_m128_f32(
- vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
+ return vreinterpretq_m128i_s16(
+ vmulq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// Compute the approximate reciprocal of packed single-precision (32-bit)
-// floating-point elements in a, and store the results in dst. The maximum
-// relative error for this approximation is less than 1.5*2^-12.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rcp_ps
-FORCE_INLINE __m128 _mm_rcp_ps(__m128 in)
+// Compute the bitwise OR of packed double-precision (64-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_or_pd
+FORCE_INLINE __m128d _mm_or_pd(__m128d a, __m128d b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(
- vdivq_f32(vdupq_n_f32(1.0f), vreinterpretq_f32_m128(in)));
-#else
- float32x4_t recip = vrecpeq_f32(vreinterpretq_f32_m128(in));
- recip = vmulq_f32(recip, vrecpsq_f32(recip, vreinterpretq_f32_m128(in)));
- return vreinterpretq_m128_f32(recip);
-#endif
+ return vreinterpretq_m128d_s64(
+ vorrq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b)));
}
-// Compute the approximate reciprocal of the lower single-precision (32-bit)
-// floating-point element in a, store the result in the lower element of dst,
-// and copy the upper 3 packed elements from a to the upper elements of dst. The
-// maximum relative error for this approximation is less than 1.5*2^-12.
-//
-// dst[31:0] := (1.0 / a[31:0])
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rcp_ss
-FORCE_INLINE __m128 _mm_rcp_ss(__m128 a)
+// Compute the bitwise OR of 128 bits (representing integer data) in a and b,
+// and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_or_si128
+FORCE_INLINE __m128i _mm_or_si128(__m128i a, __m128i b)
{
- return _mm_move_ss(a, _mm_rcp_ps(a));
+ return vreinterpretq_m128i_s32(
+ vorrq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-// Computes the approximations of square roots of the four single-precision,
-// floating-point values of a. First computes reciprocal square roots and then
-// reciprocals of the four values.
-//
-// r0 := sqrt(a0)
-// r1 := sqrt(a1)
-// r2 := sqrt(a2)
-// r3 := sqrt(a3)
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/8z67bwwk(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_sqrt_ps(__m128 in)
+// Convert packed signed 16-bit integers from a and b to packed 8-bit integers
+// using signed saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packs_epi16
+FORCE_INLINE __m128i _mm_packs_epi16(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(vsqrtq_f32(vreinterpretq_f32_m128(in)));
+ return vreinterpretq_m128i_s8(
+ vcombine_s8(vqmovn_s16(vreinterpretq_s16_m128i(a)),
+ vqmovn_s16(vreinterpretq_s16_m128i(b))));
+}
+
+// Convert packed signed 32-bit integers from a and b to packed 16-bit integers
+// using signed saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packs_epi32
+FORCE_INLINE __m128i _mm_packs_epi32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_s16(
+ vcombine_s16(vqmovn_s32(vreinterpretq_s32_m128i(a)),
+ vqmovn_s32(vreinterpretq_s32_m128i(b))));
+}
+
+// Convert packed signed 16-bit integers from a and b to packed 8-bit integers
+// using unsigned saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packus_epi16
+FORCE_INLINE __m128i _mm_packus_epi16(const __m128i a, const __m128i b)
+{
+ return vreinterpretq_m128i_u8(
+ vcombine_u8(vqmovun_s16(vreinterpretq_s16_m128i(a)),
+ vqmovun_s16(vreinterpretq_s16_m128i(b))));
+}
+
+// Pause the processor. This is typically used in spin-wait loops and depending
+// on the x86 processor typical values are in the 40-100 cycle range. The
+// 'yield' instruction isn't a good fit because it's effectively a nop on most
+// Arm cores. Experience with several databases has shown has shown an 'isb' is
+// a reasonable approximation.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_pause
+FORCE_INLINE void _mm_pause()
+{
+#if defined(_MSC_VER)
+ __isb(_ARM64_BARRIER_SY);
#else
- float32x4_t recipsq = vrsqrteq_f32(vreinterpretq_f32_m128(in));
- float32x4_t sq = vrecpeq_f32(recipsq);
- // ??? use step versions of both sqrt and recip for better accuracy?
- return vreinterpretq_m128_f32(sq);
+ __asm__ __volatile__("isb\n");
#endif
}
-// Computes the approximation of the square root of the scalar single-precision
-// floating point value of in.
-// https://msdn.microsoft.com/en-us/library/ahfsc22d(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_sqrt_ss(__m128 in)
+// Compute the absolute differences of packed unsigned 8-bit integers in a and
+// b, then horizontally sum each consecutive 8 differences to produce two
+// unsigned 16-bit integers, and pack these unsigned 16-bit integers in the low
+// 16 bits of 64-bit elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sad_epu8
+FORCE_INLINE __m128i _mm_sad_epu8(__m128i a, __m128i b)
{
- float32_t value =
- vgetq_lane_f32(vreinterpretq_f32_m128(_mm_sqrt_ps(in)), 0);
- return vreinterpretq_m128_f32(
- vsetq_lane_f32(value, vreinterpretq_f32_m128(in), 0));
+ uint16x8_t t = vpaddlq_u8(vabdq_u8((uint8x16_t) a, (uint8x16_t) b));
+ return vreinterpretq_m128i_u64(vpaddlq_u32(vpaddlq_u16(t)));
}
-// Computes the approximations of the reciprocal square roots of the four
-// single-precision floating point values of in.
-// https://msdn.microsoft.com/en-us/library/22hfsh53(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_rsqrt_ps(__m128 in)
+// Set packed 16-bit integers in dst with the supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_epi16
+FORCE_INLINE __m128i _mm_set_epi16(short i7,
+ short i6,
+ short i5,
+ short i4,
+ short i3,
+ short i2,
+ short i1,
+ short i0)
{
- return vreinterpretq_m128_f32(vrsqrteq_f32(vreinterpretq_f32_m128(in)));
+ int16_t ALIGN_STRUCT(16) data[8] = {i0, i1, i2, i3, i4, i5, i6, i7};
+ return vreinterpretq_m128i_s16(vld1q_s16(data));
}
-// Compute the approximate reciprocal square root of the lower single-precision
-// (32-bit) floating-point element in a, store the result in the lower element
-// of dst, and copy the upper 3 packed elements from a to the upper elements of
-// dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_rsqrt_ss
-FORCE_INLINE __m128 _mm_rsqrt_ss(__m128 in)
+// Set packed 32-bit integers in dst with the supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_epi32
+FORCE_INLINE __m128i _mm_set_epi32(int i3, int i2, int i1, int i0)
{
- return vsetq_lane_f32(vgetq_lane_f32(_mm_rsqrt_ps(in), 0), in, 0);
+ int32_t ALIGN_STRUCT(16) data[4] = {i0, i1, i2, i3};
+ return vreinterpretq_m128i_s32(vld1q_s32(data));
}
-// Compare packed signed 16-bit integers in a and b, and store packed maximum
-// values in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := MAX(a[i+15:i], b[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pi16
-FORCE_INLINE __m64 _mm_max_pi16(__m64 a, __m64 b)
+// Set packed 64-bit integers in dst with the supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_epi64
+FORCE_INLINE __m128i _mm_set_epi64(__m64 i1, __m64 i2)
{
- return vreinterpret_m64_s16(
- vmax_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
+ return _mm_set_epi64x(vget_lane_s64(i1, 0), vget_lane_s64(i2, 0));
}
-// Compare packed signed 16-bit integers in a and b, and store packed maximum
-// values in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := MAX(a[i+15:i], b[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pi16
-#define _m_pmaxsw(a, b) _mm_max_pi16(a, b)
-
-// Computes the maximums of the four single-precision, floating-point values of
-// a and b.
-// https://msdn.microsoft.com/en-us/library/vstudio/ff5d607a(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b)
+// Set packed 64-bit integers in dst with the supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_epi64x
+FORCE_INLINE __m128i _mm_set_epi64x(int64_t i1, int64_t i2)
{
-#if SSE2NEON_PRECISE_MINMAX
- float32x4_t _a = vreinterpretq_f32_m128(a);
- float32x4_t _b = vreinterpretq_f32_m128(b);
- return vbslq_f32(vcltq_f32(_b, _a), _a, _b);
-#else
- return vreinterpretq_m128_f32(
- vmaxq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
-#endif
+ return vreinterpretq_m128i_s64(
+ vcombine_s64(vcreate_s64(i2), vcreate_s64(i1)));
}
-// Compare packed unsigned 8-bit integers in a and b, and store packed maximum
-// values in dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := MAX(a[i+7:i], b[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pu8
-FORCE_INLINE __m64 _mm_max_pu8(__m64 a, __m64 b)
+// Set packed 8-bit integers in dst with the supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_epi8
+FORCE_INLINE __m128i _mm_set_epi8(signed char b15,
+ signed char b14,
+ signed char b13,
+ signed char b12,
+ signed char b11,
+ signed char b10,
+ signed char b9,
+ signed char b8,
+ signed char b7,
+ signed char b6,
+ signed char b5,
+ signed char b4,
+ signed char b3,
+ signed char b2,
+ signed char b1,
+ signed char b0)
{
- return vreinterpret_m64_u8(
- vmax_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
+ int8_t ALIGN_STRUCT(16)
+ data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3,
+ (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7,
+ (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11,
+ (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15};
+ return (__m128i) vld1q_s8(data);
}
-// Compare packed unsigned 8-bit integers in a and b, and store packed maximum
-// values in dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := MAX(a[i+7:i], b[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_pu8
-#define _m_pmaxub(a, b) _mm_max_pu8(a, b)
-
-// Compare packed signed 16-bit integers in a and b, and store packed minimum
-// values in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := MIN(a[i+15:i], b[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pi16
-FORCE_INLINE __m64 _mm_min_pi16(__m64 a, __m64 b)
+// Set packed double-precision (64-bit) floating-point elements in dst with the
+// supplied values.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_pd
+FORCE_INLINE __m128d _mm_set_pd(double e1, double e0)
{
- return vreinterpret_m64_s16(
- vmin_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
+ double ALIGN_STRUCT(16) data[2] = {e0, e1};
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vld1q_f64((float64_t *) data));
+#else
+ return vreinterpretq_m128d_f32(vld1q_f32((float32_t *) data));
+#endif
}
-// Compare packed signed 16-bit integers in a and b, and store packed minimum
-// values in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// dst[i+15:i] := MIN(a[i+15:i], b[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pi16
-#define _m_pminsw(a, b) _mm_min_pi16(a, b)
+// Broadcast double-precision (64-bit) floating-point value a to all elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_pd1
+#define _mm_set_pd1 _mm_set1_pd
-// Computes the minima of the four single-precision, floating-point values of a
-// and b.
-// https://msdn.microsoft.com/en-us/library/vstudio/wh13kadz(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_min_ps(__m128 a, __m128 b)
+// Copy double-precision (64-bit) floating-point element a to the lower element
+// of dst, and zero the upper element.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set_sd
+FORCE_INLINE __m128d _mm_set_sd(double a)
{
-#if SSE2NEON_PRECISE_MINMAX
- float32x4_t _a = vreinterpretq_f32_m128(a);
- float32x4_t _b = vreinterpretq_f32_m128(b);
- return vbslq_f32(vcltq_f32(_a, _b), _a, _b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vsetq_lane_f64(a, vdupq_n_f64(0), 0));
#else
- return vreinterpretq_m128_f32(
- vminq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ return _mm_set_pd(0, a);
#endif
}
-// Compare packed unsigned 8-bit integers in a and b, and store packed minimum
-// values in dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := MIN(a[i+7:i], b[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pu8
-FORCE_INLINE __m64 _mm_min_pu8(__m64 a, __m64 b)
+// Broadcast 16-bit integer a to all all elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_epi16
+FORCE_INLINE __m128i _mm_set1_epi16(short w)
{
- return vreinterpret_m64_u8(
- vmin_u8(vreinterpret_u8_m64(a), vreinterpret_u8_m64(b)));
+ return vreinterpretq_m128i_s16(vdupq_n_s16(w));
}
-// Compare packed unsigned 8-bit integers in a and b, and store packed minimum
-// values in dst.
-//
-// FOR j := 0 to 7
-// i := j*8
-// dst[i+7:i] := MIN(a[i+7:i], b[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_pu8
-#define _m_pminub(a, b) _mm_min_pu8(a, b)
-
-// Computes the maximum of the two lower scalar single-precision floating point
-// values of a and b.
-// https://msdn.microsoft.com/en-us/library/s6db5esz(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_max_ss(__m128 a, __m128 b)
+// Broadcast 32-bit integer a to all elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_epi32
+FORCE_INLINE __m128i _mm_set1_epi32(int _i)
{
- float32_t value = vgetq_lane_f32(_mm_max_ps(a, b), 0);
- return vreinterpretq_m128_f32(
- vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
+ return vreinterpretq_m128i_s32(vdupq_n_s32(_i));
}
-// Computes the minimum of the two lower scalar single-precision floating point
-// values of a and b.
-// https://msdn.microsoft.com/en-us/library/0a9y7xaa(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_min_ss(__m128 a, __m128 b)
+// Broadcast 64-bit integer a to all elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_epi64
+FORCE_INLINE __m128i _mm_set1_epi64(__m64 _i)
{
- float32_t value = vgetq_lane_f32(_mm_min_ps(a, b), 0);
- return vreinterpretq_m128_f32(
- vsetq_lane_f32(value, vreinterpretq_f32_m128(a), 0));
+ return vreinterpretq_m128i_s64(vdupq_lane_s64(_i, 0));
}
-// Computes the pairwise maxima of the 16 unsigned 8-bit integers from a and the
-// 16 unsigned 8-bit integers from b.
-// https://msdn.microsoft.com/en-us/library/st6634za(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_max_epu8(__m128i a, __m128i b)
+// Broadcast 64-bit integer a to all elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_epi64x
+FORCE_INLINE __m128i _mm_set1_epi64x(int64_t _i)
{
- return vreinterpretq_m128i_u8(
- vmaxq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
+ return vreinterpretq_m128i_s64(vdupq_n_s64(_i));
}
-// Computes the pairwise minima of the 16 unsigned 8-bit integers from a and the
-// 16 unsigned 8-bit integers from b.
-// https://msdn.microsoft.com/ko-kr/library/17k8cf58(v=vs.100).aspxx
-FORCE_INLINE __m128i _mm_min_epu8(__m128i a, __m128i b)
+// Broadcast 8-bit integer a to all elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_epi8
+FORCE_INLINE __m128i _mm_set1_epi8(signed char w)
{
- return vreinterpretq_m128i_u8(
- vminq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
+ return vreinterpretq_m128i_s8(vdupq_n_s8(w));
}
-// Computes the pairwise minima of the 8 signed 16-bit integers from a and the 8
-// signed 16-bit integers from b.
-// https://msdn.microsoft.com/en-us/library/vstudio/6te997ew(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_min_epi16(__m128i a, __m128i b)
+// Broadcast double-precision (64-bit) floating-point value a to all elements of
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_set1_pd
+FORCE_INLINE __m128d _mm_set1_pd(double d)
{
- return vreinterpretq_m128i_s16(
- vminq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vdupq_n_f64(d));
+#else
+ return vreinterpretq_m128d_s64(vdupq_n_s64(*(int64_t *) &d));
+#endif
}
-// Compare packed signed 8-bit integers in a and b, and store packed maximum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epi8
-FORCE_INLINE __m128i _mm_max_epi8(__m128i a, __m128i b)
+// Set packed 16-bit integers in dst with the supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_epi16
+FORCE_INLINE __m128i _mm_setr_epi16(short w0,
+ short w1,
+ short w2,
+ short w3,
+ short w4,
+ short w5,
+ short w6,
+ short w7)
{
- return vreinterpretq_m128i_s8(
- vmaxq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ int16_t ALIGN_STRUCT(16) data[8] = {w0, w1, w2, w3, w4, w5, w6, w7};
+ return vreinterpretq_m128i_s16(vld1q_s16((int16_t *) data));
}
-// Compare packed unsigned 16-bit integers in a and b, and store packed maximum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu16
-FORCE_INLINE __m128i _mm_max_epu16(__m128i a, __m128i b)
+// Set packed 32-bit integers in dst with the supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_epi32
+FORCE_INLINE __m128i _mm_setr_epi32(int i3, int i2, int i1, int i0)
{
- return vreinterpretq_m128i_u16(
- vmaxq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
+ int32_t ALIGN_STRUCT(16) data[4] = {i3, i2, i1, i0};
+ return vreinterpretq_m128i_s32(vld1q_s32(data));
}
-// Compare packed signed 8-bit integers in a and b, and store packed minimum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epi8
-FORCE_INLINE __m128i _mm_min_epi8(__m128i a, __m128i b)
+// Set packed 64-bit integers in dst with the supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_epi64
+FORCE_INLINE __m128i _mm_setr_epi64(__m64 e1, __m64 e0)
{
- return vreinterpretq_m128i_s8(
- vminq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ return vreinterpretq_m128i_s64(vcombine_s64(e1, e0));
}
-// Compare packed unsigned 16-bit integers in a and b, and store packed minimum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_min_epu16
-FORCE_INLINE __m128i _mm_min_epu16(__m128i a, __m128i b)
+// Set packed 8-bit integers in dst with the supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_epi8
+FORCE_INLINE __m128i _mm_setr_epi8(signed char b0,
+ signed char b1,
+ signed char b2,
+ signed char b3,
+ signed char b4,
+ signed char b5,
+ signed char b6,
+ signed char b7,
+ signed char b8,
+ signed char b9,
+ signed char b10,
+ signed char b11,
+ signed char b12,
+ signed char b13,
+ signed char b14,
+ signed char b15)
{
- return vreinterpretq_m128i_u16(
- vminq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
+ int8_t ALIGN_STRUCT(16)
+ data[16] = {(int8_t) b0, (int8_t) b1, (int8_t) b2, (int8_t) b3,
+ (int8_t) b4, (int8_t) b5, (int8_t) b6, (int8_t) b7,
+ (int8_t) b8, (int8_t) b9, (int8_t) b10, (int8_t) b11,
+ (int8_t) b12, (int8_t) b13, (int8_t) b14, (int8_t) b15};
+ return (__m128i) vld1q_s8(data);
}
-// Computes the pairwise maxima of the 8 signed 16-bit integers from a and the 8
-// signed 16-bit integers from b.
-// https://msdn.microsoft.com/en-us/LIBRary/3x060h7c(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_max_epi16(__m128i a, __m128i b)
+// Set packed double-precision (64-bit) floating-point elements in dst with the
+// supplied values in reverse order.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setr_pd
+FORCE_INLINE __m128d _mm_setr_pd(double e1, double e0)
{
- return vreinterpretq_m128i_s16(
- vmaxq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+ return _mm_set_pd(e0, e1);
}
-// epi versions of min/max
-// Computes the pariwise maximums of the four signed 32-bit integer values of a
-// and b.
-//
-// A 128-bit parameter that can be defined with the following equations:
-// r0 := (a0 > b0) ? a0 : b0
-// r1 := (a1 > b1) ? a1 : b1
-// r2 := (a2 > b2) ? a2 : b2
-// r3 := (a3 > b3) ? a3 : b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/bb514055(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_max_epi32(__m128i a, __m128i b)
+// Return vector of type __m128d with all elements set to zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setzero_pd
+FORCE_INLINE __m128d _mm_setzero_pd(void)
{
- return vreinterpretq_m128i_s32(
- vmaxq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vdupq_n_f64(0));
+#else
+ return vreinterpretq_m128d_f32(vdupq_n_f32(0));
+#endif
}
-// Computes the pariwise minima of the four signed 32-bit integer values of a
-// and b.
-//
-// A 128-bit parameter that can be defined with the following equations:
-// r0 := (a0 < b0) ? a0 : b0
-// r1 := (a1 < b1) ? a1 : b1
-// r2 := (a2 < b2) ? a2 : b2
-// r3 := (a3 < b3) ? a3 : b3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/bb531476(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_min_epi32(__m128i a, __m128i b)
+// Return vector of type __m128i with all elements set to zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_setzero_si128
+FORCE_INLINE __m128i _mm_setzero_si128(void)
{
- return vreinterpretq_m128i_s32(
- vminq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+ return vreinterpretq_m128i_s32(vdupq_n_s32(0));
}
-// Compare packed unsigned 32-bit integers in a and b, and store packed maximum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu32
-FORCE_INLINE __m128i _mm_max_epu32(__m128i a, __m128i b)
+// Shuffle 32-bit integers in a using the control in imm8, and store the results
+// in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_epi32
+// FORCE_INLINE __m128i _mm_shuffle_epi32(__m128i a,
+// __constrange(0,255) int imm)
+#if defined(_sse2neon_shuffle)
+#define _mm_shuffle_epi32(a, imm) \
+ __extension__({ \
+ int32x4_t _input = vreinterpretq_s32_m128i(a); \
+ int32x4_t _shuf = \
+ vshuffleq_s32(_input, _input, (imm) & (0x3), ((imm) >> 2) & 0x3, \
+ ((imm) >> 4) & 0x3, ((imm) >> 6) & 0x3); \
+ vreinterpretq_m128i_s32(_shuf); \
+ })
+#else // generic
+#define _mm_shuffle_epi32(a, imm) \
+ _sse2neon_define1( \
+ __m128i, a, __m128i ret; switch (imm) { \
+ case _MM_SHUFFLE(1, 0, 3, 2): \
+ ret = _mm_shuffle_epi_1032(_a); \
+ break; \
+ case _MM_SHUFFLE(2, 3, 0, 1): \
+ ret = _mm_shuffle_epi_2301(_a); \
+ break; \
+ case _MM_SHUFFLE(0, 3, 2, 1): \
+ ret = _mm_shuffle_epi_0321(_a); \
+ break; \
+ case _MM_SHUFFLE(2, 1, 0, 3): \
+ ret = _mm_shuffle_epi_2103(_a); \
+ break; \
+ case _MM_SHUFFLE(1, 0, 1, 0): \
+ ret = _mm_shuffle_epi_1010(_a); \
+ break; \
+ case _MM_SHUFFLE(1, 0, 0, 1): \
+ ret = _mm_shuffle_epi_1001(_a); \
+ break; \
+ case _MM_SHUFFLE(0, 1, 0, 1): \
+ ret = _mm_shuffle_epi_0101(_a); \
+ break; \
+ case _MM_SHUFFLE(2, 2, 1, 1): \
+ ret = _mm_shuffle_epi_2211(_a); \
+ break; \
+ case _MM_SHUFFLE(0, 1, 2, 2): \
+ ret = _mm_shuffle_epi_0122(_a); \
+ break; \
+ case _MM_SHUFFLE(3, 3, 3, 2): \
+ ret = _mm_shuffle_epi_3332(_a); \
+ break; \
+ case _MM_SHUFFLE(0, 0, 0, 0): \
+ ret = _mm_shuffle_epi32_splat(_a, 0); \
+ break; \
+ case _MM_SHUFFLE(1, 1, 1, 1): \
+ ret = _mm_shuffle_epi32_splat(_a, 1); \
+ break; \
+ case _MM_SHUFFLE(2, 2, 2, 2): \
+ ret = _mm_shuffle_epi32_splat(_a, 2); \
+ break; \
+ case _MM_SHUFFLE(3, 3, 3, 3): \
+ ret = _mm_shuffle_epi32_splat(_a, 3); \
+ break; \
+ default: \
+ ret = _mm_shuffle_epi32_default(_a, (imm)); \
+ break; \
+ } _sse2neon_return(ret);)
+#endif
+
+// Shuffle double-precision (64-bit) floating-point elements using the control
+// in imm8, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_pd
+#ifdef _sse2neon_shuffle
+#define _mm_shuffle_pd(a, b, imm8) \
+ vreinterpretq_m128d_s64( \
+ vshuffleq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b), \
+ imm8 & 0x1, ((imm8 & 0x2) >> 1) + 2))
+#else
+#define _mm_shuffle_pd(a, b, imm8) \
+ _mm_castsi128_pd(_mm_set_epi64x( \
+ vgetq_lane_s64(vreinterpretq_s64_m128d(b), (imm8 & 0x2) >> 1), \
+ vgetq_lane_s64(vreinterpretq_s64_m128d(a), imm8 & 0x1)))
+#endif
+
+// FORCE_INLINE __m128i _mm_shufflehi_epi16(__m128i a,
+// __constrange(0,255) int imm)
+#if defined(_sse2neon_shuffle)
+#define _mm_shufflehi_epi16(a, imm) \
+ __extension__({ \
+ int16x8_t _input = vreinterpretq_s16_m128i(a); \
+ int16x8_t _shuf = \
+ vshuffleq_s16(_input, _input, 0, 1, 2, 3, ((imm) & (0x3)) + 4, \
+ (((imm) >> 2) & 0x3) + 4, (((imm) >> 4) & 0x3) + 4, \
+ (((imm) >> 6) & 0x3) + 4); \
+ vreinterpretq_m128i_s16(_shuf); \
+ })
+#else // generic
+#define _mm_shufflehi_epi16(a, imm) _mm_shufflehi_epi16_function((a), (imm))
+#endif
+
+// FORCE_INLINE __m128i _mm_shufflelo_epi16(__m128i a,
+// __constrange(0,255) int imm)
+#if defined(_sse2neon_shuffle)
+#define _mm_shufflelo_epi16(a, imm) \
+ __extension__({ \
+ int16x8_t _input = vreinterpretq_s16_m128i(a); \
+ int16x8_t _shuf = vshuffleq_s16( \
+ _input, _input, ((imm) & (0x3)), (((imm) >> 2) & 0x3), \
+ (((imm) >> 4) & 0x3), (((imm) >> 6) & 0x3), 4, 5, 6, 7); \
+ vreinterpretq_m128i_s16(_shuf); \
+ })
+#else // generic
+#define _mm_shufflelo_epi16(a, imm) _mm_shufflelo_epi16_function((a), (imm))
+#endif
+
+// Shift packed 16-bit integers in a left by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sll_epi16
+FORCE_INLINE __m128i _mm_sll_epi16(__m128i a, __m128i count)
{
- return vreinterpretq_m128i_u32(
- vmaxq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)));
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~15))
+ return _mm_setzero_si128();
+
+ int16x8_t vc = vdupq_n_s16((int16_t) c);
+ return vreinterpretq_m128i_s16(vshlq_s16(vreinterpretq_s16_m128i(a), vc));
}
-// Compare packed unsigned 32-bit integers in a and b, and store packed minimum
-// values in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_max_epu32
-FORCE_INLINE __m128i _mm_min_epu32(__m128i a, __m128i b)
+// Shift packed 32-bit integers in a left by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sll_epi32
+FORCE_INLINE __m128i _mm_sll_epi32(__m128i a, __m128i count)
{
- return vreinterpretq_m128i_u32(
- vminq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)));
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~31))
+ return _mm_setzero_si128();
+
+ int32x4_t vc = vdupq_n_s32((int32_t) c);
+ return vreinterpretq_m128i_s32(vshlq_s32(vreinterpretq_s32_m128i(a), vc));
}
-// Multiply the packed unsigned 16-bit integers in a and b, producing
-// intermediate 32-bit integers, and store the high 16 bits of the intermediate
-// integers in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mulhi_pu16
-FORCE_INLINE __m64 _mm_mulhi_pu16(__m64 a, __m64 b)
+// Shift packed 64-bit integers in a left by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sll_epi64
+FORCE_INLINE __m128i _mm_sll_epi64(__m128i a, __m128i count)
{
- return vreinterpret_m64_u16(vshrn_n_u32(
- vmull_u16(vreinterpret_u16_m64(a), vreinterpret_u16_m64(b)), 16));
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~63))
+ return _mm_setzero_si128();
+
+ int64x2_t vc = vdupq_n_s64((int64_t) c);
+ return vreinterpretq_m128i_s64(vshlq_s64(vreinterpretq_s64_m128i(a), vc));
}
-// Multiplies the 8 signed 16-bit integers from a by the 8 signed 16-bit
-// integers from b.
-//
-// r0 := (a0 * b0)[31:16]
-// r1 := (a1 * b1)[31:16]
-// ...
-// r7 := (a7 * b7)[31:16]
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/59hddw1d(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_mulhi_epi16(__m128i a, __m128i b)
+// Shift packed 16-bit integers in a left by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_slli_epi16
+FORCE_INLINE __m128i _mm_slli_epi16(__m128i a, int imm)
{
- /* FIXME: issue with large values because of result saturation */
- // int16x8_t ret = vqdmulhq_s16(vreinterpretq_s16_m128i(a),
- // vreinterpretq_s16_m128i(b)); /* =2*a*b */ return
- // vreinterpretq_m128i_s16(vshrq_n_s16(ret, 1));
- int16x4_t a3210 = vget_low_s16(vreinterpretq_s16_m128i(a));
- int16x4_t b3210 = vget_low_s16(vreinterpretq_s16_m128i(b));
- int32x4_t ab3210 = vmull_s16(a3210, b3210); /* 3333222211110000 */
- int16x4_t a7654 = vget_high_s16(vreinterpretq_s16_m128i(a));
- int16x4_t b7654 = vget_high_s16(vreinterpretq_s16_m128i(b));
- int32x4_t ab7654 = vmull_s16(a7654, b7654); /* 7777666655554444 */
- uint16x8x2_t r =
- vuzpq_u16(vreinterpretq_u16_s32(ab3210), vreinterpretq_u16_s32(ab7654));
- return vreinterpretq_m128i_u16(r.val[1]);
+ if (_sse2neon_unlikely(imm & ~15))
+ return _mm_setzero_si128();
+ return vreinterpretq_m128i_s16(
+ vshlq_s16(vreinterpretq_s16_m128i(a), vdupq_n_s16(imm)));
+}
+
+// Shift packed 32-bit integers in a left by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_slli_epi32
+FORCE_INLINE __m128i _mm_slli_epi32(__m128i a, int imm)
+{
+ if (_sse2neon_unlikely(imm & ~31))
+ return _mm_setzero_si128();
+ return vreinterpretq_m128i_s32(
+ vshlq_s32(vreinterpretq_s32_m128i(a), vdupq_n_s32(imm)));
}
-// Multiply the packed unsigned 16-bit integers in a and b, producing
-// intermediate 32-bit integers, and store the high 16 bits of the intermediate
-// integers in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mulhi_epu16
-FORCE_INLINE __m128i _mm_mulhi_epu16(__m128i a, __m128i b)
+// Shift packed 64-bit integers in a left by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_slli_epi64
+FORCE_INLINE __m128i _mm_slli_epi64(__m128i a, int imm)
{
- uint16x4_t a3210 = vget_low_u16(vreinterpretq_u16_m128i(a));
- uint16x4_t b3210 = vget_low_u16(vreinterpretq_u16_m128i(b));
- uint32x4_t ab3210 = vmull_u16(a3210, b3210);
-#if defined(__aarch64__)
- uint32x4_t ab7654 =
- vmull_high_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b));
- uint16x8_t r = vuzp2q_u16(vreinterpretq_u16_u32(ab3210),
- vreinterpretq_u16_u32(ab7654));
- return vreinterpretq_m128i_u16(r);
+ if (_sse2neon_unlikely(imm & ~63))
+ return _mm_setzero_si128();
+ return vreinterpretq_m128i_s64(
+ vshlq_s64(vreinterpretq_s64_m128i(a), vdupq_n_s64(imm)));
+}
+
+// Shift a left by imm8 bytes while shifting in zeros, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_slli_si128
+#define _mm_slli_si128(a, imm) \
+ _sse2neon_define1( \
+ __m128i, a, int8x16_t ret; \
+ if (_sse2neon_unlikely(imm == 0)) ret = vreinterpretq_s8_m128i(_a); \
+ else if (_sse2neon_unlikely((imm) & ~15)) ret = vdupq_n_s8(0); \
+ else ret = vextq_s8(vdupq_n_s8(0), vreinterpretq_s8_m128i(_a), \
+ ((imm <= 0 || imm > 15) ? 0 : (16 - imm))); \
+ _sse2neon_return(vreinterpretq_m128i_s8(ret));)
+
+// Compute the square root of packed double-precision (64-bit) floating-point
+// elements in a, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sqrt_pd
+FORCE_INLINE __m128d _mm_sqrt_pd(__m128d a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vsqrtq_f64(vreinterpretq_f64_m128d(a)));
#else
- uint16x4_t a7654 = vget_high_u16(vreinterpretq_u16_m128i(a));
- uint16x4_t b7654 = vget_high_u16(vreinterpretq_u16_m128i(b));
- uint32x4_t ab7654 = vmull_u16(a7654, b7654);
- uint16x8x2_t r =
- vuzpq_u16(vreinterpretq_u16_u32(ab3210), vreinterpretq_u16_u32(ab7654));
- return vreinterpretq_m128i_u16(r.val[1]);
+ double a0 = sqrt(((double *) &a)[0]);
+ double a1 = sqrt(((double *) &a)[1]);
+ return _mm_set_pd(a1, a0);
#endif
}
-// Computes pairwise add of each argument as single-precision, floating-point
-// values a and b.
-// https://msdn.microsoft.com/en-us/library/yd9wecaa.aspx
-FORCE_INLINE __m128 _mm_hadd_ps(__m128 a, __m128 b)
+// Compute the square root of the lower double-precision (64-bit) floating-point
+// element in b, store the result in the lower element of dst, and copy the
+// upper element from a to the upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sqrt_sd
+FORCE_INLINE __m128d _mm_sqrt_sd(__m128d a, __m128d b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(
- vpaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return _mm_move_sd(a, _mm_sqrt_pd(b));
#else
- float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
- float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
- float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
- float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_f32(
- vcombine_f32(vpadd_f32(a10, a32), vpadd_f32(b10, b32)));
+ return _mm_set_pd(((double *) &a)[1], sqrt(((double *) &b)[0]));
#endif
}
-// Computes pairwise add of each argument as a 16-bit signed or unsigned integer
-// values a and b.
-FORCE_INLINE __m128i _mm_hadd_epi16(__m128i _a, __m128i _b)
+// Shift packed 16-bit integers in a right by count while shifting in sign bits,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sra_epi16
+FORCE_INLINE __m128i _mm_sra_epi16(__m128i a, __m128i count)
{
- int16x8_t a = vreinterpretq_s16_m128i(_a);
- int16x8_t b = vreinterpretq_s16_m128i(_b);
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s16(vpaddq_s16(a, b));
-#else
+ int64_t c = vgetq_lane_s64(count, 0);
+ if (_sse2neon_unlikely(c & ~15))
+ return _mm_cmplt_epi16(a, _mm_setzero_si128());
return vreinterpretq_m128i_s16(
- vcombine_s16(vpadd_s16(vget_low_s16(a), vget_high_s16(a)),
- vpadd_s16(vget_low_s16(b), vget_high_s16(b))));
-#endif
+ vshlq_s16((int16x8_t) a, vdupq_n_s16((int) -c)));
}
-// Horizontally substract adjacent pairs of single-precision (32-bit)
-// floating-point elements in a and b, and pack the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsub_ps
-FORCE_INLINE __m128 _mm_hsub_ps(__m128 _a, __m128 _b)
+// Shift packed 32-bit integers in a right by count while shifting in sign bits,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sra_epi32
+FORCE_INLINE __m128i _mm_sra_epi32(__m128i a, __m128i count)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(vsubq_f32(
- vuzp1q_f32(vreinterpretq_f32_m128(_a), vreinterpretq_f32_m128(_b)),
- vuzp2q_f32(vreinterpretq_f32_m128(_a), vreinterpretq_f32_m128(_b))));
-#else
- float32x4x2_t c =
- vuzpq_f32(vreinterpretq_f32_m128(_a), vreinterpretq_f32_m128(_b));
- return vreinterpretq_m128_f32(vsubq_f32(c.val[0], c.val[1]));
-#endif
+ int64_t c = vgetq_lane_s64(count, 0);
+ if (_sse2neon_unlikely(c & ~31))
+ return _mm_cmplt_epi32(a, _mm_setzero_si128());
+ return vreinterpretq_m128i_s32(
+ vshlq_s32((int32x4_t) a, vdupq_n_s32((int) -c)));
}
-// Horizontally add adjacent pairs of 16-bit integers in a and b, and pack the
-// signed 16-bit results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hadd_pi16
-FORCE_INLINE __m64 _mm_hadd_pi16(__m64 a, __m64 b)
+// Shift packed 16-bit integers in a right by imm8 while shifting in sign
+// bits, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srai_epi16
+FORCE_INLINE __m128i _mm_srai_epi16(__m128i a, int imm)
{
- return vreinterpret_m64_s16(
- vpadd_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
+ const int count = (imm & ~15) ? 15 : imm;
+ return (__m128i) vshlq_s16((int16x8_t) a, vdupq_n_s16(-count));
}
-// Horizontally add adjacent pairs of 32-bit integers in a and b, and pack the
-// signed 32-bit results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hadd_pi32
-FORCE_INLINE __m64 _mm_hadd_pi32(__m64 a, __m64 b)
+// Shift packed 32-bit integers in a right by imm8 while shifting in sign bits,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srai_epi32
+// FORCE_INLINE __m128i _mm_srai_epi32(__m128i a, __constrange(0,255) int imm)
+#define _mm_srai_epi32(a, imm) \
+ _sse2neon_define0( \
+ __m128i, a, __m128i ret; if (_sse2neon_unlikely((imm) == 0)) { \
+ ret = _a; \
+ } else if (_sse2neon_likely(0 < (imm) && (imm) < 32)) { \
+ ret = vreinterpretq_m128i_s32( \
+ vshlq_s32(vreinterpretq_s32_m128i(_a), vdupq_n_s32(-(imm)))); \
+ } else { \
+ ret = vreinterpretq_m128i_s32( \
+ vshrq_n_s32(vreinterpretq_s32_m128i(_a), 31)); \
+ } _sse2neon_return(ret);)
+
+// Shift packed 16-bit integers in a right by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srl_epi16
+FORCE_INLINE __m128i _mm_srl_epi16(__m128i a, __m128i count)
{
- return vreinterpret_m64_s32(
- vpadd_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)));
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~15))
+ return _mm_setzero_si128();
+
+ int16x8_t vc = vdupq_n_s16(-(int16_t) c);
+ return vreinterpretq_m128i_u16(vshlq_u16(vreinterpretq_u16_m128i(a), vc));
}
-// Computes pairwise difference of each argument as a 16-bit signed or unsigned
-// integer values a and b.
-FORCE_INLINE __m128i _mm_hsub_epi16(__m128i _a, __m128i _b)
+// Shift packed 32-bit integers in a right by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srl_epi32
+FORCE_INLINE __m128i _mm_srl_epi32(__m128i a, __m128i count)
{
- int32x4_t a = vreinterpretq_s32_m128i(_a);
- int32x4_t b = vreinterpretq_s32_m128i(_b);
- // Interleave using vshrn/vmovn
- // [a0|a2|a4|a6|b0|b2|b4|b6]
- // [a1|a3|a5|a7|b1|b3|b5|b7]
- int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b));
- int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16));
- // Subtract
- return vreinterpretq_m128i_s16(vsubq_s16(ab0246, ab1357));
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~31))
+ return _mm_setzero_si128();
+
+ int32x4_t vc = vdupq_n_s32(-(int32_t) c);
+ return vreinterpretq_m128i_u32(vshlq_u32(vreinterpretq_u32_m128i(a), vc));
}
-// Computes saturated pairwise sub of each argument as a 16-bit signed
-// integer values a and b.
-FORCE_INLINE __m128i _mm_hadds_epi16(__m128i _a, __m128i _b)
+// Shift packed 64-bit integers in a right by count while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srl_epi64
+FORCE_INLINE __m128i _mm_srl_epi64(__m128i a, __m128i count)
{
-#if defined(__aarch64__)
- int16x8_t a = vreinterpretq_s16_m128i(_a);
- int16x8_t b = vreinterpretq_s16_m128i(_b);
- return vreinterpretq_s64_s16(
- vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
-#else
- int32x4_t a = vreinterpretq_s32_m128i(_a);
- int32x4_t b = vreinterpretq_s32_m128i(_b);
- // Interleave using vshrn/vmovn
- // [a0|a2|a4|a6|b0|b2|b4|b6]
- // [a1|a3|a5|a7|b1|b3|b5|b7]
- int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b));
- int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16));
- // Saturated add
- return vreinterpretq_m128i_s16(vqaddq_s16(ab0246, ab1357));
-#endif
+ uint64_t c = vreinterpretq_nth_u64_m128i(count, 0);
+ if (_sse2neon_unlikely(c & ~63))
+ return _mm_setzero_si128();
+
+ int64x2_t vc = vdupq_n_s64(-(int64_t) c);
+ return vreinterpretq_m128i_u64(vshlq_u64(vreinterpretq_u64_m128i(a), vc));
}
-// Computes saturated pairwise difference of each argument as a 16-bit signed
-// integer values a and b.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_hsubs_epi16
-FORCE_INLINE __m128i _mm_hsubs_epi16(__m128i _a, __m128i _b)
+// Shift packed 16-bit integers in a right by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srli_epi16
+#define _mm_srli_epi16(a, imm) \
+ _sse2neon_define0( \
+ __m128i, a, __m128i ret; if (_sse2neon_unlikely((imm) & ~15)) { \
+ ret = _mm_setzero_si128(); \
+ } else { \
+ ret = vreinterpretq_m128i_u16( \
+ vshlq_u16(vreinterpretq_u16_m128i(_a), vdupq_n_s16(-(imm)))); \
+ } _sse2neon_return(ret);)
+
+// Shift packed 32-bit integers in a right by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srli_epi32
+// FORCE_INLINE __m128i _mm_srli_epi32(__m128i a, __constrange(0,255) int imm)
+#define _mm_srli_epi32(a, imm) \
+ _sse2neon_define0( \
+ __m128i, a, __m128i ret; if (_sse2neon_unlikely((imm) & ~31)) { \
+ ret = _mm_setzero_si128(); \
+ } else { \
+ ret = vreinterpretq_m128i_u32( \
+ vshlq_u32(vreinterpretq_u32_m128i(_a), vdupq_n_s32(-(imm)))); \
+ } _sse2neon_return(ret);)
+
+// Shift packed 64-bit integers in a right by imm8 while shifting in zeros, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srli_epi64
+#define _mm_srli_epi64(a, imm) \
+ _sse2neon_define0( \
+ __m128i, a, __m128i ret; if (_sse2neon_unlikely((imm) & ~63)) { \
+ ret = _mm_setzero_si128(); \
+ } else { \
+ ret = vreinterpretq_m128i_u64( \
+ vshlq_u64(vreinterpretq_u64_m128i(_a), vdupq_n_s64(-(imm)))); \
+ } _sse2neon_return(ret);)
+
+// Shift a right by imm8 bytes while shifting in zeros, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_srli_si128
+#define _mm_srli_si128(a, imm) \
+ _sse2neon_define1( \
+ __m128i, a, int8x16_t ret; \
+ if (_sse2neon_unlikely((imm) & ~15)) ret = vdupq_n_s8(0); \
+ else ret = vextq_s8(vreinterpretq_s8_m128i(_a), vdupq_n_s8(0), \
+ (imm > 15 ? 0 : imm)); \
+ _sse2neon_return(vreinterpretq_m128i_s8(ret));)
+
+// Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point
+// elements) from a into memory. mem_addr must be aligned on a 16-byte boundary
+// or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_pd
+FORCE_INLINE void _mm_store_pd(double *mem_addr, __m128d a)
{
-#if defined(__aarch64__)
- int16x8_t a = vreinterpretq_s16_m128i(_a);
- int16x8_t b = vreinterpretq_s16_m128i(_b);
- return vreinterpretq_s64_s16(
- vqsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ vst1q_f64((float64_t *) mem_addr, vreinterpretq_f64_m128d(a));
#else
- int32x4_t a = vreinterpretq_s32_m128i(_a);
- int32x4_t b = vreinterpretq_s32_m128i(_b);
- // Interleave using vshrn/vmovn
- // [a0|a2|a4|a6|b0|b2|b4|b6]
- // [a1|a3|a5|a7|b1|b3|b5|b7]
- int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b));
- int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16));
- // Saturated subtract
- return vreinterpretq_m128i_s16(vqsubq_s16(ab0246, ab1357));
+ vst1q_f32((float32_t *) mem_addr, vreinterpretq_f32_m128d(a));
#endif
}
-// Computes pairwise add of each argument as a 32-bit signed or unsigned integer
-// values a and b.
-FORCE_INLINE __m128i _mm_hadd_epi32(__m128i _a, __m128i _b)
+// Store the lower double-precision (64-bit) floating-point element from a into
+// 2 contiguous elements in memory. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_pd1
+FORCE_INLINE void _mm_store_pd1(double *mem_addr, __m128d a)
{
- int32x4_t a = vreinterpretq_s32_m128i(_a);
- int32x4_t b = vreinterpretq_s32_m128i(_b);
- return vreinterpretq_m128i_s32(
- vcombine_s32(vpadd_s32(vget_low_s32(a), vget_high_s32(a)),
- vpadd_s32(vget_low_s32(b), vget_high_s32(b))));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float64x1_t a_low = vget_low_f64(vreinterpretq_f64_m128d(a));
+ vst1q_f64((float64_t *) mem_addr,
+ vreinterpretq_f64_m128d(vcombine_f64(a_low, a_low)));
+#else
+ float32x2_t a_low = vget_low_f32(vreinterpretq_f32_m128d(a));
+ vst1q_f32((float32_t *) mem_addr,
+ vreinterpretq_f32_m128d(vcombine_f32(a_low, a_low)));
+#endif
}
-// Computes pairwise difference of each argument as a 32-bit signed or unsigned
-// integer values a and b.
-FORCE_INLINE __m128i _mm_hsub_epi32(__m128i _a, __m128i _b)
+// Store the lower double-precision (64-bit) floating-point element from a into
+// memory. mem_addr does not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_store_sd
+FORCE_INLINE void _mm_store_sd(double *mem_addr, __m128d a)
{
- int64x2_t a = vreinterpretq_s64_m128i(_a);
- int64x2_t b = vreinterpretq_s64_m128i(_b);
- // Interleave using vshrn/vmovn
- // [a0|a2|b0|b2]
- // [a1|a2|b1|b3]
- int32x4_t ab02 = vcombine_s32(vmovn_s64(a), vmovn_s64(b));
- int32x4_t ab13 = vcombine_s32(vshrn_n_s64(a, 32), vshrn_n_s64(b, 32));
- // Subtract
- return vreinterpretq_m128i_s32(vsubq_s32(ab02, ab13));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ vst1_f64((float64_t *) mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a)));
+#else
+ vst1_u64((uint64_t *) mem_addr, vget_low_u64(vreinterpretq_u64_m128d(a)));
+#endif
}
-// Kahan summation for accurate summation of floating-point numbers.
-// http://blog.zachbjornson.com/2019/08/11/fast-float-summation.html
-FORCE_INLINE void sse2neon_kadd_f32(float *sum, float *c, float y)
+// Store 128-bits of integer data from a into memory. mem_addr must be aligned
+// on a 16-byte boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_si128
+FORCE_INLINE void _mm_store_si128(__m128i *p, __m128i a)
{
- y -= *c;
- float t = *sum + y;
- *c = (t - *sum) - y;
- *sum = t;
+ vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a));
}
-// Conditionally multiply the packed single-precision (32-bit) floating-point
-// elements in a and b using the high 4 bits in imm8, sum the four products,
-// and conditionally store the sum in dst using the low 4 bits of imm.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_dp_ps
-FORCE_INLINE __m128 _mm_dp_ps(__m128 a, __m128 b, const int imm)
+// Store the lower double-precision (64-bit) floating-point element from a into
+// 2 contiguous elements in memory. mem_addr must be aligned on a 16-byte
+// boundary or a general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#expand=9,526,5601&text=_mm_store1_pd
+#define _mm_store1_pd _mm_store_pd1
+
+// Store the upper double-precision (64-bit) floating-point element from a into
+// memory.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeh_pd
+FORCE_INLINE void _mm_storeh_pd(double *mem_addr, __m128d a)
{
-#if defined(__aarch64__)
- /* shortcuts */
- if (imm == 0xFF) {
- return _mm_set1_ps(vaddvq_f32(_mm_mul_ps(a, b)));
- }
- if (imm == 0x7F) {
- float32x4_t m = _mm_mul_ps(a, b);
- m[3] = 0;
- return _mm_set1_ps(vaddvq_f32(m));
- }
+#if defined(__aarch64__) || defined(_M_ARM64)
+ vst1_f64((float64_t *) mem_addr, vget_high_f64(vreinterpretq_f64_m128d(a)));
+#else
+ vst1_f32((float32_t *) mem_addr, vget_high_f32(vreinterpretq_f32_m128d(a)));
#endif
-
- float s = 0, c = 0;
- float32x4_t f32a = vreinterpretq_f32_m128(a);
- float32x4_t f32b = vreinterpretq_f32_m128(b);
-
- /* To improve the accuracy of floating-point summation, Kahan algorithm
- * is used for each operation.
- */
- if (imm & (1 << 4))
- sse2neon_kadd_f32(&s, &c, f32a[0] * f32b[0]);
- if (imm & (1 << 5))
- sse2neon_kadd_f32(&s, &c, f32a[1] * f32b[1]);
- if (imm & (1 << 6))
- sse2neon_kadd_f32(&s, &c, f32a[2] * f32b[2]);
- if (imm & (1 << 7))
- sse2neon_kadd_f32(&s, &c, f32a[3] * f32b[3]);
- s += c;
-
- float32x4_t res = {
- (imm & 0x1) ? s : 0,
- (imm & 0x2) ? s : 0,
- (imm & 0x4) ? s : 0,
- (imm & 0x8) ? s : 0,
- };
- return vreinterpretq_m128_f32(res);
}
-/* Compare operations */
-
-// Compares for less than
-// https://msdn.microsoft.com/en-us/library/vstudio/f330yhc8(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmplt_ps(__m128 a, __m128 b)
+// Store 64-bit integer from the first element of a into memory.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storel_epi64
+FORCE_INLINE void _mm_storel_epi64(__m128i *a, __m128i b)
{
- return vreinterpretq_m128_u32(
- vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ vst1_u64((uint64_t *) a, vget_low_u64(vreinterpretq_u64_m128i(b)));
}
-// Compares for less than
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/fy94wye7(v=vs.100)
-FORCE_INLINE __m128 _mm_cmplt_ss(__m128 a, __m128 b)
+// Store the lower double-precision (64-bit) floating-point element from a into
+// memory.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storel_pd
+FORCE_INLINE void _mm_storel_pd(double *mem_addr, __m128d a)
{
- return _mm_move_ss(a, _mm_cmplt_ps(a, b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ vst1_f64((float64_t *) mem_addr, vget_low_f64(vreinterpretq_f64_m128d(a)));
+#else
+ vst1_f32((float32_t *) mem_addr, vget_low_f32(vreinterpretq_f32_m128d(a)));
+#endif
}
-// Compares for greater than.
-//
-// r0 := (a0 > b0) ? 0xffffffff : 0x0
-// r1 := (a1 > b1) ? 0xffffffff : 0x0
-// r2 := (a2 > b2) ? 0xffffffff : 0x0
-// r3 := (a3 > b3) ? 0xffffffff : 0x0
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/11dy102s(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmpgt_ps(__m128 a, __m128 b)
+// Store 2 double-precision (64-bit) floating-point elements from a into memory
+// in reverse order. mem_addr must be aligned on a 16-byte boundary or a
+// general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storer_pd
+FORCE_INLINE void _mm_storer_pd(double *mem_addr, __m128d a)
{
- return vreinterpretq_m128_u32(
- vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ float32x4_t f = vreinterpretq_f32_m128d(a);
+ _mm_store_pd(mem_addr, vreinterpretq_m128d_f32(vextq_f32(f, f, 2)));
}
-// Compares for greater than.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/1xyyyy9e(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpgt_ss(__m128 a, __m128 b)
+// Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point
+// elements) from a into memory. mem_addr does not need to be aligned on any
+// particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_pd
+FORCE_INLINE void _mm_storeu_pd(double *mem_addr, __m128d a)
{
- return _mm_move_ss(a, _mm_cmpgt_ps(a, b));
+ _mm_store_pd(mem_addr, a);
}
-// Compares for greater than or equal.
-// https://msdn.microsoft.com/en-us/library/vstudio/fs813y2t(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmpge_ps(__m128 a, __m128 b)
+// Store 128-bits of integer data from a into memory. mem_addr does not need to
+// be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_si128
+FORCE_INLINE void _mm_storeu_si128(__m128i *p, __m128i a)
{
- return vreinterpretq_m128_u32(
- vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ vst1q_s32((int32_t *) p, vreinterpretq_s32_m128i(a));
}
-// Compares for greater than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/kesh3ddc(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpge_ss(__m128 a, __m128 b)
+// Store 32-bit integer from the first element of a into memory. mem_addr does
+// not need to be aligned on any particular boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storeu_si32
+FORCE_INLINE void _mm_storeu_si32(void *p, __m128i a)
{
- return _mm_move_ss(a, _mm_cmpge_ps(a, b));
+ vst1q_lane_s32((int32_t *) p, vreinterpretq_s32_m128i(a), 0);
}
-// Compares for less than or equal.
-//
-// r0 := (a0 <= b0) ? 0xffffffff : 0x0
-// r1 := (a1 <= b1) ? 0xffffffff : 0x0
-// r2 := (a2 <= b2) ? 0xffffffff : 0x0
-// r3 := (a3 <= b3) ? 0xffffffff : 0x0
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/1s75w83z(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmple_ps(__m128 a, __m128 b)
+// Store 128-bits (composed of 2 packed double-precision (64-bit) floating-point
+// elements) from a into memory using a non-temporal memory hint. mem_addr must
+// be aligned on a 16-byte boundary or a general-protection exception may be
+// generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_pd
+FORCE_INLINE void _mm_stream_pd(double *p, __m128d a)
{
- return vreinterpretq_m128_u32(
- vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#if __has_builtin(__builtin_nontemporal_store)
+ __builtin_nontemporal_store(a, (float32x4_t *) p);
+#elif defined(__aarch64__) || defined(_M_ARM64)
+ vst1q_f64(p, vreinterpretq_f64_m128d(a));
+#else
+ vst1q_s64((int64_t *) p, vreinterpretq_s64_m128d(a));
+#endif
}
-// Compares for less than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/a7x0hbhw(v=vs.100)
-FORCE_INLINE __m128 _mm_cmple_ss(__m128 a, __m128 b)
+// Store 128-bits of integer data from a into memory using a non-temporal memory
+// hint. mem_addr must be aligned on a 16-byte boundary or a general-protection
+// exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_si128
+FORCE_INLINE void _mm_stream_si128(__m128i *p, __m128i a)
{
- return _mm_move_ss(a, _mm_cmple_ps(a, b));
+#if __has_builtin(__builtin_nontemporal_store)
+ __builtin_nontemporal_store(a, p);
+#else
+ vst1q_s64((int64_t *) p, vreinterpretq_s64_m128i(a));
+#endif
}
-// Compares for equality.
-// https://msdn.microsoft.com/en-us/library/vstudio/36aectz5(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmpeq_ps(__m128 a, __m128 b)
+// Store 32-bit integer a into memory using a non-temporal hint to minimize
+// cache pollution. If the cache line containing address mem_addr is already in
+// the cache, the cache will be updated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_si32
+FORCE_INLINE void _mm_stream_si32(int *p, int a)
{
- return vreinterpretq_m128_u32(
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+ vst1q_lane_s32((int32_t *) p, vdupq_n_s32(a), 0);
}
-// Compares for equality.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/k423z28e(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpeq_ss(__m128 a, __m128 b)
+// Store 64-bit integer a into memory using a non-temporal hint to minimize
+// cache pollution. If the cache line containing address mem_addr is already in
+// the cache, the cache will be updated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_si64
+FORCE_INLINE void _mm_stream_si64(__int64 *p, __int64 a)
{
- return _mm_move_ss(a, _mm_cmpeq_ps(a, b));
+ vst1_s64((int64_t *) p, vdup_n_s64((int64_t) a));
}
-// Compares for inequality.
-// https://msdn.microsoft.com/en-us/library/sf44thbx(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cmpneq_ps(__m128 a, __m128 b)
+// Subtract packed 16-bit integers in b from packed 16-bit integers in a, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_epi16
+FORCE_INLINE __m128i _mm_sub_epi16(__m128i a, __m128i b)
{
- return vreinterpretq_m128_u32(vmvnq_u32(
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b))));
+ return vreinterpretq_m128i_s16(
+ vsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// Compares for inequality.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ekya8fh4(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpneq_ss(__m128 a, __m128 b)
+// Subtract packed 32-bit integers in b from packed 32-bit integers in a, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_epi32
+FORCE_INLINE __m128i _mm_sub_epi32(__m128i a, __m128i b)
{
- return _mm_move_ss(a, _mm_cmpneq_ps(a, b));
+ return vreinterpretq_m128i_s32(
+ vsubq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-// Compares for not greater than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/wsexys62(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnge_ps(__m128 a, __m128 b)
+// Subtract packed 64-bit integers in b from packed 64-bit integers in a, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_epi64
+FORCE_INLINE __m128i _mm_sub_epi64(__m128i a, __m128i b)
{
- return _mm_cmplt_ps(a, b);
+ return vreinterpretq_m128i_s64(
+ vsubq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
}
-// Compares for not greater than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/fk2y80s8(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnge_ss(__m128 a, __m128 b)
+// Subtract packed 8-bit integers in b from packed 8-bit integers in a, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_epi8
+FORCE_INLINE __m128i _mm_sub_epi8(__m128i a, __m128i b)
{
- return _mm_cmplt_ss(a, b);
+ return vreinterpretq_m128i_s8(
+ vsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
}
-// Compares for not greater than.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/d0xh7w0s(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpngt_ps(__m128 a, __m128 b)
+// Subtract packed double-precision (64-bit) floating-point elements in b from
+// packed double-precision (64-bit) floating-point elements in a, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_sub_pd
+FORCE_INLINE __m128d _mm_sub_pd(__m128d a, __m128d b)
{
- return _mm_cmple_ps(a, b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vsubq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[2];
+ c[0] = da[0] - db[0];
+ c[1] = da[1] - db[1];
+ return vld1q_f32((float32_t *) c);
+#endif
}
-// Compares for not greater than.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/z7x9ydwh(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpngt_ss(__m128 a, __m128 b)
+// Subtract the lower double-precision (64-bit) floating-point element in b from
+// the lower double-precision (64-bit) floating-point element in a, store the
+// result in the lower element of dst, and copy the upper element from a to the
+// upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_sd
+FORCE_INLINE __m128d _mm_sub_sd(__m128d a, __m128d b)
{
- return _mm_cmple_ss(a, b);
+ return _mm_move_sd(a, _mm_sub_pd(a, b));
}
-// Compares for not less than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/6a330kxw(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnle_ps(__m128 a, __m128 b)
+// Subtract 64-bit integer b from 64-bit integer a, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sub_si64
+FORCE_INLINE __m64 _mm_sub_si64(__m64 a, __m64 b)
{
- return _mm_cmpgt_ps(a, b);
+ return vreinterpret_m64_s64(
+ vsub_s64(vreinterpret_s64_m64(a), vreinterpret_s64_m64(b)));
}
-// Compares for not less than or equal.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/z7x9ydwh(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnle_ss(__m128 a, __m128 b)
+// Subtract packed signed 16-bit integers in b from packed 16-bit integers in a
+// using saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_subs_epi16
+FORCE_INLINE __m128i _mm_subs_epi16(__m128i a, __m128i b)
{
- return _mm_cmpgt_ss(a, b);
+ return vreinterpretq_m128i_s16(
+ vqsubq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
}
-// Compares for not less than.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/4686bbdw(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnlt_ps(__m128 a, __m128 b)
+// Subtract packed signed 8-bit integers in b from packed 8-bit integers in a
+// using saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_subs_epi8
+FORCE_INLINE __m128i _mm_subs_epi8(__m128i a, __m128i b)
{
- return _mm_cmpge_ps(a, b);
+ return vreinterpretq_m128i_s8(
+ vqsubq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
}
-// Compares for not less than.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/56b9z2wf(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpnlt_ss(__m128 a, __m128 b)
+// Subtract packed unsigned 16-bit integers in b from packed unsigned 16-bit
+// integers in a using saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_subs_epu16
+FORCE_INLINE __m128i _mm_subs_epu16(__m128i a, __m128i b)
{
- return _mm_cmpge_ss(a, b);
+ return vreinterpretq_m128i_u16(
+ vqsubq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
}
-// Compares the 16 signed or unsigned 8-bit integers in a and the 16 signed or
-// unsigned 8-bit integers in b for equality.
-// https://msdn.microsoft.com/en-us/library/windows/desktop/bz5xk21a(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_cmpeq_epi8(__m128i a, __m128i b)
+// Subtract packed unsigned 8-bit integers in b from packed unsigned 8-bit
+// integers in a using saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_subs_epu8
+FORCE_INLINE __m128i _mm_subs_epu8(__m128i a, __m128i b)
{
return vreinterpretq_m128i_u8(
- vceqq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ vqsubq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b)));
}
-// Compares the 8 signed or unsigned 16-bit integers in a and the 8 signed or
-// unsigned 16-bit integers in b for equality.
-// https://msdn.microsoft.com/en-us/library/2ay060te(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmpeq_epi16(__m128i a, __m128i b)
+#define _mm_ucomieq_sd _mm_comieq_sd
+#define _mm_ucomige_sd _mm_comige_sd
+#define _mm_ucomigt_sd _mm_comigt_sd
+#define _mm_ucomile_sd _mm_comile_sd
+#define _mm_ucomilt_sd _mm_comilt_sd
+#define _mm_ucomineq_sd _mm_comineq_sd
+
+// Return vector of type __m128d with undefined elements.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_undefined_pd
+FORCE_INLINE __m128d _mm_undefined_pd(void)
{
- return vreinterpretq_m128i_u16(
- vceqq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+ __m128d a;
+#if defined(_MSC_VER)
+ a = _mm_setzero_pd();
+#endif
+ return a;
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
}
-// Compare packed 32-bit integers in a and b for equality, and store the results
-// in dst
-FORCE_INLINE __m128i _mm_cmpeq_epi32(__m128i a, __m128i b)
+// Unpack and interleave 16-bit integers from the high half of a and b, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_epi16
+FORCE_INLINE __m128i _mm_unpackhi_epi16(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u32(
- vceqq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s16(
+ vzip2q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#else
+ int16x4_t a1 = vget_high_s16(vreinterpretq_s16_m128i(a));
+ int16x4_t b1 = vget_high_s16(vreinterpretq_s16_m128i(b));
+ int16x4x2_t result = vzip_s16(a1, b1);
+ return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1]));
+#endif
}
-// Compare packed 64-bit integers in a and b for equality, and store the results
-// in dst
-FORCE_INLINE __m128i _mm_cmpeq_epi64(__m128i a, __m128i b)
+// Unpack and interleave 32-bit integers from the high half of a and b, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_epi32
+FORCE_INLINE __m128i _mm_unpackhi_epi32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_u64(
- vceqq_u64(vreinterpretq_u64_m128i(a), vreinterpretq_u64_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s32(
+ vzip2q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
#else
- // ARMv7 lacks vceqq_u64
- // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi)
- uint32x4_t cmp =
- vceqq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b));
- uint32x4_t swapped = vrev64q_u32(cmp);
- return vreinterpretq_m128i_u32(vandq_u32(cmp, swapped));
+ int32x2_t a1 = vget_high_s32(vreinterpretq_s32_m128i(a));
+ int32x2_t b1 = vget_high_s32(vreinterpretq_s32_m128i(b));
+ int32x2x2_t result = vzip_s32(a1, b1);
+ return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1]));
#endif
}
-// Compares the 16 signed 8-bit integers in a and the 16 signed 8-bit integers
-// in b for lesser than.
-// https://msdn.microsoft.com/en-us/library/windows/desktop/9s46csht(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_cmplt_epi8(__m128i a, __m128i b)
+// Unpack and interleave 64-bit integers from the high half of a and b, and
+// store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_epi64
+FORCE_INLINE __m128i _mm_unpackhi_epi64(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u8(
- vcltq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s64(
+ vzip2q_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
+#else
+ int64x1_t a_h = vget_high_s64(vreinterpretq_s64_m128i(a));
+ int64x1_t b_h = vget_high_s64(vreinterpretq_s64_m128i(b));
+ return vreinterpretq_m128i_s64(vcombine_s64(a_h, b_h));
+#endif
}
-// Compares the 16 signed 8-bit integers in a and the 16 signed 8-bit integers
-// in b for greater than.
-//
-// r0 := (a0 > b0) ? 0xff : 0x0
-// r1 := (a1 > b1) ? 0xff : 0x0
-// ...
-// r15 := (a15 > b15) ? 0xff : 0x0
-//
-// https://msdn.microsoft.com/zh-tw/library/wf45zt2b(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmpgt_epi8(__m128i a, __m128i b)
+// Unpack and interleave 8-bit integers from the high half of a and b, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_epi8
+FORCE_INLINE __m128i _mm_unpackhi_epi8(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u8(
- vcgtq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s8(
+ vzip2q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+#else
+ int8x8_t a1 =
+ vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(a)));
+ int8x8_t b1 =
+ vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(b)));
+ int8x8x2_t result = vzip_s8(a1, b1);
+ return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1]));
+#endif
}
-// Compares the 8 signed 16-bit integers in a and the 8 signed 16-bit integers
-// in b for less than.
-//
-// r0 := (a0 < b0) ? 0xffff : 0x0
-// r1 := (a1 < b1) ? 0xffff : 0x0
-// ...
-// r7 := (a7 < b7) ? 0xffff : 0x0
-//
-// https://technet.microsoft.com/en-us/library/t863edb2(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmplt_epi16(__m128i a, __m128i b)
+// Unpack and interleave double-precision (64-bit) floating-point elements from
+// the high half of a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpackhi_pd
+FORCE_INLINE __m128d _mm_unpackhi_pd(__m128d a, __m128d b)
{
- return vreinterpretq_m128i_u16(
- vcltq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vzip2q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ return vreinterpretq_m128d_s64(
+ vcombine_s64(vget_high_s64(vreinterpretq_s64_m128d(a)),
+ vget_high_s64(vreinterpretq_s64_m128d(b))));
+#endif
}
-// Compares the 8 signed 16-bit integers in a and the 8 signed 16-bit integers
-// in b for greater than.
-//
-// r0 := (a0 > b0) ? 0xffff : 0x0
-// r1 := (a1 > b1) ? 0xffff : 0x0
-// ...
-// r7 := (a7 > b7) ? 0xffff : 0x0
-//
-// https://technet.microsoft.com/en-us/library/xd43yfsa(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmpgt_epi16(__m128i a, __m128i b)
+// Unpack and interleave 16-bit integers from the low half of a and b, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_epi16
+FORCE_INLINE __m128i _mm_unpacklo_epi16(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u16(
- vcgtq_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s16(
+ vzip1q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+#else
+ int16x4_t a1 = vget_low_s16(vreinterpretq_s16_m128i(a));
+ int16x4_t b1 = vget_low_s16(vreinterpretq_s16_m128i(b));
+ int16x4x2_t result = vzip_s16(a1, b1);
+ return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1]));
+#endif
}
+// Unpack and interleave 32-bit integers from the low half of a and b, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_epi32
+FORCE_INLINE __m128i _mm_unpacklo_epi32(__m128i a, __m128i b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s32(
+ vzip1q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#else
+ int32x2_t a1 = vget_low_s32(vreinterpretq_s32_m128i(a));
+ int32x2_t b1 = vget_low_s32(vreinterpretq_s32_m128i(b));
+ int32x2x2_t result = vzip_s32(a1, b1);
+ return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1]));
+#endif
+}
-// Compares the 4 signed 32-bit integers in a and the 4 signed 32-bit integers
-// in b for less than.
-// https://msdn.microsoft.com/en-us/library/vstudio/4ak0bf5d(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmplt_epi32(__m128i a, __m128i b)
+// Unpack and interleave 64-bit integers from the low half of a and b, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_epi64
+FORCE_INLINE __m128i _mm_unpacklo_epi64(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u32(
- vcltq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s64(
+ vzip1q_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
+#else
+ int64x1_t a_l = vget_low_s64(vreinterpretq_s64_m128i(a));
+ int64x1_t b_l = vget_low_s64(vreinterpretq_s64_m128i(b));
+ return vreinterpretq_m128i_s64(vcombine_s64(a_l, b_l));
+#endif
}
-// Compares the 4 signed 32-bit integers in a and the 4 signed 32-bit integers
-// in b for greater than.
-// https://msdn.microsoft.com/en-us/library/vstudio/1s9f2z0y(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cmpgt_epi32(__m128i a, __m128i b)
+// Unpack and interleave 8-bit integers from the low half of a and b, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_epi8
+FORCE_INLINE __m128i _mm_unpacklo_epi8(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u32(
- vcgtq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s8(
+ vzip1q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+#else
+ int8x8_t a1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(a)));
+ int8x8_t b1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(b)));
+ int8x8x2_t result = vzip_s8(a1, b1);
+ return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1]));
+#endif
}
-// Compares the 2 signed 64-bit integers in a and the 2 signed 64-bit integers
-// in b for greater than.
-FORCE_INLINE __m128i _mm_cmpgt_epi64(__m128i a, __m128i b)
+// Unpack and interleave double-precision (64-bit) floating-point elements from
+// the low half of a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_unpacklo_pd
+FORCE_INLINE __m128d _mm_unpacklo_pd(__m128d a, __m128d b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_u64(
- vcgtq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vzip1q_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
#else
- // ARMv7 lacks vcgtq_s64.
- // This is based off of Clang's SSE2 polyfill:
- // (a > b) -> ((a_hi > b_hi) || (a_lo > b_lo && a_hi == b_hi))
-
- // Mask the sign bit out since we need a signed AND an unsigned comparison
- // and it is ugly to try and split them.
- int32x4_t mask = vreinterpretq_s32_s64(vdupq_n_s64(0x80000000ull));
- int32x4_t a_mask = veorq_s32(vreinterpretq_s32_m128i(a), mask);
- int32x4_t b_mask = veorq_s32(vreinterpretq_s32_m128i(b), mask);
- // Check if a > b
- int64x2_t greater = vreinterpretq_s64_u32(vcgtq_s32(a_mask, b_mask));
- // Copy upper mask to lower mask
- // a_hi > b_hi
- int64x2_t gt_hi = vshrq_n_s64(greater, 63);
- // Copy lower mask to upper mask
- // a_lo > b_lo
- int64x2_t gt_lo = vsliq_n_s64(greater, greater, 32);
- // Compare for equality
- int64x2_t equal = vreinterpretq_s64_u32(vceqq_s32(a_mask, b_mask));
- // Copy upper mask to lower mask
- // a_hi == b_hi
- int64x2_t eq_hi = vshrq_n_s64(equal, 63);
- // a_hi > b_hi || (a_lo > b_lo && a_hi == b_hi)
- int64x2_t ret = vorrq_s64(gt_hi, vandq_s64(gt_lo, eq_hi));
- return vreinterpretq_m128i_s64(ret);
-#endif
-}
-
-// Compares the four 32-bit floats in a and b to check if any values are NaN.
-// Ordered compare between each value returns true for "orderable" and false for
-// "not orderable" (NaN).
-// https://msdn.microsoft.com/en-us/library/vstudio/0h9w00fx(v=vs.100).aspx see
-// also:
-// http://stackoverflow.com/questions/8627331/what-does-ordered-unordered-comparison-mean
-// http://stackoverflow.com/questions/29349621/neon-isnanval-intrinsics
-FORCE_INLINE __m128 _mm_cmpord_ps(__m128 a, __m128 b)
+ return vreinterpretq_m128d_s64(
+ vcombine_s64(vget_low_s64(vreinterpretq_s64_m128d(a)),
+ vget_low_s64(vreinterpretq_s64_m128d(b))));
+#endif
+}
+
+// Compute the bitwise XOR of packed double-precision (64-bit) floating-point
+// elements in a and b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_xor_pd
+FORCE_INLINE __m128d _mm_xor_pd(__m128d a, __m128d b)
{
- // Note: NEON does not have ordered compare builtin
- // Need to compare a eq a and b eq b to check for NaN
- // Do AND of results to get final
- uint32x4_t ceqaa =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t ceqbb =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_u32(vandq_u32(ceqaa, ceqbb));
+ return vreinterpretq_m128d_s64(
+ veorq_s64(vreinterpretq_s64_m128d(a), vreinterpretq_s64_m128d(b)));
}
-// Compares for ordered.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/343t62da(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpord_ss(__m128 a, __m128 b)
+// Compute the bitwise XOR of 128 bits (representing integer data) in a and b,
+// and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_xor_si128
+FORCE_INLINE __m128i _mm_xor_si128(__m128i a, __m128i b)
{
- return _mm_move_ss(a, _mm_cmpord_ps(a, b));
+ return vreinterpretq_m128i_s32(
+ veorq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-// Compares for unordered.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/khy6fk1t(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpunord_ps(__m128 a, __m128 b)
+/* SSE3 */
+
+// Alternatively add and subtract packed double-precision (64-bit)
+// floating-point elements in a to/from packed elements in b, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_addsub_pd
+FORCE_INLINE __m128d _mm_addsub_pd(__m128d a, __m128d b)
+{
+ _sse2neon_const __m128d mask = _mm_set_pd(1.0f, -1.0f);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vfmaq_f64(vreinterpretq_f64_m128d(a),
+ vreinterpretq_f64_m128d(b),
+ vreinterpretq_f64_m128d(mask)));
+#else
+ return _mm_add_pd(_mm_mul_pd(b, mask), a);
+#endif
+}
+
+// Alternatively add and subtract packed single-precision (32-bit)
+// floating-point elements in a to/from packed elements in b, and store the
+// results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=addsub_ps
+FORCE_INLINE __m128 _mm_addsub_ps(__m128 a, __m128 b)
{
- uint32x4_t f32a =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t f32b =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- return vreinterpretq_m128_u32(vmvnq_u32(vandq_u32(f32a, f32b)));
+ _sse2neon_const __m128 mask = _mm_setr_ps(-1.0f, 1.0f, -1.0f, 1.0f);
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_FMA) /* VFPv4+ */
+ return vreinterpretq_m128_f32(vfmaq_f32(vreinterpretq_f32_m128(a),
+ vreinterpretq_f32_m128(mask),
+ vreinterpretq_f32_m128(b)));
+#else
+ return _mm_add_ps(_mm_mul_ps(b, mask), a);
+#endif
}
-// Compares for unordered.
-// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/2as2387b(v=vs.100)
-FORCE_INLINE __m128 _mm_cmpunord_ss(__m128 a, __m128 b)
+// Horizontally add adjacent pairs of double-precision (64-bit) floating-point
+// elements in a and b, and pack the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_pd
+FORCE_INLINE __m128d _mm_hadd_pd(__m128d a, __m128d b)
{
- return _mm_move_ss(a, _mm_cmpunord_ps(a, b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vpaddq_f64(vreinterpretq_f64_m128d(a), vreinterpretq_f64_m128d(b)));
+#else
+ double *da = (double *) &a;
+ double *db = (double *) &b;
+ double c[] = {da[0] + da[1], db[0] + db[1]};
+ return vreinterpretq_m128d_u64(vld1q_u64((uint64_t *) c));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using a less than operation. :
-// https://msdn.microsoft.com/en-us/library/2kwe606b(v=vs.90).aspx Important
-// note!! The documentation on MSDN is incorrect! If either of the values is a
-// NAN the docs say you will get a one, but in fact, it will return a zero!!
-FORCE_INLINE int _mm_comilt_ss(__m128 a, __m128 b)
+// Horizontally add adjacent pairs of single-precision (32-bit) floating-point
+// elements in a and b, and pack the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_ps
+FORCE_INLINE __m128 _mm_hadd_ps(__m128 a, __m128 b)
{
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
- uint32x4_t a_lt_b =
- vcltq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
- return (vgetq_lane_u32(vandq_u32(a_and_b_not_nan, a_lt_b), 0) != 0) ? 1 : 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vpaddq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
+#else
+ float32x2_t a10 = vget_low_f32(vreinterpretq_f32_m128(a));
+ float32x2_t a32 = vget_high_f32(vreinterpretq_f32_m128(a));
+ float32x2_t b10 = vget_low_f32(vreinterpretq_f32_m128(b));
+ float32x2_t b32 = vget_high_f32(vreinterpretq_f32_m128(b));
+ return vreinterpretq_m128_f32(
+ vcombine_f32(vpadd_f32(a10, a32), vpadd_f32(b10, b32)));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using a greater than operation. :
-// https://msdn.microsoft.com/en-us/library/b0738e0t(v=vs.100).aspx
-FORCE_INLINE int _mm_comigt_ss(__m128 a, __m128 b)
+// Horizontally subtract adjacent pairs of double-precision (64-bit)
+// floating-point elements in a and b, and pack the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsub_pd
+FORCE_INLINE __m128d _mm_hsub_pd(__m128d _a, __m128d _b)
{
- // return vgetq_lane_u32(vcgtq_f32(vreinterpretq_f32_m128(a),
- // vreinterpretq_f32_m128(b)), 0);
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
- uint32x4_t a_gt_b =
- vcgtq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
- return (vgetq_lane_u32(vandq_u32(a_and_b_not_nan, a_gt_b), 0) != 0) ? 1 : 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float64x2_t a = vreinterpretq_f64_m128d(_a);
+ float64x2_t b = vreinterpretq_f64_m128d(_b);
+ return vreinterpretq_m128d_f64(
+ vsubq_f64(vuzp1q_f64(a, b), vuzp2q_f64(a, b)));
+#else
+ double *da = (double *) &_a;
+ double *db = (double *) &_b;
+ double c[] = {da[0] - da[1], db[0] - db[1]};
+ return vreinterpretq_m128d_u64(vld1q_u64((uint64_t *) c));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using a less than or equal operation. :
-// https://msdn.microsoft.com/en-us/library/1w4t7c57(v=vs.90).aspx
-FORCE_INLINE int _mm_comile_ss(__m128 a, __m128 b)
+// Horizontally subtract adjacent pairs of single-precision (32-bit)
+// floating-point elements in a and b, and pack the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsub_ps
+FORCE_INLINE __m128 _mm_hsub_ps(__m128 _a, __m128 _b)
{
- // return vgetq_lane_u32(vcleq_f32(vreinterpretq_f32_m128(a),
- // vreinterpretq_f32_m128(b)), 0);
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
- uint32x4_t a_le_b =
- vcleq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
- return (vgetq_lane_u32(vandq_u32(a_and_b_not_nan, a_le_b), 0) != 0) ? 1 : 0;
+ float32x4_t a = vreinterpretq_f32_m128(_a);
+ float32x4_t b = vreinterpretq_f32_m128(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vsubq_f32(vuzp1q_f32(a, b), vuzp2q_f32(a, b)));
+#else
+ float32x4x2_t c = vuzpq_f32(a, b);
+ return vreinterpretq_m128_f32(vsubq_f32(c.val[0], c.val[1]));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using a greater than or equal operation. :
-// https://msdn.microsoft.com/en-us/library/8t80des6(v=vs.100).aspx
-FORCE_INLINE int _mm_comige_ss(__m128 a, __m128 b)
+// Load 128-bits of integer data from unaligned memory into dst. This intrinsic
+// may perform better than _mm_loadu_si128 when the data crosses a cache line
+// boundary.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_lddqu_si128
+#define _mm_lddqu_si128 _mm_loadu_si128
+
+// Load a double-precision (64-bit) floating-point element from memory into both
+// elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loaddup_pd
+#define _mm_loaddup_pd _mm_load1_pd
+
+// Duplicate the low double-precision (64-bit) floating-point element from a,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movedup_pd
+FORCE_INLINE __m128d _mm_movedup_pd(__m128d a)
{
- // return vgetq_lane_u32(vcgeq_f32(vreinterpretq_f32_m128(a),
- // vreinterpretq_f32_m128(b)), 0);
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
- uint32x4_t a_ge_b =
- vcgeq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
- return (vgetq_lane_u32(vandq_u32(a_and_b_not_nan, a_ge_b), 0) != 0) ? 1 : 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(
+ vdupq_laneq_f64(vreinterpretq_f64_m128d(a), 0));
+#else
+ return vreinterpretq_m128d_u64(
+ vdupq_n_u64(vgetq_lane_u64(vreinterpretq_u64_m128d(a), 0)));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using an equality operation. :
-// https://msdn.microsoft.com/en-us/library/93yx2h2b(v=vs.100).aspx
-FORCE_INLINE int _mm_comieq_ss(__m128 a, __m128 b)
+// Duplicate odd-indexed single-precision (32-bit) floating-point elements
+// from a, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_movehdup_ps
+FORCE_INLINE __m128 _mm_movehdup_ps(__m128 a)
{
- // return vgetq_lane_u32(vceqq_f32(vreinterpretq_f32_m128(a),
- // vreinterpretq_f32_m128(b)), 0);
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_and_b_not_nan = vandq_u32(a_not_nan, b_not_nan);
- uint32x4_t a_eq_b =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b));
- return (vgetq_lane_u32(vandq_u32(a_and_b_not_nan, a_eq_b), 0) != 0) ? 1 : 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vtrn2q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)));
+#elif defined(_sse2neon_shuffle)
+ return vreinterpretq_m128_f32(vshuffleq_s32(
+ vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 1, 1, 3, 3));
+#else
+ float32_t a1 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 1);
+ float32_t a3 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 3);
+ float ALIGN_STRUCT(16) data[4] = {a1, a1, a3, a3};
+ return vreinterpretq_m128_f32(vld1q_f32(data));
+#endif
}
-// Compares the lower single-precision floating point scalar values of a and b
-// using an inequality operation. :
-// https://msdn.microsoft.com/en-us/library/bafh5e0a(v=vs.90).aspx
-FORCE_INLINE int _mm_comineq_ss(__m128 a, __m128 b)
+// Duplicate even-indexed single-precision (32-bit) floating-point elements
+// from a, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_moveldup_ps
+FORCE_INLINE __m128 _mm_moveldup_ps(__m128 a)
{
- // return !vgetq_lane_u32(vceqq_f32(vreinterpretq_f32_m128(a),
- // vreinterpretq_f32_m128(b)), 0);
- uint32x4_t a_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a));
- uint32x4_t b_not_nan =
- vceqq_f32(vreinterpretq_f32_m128(b), vreinterpretq_f32_m128(b));
- uint32x4_t a_or_b_nan = vmvnq_u32(vandq_u32(a_not_nan, b_not_nan));
- uint32x4_t a_neq_b = vmvnq_u32(
- vceqq_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
- return (vgetq_lane_u32(vorrq_u32(a_or_b_nan, a_neq_b), 0) != 0) ? 1 : 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128_f32(
+ vtrn1q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a)));
+#elif defined(_sse2neon_shuffle)
+ return vreinterpretq_m128_f32(vshuffleq_s32(
+ vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(a), 0, 0, 2, 2));
+#else
+ float32_t a0 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
+ float32_t a2 = vgetq_lane_f32(vreinterpretq_f32_m128(a), 2);
+ float ALIGN_STRUCT(16) data[4] = {a0, a0, a2, a2};
+ return vreinterpretq_m128_f32(vld1q_f32(data));
+#endif
}
-// according to the documentation, these intrinsics behave the same as the
-// non-'u' versions. We'll just alias them here.
-#define _mm_ucomilt_ss _mm_comilt_ss
-#define _mm_ucomile_ss _mm_comile_ss
-#define _mm_ucomigt_ss _mm_comigt_ss
-#define _mm_ucomige_ss _mm_comige_ss
-#define _mm_ucomieq_ss _mm_comieq_ss
-#define _mm_ucomineq_ss _mm_comineq_ss
-
-/* Conversions */
+/* SSSE3 */
-// Convert packed signed 32-bit integers in b to packed single-precision
-// (32-bit) floating-point elements, store the results in the lower 2 elements
-// of dst, and copy the upper 2 packed elements from a to the upper elements of
-// dst.
-//
-// dst[31:0] := Convert_Int32_To_FP32(b[31:0])
-// dst[63:32] := Convert_Int32_To_FP32(b[63:32])
-// dst[95:64] := a[95:64]
-// dst[127:96] := a[127:96]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_pi2ps
-FORCE_INLINE __m128 _mm_cvt_pi2ps(__m128 a, __m64 b)
+// Compute the absolute value of packed signed 16-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_epi16
+FORCE_INLINE __m128i _mm_abs_epi16(__m128i a)
{
- return vreinterpretq_m128_f32(
- vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)),
- vget_high_f32(vreinterpretq_f32_m128(a))));
+ return vreinterpretq_m128i_s16(vabsq_s16(vreinterpretq_s16_m128i(a)));
}
-// Convert the signed 32-bit integer b to a single-precision (32-bit)
-// floating-point element, store the result in the lower element of dst, and
-// copy the upper 3 packed elements from a to the upper elements of dst.
-//
-// dst[31:0] := Convert_Int32_To_FP32(b[31:0])
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_si2ss
-FORCE_INLINE __m128 _mm_cvt_si2ss(__m128 a, int b)
+// Compute the absolute value of packed signed 32-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_epi32
+FORCE_INLINE __m128i _mm_abs_epi32(__m128i a)
{
- return vreinterpretq_m128_f32(
- vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0));
+ return vreinterpretq_m128i_s32(vabsq_s32(vreinterpretq_s32_m128i(a)));
}
-// Convert the signed 32-bit integer b to a single-precision (32-bit)
-// floating-point element, store the result in the lower element of dst, and
-// copy the upper 3 packed elements from a to the upper elements of dst.
-//
-// dst[31:0] := Convert_Int32_To_FP32(b[31:0])
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi32_ss
-#define _mm_cvtsi32_ss(a, b) _mm_cvt_si2ss(a, b)
+// Compute the absolute value of packed signed 8-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_epi8
+FORCE_INLINE __m128i _mm_abs_epi8(__m128i a)
+{
+ return vreinterpretq_m128i_s8(vabsq_s8(vreinterpretq_s8_m128i(a)));
+}
-// Convert the signed 64-bit integer b to a single-precision (32-bit)
-// floating-point element, store the result in the lower element of dst, and
-// copy the upper 3 packed elements from a to the upper elements of dst.
-//
-// dst[31:0] := Convert_Int64_To_FP32(b[63:0])
-// dst[127:32] := a[127:32]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi64_ss
-FORCE_INLINE __m128 _mm_cvtsi64_ss(__m128 a, int64_t b)
+// Compute the absolute value of packed signed 16-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_pi16
+FORCE_INLINE __m64 _mm_abs_pi16(__m64 a)
{
- return vreinterpretq_m128_f32(
- vsetq_lane_f32((float) b, vreinterpretq_f32_m128(a), 0));
+ return vreinterpret_m64_s16(vabs_s16(vreinterpret_s16_m64(a)));
}
-// Convert the lower single-precision (32-bit) floating-point element in a to a
-// 32-bit integer, and store the result in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_ss2si
-FORCE_INLINE int _mm_cvt_ss2si(__m128 a)
+// Compute the absolute value of packed signed 32-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_pi32
+FORCE_INLINE __m64 _mm_abs_pi32(__m64 a)
{
-#if defined(__aarch64__)
- return vgetq_lane_s32(vcvtnq_s32_f32(vreinterpretq_f32_m128(a)), 0);
-#else
- float32_t data = vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
- float32_t diff = data - floor(data);
- if (diff > 0.5)
- return (int32_t) ceil(data);
- if (diff == 0.5) {
- int32_t f = (int32_t) floor(data);
- int32_t c = (int32_t) ceil(data);
- return c & 1 ? f : c;
- }
- return (int32_t) floor(data);
-#endif
+ return vreinterpret_m64_s32(vabs_s32(vreinterpret_s32_m64(a)));
}
-// Convert packed 16-bit integers in a to packed single-precision (32-bit)
-// floating-point elements, and store the results in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// m := j*32
-// dst[m+31:m] := Convert_Int16_To_FP32(a[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi16_ps
-FORCE_INLINE __m128 _mm_cvtpi16_ps(__m64 a)
+// Compute the absolute value of packed signed 8-bit integers in a, and store
+// the unsigned results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_abs_pi8
+FORCE_INLINE __m64 _mm_abs_pi8(__m64 a)
{
- return vreinterpretq_m128_f32(
- vcvtq_f32_s32(vmovl_s16(vreinterpret_s16_m64(a))));
+ return vreinterpret_m64_s8(vabs_s8(vreinterpret_s8_m64(a)));
}
-// Convert packed 32-bit integers in b to packed single-precision (32-bit)
-// floating-point elements, store the results in the lower 2 elements of dst,
-// and copy the upper 2 packed elements from a to the upper elements of dst.
-//
-// dst[31:0] := Convert_Int32_To_FP32(b[31:0])
-// dst[63:32] := Convert_Int32_To_FP32(b[63:32])
-// dst[95:64] := a[95:64]
-// dst[127:96] := a[127:96]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi32_ps
-FORCE_INLINE __m128 _mm_cvtpi32_ps(__m128 a, __m64 b)
+// Concatenate 16-byte blocks in a and b into a 32-byte temporary result, shift
+// the result right by imm8 bytes, and store the low 16 bytes in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_alignr_epi8
+#if defined(__GNUC__) && !defined(__clang__)
+#define _mm_alignr_epi8(a, b, imm) \
+ __extension__({ \
+ uint8x16_t _a = vreinterpretq_u8_m128i(a); \
+ uint8x16_t _b = vreinterpretq_u8_m128i(b); \
+ __m128i ret; \
+ if (_sse2neon_unlikely((imm) & ~31)) \
+ ret = vreinterpretq_m128i_u8(vdupq_n_u8(0)); \
+ else if (imm >= 16) \
+ ret = _mm_srli_si128(a, imm >= 16 ? imm - 16 : 0); \
+ else \
+ ret = \
+ vreinterpretq_m128i_u8(vextq_u8(_b, _a, imm < 16 ? imm : 0)); \
+ ret; \
+ })
+
+#else
+#define _mm_alignr_epi8(a, b, imm) \
+ _sse2neon_define2( \
+ __m128i, a, b, uint8x16_t __a = vreinterpretq_u8_m128i(_a); \
+ uint8x16_t __b = vreinterpretq_u8_m128i(_b); __m128i ret; \
+ if (_sse2neon_unlikely((imm) & ~31)) ret = \
+ vreinterpretq_m128i_u8(vdupq_n_u8(0)); \
+ else if (imm >= 16) ret = \
+ _mm_srli_si128(_a, imm >= 16 ? imm - 16 : 0); \
+ else ret = \
+ vreinterpretq_m128i_u8(vextq_u8(__b, __a, imm < 16 ? imm : 0)); \
+ _sse2neon_return(ret);)
+
+#endif
+
+// Concatenate 8-byte blocks in a and b into a 16-byte temporary result, shift
+// the result right by imm8 bytes, and store the low 8 bytes in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_alignr_pi8
+#define _mm_alignr_pi8(a, b, imm) \
+ _sse2neon_define2( \
+ __m64, a, b, __m64 ret; if (_sse2neon_unlikely((imm) >= 16)) { \
+ ret = vreinterpret_m64_s8(vdup_n_s8(0)); \
+ } else { \
+ uint8x8_t tmp_low; \
+ uint8x8_t tmp_high; \
+ if ((imm) >= 8) { \
+ const int idx = (imm) -8; \
+ tmp_low = vreinterpret_u8_m64(_a); \
+ tmp_high = vdup_n_u8(0); \
+ ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \
+ } else { \
+ const int idx = (imm); \
+ tmp_low = vreinterpret_u8_m64(_b); \
+ tmp_high = vreinterpret_u8_m64(_a); \
+ ret = vreinterpret_m64_u8(vext_u8(tmp_low, tmp_high, idx)); \
+ } \
+ } _sse2neon_return(ret);)
+
+// Horizontally add adjacent pairs of 16-bit integers in a and b, and pack the
+// signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_epi16
+FORCE_INLINE __m128i _mm_hadd_epi16(__m128i _a, __m128i _b)
{
- return vreinterpretq_m128_f32(
- vcombine_f32(vcvt_f32_s32(vreinterpret_s32_m64(b)),
- vget_high_f32(vreinterpretq_f32_m128(a))));
+ int16x8_t a = vreinterpretq_s16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s16(vpaddq_s16(a, b));
+#else
+ return vreinterpretq_m128i_s16(
+ vcombine_s16(vpadd_s16(vget_low_s16(a), vget_high_s16(a)),
+ vpadd_s16(vget_low_s16(b), vget_high_s16(b))));
+#endif
}
-// Convert packed signed 32-bit integers in a to packed single-precision
-// (32-bit) floating-point elements, store the results in the lower 2 elements
-// of dst, then covert the packed signed 32-bit integers in b to
-// single-precision (32-bit) floating-point element, and store the results in
-// the upper 2 elements of dst.
-//
-// dst[31:0] := Convert_Int32_To_FP32(a[31:0])
-// dst[63:32] := Convert_Int32_To_FP32(a[63:32])
-// dst[95:64] := Convert_Int32_To_FP32(b[31:0])
-// dst[127:96] := Convert_Int32_To_FP32(b[63:32])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi32x2_ps
-FORCE_INLINE __m128 _mm_cvtpi32x2_ps(__m64 a, __m64 b)
+// Horizontally add adjacent pairs of 32-bit integers in a and b, and pack the
+// signed 32-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_epi32
+FORCE_INLINE __m128i _mm_hadd_epi32(__m128i _a, __m128i _b)
{
- return vreinterpretq_m128_f32(vcvtq_f32_s32(
- vcombine_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b))));
+ int32x4_t a = vreinterpretq_s32_m128i(_a);
+ int32x4_t b = vreinterpretq_s32_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s32(vpaddq_s32(a, b));
+#else
+ return vreinterpretq_m128i_s32(
+ vcombine_s32(vpadd_s32(vget_low_s32(a), vget_high_s32(a)),
+ vpadd_s32(vget_low_s32(b), vget_high_s32(b))));
+#endif
}
-// Convert the lower packed 8-bit integers in a to packed single-precision
-// (32-bit) floating-point elements, and store the results in dst.
-//
-// FOR j := 0 to 3
-// i := j*8
-// m := j*32
-// dst[m+31:m] := Convert_Int8_To_FP32(a[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpi8_ps
-FORCE_INLINE __m128 _mm_cvtpi8_ps(__m64 a)
+// Horizontally add adjacent pairs of 16-bit integers in a and b, and pack the
+// signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_pi16
+FORCE_INLINE __m64 _mm_hadd_pi16(__m64 a, __m64 b)
{
- return vreinterpretq_m128_f32(vcvtq_f32_s32(
- vmovl_s16(vget_low_s16(vmovl_s8(vreinterpret_s8_m64(a))))));
+ return vreinterpret_m64_s16(
+ vpadd_s16(vreinterpret_s16_m64(a), vreinterpret_s16_m64(b)));
}
-// Convert packed unsigned 16-bit integers in a to packed single-precision
-// (32-bit) floating-point elements, and store the results in dst.
-//
-// FOR j := 0 to 3
-// i := j*16
-// m := j*32
-// dst[m+31:m] := Convert_UInt16_To_FP32(a[i+15:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpu16_ps
-FORCE_INLINE __m128 _mm_cvtpu16_ps(__m64 a)
+// Horizontally add adjacent pairs of 32-bit integers in a and b, and pack the
+// signed 32-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadd_pi32
+FORCE_INLINE __m64 _mm_hadd_pi32(__m64 a, __m64 b)
{
- return vreinterpretq_m128_f32(
- vcvtq_f32_u32(vmovl_u16(vreinterpret_u16_m64(a))));
+ return vreinterpret_m64_s32(
+ vpadd_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)));
}
-// Convert the lower packed unsigned 8-bit integers in a to packed
-// single-precision (32-bit) floating-point elements, and store the results in
-// dst.
-//
-// FOR j := 0 to 3
-// i := j*8
-// m := j*32
-// dst[m+31:m] := Convert_UInt8_To_FP32(a[i+7:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpu8_ps
-FORCE_INLINE __m128 _mm_cvtpu8_ps(__m64 a)
+// Horizontally add adjacent pairs of signed 16-bit integers in a and b using
+// saturation, and pack the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadds_epi16
+FORCE_INLINE __m128i _mm_hadds_epi16(__m128i _a, __m128i _b)
{
- return vreinterpretq_m128_f32(vcvtq_f32_u32(
- vmovl_u16(vget_low_u16(vmovl_u8(vreinterpret_u8_m64(a))))));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int16x8_t a = vreinterpretq_s16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
+ return vreinterpretq_s64_s16(
+ vqaddq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
+#else
+ int32x4_t a = vreinterpretq_s32_m128i(_a);
+ int32x4_t b = vreinterpretq_s32_m128i(_b);
+ // Interleave using vshrn/vmovn
+ // [a0|a2|a4|a6|b0|b2|b4|b6]
+ // [a1|a3|a5|a7|b1|b3|b5|b7]
+ int16x8_t ab0246 = vcombine_s16(vmovn_s32(a), vmovn_s32(b));
+ int16x8_t ab1357 = vcombine_s16(vshrn_n_s32(a, 16), vshrn_n_s32(b, 16));
+ // Saturated add
+ return vreinterpretq_m128i_s16(vqaddq_s16(ab0246, ab1357));
+#endif
}
-// Converts the four single-precision, floating-point values of a to signed
-// 32-bit integer values using truncate.
-// https://msdn.microsoft.com/en-us/library/vstudio/1h005y6x(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_cvttps_epi32(__m128 a)
+// Horizontally add adjacent pairs of signed 16-bit integers in a and b using
+// saturation, and pack the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hadds_pi16
+FORCE_INLINE __m64 _mm_hadds_pi16(__m64 _a, __m64 _b)
{
- return vreinterpretq_m128i_s32(vcvtq_s32_f32(vreinterpretq_f32_m128(a)));
+ int16x4_t a = vreinterpret_s16_m64(_a);
+ int16x4_t b = vreinterpret_s16_m64(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpret_s64_s16(vqadd_s16(vuzp1_s16(a, b), vuzp2_s16(a, b)));
+#else
+ int16x4x2_t res = vuzp_s16(a, b);
+ return vreinterpret_s64_s16(vqadd_s16(res.val[0], res.val[1]));
+#endif
}
-// Convert the lower double-precision (64-bit) floating-point element in a to a
-// 64-bit integer with truncation, and store the result in dst.
-//
-// dst[63:0] := Convert_FP64_To_Int64_Truncate(a[63:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttsd_si64
-FORCE_INLINE int64_t _mm_cvttsd_si64(__m128d a)
+// Horizontally subtract adjacent pairs of 16-bit integers in a and b, and pack
+// the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsub_epi16
+FORCE_INLINE __m128i _mm_hsub_epi16(__m128i _a, __m128i _b)
{
-#if defined(__aarch64__)
- return vgetq_lane_s64(vcvtq_s64_f64(vreinterpretq_f64_m128d(a)), 0);
+ int16x8_t a = vreinterpretq_s16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s16(
+ vsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
#else
- double ret = *((double *) &a);
- return (int64_t) ret;
+ int16x8x2_t c = vuzpq_s16(a, b);
+ return vreinterpretq_m128i_s16(vsubq_s16(c.val[0], c.val[1]));
#endif
}
-// Convert the lower double-precision (64-bit) floating-point element in a to a
-// 64-bit integer with truncation, and store the result in dst.
-//
-// dst[63:0] := Convert_FP64_To_Int64_Truncate(a[63:0])
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvttsd_si64x
-#define _mm_cvttsd_si64x(a) _mm_cvttsd_si64(a)
-
-// Converts the four signed 32-bit integer values of a to single-precision,
-// floating-point values
-// https://msdn.microsoft.com/en-us/library/vstudio/36bwxcx5(v=vs.100).aspx
-FORCE_INLINE __m128 _mm_cvtepi32_ps(__m128i a)
+// Horizontally subtract adjacent pairs of 32-bit integers in a and b, and pack
+// the signed 32-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsub_epi32
+FORCE_INLINE __m128i _mm_hsub_epi32(__m128i _a, __m128i _b)
{
- return vreinterpretq_m128_f32(vcvtq_f32_s32(vreinterpretq_s32_m128i(a)));
+ int32x4_t a = vreinterpretq_s32_m128i(_a);
+ int32x4_t b = vreinterpretq_s32_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s32(
+ vsubq_s32(vuzp1q_s32(a, b), vuzp2q_s32(a, b)));
+#else
+ int32x4x2_t c = vuzpq_s32(a, b);
+ return vreinterpretq_m128i_s32(vsubq_s32(c.val[0], c.val[1]));
+#endif
}
-// Converts the four unsigned 8-bit integers in the lower 16 bits to four
-// unsigned 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepu8_epi16(__m128i a)
+// Horizontally subtract adjacent pairs of 16-bit integers in a and b, and pack
+// the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsub_pi16
+FORCE_INLINE __m64 _mm_hsub_pi16(__m64 _a, __m64 _b)
{
- uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx DCBA */
- uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0D0C 0B0A */
- return vreinterpretq_m128i_u16(u16x8);
+ int16x4_t a = vreinterpret_s16_m64(_a);
+ int16x4_t b = vreinterpret_s16_m64(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpret_m64_s16(vsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b)));
+#else
+ int16x4x2_t c = vuzp_s16(a, b);
+ return vreinterpret_m64_s16(vsub_s16(c.val[0], c.val[1]));
+#endif
}
-// Converts the four unsigned 8-bit integers in the lower 32 bits to four
-// unsigned 32-bit integers.
-// https://msdn.microsoft.com/en-us/library/bb531467%28v=vs.100%29.aspx
-FORCE_INLINE __m128i _mm_cvtepu8_epi32(__m128i a)
+// Horizontally subtract adjacent pairs of 32-bit integers in a and b, and pack
+// the signed 32-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_hsub_pi32
+FORCE_INLINE __m64 _mm_hsub_pi32(__m64 _a, __m64 _b)
{
- uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx DCBA */
- uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0D0C 0B0A */
- uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000D 000C 000B 000A */
- return vreinterpretq_m128i_u32(u32x4);
+ int32x2_t a = vreinterpret_s32_m64(_a);
+ int32x2_t b = vreinterpret_s32_m64(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpret_m64_s32(vsub_s32(vuzp1_s32(a, b), vuzp2_s32(a, b)));
+#else
+ int32x2x2_t c = vuzp_s32(a, b);
+ return vreinterpret_m64_s32(vsub_s32(c.val[0], c.val[1]));
+#endif
}
-// Converts the two unsigned 8-bit integers in the lower 16 bits to two
-// unsigned 64-bit integers.
-FORCE_INLINE __m128i _mm_cvtepu8_epi64(__m128i a)
+// Horizontally subtract adjacent pairs of signed 16-bit integers in a and b
+// using saturation, and pack the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsubs_epi16
+FORCE_INLINE __m128i _mm_hsubs_epi16(__m128i _a, __m128i _b)
{
- uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx xxBA */
- uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0x0x 0B0A */
- uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */
- uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */
- return vreinterpretq_m128i_u64(u64x2);
+ int16x8_t a = vreinterpretq_s16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s16(
+ vqsubq_s16(vuzp1q_s16(a, b), vuzp2q_s16(a, b)));
+#else
+ int16x8x2_t c = vuzpq_s16(a, b);
+ return vreinterpretq_m128i_s16(vqsubq_s16(c.val[0], c.val[1]));
+#endif
}
-// Converts the four unsigned 8-bit integers in the lower 16 bits to four
-// unsigned 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi8_epi16(__m128i a)
+// Horizontally subtract adjacent pairs of signed 16-bit integers in a and b
+// using saturation, and pack the signed 16-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_hsubs_pi16
+FORCE_INLINE __m64 _mm_hsubs_pi16(__m64 _a, __m64 _b)
{
- int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */
- int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */
- return vreinterpretq_m128i_s16(s16x8);
+ int16x4_t a = vreinterpret_s16_m64(_a);
+ int16x4_t b = vreinterpret_s16_m64(_b);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpret_m64_s16(vqsub_s16(vuzp1_s16(a, b), vuzp2_s16(a, b)));
+#else
+ int16x4x2_t c = vuzp_s16(a, b);
+ return vreinterpret_m64_s16(vqsub_s16(c.val[0], c.val[1]));
+#endif
}
-// Converts the four unsigned 8-bit integers in the lower 32 bits to four
-// unsigned 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi8_epi32(__m128i a)
+// Vertically multiply each unsigned 8-bit integer from a with the corresponding
+// signed 8-bit integer from b, producing intermediate signed 16-bit integers.
+// Horizontally add adjacent pairs of intermediate signed 16-bit integers,
+// and pack the saturated results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maddubs_epi16
+FORCE_INLINE __m128i _mm_maddubs_epi16(__m128i _a, __m128i _b)
{
- int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */
- int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */
- int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000D 000C 000B 000A */
- return vreinterpretq_m128i_s32(s32x4);
-}
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint8x16_t a = vreinterpretq_u8_m128i(_a);
+ int8x16_t b = vreinterpretq_s8_m128i(_b);
+ int16x8_t tl = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(a))),
+ vmovl_s8(vget_low_s8(b)));
+ int16x8_t th = vmulq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(a))),
+ vmovl_s8(vget_high_s8(b)));
+ return vreinterpretq_m128i_s16(
+ vqaddq_s16(vuzp1q_s16(tl, th), vuzp2q_s16(tl, th)));
+#else
+ // This would be much simpler if x86 would choose to zero extend OR sign
+ // extend, not both. This could probably be optimized better.
+ uint16x8_t a = vreinterpretq_u16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
-// Converts the two signed 8-bit integers in the lower 32 bits to four
-// signed 64-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi8_epi64(__m128i a)
-{
- int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx xxBA */
- int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0x0x 0B0A */
- int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */
- int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */
- return vreinterpretq_m128i_s64(s64x2);
+ // Zero extend a
+ int16x8_t a_odd = vreinterpretq_s16_u16(vshrq_n_u16(a, 8));
+ int16x8_t a_even = vreinterpretq_s16_u16(vbicq_u16(a, vdupq_n_u16(0xff00)));
+
+ // Sign extend by shifting left then shifting right.
+ int16x8_t b_even = vshrq_n_s16(vshlq_n_s16(b, 8), 8);
+ int16x8_t b_odd = vshrq_n_s16(b, 8);
+
+ // multiply
+ int16x8_t prod1 = vmulq_s16(a_even, b_even);
+ int16x8_t prod2 = vmulq_s16(a_odd, b_odd);
+
+ // saturated add
+ return vreinterpretq_m128i_s16(vqaddq_s16(prod1, prod2));
+#endif
}
-// Converts the four signed 16-bit integers in the lower 64 bits to four signed
-// 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi16_epi32(__m128i a)
+// Vertically multiply each unsigned 8-bit integer from a with the corresponding
+// signed 8-bit integer from b, producing intermediate signed 16-bit integers.
+// Horizontally add adjacent pairs of intermediate signed 16-bit integers, and
+// pack the saturated results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maddubs_pi16
+FORCE_INLINE __m64 _mm_maddubs_pi16(__m64 _a, __m64 _b)
{
- return vreinterpretq_m128i_s32(
- vmovl_s16(vget_low_s16(vreinterpretq_s16_m128i(a))));
+ uint16x4_t a = vreinterpret_u16_m64(_a);
+ int16x4_t b = vreinterpret_s16_m64(_b);
+
+ // Zero extend a
+ int16x4_t a_odd = vreinterpret_s16_u16(vshr_n_u16(a, 8));
+ int16x4_t a_even = vreinterpret_s16_u16(vand_u16(a, vdup_n_u16(0xff)));
+
+ // Sign extend by shifting left then shifting right.
+ int16x4_t b_even = vshr_n_s16(vshl_n_s16(b, 8), 8);
+ int16x4_t b_odd = vshr_n_s16(b, 8);
+
+ // multiply
+ int16x4_t prod1 = vmul_s16(a_even, b_even);
+ int16x4_t prod2 = vmul_s16(a_odd, b_odd);
+
+ // saturated add
+ return vreinterpret_m64_s16(vqadd_s16(prod1, prod2));
}
-// Converts the two signed 16-bit integers in the lower 32 bits two signed
-// 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi16_epi64(__m128i a)
+// Multiply packed signed 16-bit integers in a and b, producing intermediate
+// signed 32-bit integers. Shift right by 15 bits while rounding up, and store
+// the packed 16-bit integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhrs_epi16
+FORCE_INLINE __m128i _mm_mulhrs_epi16(__m128i a, __m128i b)
{
- int16x8_t s16x8 = vreinterpretq_s16_m128i(a); /* xxxx xxxx xxxx 0B0A */
- int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */
- int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */
- return vreinterpretq_m128i_s64(s64x2);
+ // Has issues due to saturation
+ // return vreinterpretq_m128i_s16(vqrdmulhq_s16(a, b));
+
+ // Multiply
+ int32x4_t mul_lo = vmull_s16(vget_low_s16(vreinterpretq_s16_m128i(a)),
+ vget_low_s16(vreinterpretq_s16_m128i(b)));
+ int32x4_t mul_hi = vmull_s16(vget_high_s16(vreinterpretq_s16_m128i(a)),
+ vget_high_s16(vreinterpretq_s16_m128i(b)));
+
+ // Rounding narrowing shift right
+ // narrow = (int16_t)((mul + 16384) >> 15);
+ int16x4_t narrow_lo = vrshrn_n_s32(mul_lo, 15);
+ int16x4_t narrow_hi = vrshrn_n_s32(mul_hi, 15);
+
+ // Join together
+ return vreinterpretq_m128i_s16(vcombine_s16(narrow_lo, narrow_hi));
}
-// Converts the four unsigned 16-bit integers in the lower 64 bits to four
-// unsigned 32-bit integers.
-FORCE_INLINE __m128i _mm_cvtepu16_epi32(__m128i a)
+// Multiply packed signed 16-bit integers in a and b, producing intermediate
+// signed 32-bit integers. Truncate each intermediate integer to the 18 most
+// significant bits, round by adding 1, and store bits [16:1] to dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhrs_pi16
+FORCE_INLINE __m64 _mm_mulhrs_pi16(__m64 a, __m64 b)
{
- return vreinterpretq_m128i_u32(
- vmovl_u16(vget_low_u16(vreinterpretq_u16_m128i(a))));
+ int32x4_t mul_extend =
+ vmull_s16((vreinterpret_s16_m64(a)), (vreinterpret_s16_m64(b)));
+
+ // Rounding narrowing shift right
+ return vreinterpret_m64_s16(vrshrn_n_s32(mul_extend, 15));
}
-// Converts the two unsigned 16-bit integers in the lower 32 bits to two
-// unsigned 64-bit integers.
-FORCE_INLINE __m128i _mm_cvtepu16_epi64(__m128i a)
+// Shuffle packed 8-bit integers in a according to shuffle control mask in the
+// corresponding 8-bit element of b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_epi8
+FORCE_INLINE __m128i _mm_shuffle_epi8(__m128i a, __m128i b)
{
- uint16x8_t u16x8 = vreinterpretq_u16_m128i(a); /* xxxx xxxx xxxx 0B0A */
- uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */
- uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */
- return vreinterpretq_m128i_u64(u64x2);
+ int8x16_t tbl = vreinterpretq_s8_m128i(a); // input a
+ uint8x16_t idx = vreinterpretq_u8_m128i(b); // input b
+ uint8x16_t idx_masked =
+ vandq_u8(idx, vdupq_n_u8(0x8F)); // avoid using meaningless bits
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_s8(vqtbl1q_s8(tbl, idx_masked));
+#elif defined(__GNUC__)
+ int8x16_t ret;
+ // %e and %f represent the even and odd D registers
+ // respectively.
+ __asm__ __volatile__(
+ "vtbl.8 %e[ret], {%e[tbl], %f[tbl]}, %e[idx]\n"
+ "vtbl.8 %f[ret], {%e[tbl], %f[tbl]}, %f[idx]\n"
+ : [ret] "=&w"(ret)
+ : [tbl] "w"(tbl), [idx] "w"(idx_masked));
+ return vreinterpretq_m128i_s8(ret);
+#else
+ // use this line if testing on aarch64
+ int8x8x2_t a_split = {vget_low_s8(tbl), vget_high_s8(tbl)};
+ return vreinterpretq_m128i_s8(
+ vcombine_s8(vtbl2_s8(a_split, vget_low_u8(idx_masked)),
+ vtbl2_s8(a_split, vget_high_u8(idx_masked))));
+#endif
}
-// Converts the two unsigned 32-bit integers in the lower 64 bits to two
-// unsigned 64-bit integers.
-FORCE_INLINE __m128i _mm_cvtepu32_epi64(__m128i a)
+// Shuffle packed 8-bit integers in a according to shuffle control mask in the
+// corresponding 8-bit element of b, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_pi8
+FORCE_INLINE __m64 _mm_shuffle_pi8(__m64 a, __m64 b)
{
- return vreinterpretq_m128i_u64(
- vmovl_u32(vget_low_u32(vreinterpretq_u32_m128i(a))));
+ const int8x8_t controlMask =
+ vand_s8(vreinterpret_s8_m64(b), vdup_n_s8((int8_t) (0x1 << 7 | 0x07)));
+ int8x8_t res = vtbl1_s8(vreinterpret_s8_m64(a), controlMask);
+ return vreinterpret_m64_s8(res);
}
-// Converts the two signed 32-bit integers in the lower 64 bits to two signed
-// 64-bit integers.
-FORCE_INLINE __m128i _mm_cvtepi32_epi64(__m128i a)
+// Negate packed 16-bit integers in a when the corresponding signed
+// 16-bit integer in b is negative, and store the results in dst.
+// Element in dst are zeroed out when the corresponding element
+// in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_epi16
+FORCE_INLINE __m128i _mm_sign_epi16(__m128i _a, __m128i _b)
{
- return vreinterpretq_m128i_s64(
- vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a))));
+ int16x8_t a = vreinterpretq_s16_m128i(_a);
+ int16x8_t b = vreinterpretq_s16_m128i(_b);
+
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFFFF : 0
+ uint16x8_t ltMask = vreinterpretq_u16_s16(vshrq_n_s16(b, 15));
+ // (b == 0) ? 0xFFFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int16x8_t zeroMask = vreinterpretq_s16_u16(vceqzq_s16(b));
+#else
+ int16x8_t zeroMask = vreinterpretq_s16_u16(vceqq_s16(b, vdupq_n_s16(0)));
+#endif
+
+ // bitwise select either a or negative 'a' (vnegq_s16(a) equals to negative
+ // 'a') based on ltMask
+ int16x8_t masked = vbslq_s16(ltMask, vnegq_s16(a), a);
+ // res = masked & (~zeroMask)
+ int16x8_t res = vbicq_s16(masked, zeroMask);
+ return vreinterpretq_m128i_s16(res);
}
-// Converts the four single-precision, floating-point values of a to signed
-// 32-bit integer values.
-//
-// r0 := (int) a0
-// r1 := (int) a1
-// r2 := (int) a2
-// r3 := (int) a3
-//
-// https://msdn.microsoft.com/en-us/library/vstudio/xdc42k5e(v=vs.100).aspx
-// *NOTE*. The default rounding mode on SSE is 'round to even', which ARMv7-A
-// does not support! It is supported on ARMv8-A however.
-FORCE_INLINE __m128i _mm_cvtps_epi32(__m128 a)
+// Negate packed 32-bit integers in a when the corresponding signed
+// 32-bit integer in b is negative, and store the results in dst.
+// Element in dst are zeroed out when the corresponding element
+// in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_epi32
+FORCE_INLINE __m128i _mm_sign_epi32(__m128i _a, __m128i _b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s32(vcvtnq_s32_f32(a));
-#else
- uint32x4_t signmask = vdupq_n_u32(0x80000000);
- float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a),
- vdupq_n_f32(0.5f)); /* +/- 0.5 */
- int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32(
- vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/
- int32x4_t r_trunc =
- vcvtq_s32_f32(vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */
- int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32(
- vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */
- int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone),
- vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */
- float32x4_t delta = vsubq_f32(
- vreinterpretq_f32_m128(a),
- vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */
- uint32x4_t is_delta_half = vceqq_f32(delta, half); /* delta == +/- 0.5 */
- return vreinterpretq_m128i_s32(vbslq_s32(is_delta_half, r_even, r_normal));
+ int32x4_t a = vreinterpretq_s32_m128i(_a);
+ int32x4_t b = vreinterpretq_s32_m128i(_b);
+
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFFFFFFFF : 0
+ uint32x4_t ltMask = vreinterpretq_u32_s32(vshrq_n_s32(b, 31));
+
+ // (b == 0) ? 0xFFFFFFFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int32x4_t zeroMask = vreinterpretq_s32_u32(vceqzq_s32(b));
+#else
+ int32x4_t zeroMask = vreinterpretq_s32_u32(vceqq_s32(b, vdupq_n_s32(0)));
#endif
+
+ // bitwise select either a or negative 'a' (vnegq_s32(a) equals to negative
+ // 'a') based on ltMask
+ int32x4_t masked = vbslq_s32(ltMask, vnegq_s32(a), a);
+ // res = masked & (~zeroMask)
+ int32x4_t res = vbicq_s32(masked, zeroMask);
+ return vreinterpretq_m128i_s32(res);
}
-// Copy the lower 32-bit integer in a to dst.
-//
-// dst[31:0] := a[31:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi128_si32
-FORCE_INLINE int _mm_cvtsi128_si32(__m128i a)
+// Negate packed 8-bit integers in a when the corresponding signed
+// 8-bit integer in b is negative, and store the results in dst.
+// Element in dst are zeroed out when the corresponding element
+// in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_epi8
+FORCE_INLINE __m128i _mm_sign_epi8(__m128i _a, __m128i _b)
{
- return vgetq_lane_s32(vreinterpretq_s32_m128i(a), 0);
-}
+ int8x16_t a = vreinterpretq_s8_m128i(_a);
+ int8x16_t b = vreinterpretq_s8_m128i(_b);
-// Copy the lower 64-bit integer in a to dst.
-//
-// dst[63:0] := a[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi128_si64
-FORCE_INLINE int64_t _mm_cvtsi128_si64(__m128i a)
-{
- return vgetq_lane_s64(vreinterpretq_s64_m128i(a), 0);
-}
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFF : 0
+ uint8x16_t ltMask = vreinterpretq_u8_s8(vshrq_n_s8(b, 7));
-// Copy the lower 64-bit integer in a to dst.
-//
-// dst[63:0] := a[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsi128_si64x
-#define _mm_cvtsi128_si64x(a) _mm_cvtsi128_si64(a)
+ // (b == 0) ? 0xFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int8x16_t zeroMask = vreinterpretq_s8_u8(vceqzq_s8(b));
+#else
+ int8x16_t zeroMask = vreinterpretq_s8_u8(vceqq_s8(b, vdupq_n_s8(0)));
+#endif
-// Moves 32-bit integer a to the least significant 32 bits of an __m128 object,
-// zero extending the upper bits.
-//
-// r0 := a
-// r1 := 0x0
-// r2 := 0x0
-// r3 := 0x0
-//
-// https://msdn.microsoft.com/en-us/library/ct3539ha%28v=vs.90%29.aspx
-FORCE_INLINE __m128i _mm_cvtsi32_si128(int a)
-{
- return vreinterpretq_m128i_s32(vsetq_lane_s32(a, vdupq_n_s32(0), 0));
-}
+ // bitwise select either a or negative 'a' (vnegq_s8(a) return negative 'a')
+ // based on ltMask
+ int8x16_t masked = vbslq_s8(ltMask, vnegq_s8(a), a);
+ // res = masked & (~zeroMask)
+ int8x16_t res = vbicq_s8(masked, zeroMask);
-// Moves 64-bit integer a to the least significant 64 bits of an __m128 object,
-// zero extending the upper bits.
-//
-// r0 := a
-// r1 := 0x0
-FORCE_INLINE __m128i _mm_cvtsi64_si128(int64_t a)
-{
- return vreinterpretq_m128i_s64(vsetq_lane_s64(a, vdupq_n_s64(0), 0));
+ return vreinterpretq_m128i_s8(res);
}
-// Cast vector of type __m128 to type __m128d. This intrinsic is only used for
-// compilation and does not generate any instructions, thus it has zero latency.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_castps_pd
-FORCE_INLINE __m128d _mm_castps_pd(__m128 a)
+// Negate packed 16-bit integers in a when the corresponding signed 16-bit
+// integer in b is negative, and store the results in dst. Element in dst are
+// zeroed out when the corresponding element in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_pi16
+FORCE_INLINE __m64 _mm_sign_pi16(__m64 _a, __m64 _b)
{
- return vreinterpretq_m128d_s32(vreinterpretq_s32_m128(a));
-}
+ int16x4_t a = vreinterpret_s16_m64(_a);
+ int16x4_t b = vreinterpret_s16_m64(_b);
-// Applies a type cast to reinterpret four 32-bit floating point values passed
-// in as a 128-bit parameter as packed 32-bit integers.
-// https://msdn.microsoft.com/en-us/library/bb514099.aspx
-FORCE_INLINE __m128i _mm_castps_si128(__m128 a)
-{
- return vreinterpretq_m128i_s32(vreinterpretq_s32_m128(a));
-}
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFFFF : 0
+ uint16x4_t ltMask = vreinterpret_u16_s16(vshr_n_s16(b, 15));
-// Applies a type cast to reinterpret four 32-bit integers passed in as a
-// 128-bit parameter as packed 32-bit floating point values.
-// https://msdn.microsoft.com/en-us/library/bb514029.aspx
-FORCE_INLINE __m128 _mm_castsi128_ps(__m128i a)
-{
- return vreinterpretq_m128_s32(vreinterpretq_s32_m128i(a));
-}
+ // (b == 0) ? 0xFFFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int16x4_t zeroMask = vreinterpret_s16_u16(vceqz_s16(b));
+#else
+ int16x4_t zeroMask = vreinterpret_s16_u16(vceq_s16(b, vdup_n_s16(0)));
+#endif
-// Loads 128-bit value. :
-// https://msdn.microsoft.com/en-us/library/atzzad1h(v=vs.80).aspx
-FORCE_INLINE __m128i _mm_load_si128(const __m128i *p)
-{
- return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p));
+ // bitwise select either a or negative 'a' (vneg_s16(a) return negative 'a')
+ // based on ltMask
+ int16x4_t masked = vbsl_s16(ltMask, vneg_s16(a), a);
+ // res = masked & (~zeroMask)
+ int16x4_t res = vbic_s16(masked, zeroMask);
+
+ return vreinterpret_m64_s16(res);
}
-// Load a double-precision (64-bit) floating-point element from memory into both
-// elements of dst.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[127:64] := MEM[mem_addr+63:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load1_pd
-FORCE_INLINE __m128d _mm_load1_pd(const double *p)
+// Negate packed 32-bit integers in a when the corresponding signed 32-bit
+// integer in b is negative, and store the results in dst. Element in dst are
+// zeroed out when the corresponding element in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_pi32
+FORCE_INLINE __m64 _mm_sign_pi32(__m64 _a, __m64 _b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(vld1q_dup_f64(p));
+ int32x2_t a = vreinterpret_s32_m64(_a);
+ int32x2_t b = vreinterpret_s32_m64(_b);
+
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFFFFFFFF : 0
+ uint32x2_t ltMask = vreinterpret_u32_s32(vshr_n_s32(b, 31));
+
+ // (b == 0) ? 0xFFFFFFFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int32x2_t zeroMask = vreinterpret_s32_u32(vceqz_s32(b));
#else
- return vreinterpretq_m128d_s64(vdupq_n_s64(*(const int64_t *) p));
+ int32x2_t zeroMask = vreinterpret_s32_u32(vceq_s32(b, vdup_n_s32(0)));
#endif
+
+ // bitwise select either a or negative 'a' (vneg_s32(a) return negative 'a')
+ // based on ltMask
+ int32x2_t masked = vbsl_s32(ltMask, vneg_s32(a), a);
+ // res = masked & (~zeroMask)
+ int32x2_t res = vbic_s32(masked, zeroMask);
+
+ return vreinterpret_m64_s32(res);
}
-// Load a double-precision (64-bit) floating-point element from memory into the
-// upper element of dst, and copy the lower element from a to dst. mem_addr does
-// not need to be aligned on any particular boundary.
-//
-// dst[63:0] := a[63:0]
-// dst[127:64] := MEM[mem_addr+63:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadh_pd
-FORCE_INLINE __m128d _mm_loadh_pd(__m128d a, const double *p)
+// Negate packed 8-bit integers in a when the corresponding signed 8-bit integer
+// in b is negative, and store the results in dst. Element in dst are zeroed out
+// when the corresponding element in b is zero.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sign_pi8
+FORCE_INLINE __m64 _mm_sign_pi8(__m64 _a, __m64 _b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(
- vcombine_f64(vget_low_f64(vreinterpretq_f64_m128d(a)), vld1_f64(p)));
+ int8x8_t a = vreinterpret_s8_m64(_a);
+ int8x8_t b = vreinterpret_s8_m64(_b);
+
+ // signed shift right: faster than vclt
+ // (b < 0) ? 0xFF : 0
+ uint8x8_t ltMask = vreinterpret_u8_s8(vshr_n_s8(b, 7));
+
+ // (b == 0) ? 0xFF : 0
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int8x8_t zeroMask = vreinterpret_s8_u8(vceqz_s8(b));
#else
- return vreinterpretq_m128d_f32(vcombine_f32(
- vget_low_f32(vreinterpretq_f32_m128d(a)), vld1_f32((const float *) p)));
+ int8x8_t zeroMask = vreinterpret_s8_u8(vceq_s8(b, vdup_n_s8(0)));
#endif
+
+ // bitwise select either a or negative 'a' (vneg_s8(a) return negative 'a')
+ // based on ltMask
+ int8x8_t masked = vbsl_s8(ltMask, vneg_s8(a), a);
+ // res = masked & (~zeroMask)
+ int8x8_t res = vbic_s8(masked, zeroMask);
+
+ return vreinterpret_m64_s8(res);
}
-// Load a double-precision (64-bit) floating-point element from memory into both
-// elements of dst.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[127:64] := MEM[mem_addr+63:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_load_pd1
-#define _mm_load_pd1 _mm_load1_pd
+/* SSE4.1 */
-// Load a double-precision (64-bit) floating-point element from memory into both
-// elements of dst.
-//
-// dst[63:0] := MEM[mem_addr+63:mem_addr]
-// dst[127:64] := MEM[mem_addr+63:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loaddup_pd
-#define _mm_loaddup_pd _mm_load1_pd
+// Blend packed 16-bit integers from a and b using control mask imm8, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blend_epi16
+// FORCE_INLINE __m128i _mm_blend_epi16(__m128i a, __m128i b,
+// __constrange(0,255) int imm)
+#define _mm_blend_epi16(a, b, imm) \
+ _sse2neon_define2( \
+ __m128i, a, b, \
+ const uint16_t _mask[8] = \
+ _sse2neon_init(((imm) & (1 << 0)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 1)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 2)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 3)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 4)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 5)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 6)) ? (uint16_t) -1 : 0x0, \
+ ((imm) & (1 << 7)) ? (uint16_t) -1 : 0x0); \
+ uint16x8_t _mask_vec = vld1q_u16(_mask); \
+ uint16x8_t __a = vreinterpretq_u16_m128i(_a); \
+ uint16x8_t __b = vreinterpretq_u16_m128i(_b); _sse2neon_return( \
+ vreinterpretq_m128i_u16(vbslq_u16(_mask_vec, __b, __a)));)
+
+// Blend packed double-precision (64-bit) floating-point elements from a and b
+// using control mask imm8, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blend_pd
+#define _mm_blend_pd(a, b, imm) \
+ _sse2neon_define2( \
+ __m128d, a, b, \
+ const uint64_t _mask[2] = \
+ _sse2neon_init(((imm) & (1 << 0)) ? ~UINT64_C(0) : UINT64_C(0), \
+ ((imm) & (1 << 1)) ? ~UINT64_C(0) : UINT64_C(0)); \
+ uint64x2_t _mask_vec = vld1q_u64(_mask); \
+ uint64x2_t __a = vreinterpretq_u64_m128d(_a); \
+ uint64x2_t __b = vreinterpretq_u64_m128d(_b); _sse2neon_return( \
+ vreinterpretq_m128d_u64(vbslq_u64(_mask_vec, __b, __a)));)
-// Loads 128-bit value. :
-// https://msdn.microsoft.com/zh-cn/library/f4k12ae8(v=vs.90).aspx
-FORCE_INLINE __m128i _mm_loadu_si128(const __m128i *p)
+// Blend packed single-precision (32-bit) floating-point elements from a and b
+// using mask, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blend_ps
+FORCE_INLINE __m128 _mm_blend_ps(__m128 _a, __m128 _b, const char imm8)
{
- return vreinterpretq_m128i_s32(vld1q_s32((const int32_t *) p));
+ const uint32_t ALIGN_STRUCT(16)
+ data[4] = {((imm8) & (1 << 0)) ? UINT32_MAX : 0,
+ ((imm8) & (1 << 1)) ? UINT32_MAX : 0,
+ ((imm8) & (1 << 2)) ? UINT32_MAX : 0,
+ ((imm8) & (1 << 3)) ? UINT32_MAX : 0};
+ uint32x4_t mask = vld1q_u32(data);
+ float32x4_t a = vreinterpretq_f32_m128(_a);
+ float32x4_t b = vreinterpretq_f32_m128(_b);
+ return vreinterpretq_m128_f32(vbslq_f32(mask, b, a));
}
-// Load unaligned 32-bit integer from memory into the first element of dst.
-//
-// dst[31:0] := MEM[mem_addr+31:mem_addr]
-// dst[MAX:32] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si32
-FORCE_INLINE __m128i _mm_loadu_si32(const void *p)
+// Blend packed 8-bit integers from a and b using mask, and store the results in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blendv_epi8
+FORCE_INLINE __m128i _mm_blendv_epi8(__m128i _a, __m128i _b, __m128i _mask)
{
- return vreinterpretq_m128i_s32(
- vsetq_lane_s32(*(const int32_t *) p, vdupq_n_s32(0), 0));
+ // Use a signed shift right to create a mask with the sign bit
+ uint8x16_t mask =
+ vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_m128i(_mask), 7));
+ uint8x16_t a = vreinterpretq_u8_m128i(_a);
+ uint8x16_t b = vreinterpretq_u8_m128i(_b);
+ return vreinterpretq_m128i_u8(vbslq_u8(mask, b, a));
}
-// Convert packed double-precision (64-bit) floating-point elements in a to
-// packed single-precision (32-bit) floating-point elements, and store the
-// results in dst.
-//
-// FOR j := 0 to 1
-// i := 32*j
-// k := 64*j
-// dst[i+31:i] := Convert_FP64_To_FP32(a[k+64:k])
-// ENDFOR
-// dst[127:64] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtpd_ps
-FORCE_INLINE __m128 _mm_cvtpd_ps(__m128d a)
-{
-#if defined(__aarch64__)
- float32x2_t tmp = vcvt_f32_f64(vreinterpretq_f64_m128d(a));
- return vreinterpretq_m128_f32(vcombine_f32(tmp, vdup_n_f32(0)));
+// Blend packed double-precision (64-bit) floating-point elements from a and b
+// using mask, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blendv_pd
+FORCE_INLINE __m128d _mm_blendv_pd(__m128d _a, __m128d _b, __m128d _mask)
+{
+ uint64x2_t mask =
+ vreinterpretq_u64_s64(vshrq_n_s64(vreinterpretq_s64_m128d(_mask), 63));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ float64x2_t a = vreinterpretq_f64_m128d(_a);
+ float64x2_t b = vreinterpretq_f64_m128d(_b);
+ return vreinterpretq_m128d_f64(vbslq_f64(mask, b, a));
#else
- float a0 = (float) ((double *) &a)[0];
- float a1 = (float) ((double *) &a)[1];
- return _mm_set_ps(0, 0, a1, a0);
+ uint64x2_t a = vreinterpretq_u64_m128d(_a);
+ uint64x2_t b = vreinterpretq_u64_m128d(_b);
+ return vreinterpretq_m128d_u64(vbslq_u64(mask, b, a));
#endif
}
-// Copy the lower double-precision (64-bit) floating-point element of a to dst.
-//
-// dst[63:0] := a[63:0]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtsd_f64
-FORCE_INLINE double _mm_cvtsd_f64(__m128d a)
+// Blend packed single-precision (32-bit) floating-point elements from a and b
+// using mask, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blendv_ps
+FORCE_INLINE __m128 _mm_blendv_ps(__m128 _a, __m128 _b, __m128 _mask)
{
-#if defined(__aarch64__)
- return (double) vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0);
-#else
- return ((double *) &a)[0];
-#endif
+ // Use a signed shift right to create a mask with the sign bit
+ uint32x4_t mask =
+ vreinterpretq_u32_s32(vshrq_n_s32(vreinterpretq_s32_m128(_mask), 31));
+ float32x4_t a = vreinterpretq_f32_m128(_a);
+ float32x4_t b = vreinterpretq_f32_m128(_b);
+ return vreinterpretq_m128_f32(vbslq_f32(mask, b, a));
}
-// Convert packed single-precision (32-bit) floating-point elements in a to
-// packed double-precision (64-bit) floating-point elements, and store the
-// results in dst.
-//
-// FOR j := 0 to 1
-// i := 64*j
-// k := 32*j
-// dst[i+63:i] := Convert_FP32_To_FP64(a[k+31:k])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtps_pd
-FORCE_INLINE __m128d _mm_cvtps_pd(__m128 a)
+// Round the packed double-precision (64-bit) floating-point elements in a up
+// to an integer value, and store the results as packed double-precision
+// floating-point elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_ceil_pd
+FORCE_INLINE __m128d _mm_ceil_pd(__m128d a)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128d_f64(
- vcvt_f64_f32(vget_low_f32(vreinterpretq_f32_m128(a))));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vrndpq_f64(vreinterpretq_f64_m128d(a)));
#else
- double a0 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 0);
- double a1 = (double) vgetq_lane_f32(vreinterpretq_f32_m128(a), 1);
- return _mm_set_pd(a1, a0);
+ double *f = (double *) &a;
+ return _mm_set_pd(ceil(f[1]), ceil(f[0]));
#endif
}
-// Cast vector of type __m128d to type __m128i. This intrinsic is only used for
-// compilation and does not generate any instructions, thus it has zero latency.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_castpd_si128
-FORCE_INLINE __m128i _mm_castpd_si128(__m128d a)
+// Round the packed single-precision (32-bit) floating-point elements in a up to
+// an integer value, and store the results as packed single-precision
+// floating-point elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_ceil_ps
+FORCE_INLINE __m128 _mm_ceil_ps(__m128 a)
{
- return vreinterpretq_m128i_s64(vreinterpretq_s64_m128d(a));
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ return vreinterpretq_m128_f32(vrndpq_f32(vreinterpretq_f32_m128(a)));
+#else
+ float *f = (float *) &a;
+ return _mm_set_ps(ceilf(f[3]), ceilf(f[2]), ceilf(f[1]), ceilf(f[0]));
+#endif
}
-// Blend packed single-precision (32-bit) floating-point elements from a and b
-// using mask, and store the results in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_blendv_ps
-FORCE_INLINE __m128 _mm_blendv_ps(__m128 a, __m128 b, __m128 mask)
+// Round the lower double-precision (64-bit) floating-point element in b up to
+// an integer value, store the result as a double-precision floating-point
+// element in the lower element of dst, and copy the upper element from a to the
+// upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_ceil_sd
+FORCE_INLINE __m128d _mm_ceil_sd(__m128d a, __m128d b)
{
- return vreinterpretq_m128_f32(vbslq_f32(vreinterpretq_u32_m128(mask),
- vreinterpretq_f32_m128(b),
- vreinterpretq_f32_m128(a)));
+ return _mm_move_sd(a, _mm_ceil_pd(b));
}
-// Round the packed single-precision (32-bit) floating-point elements in a using
-// the rounding parameter, and store the results as packed single-precision
-// floating-point elements in dst.
-// software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_round_ps
-FORCE_INLINE __m128 _mm_round_ps(__m128 a, int rounding)
+// Round the lower single-precision (32-bit) floating-point element in b up to
+// an integer value, store the result as a single-precision floating-point
+// element in the lower element of dst, and copy the upper 3 packed elements
+// from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_ceil_ss
+FORCE_INLINE __m128 _mm_ceil_ss(__m128 a, __m128 b)
{
-#if defined(__aarch64__)
- switch (rounding) {
- case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC):
- return vreinterpretq_m128_f32(vrndnq_f32(vreinterpretq_f32_m128(a)));
- case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC):
- return vreinterpretq_m128_f32(vrndmq_f32(vreinterpretq_f32_m128(a)));
- case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC):
- return vreinterpretq_m128_f32(vrndpq_f32(vreinterpretq_f32_m128(a)));
- case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC):
- return vreinterpretq_m128_f32(vrndq_f32(vreinterpretq_f32_m128(a)));
- default: //_MM_FROUND_CUR_DIRECTION
- return vreinterpretq_m128_f32(vrndiq_f32(vreinterpretq_f32_m128(a)));
- }
-#else
- float *v_float = (float *) &a;
- __m128 zero, neg_inf, pos_inf;
-
- switch (rounding) {
- case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC):
- return _mm_cvtepi32_ps(_mm_cvtps_epi32(a));
- case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC):
- return (__m128){floorf(v_float[0]), floorf(v_float[1]),
- floorf(v_float[2]), floorf(v_float[3])};
- case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC):
- return (__m128){ceilf(v_float[0]), ceilf(v_float[1]), ceilf(v_float[2]),
- ceilf(v_float[3])};
- case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC):
- zero = _mm_set_ps(0.0f, 0.0f, 0.0f, 0.0f);
- neg_inf = _mm_set_ps(floorf(v_float[0]), floorf(v_float[1]),
- floorf(v_float[2]), floorf(v_float[3]));
- pos_inf = _mm_set_ps(ceilf(v_float[0]), ceilf(v_float[1]),
- ceilf(v_float[2]), ceilf(v_float[3]));
- return _mm_blendv_ps(pos_inf, neg_inf, _mm_cmple_ps(a, zero));
- default: //_MM_FROUND_CUR_DIRECTION
- return (__m128){roundf(v_float[0]), roundf(v_float[1]),
- roundf(v_float[2]), roundf(v_float[3])};
- }
-#endif
+ return _mm_move_ss(a, _mm_ceil_ps(b));
}
-// Convert packed single-precision (32-bit) floating-point elements in a to
-// packed 32-bit integers, and store the results in dst.
-//
-// FOR j := 0 to 1
-// i := 32*j
-// dst[i+31:i] := Convert_FP32_To_Int32(a[i+31:i])
-// ENDFOR
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvt_ps2pi
-FORCE_INLINE __m64 _mm_cvt_ps2pi(__m128 a)
+// Compare packed 64-bit integers in a and b for equality, and store the results
+// in dst
+FORCE_INLINE __m128i _mm_cmpeq_epi64(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpret_m64_s32(
- vget_low_s32(vcvtnq_s32_f32(vreinterpretq_f32_m128(a))));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_u64(
+ vceqq_u64(vreinterpretq_u64_m128i(a), vreinterpretq_u64_m128i(b)));
#else
- return vreinterpret_m64_s32(
- vcvt_s32_f32(vget_low_f32(vreinterpretq_f32_m128(
- _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)))));
+ // ARMv7 lacks vceqq_u64
+ // (a == b) -> (a_lo == b_lo) && (a_hi == b_hi)
+ uint32x4_t cmp =
+ vceqq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b));
+ uint32x4_t swapped = vrev64q_u32(cmp);
+ return vreinterpretq_m128i_u32(vandq_u32(cmp, swapped));
#endif
}
-// Round the packed single-precision (32-bit) floating-point elements in a up to
-// an integer value, and store the results as packed single-precision
-// floating-point elements in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_ceil_ps
-FORCE_INLINE __m128 _mm_ceil_ps(__m128 a)
+// Sign extend packed 16-bit integers in a to packed 32-bit integers, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi16_epi32
+FORCE_INLINE __m128i _mm_cvtepi16_epi32(__m128i a)
{
- return _mm_round_ps(a, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
+ return vreinterpretq_m128i_s32(
+ vmovl_s16(vget_low_s16(vreinterpretq_s16_m128i(a))));
}
-// Round the packed single-precision (32-bit) floating-point elements in a down
-// to an integer value, and store the results as packed single-precision
-// floating-point elements in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_floor_ps
-FORCE_INLINE __m128 _mm_floor_ps(__m128 a)
+// Sign extend packed 16-bit integers in a to packed 64-bit integers, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi16_epi64
+FORCE_INLINE __m128i _mm_cvtepi16_epi64(__m128i a)
{
- return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
+ int16x8_t s16x8 = vreinterpretq_s16_m128i(a); /* xxxx xxxx xxxx 0B0A */
+ int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */
+ int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */
+ return vreinterpretq_m128i_s64(s64x2);
}
+// Sign extend packed 32-bit integers in a to packed 64-bit integers, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi32_epi64
+FORCE_INLINE __m128i _mm_cvtepi32_epi64(__m128i a)
+{
+ return vreinterpretq_m128i_s64(
+ vmovl_s32(vget_low_s32(vreinterpretq_s32_m128i(a))));
+}
-// Load 128-bits of integer data from unaligned memory into dst. This intrinsic
-// may perform better than _mm_loadu_si128 when the data crosses a cache line
-// boundary.
-//
-// dst[127:0] := MEM[mem_addr+127:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_lddqu_si128
-#define _mm_lddqu_si128 _mm_loadu_si128
+// Sign extend packed 8-bit integers in a to packed 16-bit integers, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi8_epi16
+FORCE_INLINE __m128i _mm_cvtepi8_epi16(__m128i a)
+{
+ int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */
+ int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */
+ return vreinterpretq_m128i_s16(s16x8);
+}
-/* Miscellaneous Operations */
+// Sign extend packed 8-bit integers in a to packed 32-bit integers, and store
+// the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi8_epi32
+FORCE_INLINE __m128i _mm_cvtepi8_epi32(__m128i a)
+{
+ int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx DCBA */
+ int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0D0C 0B0A */
+ int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000D 000C 000B 000A */
+ return vreinterpretq_m128i_s32(s32x4);
+}
-// Shifts the 8 signed 16-bit integers in a right by count bits while shifting
-// in the sign bit.
-//
-// r0 := a0 >> count
-// r1 := a1 >> count
-// ...
-// r7 := a7 >> count
-//
-// https://msdn.microsoft.com/en-us/library/3c9997dk(v%3dvs.90).aspx
-FORCE_INLINE __m128i _mm_sra_epi16(__m128i a, __m128i count)
+// Sign extend packed 8-bit integers in the low 8 bytes of a to packed 64-bit
+// integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepi8_epi64
+FORCE_INLINE __m128i _mm_cvtepi8_epi64(__m128i a)
{
- int64_t c = (int64_t) vget_low_s64((int64x2_t) count);
- if (c > 15)
- return _mm_cmplt_epi16(a, _mm_setzero_si128());
- return vreinterpretq_m128i_s16(vshlq_s16((int16x8_t) a, vdupq_n_s16(-c)));
+ int8x16_t s8x16 = vreinterpretq_s8_m128i(a); /* xxxx xxxx xxxx xxBA */
+ int16x8_t s16x8 = vmovl_s8(vget_low_s8(s8x16)); /* 0x0x 0x0x 0x0x 0B0A */
+ int32x4_t s32x4 = vmovl_s16(vget_low_s16(s16x8)); /* 000x 000x 000B 000A */
+ int64x2_t s64x2 = vmovl_s32(vget_low_s32(s32x4)); /* 0000 000B 0000 000A */
+ return vreinterpretq_m128i_s64(s64x2);
}
-// Shifts the 4 signed 32-bit integers in a right by count bits while shifting
-// in the sign bit.
-//
-// r0 := a0 >> count
-// r1 := a1 >> count
-// r2 := a2 >> count
-// r3 := a3 >> count
-//
-// https://msdn.microsoft.com/en-us/library/ce40009e(v%3dvs.100).aspx
-FORCE_INLINE __m128i _mm_sra_epi32(__m128i a, __m128i count)
+// Zero extend packed unsigned 16-bit integers in a to packed 32-bit integers,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu16_epi32
+FORCE_INLINE __m128i _mm_cvtepu16_epi32(__m128i a)
{
- int64_t c = (int64_t) vget_low_s64((int64x2_t) count);
- if (c > 31)
- return _mm_cmplt_epi32(a, _mm_setzero_si128());
- return vreinterpretq_m128i_s32(vshlq_s32((int32x4_t) a, vdupq_n_s32(-c)));
+ return vreinterpretq_m128i_u32(
+ vmovl_u16(vget_low_u16(vreinterpretq_u16_m128i(a))));
}
-// Packs the 16 signed 16-bit integers from a and b into 8-bit integers and
-// saturates.
-// https://msdn.microsoft.com/en-us/library/k4y4f7w5%28v=vs.90%29.aspx
-FORCE_INLINE __m128i _mm_packs_epi16(__m128i a, __m128i b)
+// Zero extend packed unsigned 16-bit integers in a to packed 64-bit integers,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu16_epi64
+FORCE_INLINE __m128i _mm_cvtepu16_epi64(__m128i a)
{
- return vreinterpretq_m128i_s8(
- vcombine_s8(vqmovn_s16(vreinterpretq_s16_m128i(a)),
- vqmovn_s16(vreinterpretq_s16_m128i(b))));
+ uint16x8_t u16x8 = vreinterpretq_u16_m128i(a); /* xxxx xxxx xxxx 0B0A */
+ uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */
+ uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */
+ return vreinterpretq_m128i_u64(u64x2);
}
-// Packs the 16 signed 16 - bit integers from a and b into 8 - bit unsigned
-// integers and saturates.
-//
-// r0 := UnsignedSaturate(a0)
-// r1 := UnsignedSaturate(a1)
-// ...
-// r7 := UnsignedSaturate(a7)
-// r8 := UnsignedSaturate(b0)
-// r9 := UnsignedSaturate(b1)
-// ...
-// r15 := UnsignedSaturate(b7)
-//
-// https://msdn.microsoft.com/en-us/library/07ad1wx4(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_packus_epi16(const __m128i a, const __m128i b)
+// Zero extend packed unsigned 32-bit integers in a to packed 64-bit integers,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu32_epi64
+FORCE_INLINE __m128i _mm_cvtepu32_epi64(__m128i a)
{
- return vreinterpretq_m128i_u8(
- vcombine_u8(vqmovun_s16(vreinterpretq_s16_m128i(a)),
- vqmovun_s16(vreinterpretq_s16_m128i(b))));
+ return vreinterpretq_m128i_u64(
+ vmovl_u32(vget_low_u32(vreinterpretq_u32_m128i(a))));
}
-// Packs the 8 signed 32-bit integers from a and b into signed 16-bit integers
-// and saturates.
-//
-// r0 := SignedSaturate(a0)
-// r1 := SignedSaturate(a1)
-// r2 := SignedSaturate(a2)
-// r3 := SignedSaturate(a3)
-// r4 := SignedSaturate(b0)
-// r5 := SignedSaturate(b1)
-// r6 := SignedSaturate(b2)
-// r7 := SignedSaturate(b3)
-//
-// https://msdn.microsoft.com/en-us/library/393t56f9%28v=vs.90%29.aspx
-FORCE_INLINE __m128i _mm_packs_epi32(__m128i a, __m128i b)
+// Zero extend packed unsigned 8-bit integers in a to packed 16-bit integers,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu8_epi16
+FORCE_INLINE __m128i _mm_cvtepu8_epi16(__m128i a)
{
- return vreinterpretq_m128i_s16(
- vcombine_s16(vqmovn_s32(vreinterpretq_s32_m128i(a)),
- vqmovn_s32(vreinterpretq_s32_m128i(b))));
+ uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx HGFE DCBA */
+ uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0H0G 0F0E 0D0C 0B0A */
+ return vreinterpretq_m128i_u16(u16x8);
}
-// Packs the 8 unsigned 32-bit integers from a and b into unsigned 16-bit
-// integers and saturates.
-//
-// r0 := UnsignedSaturate(a0)
-// r1 := UnsignedSaturate(a1)
-// r2 := UnsignedSaturate(a2)
-// r3 := UnsignedSaturate(a3)
-// r4 := UnsignedSaturate(b0)
-// r5 := UnsignedSaturate(b1)
-// r6 := UnsignedSaturate(b2)
-// r7 := UnsignedSaturate(b3)
-FORCE_INLINE __m128i _mm_packus_epi32(__m128i a, __m128i b)
+// Zero extend packed unsigned 8-bit integers in a to packed 32-bit integers,
+// and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu8_epi32
+FORCE_INLINE __m128i _mm_cvtepu8_epi32(__m128i a)
{
- return vreinterpretq_m128i_u16(
- vcombine_u16(vqmovun_s32(vreinterpretq_s32_m128i(a)),
- vqmovun_s32(vreinterpretq_s32_m128i(b))));
+ uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx DCBA */
+ uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0D0C 0B0A */
+ uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000D 000C 000B 000A */
+ return vreinterpretq_m128i_u32(u32x4);
}
-// Interleaves the lower 8 signed or unsigned 8-bit integers in a with the lower
-// 8 signed or unsigned 8-bit integers in b.
-//
-// r0 := a0
-// r1 := b0
-// r2 := a1
-// r3 := b1
-// ...
-// r14 := a7
-// r15 := b7
-//
-// https://msdn.microsoft.com/en-us/library/xf7k860c%28v=vs.90%29.aspx
-FORCE_INLINE __m128i _mm_unpacklo_epi8(__m128i a, __m128i b)
+// Zero extend packed unsigned 8-bit integers in the low 8 byte sof a to packed
+// 64-bit integers, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtepu8_epi64
+FORCE_INLINE __m128i _mm_cvtepu8_epi64(__m128i a)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s8(
- vzip1q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+ uint8x16_t u8x16 = vreinterpretq_u8_m128i(a); /* xxxx xxxx xxxx xxBA */
+ uint16x8_t u16x8 = vmovl_u8(vget_low_u8(u8x16)); /* 0x0x 0x0x 0x0x 0B0A */
+ uint32x4_t u32x4 = vmovl_u16(vget_low_u16(u16x8)); /* 000x 000x 000B 000A */
+ uint64x2_t u64x2 = vmovl_u32(vget_low_u32(u32x4)); /* 0000 000B 0000 000A */
+ return vreinterpretq_m128i_u64(u64x2);
+}
+
+// Conditionally multiply the packed double-precision (64-bit) floating-point
+// elements in a and b using the high 4 bits in imm8, sum the four products, and
+// conditionally store the sum in dst using the low 4 bits of imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_dp_pd
+FORCE_INLINE __m128d _mm_dp_pd(__m128d a, __m128d b, const int imm)
+{
+ // Generate mask value from constant immediate bit value
+ const int64_t bit0Mask = imm & 0x01 ? UINT64_MAX : 0;
+ const int64_t bit1Mask = imm & 0x02 ? UINT64_MAX : 0;
+#if !SSE2NEON_PRECISE_DP
+ const int64_t bit4Mask = imm & 0x10 ? UINT64_MAX : 0;
+ const int64_t bit5Mask = imm & 0x20 ? UINT64_MAX : 0;
+#endif
+ // Conditional multiplication
+#if !SSE2NEON_PRECISE_DP
+ __m128d mul = _mm_mul_pd(a, b);
+ const __m128d mulMask =
+ _mm_castsi128_pd(_mm_set_epi64x(bit5Mask, bit4Mask));
+ __m128d tmp = _mm_and_pd(mul, mulMask);
#else
- int8x8_t a1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(a)));
- int8x8_t b1 = vreinterpret_s8_s16(vget_low_s16(vreinterpretq_s16_m128i(b)));
- int8x8x2_t result = vzip_s8(a1, b1);
- return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1]));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ double d0 = (imm & 0x10) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 0) *
+ vgetq_lane_f64(vreinterpretq_f64_m128d(b), 0)
+ : 0;
+ double d1 = (imm & 0x20) ? vgetq_lane_f64(vreinterpretq_f64_m128d(a), 1) *
+ vgetq_lane_f64(vreinterpretq_f64_m128d(b), 1)
+ : 0;
+#else
+ double d0 = (imm & 0x10) ? ((double *) &a)[0] * ((double *) &b)[0] : 0;
+ double d1 = (imm & 0x20) ? ((double *) &a)[1] * ((double *) &b)[1] : 0;
+#endif
+ __m128d tmp = _mm_set_pd(d1, d0);
#endif
+ // Sum the products
+#if defined(__aarch64__) || defined(_M_ARM64)
+ double sum = vpaddd_f64(vreinterpretq_f64_m128d(tmp));
+#else
+ double sum = *((double *) &tmp) + *(((double *) &tmp) + 1);
+#endif
+ // Conditionally store the sum
+ const __m128d sumMask =
+ _mm_castsi128_pd(_mm_set_epi64x(bit1Mask, bit0Mask));
+ __m128d res = _mm_and_pd(_mm_set_pd1(sum), sumMask);
+ return res;
}
-// Interleaves the lower 4 signed or unsigned 16-bit integers in a with the
-// lower 4 signed or unsigned 16-bit integers in b.
-//
-// r0 := a0
-// r1 := b0
-// r2 := a1
-// r3 := b1
-// r4 := a2
-// r5 := b2
-// r6 := a3
-// r7 := b3
-//
-// https://msdn.microsoft.com/en-us/library/btxb17bw%28v=vs.90%29.aspx
-FORCE_INLINE __m128i _mm_unpacklo_epi16(__m128i a, __m128i b)
+// Conditionally multiply the packed single-precision (32-bit) floating-point
+// elements in a and b using the high 4 bits in imm8, sum the four products,
+// and conditionally store the sum in dst using the low 4 bits of imm.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_dp_ps
+FORCE_INLINE __m128 _mm_dp_ps(__m128 a, __m128 b, const int imm)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s16(
- vzip1q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
+ float32x4_t elementwise_prod = _mm_mul_ps(a, b);
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+ /* shortcuts */
+ if (imm == 0xFF) {
+ return _mm_set1_ps(vaddvq_f32(elementwise_prod));
+ }
+
+ if ((imm & 0x0F) == 0x0F) {
+ if (!(imm & (1 << 4)))
+ elementwise_prod = vsetq_lane_f32(0.0f, elementwise_prod, 0);
+ if (!(imm & (1 << 5)))
+ elementwise_prod = vsetq_lane_f32(0.0f, elementwise_prod, 1);
+ if (!(imm & (1 << 6)))
+ elementwise_prod = vsetq_lane_f32(0.0f, elementwise_prod, 2);
+ if (!(imm & (1 << 7)))
+ elementwise_prod = vsetq_lane_f32(0.0f, elementwise_prod, 3);
+
+ return _mm_set1_ps(vaddvq_f32(elementwise_prod));
+ }
+#endif
+
+ float s = 0.0f;
+
+ if (imm & (1 << 4))
+ s += vgetq_lane_f32(elementwise_prod, 0);
+ if (imm & (1 << 5))
+ s += vgetq_lane_f32(elementwise_prod, 1);
+ if (imm & (1 << 6))
+ s += vgetq_lane_f32(elementwise_prod, 2);
+ if (imm & (1 << 7))
+ s += vgetq_lane_f32(elementwise_prod, 3);
+
+ const float32_t res[4] = {
+ (imm & 0x1) ? s : 0.0f,
+ (imm & 0x2) ? s : 0.0f,
+ (imm & 0x4) ? s : 0.0f,
+ (imm & 0x8) ? s : 0.0f,
+ };
+ return vreinterpretq_m128_f32(vld1q_f32(res));
+}
+
+// Extract a 32-bit integer from a, selected with imm8, and store the result in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_epi32
+// FORCE_INLINE int _mm_extract_epi32(__m128i a, __constrange(0,4) int imm)
+#define _mm_extract_epi32(a, imm) \
+ vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm))
+
+// Extract a 64-bit integer from a, selected with imm8, and store the result in
+// dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_epi64
+// FORCE_INLINE __int64 _mm_extract_epi64(__m128i a, __constrange(0,2) int imm)
+#define _mm_extract_epi64(a, imm) \
+ vgetq_lane_s64(vreinterpretq_s64_m128i(a), (imm))
+
+// Extract an 8-bit integer from a, selected with imm8, and store the result in
+// the lower element of dst. FORCE_INLINE int _mm_extract_epi8(__m128i a,
+// __constrange(0,16) int imm)
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_epi8
+#define _mm_extract_epi8(a, imm) vgetq_lane_u8(vreinterpretq_u8_m128i(a), (imm))
+
+// Extracts the selected single-precision (32-bit) floating-point from a.
+// FORCE_INLINE int _mm_extract_ps(__m128 a, __constrange(0,4) int imm)
+#define _mm_extract_ps(a, imm) vgetq_lane_s32(vreinterpretq_s32_m128(a), (imm))
+
+// Round the packed double-precision (64-bit) floating-point elements in a down
+// to an integer value, and store the results as packed double-precision
+// floating-point elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_floor_pd
+FORCE_INLINE __m128d _mm_floor_pd(__m128d a)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128d_f64(vrndmq_f64(vreinterpretq_f64_m128d(a)));
#else
- int16x4_t a1 = vget_low_s16(vreinterpretq_s16_m128i(a));
- int16x4_t b1 = vget_low_s16(vreinterpretq_s16_m128i(b));
- int16x4x2_t result = vzip_s16(a1, b1);
- return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1]));
+ double *f = (double *) &a;
+ return _mm_set_pd(floor(f[1]), floor(f[0]));
#endif
}
-// Interleaves the lower 2 signed or unsigned 32 - bit integers in a with the
-// lower 2 signed or unsigned 32 - bit integers in b.
-//
-// r0 := a0
-// r1 := b0
-// r2 := a1
-// r3 := b1
-//
-// https://msdn.microsoft.com/en-us/library/x8atst9d(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_unpacklo_epi32(__m128i a, __m128i b)
+// Round the packed single-precision (32-bit) floating-point elements in a down
+// to an integer value, and store the results as packed single-precision
+// floating-point elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_floor_ps
+FORCE_INLINE __m128 _mm_floor_ps(__m128 a)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s32(
- vzip1q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ return vreinterpretq_m128_f32(vrndmq_f32(vreinterpretq_f32_m128(a)));
#else
- int32x2_t a1 = vget_low_s32(vreinterpretq_s32_m128i(a));
- int32x2_t b1 = vget_low_s32(vreinterpretq_s32_m128i(b));
- int32x2x2_t result = vzip_s32(a1, b1);
- return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1]));
+ float *f = (float *) &a;
+ return _mm_set_ps(floorf(f[3]), floorf(f[2]), floorf(f[1]), floorf(f[0]));
#endif
}
-FORCE_INLINE __m128i _mm_unpacklo_epi64(__m128i a, __m128i b)
+// Round the lower double-precision (64-bit) floating-point element in b down to
+// an integer value, store the result as a double-precision floating-point
+// element in the lower element of dst, and copy the upper element from a to the
+// upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_floor_sd
+FORCE_INLINE __m128d _mm_floor_sd(__m128d a, __m128d b)
{
- int64x1_t a_l = vget_low_s64(vreinterpretq_s64_m128i(a));
- int64x1_t b_l = vget_low_s64(vreinterpretq_s64_m128i(b));
- return vreinterpretq_m128i_s64(vcombine_s64(a_l, b_l));
+ return _mm_move_sd(a, _mm_floor_pd(b));
}
-// Selects and interleaves the lower two single-precision, floating-point values
-// from a and b.
-//
-// r0 := a0
-// r1 := b0
-// r2 := a1
-// r3 := b1
-//
-// https://msdn.microsoft.com/en-us/library/25st103b%28v=vs.90%29.aspx
-FORCE_INLINE __m128 _mm_unpacklo_ps(__m128 a, __m128 b)
+// Round the lower single-precision (32-bit) floating-point element in b down to
+// an integer value, store the result as a single-precision floating-point
+// element in the lower element of dst, and copy the upper 3 packed elements
+// from a to the upper elements of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_floor_ss
+FORCE_INLINE __m128 _mm_floor_ss(__m128 a, __m128 b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(
- vzip1q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
-#else
- float32x2_t a1 = vget_low_f32(vreinterpretq_f32_m128(a));
- float32x2_t b1 = vget_low_f32(vreinterpretq_f32_m128(b));
- float32x2x2_t result = vzip_f32(a1, b1);
- return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1]));
-#endif
+ return _mm_move_ss(a, _mm_floor_ps(b));
}
-// Selects and interleaves the upper two single-precision, floating-point values
-// from a and b.
-//
-// r0 := a2
-// r1 := b2
-// r2 := a3
-// r3 := b3
-//
-// https://msdn.microsoft.com/en-us/library/skccxx7d%28v=vs.90%29.aspx
-FORCE_INLINE __m128 _mm_unpackhi_ps(__m128 a, __m128 b)
+// Copy a to dst, and insert the 32-bit integer i into dst at the location
+// specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_insert_epi32
+// FORCE_INLINE __m128i _mm_insert_epi32(__m128i a, int b,
+// __constrange(0,4) int imm)
+#define _mm_insert_epi32(a, b, imm) \
+ vreinterpretq_m128i_s32( \
+ vsetq_lane_s32((b), vreinterpretq_s32_m128i(a), (imm)))
+
+// Copy a to dst, and insert the 64-bit integer i into dst at the location
+// specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_insert_epi64
+// FORCE_INLINE __m128i _mm_insert_epi64(__m128i a, __int64 b,
+// __constrange(0,2) int imm)
+#define _mm_insert_epi64(a, b, imm) \
+ vreinterpretq_m128i_s64( \
+ vsetq_lane_s64((b), vreinterpretq_s64_m128i(a), (imm)))
+
+// Copy a to dst, and insert the lower 8-bit integer from i into dst at the
+// location specified by imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_insert_epi8
+// FORCE_INLINE __m128i _mm_insert_epi8(__m128i a, int b,
+// __constrange(0,16) int imm)
+#define _mm_insert_epi8(a, b, imm) \
+ vreinterpretq_m128i_s8(vsetq_lane_s8((b), vreinterpretq_s8_m128i(a), (imm)))
+
+// Copy a to tmp, then insert a single-precision (32-bit) floating-point
+// element from b into tmp using the control in imm8. Store tmp to dst using
+// the mask in imm8 (elements are zeroed out when the corresponding bit is set).
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=insert_ps
+#define _mm_insert_ps(a, b, imm8) \
+ _sse2neon_define2( \
+ __m128, a, b, \
+ float32x4_t tmp1 = \
+ vsetq_lane_f32(vgetq_lane_f32(_b, (imm8 >> 6) & 0x3), \
+ vreinterpretq_f32_m128(_a), 0); \
+ float32x4_t tmp2 = \
+ vsetq_lane_f32(vgetq_lane_f32(tmp1, 0), \
+ vreinterpretq_f32_m128(_a), ((imm8 >> 4) & 0x3)); \
+ const uint32_t data[4] = \
+ _sse2neon_init(((imm8) & (1 << 0)) ? UINT32_MAX : 0, \
+ ((imm8) & (1 << 1)) ? UINT32_MAX : 0, \
+ ((imm8) & (1 << 2)) ? UINT32_MAX : 0, \
+ ((imm8) & (1 << 3)) ? UINT32_MAX : 0); \
+ uint32x4_t mask = vld1q_u32(data); \
+ float32x4_t all_zeros = vdupq_n_f32(0); \
+ \
+ _sse2neon_return(vreinterpretq_m128_f32( \
+ vbslq_f32(mask, all_zeros, vreinterpretq_f32_m128(tmp2))));)
+
+// Compare packed signed 32-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epi32
+FORCE_INLINE __m128i _mm_max_epi32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128_f32(
- vzip2q_f32(vreinterpretq_f32_m128(a), vreinterpretq_f32_m128(b)));
-#else
- float32x2_t a1 = vget_high_f32(vreinterpretq_f32_m128(a));
- float32x2_t b1 = vget_high_f32(vreinterpretq_f32_m128(b));
- float32x2x2_t result = vzip_f32(a1, b1);
- return vreinterpretq_m128_f32(vcombine_f32(result.val[0], result.val[1]));
-#endif
+ return vreinterpretq_m128i_s32(
+ vmaxq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+}
+
+// Compare packed signed 8-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epi8
+FORCE_INLINE __m128i _mm_max_epi8(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_s8(
+ vmaxq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
}
-// Interleaves the upper 8 signed or unsigned 8-bit integers in a with the upper
-// 8 signed or unsigned 8-bit integers in b.
-//
-// r0 := a8
-// r1 := b8
-// r2 := a9
-// r3 := b9
-// ...
-// r14 := a15
-// r15 := b15
-//
-// https://msdn.microsoft.com/en-us/library/t5h7783k(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_unpackhi_epi8(__m128i a, __m128i b)
+// Compare packed unsigned 16-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epu16
+FORCE_INLINE __m128i _mm_max_epu16(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s8(
- vzip2q_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
-#else
- int8x8_t a1 =
- vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(a)));
- int8x8_t b1 =
- vreinterpret_s8_s16(vget_high_s16(vreinterpretq_s16_m128i(b)));
- int8x8x2_t result = vzip_s8(a1, b1);
- return vreinterpretq_m128i_s8(vcombine_s8(result.val[0], result.val[1]));
-#endif
+ return vreinterpretq_m128i_u16(
+ vmaxq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
}
-// Interleaves the upper 4 signed or unsigned 16-bit integers in a with the
-// upper 4 signed or unsigned 16-bit integers in b.
-//
-// r0 := a4
-// r1 := b4
-// r2 := a5
-// r3 := b5
-// r4 := a6
-// r5 := b6
-// r6 := a7
-// r7 := b7
-//
-// https://msdn.microsoft.com/en-us/library/03196cz7(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_unpackhi_epi16(__m128i a, __m128i b)
+// Compare packed unsigned 32-bit integers in a and b, and store packed maximum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epu32
+FORCE_INLINE __m128i _mm_max_epu32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
- return vreinterpretq_m128i_s16(
- vzip2q_s16(vreinterpretq_s16_m128i(a), vreinterpretq_s16_m128i(b)));
-#else
- int16x4_t a1 = vget_high_s16(vreinterpretq_s16_m128i(a));
- int16x4_t b1 = vget_high_s16(vreinterpretq_s16_m128i(b));
- int16x4x2_t result = vzip_s16(a1, b1);
- return vreinterpretq_m128i_s16(vcombine_s16(result.val[0], result.val[1]));
-#endif
+ return vreinterpretq_m128i_u32(
+ vmaxq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)));
}
-// Interleaves the upper 2 signed or unsigned 32-bit integers in a with the
-// upper 2 signed or unsigned 32-bit integers in b.
-// https://msdn.microsoft.com/en-us/library/65sa7cbs(v=vs.100).aspx
-FORCE_INLINE __m128i _mm_unpackhi_epi32(__m128i a, __m128i b)
+// Compare packed signed 32-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_epi32
+FORCE_INLINE __m128i _mm_min_epi32(__m128i a, __m128i b)
{
-#if defined(__aarch64__)
return vreinterpretq_m128i_s32(
- vzip2q_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
-#else
- int32x2_t a1 = vget_high_s32(vreinterpretq_s32_m128i(a));
- int32x2_t b1 = vget_high_s32(vreinterpretq_s32_m128i(b));
- int32x2x2_t result = vzip_s32(a1, b1);
- return vreinterpretq_m128i_s32(vcombine_s32(result.val[0], result.val[1]));
-#endif
+ vminq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
}
-// Interleaves the upper signed or unsigned 64-bit integer in a with the
-// upper signed or unsigned 64-bit integer in b.
-//
-// r0 := a1
-// r1 := b1
-FORCE_INLINE __m128i _mm_unpackhi_epi64(__m128i a, __m128i b)
+// Compare packed signed 8-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_epi8
+FORCE_INLINE __m128i _mm_min_epi8(__m128i a, __m128i b)
{
- int64x1_t a_h = vget_high_s64(vreinterpretq_s64_m128i(a));
- int64x1_t b_h = vget_high_s64(vreinterpretq_s64_m128i(b));
- return vreinterpretq_m128i_s64(vcombine_s64(a_h, b_h));
+ return vreinterpretq_m128i_s8(
+ vminq_s8(vreinterpretq_s8_m128i(a), vreinterpretq_s8_m128i(b)));
+}
+
+// Compare packed unsigned 16-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_epu16
+FORCE_INLINE __m128i _mm_min_epu16(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u16(
+ vminq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b)));
+}
+
+// Compare packed unsigned 32-bit integers in a and b, and store packed minimum
+// values in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_epu32
+FORCE_INLINE __m128i _mm_min_epu32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u32(
+ vminq_u32(vreinterpretq_u32_m128i(a), vreinterpretq_u32_m128i(b)));
}
// Horizontally compute the minimum amongst the packed unsigned 16-bit integers
// in a, store the minimum and index in dst, and zero the remaining bits in dst.
-//
-// index[2:0] := 0
-// min[15:0] := a[15:0]
-// FOR j := 0 to 7
-// i := j*16
-// IF a[i+15:i] < min[15:0]
-// index[2:0] := j
-// min[15:0] := a[i+15:i]
-// FI
-// ENDFOR
-// dst[15:0] := min[15:0]
-// dst[18:16] := index[2:0]
-// dst[127:19] := 0
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_minpos_epu16
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_minpos_epu16
FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a)
{
__m128i dst;
uint16_t min, idx = 0;
+#if defined(__aarch64__) || defined(_M_ARM64)
// Find the minimum value
-#if defined(__aarch64__)
min = vminvq_u16(vreinterpretq_u16_m128i(a));
+
+ // Get the index of the minimum value
+ static const uint16_t idxv[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ uint16x8_t minv = vdupq_n_u16(min);
+ uint16x8_t cmeq = vceqq_u16(minv, vreinterpretq_u16_m128i(a));
+ idx = vminvq_u16(vornq_u16(vld1q_u16(idxv), cmeq));
#else
+ // Find the minimum value
__m64 tmp;
tmp = vreinterpret_m64_u16(
vmin_u16(vget_low_u16(vreinterpretq_u16_m128i(a)),
@@ -5493,7 +7242,6 @@ FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a)
tmp = vreinterpret_m64_u16(
vpmin_u16(vreinterpret_u16_m64(tmp), vreinterpret_u16_m64(tmp)));
min = vget_lane_u16(vreinterpret_u16_m64(tmp), 0);
-#endif
// Get the index of the minimum value
int i;
for (i = 0; i < 8; i++) {
@@ -5503,6 +7251,7 @@ FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a)
}
a = _mm_srli_si128(a, 2);
}
+#endif
// Generate result
dst = _mm_setzero_si128();
dst = vreinterpretq_m128i_u16(
@@ -5512,32 +7261,356 @@ FORCE_INLINE __m128i _mm_minpos_epu16(__m128i a)
return dst;
}
-// shift to right
-// https://msdn.microsoft.com/en-us/library/bb514041(v=vs.120).aspx
-// http://blog.csdn.net/hemmingway/article/details/44828303
-// Clang requires a macro here, as it is extremely picky about c being a
-// literal.
-#define _mm_alignr_epi8(a, b, c) \
- ((__m128i) vextq_s8((int8x16_t)(b), (int8x16_t)(a), (c)))
+// Compute the sum of absolute differences (SADs) of quadruplets of unsigned
+// 8-bit integers in a compared to those in b, and store the 16-bit results in
+// dst. Eight SADs are performed using one quadruplet from b and eight
+// quadruplets from a. One quadruplet is selected from b starting at on the
+// offset specified in imm8. Eight quadruplets are formed from sequential 8-bit
+// integers selected from a starting at the offset specified in imm8.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mpsadbw_epu8
+FORCE_INLINE __m128i _mm_mpsadbw_epu8(__m128i a, __m128i b, const int imm)
+{
+ uint8x16_t _a, _b;
+
+ switch (imm & 0x4) {
+ case 0:
+ // do nothing
+ _a = vreinterpretq_u8_m128i(a);
+ break;
+ case 4:
+ _a = vreinterpretq_u8_u32(vextq_u32(vreinterpretq_u32_m128i(a),
+ vreinterpretq_u32_m128i(a), 1));
+ break;
+ default:
+#if defined(__GNUC__) || defined(__clang__)
+ __builtin_unreachable();
+#elif defined(_MSC_VER)
+ __assume(0);
+#endif
+ break;
+ }
+
+ switch (imm & 0x3) {
+ case 0:
+ _b = vreinterpretq_u8_u32(
+ vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 0)));
+ break;
+ case 1:
+ _b = vreinterpretq_u8_u32(
+ vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 1)));
+ break;
+ case 2:
+ _b = vreinterpretq_u8_u32(
+ vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 2)));
+ break;
+ case 3:
+ _b = vreinterpretq_u8_u32(
+ vdupq_n_u32(vgetq_lane_u32(vreinterpretq_u32_m128i(b), 3)));
+ break;
+ default:
+#if defined(__GNUC__) || defined(__clang__)
+ __builtin_unreachable();
+#elif defined(_MSC_VER)
+ __assume(0);
+#endif
+ break;
+ }
+
+ int16x8_t c04, c15, c26, c37;
+ uint8x8_t low_b = vget_low_u8(_b);
+ c04 = vreinterpretq_s16_u16(vabdl_u8(vget_low_u8(_a), low_b));
+ uint8x16_t _a_1 = vextq_u8(_a, _a, 1);
+ c15 = vreinterpretq_s16_u16(vabdl_u8(vget_low_u8(_a_1), low_b));
+ uint8x16_t _a_2 = vextq_u8(_a, _a, 2);
+ c26 = vreinterpretq_s16_u16(vabdl_u8(vget_low_u8(_a_2), low_b));
+ uint8x16_t _a_3 = vextq_u8(_a, _a, 3);
+ c37 = vreinterpretq_s16_u16(vabdl_u8(vget_low_u8(_a_3), low_b));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ // |0|4|2|6|
+ c04 = vpaddq_s16(c04, c26);
+ // |1|5|3|7|
+ c15 = vpaddq_s16(c15, c37);
+
+ int32x4_t trn1_c =
+ vtrn1q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15));
+ int32x4_t trn2_c =
+ vtrn2q_s32(vreinterpretq_s32_s16(c04), vreinterpretq_s32_s16(c15));
+ return vreinterpretq_m128i_s16(vpaddq_s16(vreinterpretq_s16_s32(trn1_c),
+ vreinterpretq_s16_s32(trn2_c)));
+#else
+ int16x4_t c01, c23, c45, c67;
+ c01 = vpadd_s16(vget_low_s16(c04), vget_low_s16(c15));
+ c23 = vpadd_s16(vget_low_s16(c26), vget_low_s16(c37));
+ c45 = vpadd_s16(vget_high_s16(c04), vget_high_s16(c15));
+ c67 = vpadd_s16(vget_high_s16(c26), vget_high_s16(c37));
+
+ return vreinterpretq_m128i_s16(
+ vcombine_s16(vpadd_s16(c01, c23), vpadd_s16(c45, c67)));
+#endif
+}
+
+// Multiply the low signed 32-bit integers from each packed 64-bit element in
+// a and b, and store the signed 64-bit results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mul_epi32
+FORCE_INLINE __m128i _mm_mul_epi32(__m128i a, __m128i b)
+{
+ // vmull_s32 upcasts instead of masking, so we downcast.
+ int32x2_t a_lo = vmovn_s64(vreinterpretq_s64_m128i(a));
+ int32x2_t b_lo = vmovn_s64(vreinterpretq_s64_m128i(b));
+ return vreinterpretq_m128i_s64(vmull_s32(a_lo, b_lo));
+}
+
+// Multiply the packed 32-bit integers in a and b, producing intermediate 64-bit
+// integers, and store the low 32 bits of the intermediate integers in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mullo_epi32
+FORCE_INLINE __m128i _mm_mullo_epi32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_s32(
+ vmulq_s32(vreinterpretq_s32_m128i(a), vreinterpretq_s32_m128i(b)));
+}
+
+// Convert packed signed 32-bit integers from a and b to packed 16-bit integers
+// using unsigned saturation, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packus_epi32
+FORCE_INLINE __m128i _mm_packus_epi32(__m128i a, __m128i b)
+{
+ return vreinterpretq_m128i_u16(
+ vcombine_u16(vqmovun_s32(vreinterpretq_s32_m128i(a)),
+ vqmovun_s32(vreinterpretq_s32_m128i(b))));
+}
+
+// Round the packed double-precision (64-bit) floating-point elements in a using
+// the rounding parameter, and store the results as packed double-precision
+// floating-point elements in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_round_pd
+FORCE_INLINE __m128d _mm_round_pd(__m128d a, int rounding)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ switch (rounding) {
+ case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC):
+ return vreinterpretq_m128d_f64(vrndnq_f64(vreinterpretq_f64_m128d(a)));
+ case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC):
+ return _mm_floor_pd(a);
+ case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC):
+ return _mm_ceil_pd(a);
+ case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC):
+ return vreinterpretq_m128d_f64(vrndq_f64(vreinterpretq_f64_m128d(a)));
+ default: //_MM_FROUND_CUR_DIRECTION
+ return vreinterpretq_m128d_f64(vrndiq_f64(vreinterpretq_f64_m128d(a)));
+ }
+#else
+ double *v_double = (double *) &a;
+
+ if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) {
+ double res[2], tmp;
+ for (int i = 0; i < 2; i++) {
+ tmp = (v_double[i] < 0) ? -v_double[i] : v_double[i];
+ double roundDown = floor(tmp); // Round down value
+ double roundUp = ceil(tmp); // Round up value
+ double diffDown = tmp - roundDown;
+ double diffUp = roundUp - tmp;
+ if (diffDown < diffUp) {
+ /* If it's closer to the round down value, then use it */
+ res[i] = roundDown;
+ } else if (diffDown > diffUp) {
+ /* If it's closer to the round up value, then use it */
+ res[i] = roundUp;
+ } else {
+ /* If it's equidistant between round up and round down value,
+ * pick the one which is an even number */
+ double half = roundDown / 2;
+ if (half != floor(half)) {
+ /* If the round down value is odd, return the round up value
+ */
+ res[i] = roundUp;
+ } else {
+ /* If the round up value is odd, return the round down value
+ */
+ res[i] = roundDown;
+ }
+ }
+ res[i] = (v_double[i] < 0) ? -res[i] : res[i];
+ }
+ return _mm_set_pd(res[1], res[0]);
+ } else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) {
+ return _mm_floor_pd(a);
+ } else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) {
+ return _mm_ceil_pd(a);
+ }
+ return _mm_set_pd(v_double[1] > 0 ? floor(v_double[1]) : ceil(v_double[1]),
+ v_double[0] > 0 ? floor(v_double[0]) : ceil(v_double[0]));
+#endif
+}
+
+// Round the packed single-precision (32-bit) floating-point elements in a using
+// the rounding parameter, and store the results as packed single-precision
+// floating-point elements in dst.
+// software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_round_ps
+FORCE_INLINE __m128 _mm_round_ps(__m128 a, int rounding)
+{
+#if (defined(__aarch64__) || defined(_M_ARM64)) || \
+ defined(__ARM_FEATURE_DIRECTED_ROUNDING)
+ switch (rounding) {
+ case (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC):
+ return vreinterpretq_m128_f32(vrndnq_f32(vreinterpretq_f32_m128(a)));
+ case (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC):
+ return _mm_floor_ps(a);
+ case (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC):
+ return _mm_ceil_ps(a);
+ case (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC):
+ return vreinterpretq_m128_f32(vrndq_f32(vreinterpretq_f32_m128(a)));
+ default: //_MM_FROUND_CUR_DIRECTION
+ return vreinterpretq_m128_f32(vrndiq_f32(vreinterpretq_f32_m128(a)));
+ }
+#else
+ float *v_float = (float *) &a;
+
+ if (rounding == (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_NEAREST)) {
+ uint32x4_t signmask = vdupq_n_u32(0x80000000);
+ float32x4_t half = vbslq_f32(signmask, vreinterpretq_f32_m128(a),
+ vdupq_n_f32(0.5f)); /* +/- 0.5 */
+ int32x4_t r_normal = vcvtq_s32_f32(vaddq_f32(
+ vreinterpretq_f32_m128(a), half)); /* round to integer: [a + 0.5]*/
+ int32x4_t r_trunc = vcvtq_s32_f32(
+ vreinterpretq_f32_m128(a)); /* truncate to integer: [a] */
+ int32x4_t plusone = vreinterpretq_s32_u32(vshrq_n_u32(
+ vreinterpretq_u32_s32(vnegq_s32(r_trunc)), 31)); /* 1 or 0 */
+ int32x4_t r_even = vbicq_s32(vaddq_s32(r_trunc, plusone),
+ vdupq_n_s32(1)); /* ([a] + {0,1}) & ~1 */
+ float32x4_t delta = vsubq_f32(
+ vreinterpretq_f32_m128(a),
+ vcvtq_f32_s32(r_trunc)); /* compute delta: delta = (a - [a]) */
+ uint32x4_t is_delta_half =
+ vceqq_f32(delta, half); /* delta == +/- 0.5 */
+ return vreinterpretq_m128_f32(
+ vcvtq_f32_s32(vbslq_s32(is_delta_half, r_even, r_normal)));
+ } else if (rounding == (_MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_DOWN)) {
+ return _mm_floor_ps(a);
+ } else if (rounding == (_MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC) ||
+ (rounding == _MM_FROUND_CUR_DIRECTION &&
+ _MM_GET_ROUNDING_MODE() == _MM_ROUND_UP)) {
+ return _mm_ceil_ps(a);
+ }
+ return _mm_set_ps(v_float[3] > 0 ? floorf(v_float[3]) : ceilf(v_float[3]),
+ v_float[2] > 0 ? floorf(v_float[2]) : ceilf(v_float[2]),
+ v_float[1] > 0 ? floorf(v_float[1]) : ceilf(v_float[1]),
+ v_float[0] > 0 ? floorf(v_float[0]) : ceilf(v_float[0]));
+#endif
+}
+
+// Round the lower double-precision (64-bit) floating-point element in b using
+// the rounding parameter, store the result as a double-precision floating-point
+// element in the lower element of dst, and copy the upper element from a to the
+// upper element of dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_round_sd
+FORCE_INLINE __m128d _mm_round_sd(__m128d a, __m128d b, int rounding)
+{
+ return _mm_move_sd(a, _mm_round_pd(b, rounding));
+}
+
+// Round the lower single-precision (32-bit) floating-point element in b using
+// the rounding parameter, store the result as a single-precision floating-point
+// element in the lower element of dst, and copy the upper 3 packed elements
+// from a to the upper elements of dst. Rounding is done according to the
+// rounding[3:0] parameter, which can be one of:
+// (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) // round to nearest, and
+// suppress exceptions
+// (_MM_FROUND_TO_NEG_INF |_MM_FROUND_NO_EXC) // round down, and
+// suppress exceptions
+// (_MM_FROUND_TO_POS_INF |_MM_FROUND_NO_EXC) // round up, and suppress
+// exceptions
+// (_MM_FROUND_TO_ZERO |_MM_FROUND_NO_EXC) // truncate, and suppress
+// exceptions _MM_FROUND_CUR_DIRECTION // use MXCSR.RC; see
+// _MM_SET_ROUNDING_MODE
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_round_ss
+FORCE_INLINE __m128 _mm_round_ss(__m128 a, __m128 b, int rounding)
+{
+ return _mm_move_ss(a, _mm_round_ps(b, rounding));
+}
+
+// Load 128-bits of integer data from memory into dst using a non-temporal
+// memory hint. mem_addr must be aligned on a 16-byte boundary or a
+// general-protection exception may be generated.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_stream_load_si128
+FORCE_INLINE __m128i _mm_stream_load_si128(__m128i *p)
+{
+#if __has_builtin(__builtin_nontemporal_store)
+ return __builtin_nontemporal_load(p);
+#else
+ return vreinterpretq_m128i_s64(vld1q_s64((int64_t *) p));
+#endif
+}
+
+// Compute the bitwise NOT of a and then AND with a 128-bit vector containing
+// all 1's, and return 1 if the result is zero, otherwise return 0.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_test_all_ones
+FORCE_INLINE int _mm_test_all_ones(__m128i a)
+{
+ return (uint64_t) (vgetq_lane_s64(a, 0) & vgetq_lane_s64(a, 1)) ==
+ ~(uint64_t) 0;
+}
+
+// Compute the bitwise AND of 128 bits (representing integer data) in a and
+// mask, and return 1 if the result is zero, otherwise return 0.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_test_all_zeros
+FORCE_INLINE int _mm_test_all_zeros(__m128i a, __m128i mask)
+{
+ int64x2_t a_and_mask =
+ vandq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(mask));
+ return !(vgetq_lane_s64(a_and_mask, 0) | vgetq_lane_s64(a_and_mask, 1));
+}
+
+// Compute the bitwise AND of 128 bits (representing integer data) in a and
+// mask, and set ZF to 1 if the result is zero, otherwise set ZF to 0. Compute
+// the bitwise NOT of a and then AND with mask, and set CF to 1 if the result is
+// zero, otherwise set CF to 0. Return 1 if both the ZF and CF values are zero,
+// otherwise return 0.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=mm_test_mix_ones_zero
+FORCE_INLINE int _mm_test_mix_ones_zeros(__m128i a, __m128i mask)
+{
+ uint64x2_t zf =
+ vandq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a));
+ uint64x2_t cf =
+ vbicq_u64(vreinterpretq_u64_m128i(mask), vreinterpretq_u64_m128i(a));
+ uint64x2_t result = vandq_u64(zf, cf);
+ return !(vgetq_lane_u64(result, 0) | vgetq_lane_u64(result, 1));
+}
// Compute the bitwise AND of 128 bits (representing integer data) in a and b,
// and set ZF to 1 if the result is zero, otherwise set ZF to 0. Compute the
// bitwise NOT of a and then AND with b, and set CF to 1 if the result is zero,
// otherwise set CF to 0. Return the CF value.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testc_si128
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_testc_si128
FORCE_INLINE int _mm_testc_si128(__m128i a, __m128i b)
{
int64x2_t s64 =
- vandq_s64(vreinterpretq_s64_s32(vmvnq_s32(vreinterpretq_s32_m128i(a))),
- vreinterpretq_s64_m128i(b));
+ vbicq_s64(vreinterpretq_s64_m128i(b), vreinterpretq_s64_m128i(a));
return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1));
}
+// Compute the bitwise AND of 128 bits (representing integer data) in a and b,
+// and set ZF to 1 if the result is zero, otherwise set ZF to 0. Compute the
+// bitwise NOT of a and then AND with b, and set CF to 1 if the result is zero,
+// otherwise set CF to 0. Return 1 if both the ZF and CF values are zero,
+// otherwise return 0.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_testnzc_si128
+#define _mm_testnzc_si128(a, b) _mm_test_mix_ones_zeros(a, b)
+
// Compute the bitwise AND of 128 bits (representing integer data) in a and b,
// and set ZF to 1 if the result is zero, otherwise set ZF to 0. Compute the
// bitwise NOT of a and then AND with b, and set CF to 1 if the result is zero,
// otherwise set CF to 0. Return the ZF value.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_testz_si128
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_testz_si128
FORCE_INLINE int _mm_testz_si128(__m128i a, __m128i b)
{
int64x2_t s64 =
@@ -5545,290 +7618,856 @@ FORCE_INLINE int _mm_testz_si128(__m128i a, __m128i b)
return !(vgetq_lane_s64(s64, 0) | vgetq_lane_s64(s64, 1));
}
-// Extracts the selected signed or unsigned 8-bit integer from a and zero
-// extends.
-// FORCE_INLINE int _mm_extract_epi8(__m128i a, __constrange(0,16) int imm)
-#define _mm_extract_epi8(a, imm) vgetq_lane_u8(vreinterpretq_u8_m128i(a), (imm))
+/* SSE4.2 */
-// Inserts the least significant 8 bits of b into the selected 8-bit integer
-// of a.
-// FORCE_INLINE __m128i _mm_insert_epi8(__m128i a, int b,
-// __constrange(0,16) int imm)
-#define _mm_insert_epi8(a, b, imm) \
- __extension__({ \
- vreinterpretq_m128i_s8( \
- vsetq_lane_s8((b), vreinterpretq_s8_m128i(a), (imm))); \
- })
+const static uint16_t ALIGN_STRUCT(16) _sse2neon_cmpestr_mask16b[8] = {
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+};
+const static uint8_t ALIGN_STRUCT(16) _sse2neon_cmpestr_mask8b[16] = {
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+};
-// Extracts the selected signed or unsigned 16-bit integer from a and zero
-// extends.
-// https://msdn.microsoft.com/en-us/library/6dceta0c(v=vs.100).aspx
-// FORCE_INLINE int _mm_extract_epi16(__m128i a, __constrange(0,8) int imm)
-#define _mm_extract_epi16(a, imm) \
- vgetq_lane_u16(vreinterpretq_u16_m128i(a), (imm))
+/* specify the source data format */
+#define _SIDD_UBYTE_OPS 0x00 /* unsigned 8-bit characters */
+#define _SIDD_UWORD_OPS 0x01 /* unsigned 16-bit characters */
+#define _SIDD_SBYTE_OPS 0x02 /* signed 8-bit characters */
+#define _SIDD_SWORD_OPS 0x03 /* signed 16-bit characters */
+
+/* specify the comparison operation */
+#define _SIDD_CMP_EQUAL_ANY 0x00 /* compare equal any: strchr */
+#define _SIDD_CMP_RANGES 0x04 /* compare ranges */
+#define _SIDD_CMP_EQUAL_EACH 0x08 /* compare equal each: strcmp */
+#define _SIDD_CMP_EQUAL_ORDERED 0x0C /* compare equal ordered */
+
+/* specify the polarity */
+#define _SIDD_POSITIVE_POLARITY 0x00
+#define _SIDD_MASKED_POSITIVE_POLARITY 0x20
+#define _SIDD_NEGATIVE_POLARITY 0x10 /* negate results */
+#define _SIDD_MASKED_NEGATIVE_POLARITY \
+ 0x30 /* negate results only before end of string */
+
+/* specify the output selection in _mm_cmpXstri */
+#define _SIDD_LEAST_SIGNIFICANT 0x00
+#define _SIDD_MOST_SIGNIFICANT 0x40
+
+/* specify the output selection in _mm_cmpXstrm */
+#define _SIDD_BIT_MASK 0x00
+#define _SIDD_UNIT_MASK 0x40
+
+/* Pattern Matching for C macros.
+ * https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,-tips,-and-idioms
+ */
-// Inserts the least significant 16 bits of b into the selected 16-bit integer
-// of a.
-// https://msdn.microsoft.com/en-us/library/kaze8hz1%28v=vs.100%29.aspx
-// FORCE_INLINE __m128i _mm_insert_epi16(__m128i a, int b,
-// __constrange(0,8) int imm)
-#define _mm_insert_epi16(a, b, imm) \
- __extension__({ \
- vreinterpretq_m128i_s16( \
- vsetq_lane_s16((b), vreinterpretq_s16_m128i(a), (imm))); \
- })
+/* catenate */
+#define SSE2NEON_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
+#define SSE2NEON_CAT(a, b) SSE2NEON_PRIMITIVE_CAT(a, b)
+
+#define SSE2NEON_IIF(c) SSE2NEON_PRIMITIVE_CAT(SSE2NEON_IIF_, c)
+/* run the 2nd parameter */
+#define SSE2NEON_IIF_0(t, ...) __VA_ARGS__
+/* run the 1st parameter */
+#define SSE2NEON_IIF_1(t, ...) t
+
+#define SSE2NEON_COMPL(b) SSE2NEON_PRIMITIVE_CAT(SSE2NEON_COMPL_, b)
+#define SSE2NEON_COMPL_0 1
+#define SSE2NEON_COMPL_1 0
+
+#define SSE2NEON_DEC(x) SSE2NEON_PRIMITIVE_CAT(SSE2NEON_DEC_, x)
+#define SSE2NEON_DEC_1 0
+#define SSE2NEON_DEC_2 1
+#define SSE2NEON_DEC_3 2
+#define SSE2NEON_DEC_4 3
+#define SSE2NEON_DEC_5 4
+#define SSE2NEON_DEC_6 5
+#define SSE2NEON_DEC_7 6
+#define SSE2NEON_DEC_8 7
+#define SSE2NEON_DEC_9 8
+#define SSE2NEON_DEC_10 9
+#define SSE2NEON_DEC_11 10
+#define SSE2NEON_DEC_12 11
+#define SSE2NEON_DEC_13 12
+#define SSE2NEON_DEC_14 13
+#define SSE2NEON_DEC_15 14
+#define SSE2NEON_DEC_16 15
+
+/* detection */
+#define SSE2NEON_CHECK_N(x, n, ...) n
+#define SSE2NEON_CHECK(...) SSE2NEON_CHECK_N(__VA_ARGS__, 0, )
+#define SSE2NEON_PROBE(x) x, 1,
+
+#define SSE2NEON_NOT(x) SSE2NEON_CHECK(SSE2NEON_PRIMITIVE_CAT(SSE2NEON_NOT_, x))
+#define SSE2NEON_NOT_0 SSE2NEON_PROBE(~)
+
+#define SSE2NEON_BOOL(x) SSE2NEON_COMPL(SSE2NEON_NOT(x))
+#define SSE2NEON_IF(c) SSE2NEON_IIF(SSE2NEON_BOOL(c))
+
+#define SSE2NEON_EAT(...)
+#define SSE2NEON_EXPAND(...) __VA_ARGS__
+#define SSE2NEON_WHEN(c) SSE2NEON_IF(c)(SSE2NEON_EXPAND, SSE2NEON_EAT)
+
+/* recursion */
+/* deferred expression */
+#define SSE2NEON_EMPTY()
+#define SSE2NEON_DEFER(id) id SSE2NEON_EMPTY()
+#define SSE2NEON_OBSTRUCT(...) __VA_ARGS__ SSE2NEON_DEFER(SSE2NEON_EMPTY)()
+#define SSE2NEON_EXPAND(...) __VA_ARGS__
+
+#define SSE2NEON_EVAL(...) \
+ SSE2NEON_EVAL1(SSE2NEON_EVAL1(SSE2NEON_EVAL1(__VA_ARGS__)))
+#define SSE2NEON_EVAL1(...) \
+ SSE2NEON_EVAL2(SSE2NEON_EVAL2(SSE2NEON_EVAL2(__VA_ARGS__)))
+#define SSE2NEON_EVAL2(...) \
+ SSE2NEON_EVAL3(SSE2NEON_EVAL3(SSE2NEON_EVAL3(__VA_ARGS__)))
+#define SSE2NEON_EVAL3(...) __VA_ARGS__
+
+#define SSE2NEON_REPEAT(count, macro, ...) \
+ SSE2NEON_WHEN(count) \
+ (SSE2NEON_OBSTRUCT(SSE2NEON_REPEAT_INDIRECT)()( \
+ SSE2NEON_DEC(count), macro, \
+ __VA_ARGS__) SSE2NEON_OBSTRUCT(macro)(SSE2NEON_DEC(count), \
+ __VA_ARGS__))
+#define SSE2NEON_REPEAT_INDIRECT() SSE2NEON_REPEAT
+
+#define SSE2NEON_SIZE_OF_byte 8
+#define SSE2NEON_NUMBER_OF_LANES_byte 16
+#define SSE2NEON_SIZE_OF_word 16
+#define SSE2NEON_NUMBER_OF_LANES_word 8
+
+#define SSE2NEON_COMPARE_EQUAL_THEN_FILL_LANE(i, type) \
+ mtx[i] = vreinterpretq_m128i_##type(vceqq_##type( \
+ vdupq_n_##type(vgetq_lane_##type(vreinterpretq_##type##_m128i(b), i)), \
+ vreinterpretq_##type##_m128i(a)));
+
+#define SSE2NEON_FILL_LANE(i, type) \
+ vec_b[i] = \
+ vdupq_n_##type(vgetq_lane_##type(vreinterpretq_##type##_m128i(b), i));
+
+#define PCMPSTR_RANGES(a, b, mtx, data_type_prefix, type_prefix, size, \
+ number_of_lanes, byte_or_word) \
+ do { \
+ SSE2NEON_CAT( \
+ data_type_prefix, \
+ SSE2NEON_CAT(size, \
+ SSE2NEON_CAT(x, SSE2NEON_CAT(number_of_lanes, _t)))) \
+ vec_b[number_of_lanes]; \
+ __m128i mask = SSE2NEON_IIF(byte_or_word)( \
+ vreinterpretq_m128i_u16(vdupq_n_u16(0xff)), \
+ vreinterpretq_m128i_u32(vdupq_n_u32(0xffff))); \
+ SSE2NEON_EVAL(SSE2NEON_REPEAT(number_of_lanes, SSE2NEON_FILL_LANE, \
+ SSE2NEON_CAT(type_prefix, size))) \
+ for (int i = 0; i < number_of_lanes; i++) { \
+ mtx[i] = SSE2NEON_CAT(vreinterpretq_m128i_u, \
+ size)(SSE2NEON_CAT(vbslq_u, size)( \
+ SSE2NEON_CAT(vreinterpretq_u, \
+ SSE2NEON_CAT(size, _m128i))(mask), \
+ SSE2NEON_CAT(vcgeq_, SSE2NEON_CAT(type_prefix, size))( \
+ vec_b[i], \
+ SSE2NEON_CAT( \
+ vreinterpretq_, \
+ SSE2NEON_CAT(type_prefix, \
+ SSE2NEON_CAT(size, _m128i(a))))), \
+ SSE2NEON_CAT(vcleq_, SSE2NEON_CAT(type_prefix, size))( \
+ vec_b[i], \
+ SSE2NEON_CAT( \
+ vreinterpretq_, \
+ SSE2NEON_CAT(type_prefix, \
+ SSE2NEON_CAT(size, _m128i(a))))))); \
+ } \
+ } while (0)
-// Extracts the selected signed or unsigned 32-bit integer from a and zero
-// extends.
-// FORCE_INLINE int _mm_extract_epi32(__m128i a, __constrange(0,4) int imm)
-#define _mm_extract_epi32(a, imm) \
- vgetq_lane_s32(vreinterpretq_s32_m128i(a), (imm))
+#define PCMPSTR_EQ(a, b, mtx, size, number_of_lanes) \
+ do { \
+ SSE2NEON_EVAL(SSE2NEON_REPEAT(number_of_lanes, \
+ SSE2NEON_COMPARE_EQUAL_THEN_FILL_LANE, \
+ SSE2NEON_CAT(u, size))) \
+ } while (0)
-// Extracts the selected single-precision (32-bit) floating-point from a.
-// FORCE_INLINE int _mm_extract_ps(__m128 a, __constrange(0,4) int imm)
-#define _mm_extract_ps(a, imm) vgetq_lane_s32(vreinterpretq_s32_m128(a), (imm))
+#define SSE2NEON_CMP_EQUAL_ANY_IMPL(type) \
+ static int _sse2neon_cmp_##type##_equal_any(__m128i a, int la, __m128i b, \
+ int lb) \
+ { \
+ __m128i mtx[16]; \
+ PCMPSTR_EQ(a, b, mtx, SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, type)); \
+ return SSE2NEON_CAT( \
+ _sse2neon_aggregate_equal_any_, \
+ SSE2NEON_CAT( \
+ SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(x, SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, \
+ type))))(la, lb, mtx); \
+ }
-// Inserts the least significant 32 bits of b into the selected 32-bit integer
-// of a.
-// FORCE_INLINE __m128i _mm_insert_epi32(__m128i a, int b,
-// __constrange(0,4) int imm)
-#define _mm_insert_epi32(a, b, imm) \
- __extension__({ \
- vreinterpretq_m128i_s32( \
- vsetq_lane_s32((b), vreinterpretq_s32_m128i(a), (imm))); \
- })
+#define SSE2NEON_CMP_RANGES_IMPL(type, data_type, us, byte_or_word) \
+ static int _sse2neon_cmp_##us##type##_ranges(__m128i a, int la, __m128i b, \
+ int lb) \
+ { \
+ __m128i mtx[16]; \
+ PCMPSTR_RANGES( \
+ a, b, mtx, data_type, us, SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, type), byte_or_word); \
+ return SSE2NEON_CAT( \
+ _sse2neon_aggregate_ranges_, \
+ SSE2NEON_CAT( \
+ SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(x, SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, \
+ type))))(la, lb, mtx); \
+ }
-// Extracts the selected signed or unsigned 64-bit integer from a and zero
-// extends.
-// FORCE_INLINE __int64 _mm_extract_epi64(__m128i a, __constrange(0,2) int imm)
-#define _mm_extract_epi64(a, imm) \
- vgetq_lane_s64(vreinterpretq_s64_m128i(a), (imm))
+#define SSE2NEON_CMP_EQUAL_ORDERED_IMPL(type) \
+ static int _sse2neon_cmp_##type##_equal_ordered(__m128i a, int la, \
+ __m128i b, int lb) \
+ { \
+ __m128i mtx[16]; \
+ PCMPSTR_EQ(a, b, mtx, SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, type)); \
+ return SSE2NEON_CAT( \
+ _sse2neon_aggregate_equal_ordered_, \
+ SSE2NEON_CAT( \
+ SSE2NEON_CAT(SSE2NEON_SIZE_OF_, type), \
+ SSE2NEON_CAT(x, \
+ SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, type))))( \
+ SSE2NEON_CAT(SSE2NEON_NUMBER_OF_LANES_, type), la, lb, mtx); \
+ }
+
+static int _sse2neon_aggregate_equal_any_8x16(int la, int lb, __m128i mtx[16])
+{
+ int res = 0;
+ int m = (1 << la) - 1;
+ uint8x8_t vec_mask = vld1_u8(_sse2neon_cmpestr_mask8b);
+ uint8x8_t t_lo = vtst_u8(vdup_n_u8(m & 0xff), vec_mask);
+ uint8x8_t t_hi = vtst_u8(vdup_n_u8(m >> 8), vec_mask);
+ uint8x16_t vec = vcombine_u8(t_lo, t_hi);
+ for (int j = 0; j < lb; j++) {
+ mtx[j] = vreinterpretq_m128i_u8(
+ vandq_u8(vec, vreinterpretq_u8_m128i(mtx[j])));
+ mtx[j] = vreinterpretq_m128i_u8(
+ vshrq_n_u8(vreinterpretq_u8_m128i(mtx[j]), 7));
+ int tmp = _sse2neon_vaddvq_u8(vreinterpretq_u8_m128i(mtx[j])) ? 1 : 0;
+ res |= (tmp << j);
+ }
+ return res;
+}
+
+static int _sse2neon_aggregate_equal_any_16x8(int la, int lb, __m128i mtx[16])
+{
+ int res = 0;
+ int m = (1 << la) - 1;
+ uint16x8_t vec =
+ vtstq_u16(vdupq_n_u16(m), vld1q_u16(_sse2neon_cmpestr_mask16b));
+ for (int j = 0; j < lb; j++) {
+ mtx[j] = vreinterpretq_m128i_u16(
+ vandq_u16(vec, vreinterpretq_u16_m128i(mtx[j])));
+ mtx[j] = vreinterpretq_m128i_u16(
+ vshrq_n_u16(vreinterpretq_u16_m128i(mtx[j]), 15));
+ int tmp = _sse2neon_vaddvq_u16(vreinterpretq_u16_m128i(mtx[j])) ? 1 : 0;
+ res |= (tmp << j);
+ }
+ return res;
+}
+
+/* clang-format off */
+#define SSE2NEON_GENERATE_CMP_EQUAL_ANY(prefix) \
+ prefix##IMPL(byte) \
+ prefix##IMPL(word)
+/* clang-format on */
+
+SSE2NEON_GENERATE_CMP_EQUAL_ANY(SSE2NEON_CMP_EQUAL_ANY_)
+
+static int _sse2neon_aggregate_ranges_16x8(int la, int lb, __m128i mtx[16])
+{
+ int res = 0;
+ int m = (1 << la) - 1;
+ uint16x8_t vec =
+ vtstq_u16(vdupq_n_u16(m), vld1q_u16(_sse2neon_cmpestr_mask16b));
+ for (int j = 0; j < lb; j++) {
+ mtx[j] = vreinterpretq_m128i_u16(
+ vandq_u16(vec, vreinterpretq_u16_m128i(mtx[j])));
+ mtx[j] = vreinterpretq_m128i_u16(
+ vshrq_n_u16(vreinterpretq_u16_m128i(mtx[j]), 15));
+ __m128i tmp = vreinterpretq_m128i_u32(
+ vshrq_n_u32(vreinterpretq_u32_m128i(mtx[j]), 16));
+ uint32x4_t vec_res = vandq_u32(vreinterpretq_u32_m128i(mtx[j]),
+ vreinterpretq_u32_m128i(tmp));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ int t = vaddvq_u32(vec_res) ? 1 : 0;
+#else
+ uint64x2_t sumh = vpaddlq_u32(vec_res);
+ int t = vgetq_lane_u64(sumh, 0) + vgetq_lane_u64(sumh, 1);
+#endif
+ res |= (t << j);
+ }
+ return res;
+}
+
+static int _sse2neon_aggregate_ranges_8x16(int la, int lb, __m128i mtx[16])
+{
+ int res = 0;
+ int m = (1 << la) - 1;
+ uint8x8_t vec_mask = vld1_u8(_sse2neon_cmpestr_mask8b);
+ uint8x8_t t_lo = vtst_u8(vdup_n_u8(m & 0xff), vec_mask);
+ uint8x8_t t_hi = vtst_u8(vdup_n_u8(m >> 8), vec_mask);
+ uint8x16_t vec = vcombine_u8(t_lo, t_hi);
+ for (int j = 0; j < lb; j++) {
+ mtx[j] = vreinterpretq_m128i_u8(
+ vandq_u8(vec, vreinterpretq_u8_m128i(mtx[j])));
+ mtx[j] = vreinterpretq_m128i_u8(
+ vshrq_n_u8(vreinterpretq_u8_m128i(mtx[j]), 7));
+ __m128i tmp = vreinterpretq_m128i_u16(
+ vshrq_n_u16(vreinterpretq_u16_m128i(mtx[j]), 8));
+ uint16x8_t vec_res = vandq_u16(vreinterpretq_u16_m128i(mtx[j]),
+ vreinterpretq_u16_m128i(tmp));
+ int t = _sse2neon_vaddvq_u16(vec_res) ? 1 : 0;
+ res |= (t << j);
+ }
+ return res;
+}
+
+#define SSE2NEON_CMP_RANGES_IS_BYTE 1
+#define SSE2NEON_CMP_RANGES_IS_WORD 0
+
+/* clang-format off */
+#define SSE2NEON_GENERATE_CMP_RANGES(prefix) \
+ prefix##IMPL(byte, uint, u, prefix##IS_BYTE) \
+ prefix##IMPL(byte, int, s, prefix##IS_BYTE) \
+ prefix##IMPL(word, uint, u, prefix##IS_WORD) \
+ prefix##IMPL(word, int, s, prefix##IS_WORD)
+/* clang-format on */
+
+SSE2NEON_GENERATE_CMP_RANGES(SSE2NEON_CMP_RANGES_)
+
+#undef SSE2NEON_CMP_RANGES_IS_BYTE
+#undef SSE2NEON_CMP_RANGES_IS_WORD
+
+static int _sse2neon_cmp_byte_equal_each(__m128i a, int la, __m128i b, int lb)
+{
+ uint8x16_t mtx =
+ vceqq_u8(vreinterpretq_u8_m128i(a), vreinterpretq_u8_m128i(b));
+ int m0 = (la < lb) ? 0 : ((1 << la) - (1 << lb));
+ int m1 = 0x10000 - (1 << la);
+ int tb = 0x10000 - (1 << lb);
+ uint8x8_t vec_mask, vec0_lo, vec0_hi, vec1_lo, vec1_hi;
+ uint8x8_t tmp_lo, tmp_hi, res_lo, res_hi;
+ vec_mask = vld1_u8(_sse2neon_cmpestr_mask8b);
+ vec0_lo = vtst_u8(vdup_n_u8(m0), vec_mask);
+ vec0_hi = vtst_u8(vdup_n_u8(m0 >> 8), vec_mask);
+ vec1_lo = vtst_u8(vdup_n_u8(m1), vec_mask);
+ vec1_hi = vtst_u8(vdup_n_u8(m1 >> 8), vec_mask);
+ tmp_lo = vtst_u8(vdup_n_u8(tb), vec_mask);
+ tmp_hi = vtst_u8(vdup_n_u8(tb >> 8), vec_mask);
+
+ res_lo = vbsl_u8(vec0_lo, vdup_n_u8(0), vget_low_u8(mtx));
+ res_hi = vbsl_u8(vec0_hi, vdup_n_u8(0), vget_high_u8(mtx));
+ res_lo = vbsl_u8(vec1_lo, tmp_lo, res_lo);
+ res_hi = vbsl_u8(vec1_hi, tmp_hi, res_hi);
+ res_lo = vand_u8(res_lo, vec_mask);
+ res_hi = vand_u8(res_hi, vec_mask);
+
+ int res = _sse2neon_vaddv_u8(res_lo) + (_sse2neon_vaddv_u8(res_hi) << 8);
+ return res;
+}
+
+static int _sse2neon_cmp_word_equal_each(__m128i a, int la, __m128i b, int lb)
+{
+ uint16x8_t mtx =
+ vceqq_u16(vreinterpretq_u16_m128i(a), vreinterpretq_u16_m128i(b));
+ int m0 = (la < lb) ? 0 : ((1 << la) - (1 << lb));
+ int m1 = 0x100 - (1 << la);
+ int tb = 0x100 - (1 << lb);
+ uint16x8_t vec_mask = vld1q_u16(_sse2neon_cmpestr_mask16b);
+ uint16x8_t vec0 = vtstq_u16(vdupq_n_u16(m0), vec_mask);
+ uint16x8_t vec1 = vtstq_u16(vdupq_n_u16(m1), vec_mask);
+ uint16x8_t tmp = vtstq_u16(vdupq_n_u16(tb), vec_mask);
+ mtx = vbslq_u16(vec0, vdupq_n_u16(0), mtx);
+ mtx = vbslq_u16(vec1, tmp, mtx);
+ mtx = vandq_u16(mtx, vec_mask);
+ return _sse2neon_vaddvq_u16(mtx);
+}
+
+#define SSE2NEON_AGGREGATE_EQUAL_ORDER_IS_UBYTE 1
+#define SSE2NEON_AGGREGATE_EQUAL_ORDER_IS_UWORD 0
+
+#define SSE2NEON_AGGREGATE_EQUAL_ORDER_IMPL(size, number_of_lanes, data_type) \
+ static int _sse2neon_aggregate_equal_ordered_##size##x##number_of_lanes( \
+ int bound, int la, int lb, __m128i mtx[16]) \
+ { \
+ int res = 0; \
+ int m1 = SSE2NEON_IIF(data_type)(0x10000, 0x100) - (1 << la); \
+ uint##size##x8_t vec_mask = SSE2NEON_IIF(data_type)( \
+ vld1_u##size(_sse2neon_cmpestr_mask##size##b), \
+ vld1q_u##size(_sse2neon_cmpestr_mask##size##b)); \
+ uint##size##x##number_of_lanes##_t vec1 = SSE2NEON_IIF(data_type)( \
+ vcombine_u##size(vtst_u##size(vdup_n_u##size(m1), vec_mask), \
+ vtst_u##size(vdup_n_u##size(m1 >> 8), vec_mask)), \
+ vtstq_u##size(vdupq_n_u##size(m1), vec_mask)); \
+ uint##size##x##number_of_lanes##_t vec_minusone = vdupq_n_u##size(-1); \
+ uint##size##x##number_of_lanes##_t vec_zero = vdupq_n_u##size(0); \
+ for (int j = 0; j < lb; j++) { \
+ mtx[j] = vreinterpretq_m128i_u##size(vbslq_u##size( \
+ vec1, vec_minusone, vreinterpretq_u##size##_m128i(mtx[j]))); \
+ } \
+ for (int j = lb; j < bound; j++) { \
+ mtx[j] = vreinterpretq_m128i_u##size( \
+ vbslq_u##size(vec1, vec_minusone, vec_zero)); \
+ } \
+ unsigned SSE2NEON_IIF(data_type)(char, short) *ptr = \
+ (unsigned SSE2NEON_IIF(data_type)(char, short) *) mtx; \
+ for (int i = 0; i < bound; i++) { \
+ int val = 1; \
+ for (int j = 0, k = i; j < bound - i && k < bound; j++, k++) \
+ val &= ptr[k * bound + j]; \
+ res += val << i; \
+ } \
+ return res; \
+ }
+
+/* clang-format off */
+#define SSE2NEON_GENERATE_AGGREGATE_EQUAL_ORDER(prefix) \
+ prefix##IMPL(8, 16, prefix##IS_UBYTE) \
+ prefix##IMPL(16, 8, prefix##IS_UWORD)
+/* clang-format on */
+
+SSE2NEON_GENERATE_AGGREGATE_EQUAL_ORDER(SSE2NEON_AGGREGATE_EQUAL_ORDER_)
+
+#undef SSE2NEON_AGGREGATE_EQUAL_ORDER_IS_UBYTE
+#undef SSE2NEON_AGGREGATE_EQUAL_ORDER_IS_UWORD
-// Inserts the least significant 64 bits of b into the selected 64-bit integer
-// of a.
-// FORCE_INLINE __m128i _mm_insert_epi64(__m128i a, __int64 b,
-// __constrange(0,2) int imm)
-#define _mm_insert_epi64(a, b, imm) \
- __extension__({ \
- vreinterpretq_m128i_s64( \
- vsetq_lane_s64((b), vreinterpretq_s64_m128i(a), (imm))); \
- })
+/* clang-format off */
+#define SSE2NEON_GENERATE_CMP_EQUAL_ORDERED(prefix) \
+ prefix##IMPL(byte) \
+ prefix##IMPL(word)
+/* clang-format on */
-// Count the number of bits set to 1 in unsigned 32-bit integer a, and
-// return that count in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_popcnt_u32
-FORCE_INLINE int _mm_popcnt_u32(unsigned int a)
+SSE2NEON_GENERATE_CMP_EQUAL_ORDERED(SSE2NEON_CMP_EQUAL_ORDERED_)
+
+#define SSE2NEON_CMPESTR_LIST \
+ _(CMP_UBYTE_EQUAL_ANY, cmp_byte_equal_any) \
+ _(CMP_UWORD_EQUAL_ANY, cmp_word_equal_any) \
+ _(CMP_SBYTE_EQUAL_ANY, cmp_byte_equal_any) \
+ _(CMP_SWORD_EQUAL_ANY, cmp_word_equal_any) \
+ _(CMP_UBYTE_RANGES, cmp_ubyte_ranges) \
+ _(CMP_UWORD_RANGES, cmp_uword_ranges) \
+ _(CMP_SBYTE_RANGES, cmp_sbyte_ranges) \
+ _(CMP_SWORD_RANGES, cmp_sword_ranges) \
+ _(CMP_UBYTE_EQUAL_EACH, cmp_byte_equal_each) \
+ _(CMP_UWORD_EQUAL_EACH, cmp_word_equal_each) \
+ _(CMP_SBYTE_EQUAL_EACH, cmp_byte_equal_each) \
+ _(CMP_SWORD_EQUAL_EACH, cmp_word_equal_each) \
+ _(CMP_UBYTE_EQUAL_ORDERED, cmp_byte_equal_ordered) \
+ _(CMP_UWORD_EQUAL_ORDERED, cmp_word_equal_ordered) \
+ _(CMP_SBYTE_EQUAL_ORDERED, cmp_byte_equal_ordered) \
+ _(CMP_SWORD_EQUAL_ORDERED, cmp_word_equal_ordered)
+
+enum {
+#define _(name, func_suffix) name,
+ SSE2NEON_CMPESTR_LIST
+#undef _
+};
+typedef int (*cmpestr_func_t)(__m128i a, int la, __m128i b, int lb);
+static cmpestr_func_t _sse2neon_cmpfunc_table[] = {
+#define _(name, func_suffix) _sse2neon_##func_suffix,
+ SSE2NEON_CMPESTR_LIST
+#undef _
+};
+
+FORCE_INLINE int _sse2neon_sido_negative(int res, int lb, int imm8, int bound)
{
-#if defined(__aarch64__)
-#if __has_builtin(__builtin_popcount)
- return __builtin_popcount(a);
-#else
- return (int) vaddlv_u8(vcnt_u8(vcreate_u8((uint64_t) a)));
-#endif
-#else
- uint32_t count = 0;
- uint8x8_t input_val, count8x8_val;
- uint16x4_t count16x4_val;
- uint32x2_t count32x2_val;
+ switch (imm8 & 0x30) {
+ case _SIDD_NEGATIVE_POLARITY:
+ res ^= 0xffffffff;
+ break;
+ case _SIDD_MASKED_NEGATIVE_POLARITY:
+ res ^= (1 << lb) - 1;
+ break;
+ default:
+ break;
+ }
- input_val = vld1_u8((uint8_t *) &a);
- count8x8_val = vcnt_u8(input_val);
- count16x4_val = vpaddl_u8(count8x8_val);
- count32x2_val = vpaddl_u16(count16x4_val);
+ return res & ((bound == 8) ? 0xFF : 0xFFFF);
+}
- vst1_u32(&count, count32x2_val);
- return count;
+FORCE_INLINE int _sse2neon_clz(unsigned int x)
+{
+#if _MSC_VER
+ unsigned long cnt = 0;
+ if (_BitScanReverse(&cnt, x))
+ return 31 - cnt;
+ return 32;
+#else
+ return x != 0 ? __builtin_clz(x) : 32;
#endif
}
-// Count the number of bits set to 1 in unsigned 64-bit integer a, and
-// return that count in dst.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_popcnt_u64
-FORCE_INLINE int64_t _mm_popcnt_u64(uint64_t a)
+FORCE_INLINE int _sse2neon_ctz(unsigned int x)
{
-#if defined(__aarch64__)
-#if __has_builtin(__builtin_popcountll)
- return __builtin_popcountll(a);
+#if _MSC_VER
+ unsigned long cnt = 0;
+ if (_BitScanForward(&cnt, x))
+ return cnt;
+ return 32;
#else
- return (int64_t) vaddlv_u8(vcnt_u8(vcreate_u8(a)));
+ return x != 0 ? __builtin_ctz(x) : 32;
#endif
-#else
- uint64_t count = 0;
- uint8x8_t input_val, count8x8_val;
- uint16x4_t count16x4_val;
- uint32x2_t count32x2_val;
- uint64x1_t count64x1_val;
+}
- input_val = vld1_u8((uint8_t *) &a);
- count8x8_val = vcnt_u8(input_val);
- count16x4_val = vpaddl_u8(count8x8_val);
- count32x2_val = vpaddl_u16(count16x4_val);
- count64x1_val = vpaddl_u32(count32x2_val);
- vst1_u64(&count, count64x1_val);
- return count;
+FORCE_INLINE int _sse2neon_ctzll(unsigned long long x)
+{
+#if _MSC_VER
+ unsigned long cnt;
+#if defined(SSE2NEON_HAS_BITSCAN64)
+ if (_BitScanForward64(&cnt, x))
+ return (int) (cnt);
+#else
+ if (_BitScanForward(&cnt, (unsigned long) (x)))
+ return (int) cnt;
+ if (_BitScanForward(&cnt, (unsigned long) (x >> 32)))
+ return (int) (cnt + 32);
+#endif /* SSE2NEON_HAS_BITSCAN64 */
+ return 64;
+#else /* assume GNU compatible compilers */
+ return x != 0 ? __builtin_ctzll(x) : 64;
#endif
}
-// Macro: Transpose the 4x4 matrix formed by the 4 rows of single-precision
-// (32-bit) floating-point elements in row0, row1, row2, and row3, and store the
-// transposed matrix in these vectors (row0 now contains column 0, etc.).
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=MM_TRANSPOSE4_PS
-#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
- do { \
- float32x4x2_t ROW01 = vtrnq_f32(row0, row1); \
- float32x4x2_t ROW23 = vtrnq_f32(row2, row3); \
- row0 = vcombine_f32(vget_low_f32(ROW01.val[0]), \
- vget_low_f32(ROW23.val[0])); \
- row1 = vcombine_f32(vget_low_f32(ROW01.val[1]), \
- vget_low_f32(ROW23.val[1])); \
- row2 = vcombine_f32(vget_high_f32(ROW01.val[0]), \
- vget_high_f32(ROW23.val[0])); \
- row3 = vcombine_f32(vget_high_f32(ROW01.val[1]), \
- vget_high_f32(ROW23.val[1])); \
+#define SSE2NEON_MIN(x, y) (x) < (y) ? (x) : (y)
+
+#define SSE2NEON_CMPSTR_SET_UPPER(var, imm) \
+ const int var = (imm & 0x01) ? 8 : 16
+
+#define SSE2NEON_CMPESTRX_LEN_PAIR(a, b, la, lb) \
+ int tmp1 = la ^ (la >> 31); \
+ la = tmp1 - (la >> 31); \
+ int tmp2 = lb ^ (lb >> 31); \
+ lb = tmp2 - (lb >> 31); \
+ la = SSE2NEON_MIN(la, bound); \
+ lb = SSE2NEON_MIN(lb, bound)
+
+// Compare all pairs of character in string a and b,
+// then aggregate the result.
+// As the only difference of PCMPESTR* and PCMPISTR* is the way to calculate the
+// length of string, we use SSE2NEON_CMP{I,E}STRX_GET_LEN to get the length of
+// string a and b.
+#define SSE2NEON_COMP_AGG(a, b, la, lb, imm8, IE) \
+ SSE2NEON_CMPSTR_SET_UPPER(bound, imm8); \
+ SSE2NEON_##IE##_LEN_PAIR(a, b, la, lb); \
+ int r2 = (_sse2neon_cmpfunc_table[imm8 & 0x0f])(a, la, b, lb); \
+ r2 = _sse2neon_sido_negative(r2, lb, imm8, bound)
+
+#define SSE2NEON_CMPSTR_GENERATE_INDEX(r2, bound, imm8) \
+ return (r2 == 0) ? bound \
+ : ((imm8 & 0x40) ? (31 - _sse2neon_clz(r2)) \
+ : _sse2neon_ctz(r2))
+
+#define SSE2NEON_CMPSTR_GENERATE_MASK(dst) \
+ __m128i dst = vreinterpretq_m128i_u8(vdupq_n_u8(0)); \
+ if (imm8 & 0x40) { \
+ if (bound == 8) { \
+ uint16x8_t tmp = vtstq_u16(vdupq_n_u16(r2), \
+ vld1q_u16(_sse2neon_cmpestr_mask16b)); \
+ dst = vreinterpretq_m128i_u16(vbslq_u16( \
+ tmp, vdupq_n_u16(-1), vreinterpretq_u16_m128i(dst))); \
+ } else { \
+ uint8x16_t vec_r2 = \
+ vcombine_u8(vdup_n_u8(r2), vdup_n_u8(r2 >> 8)); \
+ uint8x16_t tmp = \
+ vtstq_u8(vec_r2, vld1q_u8(_sse2neon_cmpestr_mask8b)); \
+ dst = vreinterpretq_m128i_u8( \
+ vbslq_u8(tmp, vdupq_n_u8(-1), vreinterpretq_u8_m128i(dst))); \
+ } \
+ } else { \
+ if (bound == 16) { \
+ dst = vreinterpretq_m128i_u16( \
+ vsetq_lane_u16(r2 & 0xffff, vreinterpretq_u16_m128i(dst), 0)); \
+ } else { \
+ dst = vreinterpretq_m128i_u8( \
+ vsetq_lane_u8(r2 & 0xff, vreinterpretq_u8_m128i(dst), 0)); \
+ } \
+ } \
+ return dst
+
+// Compare packed strings in a and b with lengths la and lb using the control
+// in imm8, and returns 1 if b did not contain a null character and the
+// resulting mask was zero, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestra
+FORCE_INLINE int _mm_cmpestra(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ int lb_cpy = lb;
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPESTRX);
+ return !r2 & (lb_cpy > bound);
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control in
+// imm8, and returns 1 if the resulting mask was non-zero, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestrc
+FORCE_INLINE int _mm_cmpestrc(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPESTRX);
+ return r2 != 0;
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control
+// in imm8, and store the generated index in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestri
+FORCE_INLINE int _mm_cmpestri(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPESTRX);
+ SSE2NEON_CMPSTR_GENERATE_INDEX(r2, bound, imm8);
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control
+// in imm8, and store the generated mask in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestrm
+FORCE_INLINE __m128i
+_mm_cmpestrm(__m128i a, int la, __m128i b, int lb, const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPESTRX);
+ SSE2NEON_CMPSTR_GENERATE_MASK(dst);
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control in
+// imm8, and returns bit 0 of the resulting bit mask.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestro
+FORCE_INLINE int _mm_cmpestro(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPESTRX);
+ return r2 & 1;
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control in
+// imm8, and returns 1 if any character in a was null, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestrs
+FORCE_INLINE int _mm_cmpestrs(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ SSE2NEON_CMPSTR_SET_UPPER(bound, imm8);
+ return la <= (bound - 1);
+}
+
+// Compare packed strings in a and b with lengths la and lb using the control in
+// imm8, and returns 1 if any character in b was null, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpestrz
+FORCE_INLINE int _mm_cmpestrz(__m128i a,
+ int la,
+ __m128i b,
+ int lb,
+ const int imm8)
+{
+ SSE2NEON_CMPSTR_SET_UPPER(bound, imm8);
+ return lb <= (bound - 1);
+}
+
+#define SSE2NEON_CMPISTRX_LENGTH(str, len, imm8) \
+ do { \
+ if (imm8 & 0x01) { \
+ uint16x8_t equal_mask_##str = \
+ vceqq_u16(vreinterpretq_u16_m128i(str), vdupq_n_u16(0)); \
+ uint8x8_t res_##str = vshrn_n_u16(equal_mask_##str, 4); \
+ uint64_t matches_##str = \
+ vget_lane_u64(vreinterpret_u64_u8(res_##str), 0); \
+ len = _sse2neon_ctzll(matches_##str) >> 3; \
+ } else { \
+ uint16x8_t equal_mask_##str = vreinterpretq_u16_u8( \
+ vceqq_u8(vreinterpretq_u8_m128i(str), vdupq_n_u8(0))); \
+ uint8x8_t res_##str = vshrn_n_u16(equal_mask_##str, 4); \
+ uint64_t matches_##str = \
+ vget_lane_u64(vreinterpret_u64_u8(res_##str), 0); \
+ len = _sse2neon_ctzll(matches_##str) >> 2; \
+ } \
} while (0)
-/* Crypto Extensions */
+#define SSE2NEON_CMPISTRX_LEN_PAIR(a, b, la, lb) \
+ int la, lb; \
+ do { \
+ SSE2NEON_CMPISTRX_LENGTH(a, la, imm8); \
+ SSE2NEON_CMPISTRX_LENGTH(b, lb, imm8); \
+ } while (0)
-#if defined(__ARM_FEATURE_CRYPTO)
-// Wraps vmull_p64
-FORCE_INLINE uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b)
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and returns 1 if b did not contain a null character and the resulting
+// mask was zero, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistra
+FORCE_INLINE int _mm_cmpistra(__m128i a, __m128i b, const int imm8)
{
- poly64_t a = vget_lane_p64(vreinterpret_p64_u64(_a), 0);
- poly64_t b = vget_lane_p64(vreinterpret_p64_u64(_b), 0);
- return vreinterpretq_u64_p128(vmull_p64(a, b));
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPISTRX);
+ return !r2 & (lb >= bound);
}
-#else // ARMv7 polyfill
-// ARMv7/some A64 lacks vmull_p64, but it has vmull_p8.
-//
-// vmull_p8 calculates 8 8-bit->16-bit polynomial multiplies, but we need a
-// 64-bit->128-bit polynomial multiply.
-//
-// It needs some work and is somewhat slow, but it is still faster than all
-// known scalar methods.
-//
-// Algorithm adapted to C from
-// https://www.workofard.com/2017/07/ghash-for-low-end-cores/, which is adapted
-// from "Fast Software Polynomial Multiplication on ARM Processors Using the
-// NEON Engine" by Danilo Camara, Conrado Gouvea, Julio Lopez and Ricardo Dahab
-// (https://hal.inria.fr/hal-01506572)
-static uint64x2_t _sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b)
+
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and returns 1 if the resulting mask was non-zero, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistrc
+FORCE_INLINE int _mm_cmpistrc(__m128i a, __m128i b, const int imm8)
{
- poly8x8_t a = vreinterpret_p8_u64(_a);
- poly8x8_t b = vreinterpret_p8_u64(_b);
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPISTRX);
+ return r2 != 0;
+}
- // Masks
- uint8x16_t k48_32 = vcombine_u8(vcreate_u8(0x0000ffffffffffff),
- vcreate_u8(0x00000000ffffffff));
- uint8x16_t k16_00 = vcombine_u8(vcreate_u8(0x000000000000ffff),
- vcreate_u8(0x0000000000000000));
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and store the generated index in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistri
+FORCE_INLINE int _mm_cmpistri(__m128i a, __m128i b, const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPISTRX);
+ SSE2NEON_CMPSTR_GENERATE_INDEX(r2, bound, imm8);
+}
- // Do the multiplies, rotating with vext to get all combinations
- uint8x16_t d = vreinterpretq_u8_p16(vmull_p8(a, b)); // D = A0 * B0
- uint8x16_t e =
- vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 1))); // E = A0 * B1
- uint8x16_t f =
- vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 1), b)); // F = A1 * B0
- uint8x16_t g =
- vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 2))); // G = A0 * B2
- uint8x16_t h =
- vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 2), b)); // H = A2 * B0
- uint8x16_t i =
- vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 3))); // I = A0 * B3
- uint8x16_t j =
- vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 3), b)); // J = A3 * B0
- uint8x16_t k =
- vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 4))); // L = A0 * B4
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and store the generated mask in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistrm
+FORCE_INLINE __m128i _mm_cmpistrm(__m128i a, __m128i b, const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPISTRX);
+ SSE2NEON_CMPSTR_GENERATE_MASK(dst);
+}
- // Add cross products
- uint8x16_t l = veorq_u8(e, f); // L = E + F
- uint8x16_t m = veorq_u8(g, h); // M = G + H
- uint8x16_t n = veorq_u8(i, j); // N = I + J
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and returns bit 0 of the resulting bit mask.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistro
+FORCE_INLINE int _mm_cmpistro(__m128i a, __m128i b, const int imm8)
+{
+ SSE2NEON_COMP_AGG(a, b, la, lb, imm8, CMPISTRX);
+ return r2 & 1;
+}
- // Interleave. Using vzip1 and vzip2 prevents Clang from emitting TBL
- // instructions.
-#if defined(__aarch64__)
- uint8x16_t lm_p0 = vreinterpretq_u8_u64(
- vzip1q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
- uint8x16_t lm_p1 = vreinterpretq_u8_u64(
- vzip2q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
- uint8x16_t nk_p0 = vreinterpretq_u8_u64(
- vzip1q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
- uint8x16_t nk_p1 = vreinterpretq_u8_u64(
- vzip2q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and returns 1 if any character in a was null, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistrs
+FORCE_INLINE int _mm_cmpistrs(__m128i a, __m128i b, const int imm8)
+{
+ SSE2NEON_CMPSTR_SET_UPPER(bound, imm8);
+ int la;
+ SSE2NEON_CMPISTRX_LENGTH(a, la, imm8);
+ return la <= (bound - 1);
+}
+
+// Compare packed strings with implicit lengths in a and b using the control in
+// imm8, and returns 1 if any character in b was null, and 0 otherwise.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cmpistrz
+FORCE_INLINE int _mm_cmpistrz(__m128i a, __m128i b, const int imm8)
+{
+ SSE2NEON_CMPSTR_SET_UPPER(bound, imm8);
+ int lb;
+ SSE2NEON_CMPISTRX_LENGTH(b, lb, imm8);
+ return lb <= (bound - 1);
+}
+
+// Compares the 2 signed 64-bit integers in a and the 2 signed 64-bit integers
+// in b for greater than.
+FORCE_INLINE __m128i _mm_cmpgt_epi64(__m128i a, __m128i b)
+{
+#if defined(__aarch64__) || defined(_M_ARM64)
+ return vreinterpretq_m128i_u64(
+ vcgtq_s64(vreinterpretq_s64_m128i(a), vreinterpretq_s64_m128i(b)));
#else
- uint8x16_t lm_p0 = vcombine_u8(vget_low_u8(l), vget_low_u8(m));
- uint8x16_t lm_p1 = vcombine_u8(vget_high_u8(l), vget_high_u8(m));
- uint8x16_t nk_p0 = vcombine_u8(vget_low_u8(n), vget_low_u8(k));
- uint8x16_t nk_p1 = vcombine_u8(vget_high_u8(n), vget_high_u8(k));
+ return vreinterpretq_m128i_s64(vshrq_n_s64(
+ vqsubq_s64(vreinterpretq_s64_m128i(b), vreinterpretq_s64_m128i(a)),
+ 63));
#endif
- // t0 = (L) (P0 + P1) << 8
- // t1 = (M) (P2 + P3) << 16
- uint8x16_t t0t1_tmp = veorq_u8(lm_p0, lm_p1);
- uint8x16_t t0t1_h = vandq_u8(lm_p1, k48_32);
- uint8x16_t t0t1_l = veorq_u8(t0t1_tmp, t0t1_h);
+}
- // t2 = (N) (P4 + P5) << 24
- // t3 = (K) (P6 + P7) << 32
- uint8x16_t t2t3_tmp = veorq_u8(nk_p0, nk_p1);
- uint8x16_t t2t3_h = vandq_u8(nk_p1, k16_00);
- uint8x16_t t2t3_l = veorq_u8(t2t3_tmp, t2t3_h);
+// Starting with the initial value in crc, accumulates a CRC32 value for
+// unsigned 16-bit integer v, and stores the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_crc32_u16
+FORCE_INLINE uint32_t _mm_crc32_u16(uint32_t crc, uint16_t v)
+{
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
+ __asm__ __volatile__("crc32ch %w[c], %w[c], %w[v]\n\t"
+ : [c] "+r"(crc)
+ : [v] "r"(v));
+#elif ((__ARM_ARCH == 8) && defined(__ARM_FEATURE_CRC32)) || \
+ (defined(_M_ARM64) && !defined(__clang__))
+ crc = __crc32ch(crc, v);
+#else
+ crc = _mm_crc32_u8(crc, v & 0xff);
+ crc = _mm_crc32_u8(crc, (v >> 8) & 0xff);
+#endif
+ return crc;
+}
- // De-interleave
-#if defined(__aarch64__)
- uint8x16_t t0 = vreinterpretq_u8_u64(
- vuzp1q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
- uint8x16_t t1 = vreinterpretq_u8_u64(
- vuzp2q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
- uint8x16_t t2 = vreinterpretq_u8_u64(
- vuzp1q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
- uint8x16_t t3 = vreinterpretq_u8_u64(
- vuzp2q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
+// Starting with the initial value in crc, accumulates a CRC32 value for
+// unsigned 32-bit integer v, and stores the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_crc32_u32
+FORCE_INLINE uint32_t _mm_crc32_u32(uint32_t crc, uint32_t v)
+{
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
+ __asm__ __volatile__("crc32cw %w[c], %w[c], %w[v]\n\t"
+ : [c] "+r"(crc)
+ : [v] "r"(v));
+#elif ((__ARM_ARCH == 8) && defined(__ARM_FEATURE_CRC32)) || \
+ (defined(_M_ARM64) && !defined(__clang__))
+ crc = __crc32cw(crc, v);
#else
- uint8x16_t t1 = vcombine_u8(vget_high_u8(t0t1_l), vget_high_u8(t0t1_h));
- uint8x16_t t0 = vcombine_u8(vget_low_u8(t0t1_l), vget_low_u8(t0t1_h));
- uint8x16_t t3 = vcombine_u8(vget_high_u8(t2t3_l), vget_high_u8(t2t3_h));
- uint8x16_t t2 = vcombine_u8(vget_low_u8(t2t3_l), vget_low_u8(t2t3_h));
+ crc = _mm_crc32_u16(crc, v & 0xffff);
+ crc = _mm_crc32_u16(crc, (v >> 16) & 0xffff);
#endif
- // Shift the cross products
- uint8x16_t t0_shift = vextq_u8(t0, t0, 15); // t0 << 8
- uint8x16_t t1_shift = vextq_u8(t1, t1, 14); // t1 << 16
- uint8x16_t t2_shift = vextq_u8(t2, t2, 13); // t2 << 24
- uint8x16_t t3_shift = vextq_u8(t3, t3, 12); // t3 << 32
+ return crc;
+}
- // Accumulate the products
- uint8x16_t cross1 = veorq_u8(t0_shift, t1_shift);
- uint8x16_t cross2 = veorq_u8(t2_shift, t3_shift);
- uint8x16_t mix = veorq_u8(d, cross1);
- uint8x16_t r = veorq_u8(mix, cross2);
- return vreinterpretq_u64_u8(r);
+// Starting with the initial value in crc, accumulates a CRC32 value for
+// unsigned 64-bit integer v, and stores the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_crc32_u64
+FORCE_INLINE uint64_t _mm_crc32_u64(uint64_t crc, uint64_t v)
+{
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
+ __asm__ __volatile__("crc32cx %w[c], %w[c], %x[v]\n\t"
+ : [c] "+r"(crc)
+ : [v] "r"(v));
+#elif (defined(_M_ARM64) && !defined(__clang__))
+ crc = __crc32cd((uint32_t) crc, v);
+#else
+ crc = _mm_crc32_u32((uint32_t) (crc), v & 0xffffffff);
+ crc = _mm_crc32_u32((uint32_t) (crc), (v >> 32) & 0xffffffff);
+#endif
+ return crc;
}
-#endif // ARMv7 polyfill
-FORCE_INLINE __m128i _mm_clmulepi64_si128(__m128i _a, __m128i _b, const int imm)
+// Starting with the initial value in crc, accumulates a CRC32 value for
+// unsigned 8-bit integer v, and stores the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_crc32_u8
+FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t crc, uint8_t v)
{
- uint64x2_t a = vreinterpretq_u64_m128i(_a);
- uint64x2_t b = vreinterpretq_u64_m128i(_b);
- switch (imm & 0x11) {
- case 0x00:
- return vreinterpretq_m128i_u64(
- _sse2neon_vmull_p64(vget_low_u64(a), vget_low_u64(b)));
- case 0x01:
- return vreinterpretq_m128i_u64(
- _sse2neon_vmull_p64(vget_high_u64(a), vget_low_u64(b)));
- case 0x10:
- return vreinterpretq_m128i_u64(
- _sse2neon_vmull_p64(vget_low_u64(a), vget_high_u64(b)));
- case 0x11:
- return vreinterpretq_m128i_u64(
- _sse2neon_vmull_p64(vget_high_u64(a), vget_high_u64(b)));
- default:
- abort();
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
+ __asm__ __volatile__("crc32cb %w[c], %w[c], %w[v]\n\t"
+ : [c] "+r"(crc)
+ : [v] "r"(v));
+#elif ((__ARM_ARCH == 8) && defined(__ARM_FEATURE_CRC32)) || \
+ (defined(_M_ARM64) && !defined(__clang__))
+ crc = __crc32cb(crc, v);
+#else
+ crc ^= v;
+ for (int bit = 0; bit < 8; bit++) {
+ if (crc & 1)
+ crc = (crc >> 1) ^ UINT32_C(0x82f63b78);
+ else
+ crc = (crc >> 1);
}
+#endif
+ return crc;
}
-#if !defined(__ARM_FEATURE_CRYPTO)
+/* AES */
+
+#if !defined(__ARM_FEATURE_CRYPTO) && (!defined(_M_ARM64) || defined(__clang__))
/* clang-format off */
-#define SSE2NEON_AES_DATA(w) \
+#define SSE2NEON_AES_SBOX(w) \
{ \
w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), \
w(0xc5), w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), \
@@ -5868,53 +8507,114 @@ FORCE_INLINE __m128i _mm_clmulepi64_si128(__m128i _a, __m128i _b, const int imm)
w(0xe6), w(0x42), w(0x68), w(0x41), w(0x99), w(0x2d), w(0x0f), \
w(0xb0), w(0x54), w(0xbb), w(0x16) \
}
+#define SSE2NEON_AES_RSBOX(w) \
+ { \
+ w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), \
+ w(0x38), w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), \
+ w(0xd7), w(0xfb), w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), \
+ w(0x2f), w(0xff), w(0x87), w(0x34), w(0x8e), w(0x43), w(0x44), \
+ w(0xc4), w(0xde), w(0xe9), w(0xcb), w(0x54), w(0x7b), w(0x94), \
+ w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d), w(0xee), w(0x4c), \
+ w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e), w(0x08), \
+ w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2), \
+ w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), \
+ w(0x25), w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), \
+ w(0x98), w(0x16), w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), \
+ w(0x65), w(0xb6), w(0x92), w(0x6c), w(0x70), w(0x48), w(0x50), \
+ w(0xfd), w(0xed), w(0xb9), w(0xda), w(0x5e), w(0x15), w(0x46), \
+ w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84), w(0x90), w(0xd8), \
+ w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a), w(0xf7), \
+ w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06), \
+ w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), \
+ w(0x02), w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), \
+ w(0x8a), w(0x6b), w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), \
+ w(0x67), w(0xdc), w(0xea), w(0x97), w(0xf2), w(0xcf), w(0xce), \
+ w(0xf0), w(0xb4), w(0xe6), w(0x73), w(0x96), w(0xac), w(0x74), \
+ w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85), w(0xe2), w(0xf9), \
+ w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e), w(0x47), \
+ w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89), \
+ w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), \
+ w(0x1b), w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), \
+ w(0x79), w(0x20), w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), \
+ w(0xcd), w(0x5a), w(0xf4), w(0x1f), w(0xdd), w(0xa8), w(0x33), \
+ w(0x88), w(0x07), w(0xc7), w(0x31), w(0xb1), w(0x12), w(0x10), \
+ w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f), w(0x60), w(0x51), \
+ w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d), w(0x2d), \
+ w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef), \
+ w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), \
+ w(0xb0), w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), \
+ w(0x99), w(0x61), w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), \
+ w(0x77), w(0xd6), w(0x26), w(0xe1), w(0x69), w(0x14), w(0x63), \
+ w(0x55), w(0x21), w(0x0c), w(0x7d) \
+ }
/* clang-format on */
/* X Macro trick. See https://en.wikipedia.org/wiki/X_Macro */
#define SSE2NEON_AES_H0(x) (x)
-static const uint8_t SSE2NEON_sbox[256] = SSE2NEON_AES_DATA(SSE2NEON_AES_H0);
+static const uint8_t _sse2neon_sbox[256] = SSE2NEON_AES_SBOX(SSE2NEON_AES_H0);
+static const uint8_t _sse2neon_rsbox[256] = SSE2NEON_AES_RSBOX(SSE2NEON_AES_H0);
#undef SSE2NEON_AES_H0
-// In the absence of crypto extensions, implement aesenc using regular neon
+/* x_time function and matrix multiply function */
+#if !defined(__aarch64__) && !defined(_M_ARM64)
+#define SSE2NEON_XT(x) (((x) << 1) ^ ((((x) >> 7) & 1) * 0x1b))
+#define SSE2NEON_MULTIPLY(x, y) \
+ (((y & 1) * x) ^ ((y >> 1 & 1) * SSE2NEON_XT(x)) ^ \
+ ((y >> 2 & 1) * SSE2NEON_XT(SSE2NEON_XT(x))) ^ \
+ ((y >> 3 & 1) * SSE2NEON_XT(SSE2NEON_XT(SSE2NEON_XT(x)))) ^ \
+ ((y >> 4 & 1) * SSE2NEON_XT(SSE2NEON_XT(SSE2NEON_XT(SSE2NEON_XT(x))))))
+#endif
+
+// In the absence of crypto extensions, implement aesenc using regular NEON
// intrinsics instead. See:
// https://www.workofard.com/2017/01/accelerated-aes-for-the-arm64-linux-kernel/
// https://www.workofard.com/2017/07/ghash-for-low-end-cores/ and
-// https://github.com/ColinIanKing/linux-next-mirror/blob/b5f466091e130caaf0735976648f72bd5e09aa84/crypto/aegis128-neon-inner.c#L52
-// for more information Reproduced with permission of the author.
-FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey)
+// for more information.
+FORCE_INLINE __m128i _mm_aesenc_si128(__m128i a, __m128i RoundKey)
{
-#if defined(__aarch64__)
- static const uint8_t shift_rows[] = {0x0, 0x5, 0xa, 0xf, 0x4, 0x9,
- 0xe, 0x3, 0x8, 0xd, 0x2, 0x7,
- 0xc, 0x1, 0x6, 0xb};
- static const uint8_t ror32by8[] = {0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4,
- 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc};
+#if defined(__aarch64__) || defined(_M_ARM64)
+ static const uint8_t shift_rows[] = {
+ 0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3,
+ 0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb,
+ };
+ static const uint8_t ror32by8[] = {
+ 0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4,
+ 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc,
+ };
uint8x16_t v;
- uint8x16_t w = vreinterpretq_u8_m128i(EncBlock);
+ uint8x16_t w = vreinterpretq_u8_m128i(a);
- // shift rows
+ /* shift rows */
w = vqtbl1q_u8(w, vld1q_u8(shift_rows));
- // sub bytes
- v = vqtbl4q_u8(vld1q_u8_x4(SSE2NEON_sbox), w);
- v = vqtbx4q_u8(v, vld1q_u8_x4(SSE2NEON_sbox + 0x40), w - 0x40);
- v = vqtbx4q_u8(v, vld1q_u8_x4(SSE2NEON_sbox + 0x80), w - 0x80);
- v = vqtbx4q_u8(v, vld1q_u8_x4(SSE2NEON_sbox + 0xc0), w - 0xc0);
-
- // mix columns
- w = (v << 1) ^ (uint8x16_t)(((int8x16_t) v >> 7) & 0x1b);
+ /* sub bytes */
+ // Here, we separate the whole 256-bytes table into 4 64-bytes tables, and
+ // look up each of the table. After each lookup, we load the next table
+ // which locates at the next 64-bytes. In the meantime, the index in the
+ // table would be smaller than it was, so the index parameters of
+ // `vqtbx4q_u8()` need to be added the same constant as the loaded tables.
+ v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(_sse2neon_sbox), w);
+ // 'w-0x40' equals to 'vsubq_u8(w, vdupq_n_u8(0x40))'
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x40), w - 0x40);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x80), w - 0x80);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0xc0), w - 0xc0);
+
+ /* mix columns */
+ w = (v << 1) ^ (uint8x16_t) (((int8x16_t) v >> 7) & 0x1b);
w ^= (uint8x16_t) vrev32q_u16((uint16x8_t) v);
w ^= vqtbl1q_u8(v ^ w, vld1q_u8(ror32by8));
- // add round key
+ /* add round key */
return vreinterpretq_m128i_u8(w) ^ RoundKey;
-#else /* ARMv7-A NEON implementation */
-#define SSE2NEON_AES_B2W(b0, b1, b2, b3) \
- (((uint32_t)(b3) << 24) | ((uint32_t)(b2) << 16) | ((uint32_t)(b1) << 8) | \
- (b0))
+#else /* ARMv7-A implementation for a table-based AES */
+#define SSE2NEON_AES_B2W(b0, b1, b2, b3) \
+ (((uint32_t) (b3) << 24) | ((uint32_t) (b2) << 16) | \
+ ((uint32_t) (b1) << 8) | (uint32_t) (b0))
+// muliplying 'x' by 2 in GF(2^8)
#define SSE2NEON_AES_F2(x) ((x << 1) ^ (((x >> 7) & 1) * 0x011b /* WPOLY */))
+// muliplying 'x' by 3 in GF(2^8)
#define SSE2NEON_AES_F3(x) (SSE2NEON_AES_F2(x) ^ x)
#define SSE2NEON_AES_U0(p) \
SSE2NEON_AES_B2W(SSE2NEON_AES_F2(p), p, p, SSE2NEON_AES_F3(p))
@@ -5924,11 +8624,14 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey)
SSE2NEON_AES_B2W(p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p), p)
#define SSE2NEON_AES_U3(p) \
SSE2NEON_AES_B2W(p, p, SSE2NEON_AES_F3(p), SSE2NEON_AES_F2(p))
+
+ // this generates a table containing every possible permutation of
+ // shift_rows() and sub_bytes() with mix_columns().
static const uint32_t ALIGN_STRUCT(16) aes_table[4][256] = {
- SSE2NEON_AES_DATA(SSE2NEON_AES_U0),
- SSE2NEON_AES_DATA(SSE2NEON_AES_U1),
- SSE2NEON_AES_DATA(SSE2NEON_AES_U2),
- SSE2NEON_AES_DATA(SSE2NEON_AES_U3),
+ SSE2NEON_AES_SBOX(SSE2NEON_AES_U0),
+ SSE2NEON_AES_SBOX(SSE2NEON_AES_U1),
+ SSE2NEON_AES_SBOX(SSE2NEON_AES_U2),
+ SSE2NEON_AES_SBOX(SSE2NEON_AES_U3),
};
#undef SSE2NEON_AES_B2W
#undef SSE2NEON_AES_F2
@@ -5938,11 +8641,15 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey)
#undef SSE2NEON_AES_U2
#undef SSE2NEON_AES_U3
- uint32_t x0 = _mm_cvtsi128_si32(EncBlock);
- uint32_t x1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0x55));
- uint32_t x2 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xAA));
- uint32_t x3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(EncBlock, 0xFF));
+ uint32_t x0 = _mm_cvtsi128_si32(a); // get a[31:0]
+ uint32_t x1 =
+ _mm_cvtsi128_si32(_mm_shuffle_epi32(a, 0x55)); // get a[63:32]
+ uint32_t x2 =
+ _mm_cvtsi128_si32(_mm_shuffle_epi32(a, 0xAA)); // get a[95:64]
+ uint32_t x3 =
+ _mm_cvtsi128_si32(_mm_shuffle_epi32(a, 0xFF)); // get a[127:96]
+ // finish the modulo addition step in mix_columns()
__m128i out = _mm_set_epi32(
(aes_table[0][x3 & 0xff] ^ aes_table[1][(x0 >> 8) & 0xff] ^
aes_table[2][(x1 >> 16) & 0xff] ^ aes_table[3][x2 >> 24]),
@@ -5957,51 +8664,254 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey)
#endif
}
+// Perform one round of an AES decryption flow on data (state) in a using the
+// round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdec_si128
+FORCE_INLINE __m128i _mm_aesdec_si128(__m128i a, __m128i RoundKey)
+{
+#if defined(__aarch64__)
+ static const uint8_t inv_shift_rows[] = {
+ 0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb,
+ 0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3,
+ };
+ static const uint8_t ror32by8[] = {
+ 0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4,
+ 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc,
+ };
+
+ uint8x16_t v;
+ uint8x16_t w = vreinterpretq_u8_m128i(a);
+
+ // inverse shift rows
+ w = vqtbl1q_u8(w, vld1q_u8(inv_shift_rows));
+
+ // inverse sub bytes
+ v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(_sse2neon_rsbox), w);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0x40), w - 0x40);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0x80), w - 0x80);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0xc0), w - 0xc0);
+
+ // inverse mix columns
+ // muliplying 'v' by 4 in GF(2^8)
+ w = (v << 1) ^ (uint8x16_t) (((int8x16_t) v >> 7) & 0x1b);
+ w = (w << 1) ^ (uint8x16_t) (((int8x16_t) w >> 7) & 0x1b);
+ v ^= w;
+ v ^= (uint8x16_t) vrev32q_u16((uint16x8_t) w);
+
+ w = (v << 1) ^ (uint8x16_t) (((int8x16_t) v >> 7) &
+ 0x1b); // muliplying 'v' by 2 in GF(2^8)
+ w ^= (uint8x16_t) vrev32q_u16((uint16x8_t) v);
+ w ^= vqtbl1q_u8(v ^ w, vld1q_u8(ror32by8));
+
+ // add round key
+ return vreinterpretq_m128i_u8(w) ^ RoundKey;
+
+#else /* ARMv7-A NEON implementation */
+ /* FIXME: optimized for NEON */
+ uint8_t i, e, f, g, h, v[4][4];
+ uint8_t *_a = (uint8_t *) &a;
+ for (i = 0; i < 16; ++i) {
+ v[((i / 4) + (i % 4)) % 4][i % 4] = _sse2neon_rsbox[_a[i]];
+ }
+
+ // inverse mix columns
+ for (i = 0; i < 4; ++i) {
+ e = v[i][0];
+ f = v[i][1];
+ g = v[i][2];
+ h = v[i][3];
+
+ v[i][0] = SSE2NEON_MULTIPLY(e, 0x0e) ^ SSE2NEON_MULTIPLY(f, 0x0b) ^
+ SSE2NEON_MULTIPLY(g, 0x0d) ^ SSE2NEON_MULTIPLY(h, 0x09);
+ v[i][1] = SSE2NEON_MULTIPLY(e, 0x09) ^ SSE2NEON_MULTIPLY(f, 0x0e) ^
+ SSE2NEON_MULTIPLY(g, 0x0b) ^ SSE2NEON_MULTIPLY(h, 0x0d);
+ v[i][2] = SSE2NEON_MULTIPLY(e, 0x0d) ^ SSE2NEON_MULTIPLY(f, 0x09) ^
+ SSE2NEON_MULTIPLY(g, 0x0e) ^ SSE2NEON_MULTIPLY(h, 0x0b);
+ v[i][3] = SSE2NEON_MULTIPLY(e, 0x0b) ^ SSE2NEON_MULTIPLY(f, 0x0d) ^
+ SSE2NEON_MULTIPLY(g, 0x09) ^ SSE2NEON_MULTIPLY(h, 0x0e);
+ }
+
+ return vreinterpretq_m128i_u8(vld1q_u8((uint8_t *) v)) ^ RoundKey;
+#endif
+}
+
+// Perform the last round of an AES encryption flow on data (state) in a using
+// the round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenclast_si128
FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey)
{
+#if defined(__aarch64__)
+ static const uint8_t shift_rows[] = {
+ 0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3,
+ 0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb,
+ };
+
+ uint8x16_t v;
+ uint8x16_t w = vreinterpretq_u8_m128i(a);
+
+ // shift rows
+ w = vqtbl1q_u8(w, vld1q_u8(shift_rows));
+
+ // sub bytes
+ v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(_sse2neon_sbox), w);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x40), w - 0x40);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x80), w - 0x80);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0xc0), w - 0xc0);
+
+ // add round key
+ return vreinterpretq_m128i_u8(v) ^ RoundKey;
+
+#else /* ARMv7-A implementation */
+ uint8_t v[16] = {
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 0)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 5)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 10)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 15)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 4)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 9)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 14)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 3)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 8)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 13)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 2)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 7)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 12)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 1)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 6)],
+ _sse2neon_sbox[vgetq_lane_u8(vreinterpretq_u8_m128i(a), 11)],
+ };
+
+ return vreinterpretq_m128i_u8(vld1q_u8(v)) ^ RoundKey;
+#endif
+}
+
+// Perform the last round of an AES decryption flow on data (state) in a using
+// the round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdeclast_si128
+FORCE_INLINE __m128i _mm_aesdeclast_si128(__m128i a, __m128i RoundKey)
+{
+#if defined(__aarch64__)
+ static const uint8_t inv_shift_rows[] = {
+ 0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb,
+ 0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3,
+ };
+
+ uint8x16_t v;
+ uint8x16_t w = vreinterpretq_u8_m128i(a);
+
+ // inverse shift rows
+ w = vqtbl1q_u8(w, vld1q_u8(inv_shift_rows));
+
+ // inverse sub bytes
+ v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(_sse2neon_rsbox), w);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0x40), w - 0x40);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0x80), w - 0x80);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_rsbox + 0xc0), w - 0xc0);
+
+ // add round key
+ return vreinterpretq_m128i_u8(v) ^ RoundKey;
+
+#else /* ARMv7-A NEON implementation */
/* FIXME: optimized for NEON */
- uint8_t v[4][4] = {
- [0] = {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 0)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 5)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 10)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 15)]},
- [1] = {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 4)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 9)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 14)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 3)]},
- [2] = {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 8)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 13)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 2)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 7)]},
- [3] = {SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 12)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 1)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 6)],
- SSE2NEON_sbox[vreinterpretq_nth_u8_m128i(a, 11)]},
+ uint8_t v[4][4];
+ uint8_t *_a = (uint8_t *) &a;
+ for (int i = 0; i < 16; ++i) {
+ v[((i / 4) + (i % 4)) % 4][i % 4] = _sse2neon_rsbox[_a[i]];
+ }
+
+ return vreinterpretq_m128i_u8(vld1q_u8((uint8_t *) v)) ^ RoundKey;
+#endif
+}
+
+// Perform the InvMixColumns transformation on a and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesimc_si128
+FORCE_INLINE __m128i _mm_aesimc_si128(__m128i a)
+{
+#if defined(__aarch64__)
+ static const uint8_t ror32by8[] = {
+ 0x1, 0x2, 0x3, 0x0, 0x5, 0x6, 0x7, 0x4,
+ 0x9, 0xa, 0xb, 0x8, 0xd, 0xe, 0xf, 0xc,
};
- for (int i = 0; i < 16; i++)
- vreinterpretq_nth_u8_m128i(a, i) =
- v[i / 4][i % 4] ^ vreinterpretq_nth_u8_m128i(RoundKey, i);
- return a;
+ uint8x16_t v = vreinterpretq_u8_m128i(a);
+ uint8x16_t w;
+
+ // multiplying 'v' by 4 in GF(2^8)
+ w = (v << 1) ^ (uint8x16_t) (((int8x16_t) v >> 7) & 0x1b);
+ w = (w << 1) ^ (uint8x16_t) (((int8x16_t) w >> 7) & 0x1b);
+ v ^= w;
+ v ^= (uint8x16_t) vrev32q_u16((uint16x8_t) w);
+
+ // multiplying 'v' by 2 in GF(2^8)
+ w = (v << 1) ^ (uint8x16_t) (((int8x16_t) v >> 7) & 0x1b);
+ w ^= (uint8x16_t) vrev32q_u16((uint16x8_t) v);
+ w ^= vqtbl1q_u8(v ^ w, vld1q_u8(ror32by8));
+ return vreinterpretq_m128i_u8(w);
+
+#else /* ARMv7-A NEON implementation */
+ uint8_t i, e, f, g, h, v[4][4];
+ vst1q_u8((uint8_t *) v, vreinterpretq_u8_m128i(a));
+ for (i = 0; i < 4; ++i) {
+ e = v[i][0];
+ f = v[i][1];
+ g = v[i][2];
+ h = v[i][3];
+
+ v[i][0] = SSE2NEON_MULTIPLY(e, 0x0e) ^ SSE2NEON_MULTIPLY(f, 0x0b) ^
+ SSE2NEON_MULTIPLY(g, 0x0d) ^ SSE2NEON_MULTIPLY(h, 0x09);
+ v[i][1] = SSE2NEON_MULTIPLY(e, 0x09) ^ SSE2NEON_MULTIPLY(f, 0x0e) ^
+ SSE2NEON_MULTIPLY(g, 0x0b) ^ SSE2NEON_MULTIPLY(h, 0x0d);
+ v[i][2] = SSE2NEON_MULTIPLY(e, 0x0d) ^ SSE2NEON_MULTIPLY(f, 0x09) ^
+ SSE2NEON_MULTIPLY(g, 0x0e) ^ SSE2NEON_MULTIPLY(h, 0x0b);
+ v[i][3] = SSE2NEON_MULTIPLY(e, 0x0b) ^ SSE2NEON_MULTIPLY(f, 0x0d) ^
+ SSE2NEON_MULTIPLY(g, 0x09) ^ SSE2NEON_MULTIPLY(h, 0x0e);
+ }
+
+ return vreinterpretq_m128i_u8(vld1q_u8((uint8_t *) v));
+#endif
}
+// Assist in expanding the AES cipher key by computing steps towards generating
+// a round key for encryption cipher using data from a and an 8-bit round
+// constant specified in imm8, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aeskeygenassist_si128
+//
// Emits the Advanced Encryption Standard (AES) instruction aeskeygenassist.
// This instruction generates a round key for AES encryption. See
// https://kazakov.life/2017/11/01/cryptocurrency-mining-on-ios-devices/
// for details.
-//
-// https://msdn.microsoft.com/en-us/library/cc714138(v=vs.120).aspx
-FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i key, const int rcon)
+FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i a, const int rcon)
{
- uint32_t X1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0x55));
- uint32_t X3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(key, 0xFF));
+#if defined(__aarch64__)
+ uint8x16_t _a = vreinterpretq_u8_m128i(a);
+ uint8x16_t v = vqtbl4q_u8(_sse2neon_vld1q_u8_x4(_sse2neon_sbox), _a);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x40), _a - 0x40);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0x80), _a - 0x80);
+ v = vqtbx4q_u8(v, _sse2neon_vld1q_u8_x4(_sse2neon_sbox + 0xc0), _a - 0xc0);
+
+ uint32x4_t v_u32 = vreinterpretq_u32_u8(v);
+ uint32x4_t ror_v = vorrq_u32(vshrq_n_u32(v_u32, 8), vshlq_n_u32(v_u32, 24));
+ uint32x4_t ror_xor_v = veorq_u32(ror_v, vdupq_n_u32(rcon));
+
+ return vreinterpretq_m128i_u32(vtrn2q_u32(v_u32, ror_xor_v));
+
+#else /* ARMv7-A NEON implementation */
+ uint32_t X1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(a, 0x55));
+ uint32_t X3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(a, 0xFF));
for (int i = 0; i < 4; ++i) {
- ((uint8_t *) &X1)[i] = SSE2NEON_sbox[((uint8_t *) &X1)[i]];
- ((uint8_t *) &X3)[i] = SSE2NEON_sbox[((uint8_t *) &X3)[i]];
+ ((uint8_t *) &X1)[i] = _sse2neon_sbox[((uint8_t *) &X1)[i]];
+ ((uint8_t *) &X3)[i] = _sse2neon_sbox[((uint8_t *) &X3)[i]];
}
return _mm_set_epi32(((X3 >> 8) | (X3 << 24)) ^ rcon, X3,
((X1 >> 8) | (X1 << 24)) ^ rcon, X1);
+#endif
}
-#undef SSE2NEON_AES_DATA
+#undef SSE2NEON_AES_SBOX
+#undef SSE2NEON_AES_RSBOX
+
+#if defined(__aarch64__)
+#undef SSE2NEON_XT
+#undef SSE2NEON_MULTIPLY
+#endif
#else /* __ARM_FEATURE_CRYPTO */
// Implements equivalent of 'aesenc' by combining AESE (with an empty key) and
@@ -6012,12 +8922,24 @@ FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i key, const int rcon)
// for more details.
FORCE_INLINE __m128i _mm_aesenc_si128(__m128i a, __m128i b)
{
- return vreinterpretq_m128i_u8(
- vaesmcq_u8(vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0))) ^
- vreinterpretq_u8_m128i(b));
+ return vreinterpretq_m128i_u8(veorq_u8(
+ vaesmcq_u8(vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0))),
+ vreinterpretq_u8_m128i(b)));
+}
+
+// Perform one round of an AES decryption flow on data (state) in a using the
+// round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdec_si128
+FORCE_INLINE __m128i _mm_aesdec_si128(__m128i a, __m128i RoundKey)
+{
+ return vreinterpretq_m128i_u8(veorq_u8(
+ vaesimcq_u8(vaesdq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0))),
+ vreinterpretq_u8_m128i(RoundKey)));
}
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_aesenclast_si128
+// Perform the last round of an AES encryption flow on data (state) in a using
+// the round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenclast_si128
FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey)
{
return _mm_xor_si128(vreinterpretq_m128i_u8(vaeseq_u8(
@@ -6025,11 +8947,33 @@ FORCE_INLINE __m128i _mm_aesenclast_si128(__m128i a, __m128i RoundKey)
RoundKey);
}
+// Perform the last round of an AES decryption flow on data (state) in a using
+// the round key in RoundKey, and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdeclast_si128
+FORCE_INLINE __m128i _mm_aesdeclast_si128(__m128i a, __m128i RoundKey)
+{
+ return vreinterpretq_m128i_u8(
+ veorq_u8(vaesdq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0)),
+ vreinterpretq_u8_m128i(RoundKey)));
+}
+
+// Perform the InvMixColumns transformation on a and store the result in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesimc_si128
+FORCE_INLINE __m128i _mm_aesimc_si128(__m128i a)
+{
+ return vreinterpretq_m128i_u8(vaesimcq_u8(vreinterpretq_u8_m128i(a)));
+}
+
+// Assist in expanding the AES cipher key by computing steps towards generating
+// a round key for encryption cipher using data from a and an 8-bit round
+// constant specified in imm8, and store the result in dst."
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aeskeygenassist_si128
FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i a, const int rcon)
{
// AESE does ShiftRows and SubBytes on A
uint8x16_t u8 = vaeseq_u8(vreinterpretq_u8_m128i(a), vdupq_n_u8(0));
+#ifndef _MSC_VER
uint8x16_t dest = {
// Undo ShiftRows step from AESE and extract X1 and X3
u8[0x4], u8[0x1], u8[0xE], u8[0xB], // SubBytes(X1)
@@ -6039,156 +8983,209 @@ FORCE_INLINE __m128i _mm_aeskeygenassist_si128(__m128i a, const int rcon)
};
uint32x4_t r = {0, (unsigned) rcon, 0, (unsigned) rcon};
return vreinterpretq_m128i_u8(dest) ^ vreinterpretq_m128i_u32(r);
+#else
+ // We have to do this hack because MSVC is strictly adhering to the CPP
+ // standard, in particular C++03 8.5.1 sub-section 15, which states that
+ // unions must be initialized by their first member type.
+
+ // As per the Windows ARM64 ABI, it is always little endian, so this works
+ __n128 dest{
+ ((uint64_t) u8.n128_u8[0x4] << 0) | ((uint64_t) u8.n128_u8[0x1] << 8) |
+ ((uint64_t) u8.n128_u8[0xE] << 16) |
+ ((uint64_t) u8.n128_u8[0xB] << 24) |
+ ((uint64_t) u8.n128_u8[0x1] << 32) |
+ ((uint64_t) u8.n128_u8[0xE] << 40) |
+ ((uint64_t) u8.n128_u8[0xB] << 48) |
+ ((uint64_t) u8.n128_u8[0x4] << 56),
+ ((uint64_t) u8.n128_u8[0xC] << 0) | ((uint64_t) u8.n128_u8[0x9] << 8) |
+ ((uint64_t) u8.n128_u8[0x6] << 16) |
+ ((uint64_t) u8.n128_u8[0x3] << 24) |
+ ((uint64_t) u8.n128_u8[0x9] << 32) |
+ ((uint64_t) u8.n128_u8[0x6] << 40) |
+ ((uint64_t) u8.n128_u8[0x3] << 48) |
+ ((uint64_t) u8.n128_u8[0xC] << 56)};
+
+ dest.n128_u32[1] = dest.n128_u32[1] ^ rcon;
+ dest.n128_u32[3] = dest.n128_u32[3] ^ rcon;
+
+ return dest;
+#endif
}
#endif
-/* Streaming Extensions */
+/* Others */
-// Guarantees that every preceding store is globally visible before any
-// subsequent store.
-// https://msdn.microsoft.com/en-us/library/5h2w73d1%28v=vs.90%29.aspx
-FORCE_INLINE void _mm_sfence(void)
+// Perform a carry-less multiplication of two 64-bit integers, selected from a
+// and b according to imm8, and store the results in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_clmulepi64_si128
+FORCE_INLINE __m128i _mm_clmulepi64_si128(__m128i _a, __m128i _b, const int imm)
{
- __sync_synchronize();
+ uint64x2_t a = vreinterpretq_u64_m128i(_a);
+ uint64x2_t b = vreinterpretq_u64_m128i(_b);
+ switch (imm & 0x11) {
+ case 0x00:
+ return vreinterpretq_m128i_u64(
+ _sse2neon_vmull_p64(vget_low_u64(a), vget_low_u64(b)));
+ case 0x01:
+ return vreinterpretq_m128i_u64(
+ _sse2neon_vmull_p64(vget_high_u64(a), vget_low_u64(b)));
+ case 0x10:
+ return vreinterpretq_m128i_u64(
+ _sse2neon_vmull_p64(vget_low_u64(a), vget_high_u64(b)));
+ case 0x11:
+ return vreinterpretq_m128i_u64(
+ _sse2neon_vmull_p64(vget_high_u64(a), vget_high_u64(b)));
+ default:
+ abort();
+ }
}
-// Store 128-bits (composed of 4 packed single-precision (32-bit) floating-
-// point elements) from a into memory using a non-temporal memory hint.
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_ps
-FORCE_INLINE void _mm_stream_ps(float *p, __m128 a)
+FORCE_INLINE unsigned int _sse2neon_mm_get_denormals_zero_mode()
{
-#if __has_builtin(__builtin_nontemporal_store)
- __builtin_nontemporal_store(a, (float32x4_t *) p);
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
#else
- vst1q_f32(p, vreinterpretq_f32_m128(a));
+ uint32_t value;
#endif
-}
+ } r;
-// Stores the data in a to the address p without polluting the caches. If the
-// cache line containing address p is already in the cache, the cache will be
-// updated.
-// https://msdn.microsoft.com/en-us/library/ba08y07y%28v=vs.90%29.aspx
-FORCE_INLINE void _mm_stream_si128(__m128i *p, __m128i a)
-{
-#if __has_builtin(__builtin_nontemporal_store)
- __builtin_nontemporal_store(a, p);
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
#else
- vst1q_s64((int64_t *) p, vreinterpretq_s64_m128i(a));
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
#endif
+
+ return r.field.bit24 ? _MM_DENORMALS_ZERO_ON : _MM_DENORMALS_ZERO_OFF;
}
-// Load 128-bits of integer data from memory into dst using a non-temporal
-// memory hint. mem_addr must be aligned on a 16-byte boundary or a
-// general-protection exception may be generated.
-//
-// dst[127:0] := MEM[mem_addr+127:mem_addr]
-//
-// https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_stream_load_si128
-FORCE_INLINE __m128i _mm_stream_load_si128(__m128i *p)
+// Count the number of bits set to 1 in unsigned 32-bit integer a, and
+// return that count in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_popcnt_u32
+FORCE_INLINE int _mm_popcnt_u32(unsigned int a)
{
-#if __has_builtin(__builtin_nontemporal_store)
- return __builtin_nontemporal_load(p);
+#if defined(__aarch64__) || defined(_M_ARM64)
+#if __has_builtin(__builtin_popcount)
+ return __builtin_popcount(a);
+#elif defined(_MSC_VER)
+ return _CountOneBits(a);
#else
- return vreinterpretq_m128i_s64(vld1q_s64((int64_t *) p));
+ return (int) vaddlv_u8(vcnt_u8(vcreate_u8((uint64_t) a)));
#endif
-}
+#else
+ uint32_t count = 0;
+ uint8x8_t input_val, count8x8_val;
+ uint16x4_t count16x4_val;
+ uint32x2_t count32x2_val;
-// Cache line containing p is flushed and invalidated from all caches in the
-// coherency domain. :
-// https://msdn.microsoft.com/en-us/library/ba08y07y(v=vs.100).aspx
-FORCE_INLINE void _mm_clflush(void const *p)
-{
- (void) p;
- // no corollary for Neon?
-}
+ input_val = vld1_u8((uint8_t *) &a);
+ count8x8_val = vcnt_u8(input_val);
+ count16x4_val = vpaddl_u8(count8x8_val);
+ count32x2_val = vpaddl_u16(count16x4_val);
-// Allocate aligned blocks of memory.
-// https://software.intel.com/en-us/
-// cpp-compiler-developer-guide-and-reference-allocating-and-freeing-aligned-memory-blocks
-FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
-{
- void *ptr;
- if (align == 1)
- return malloc(size);
- if (align == 2 || (sizeof(void *) == 8 && align == 4))
- align = sizeof(void *);
- if (!posix_memalign(&ptr, align, size))
- return ptr;
- return NULL;
+ vst1_u32(&count, count32x2_val);
+ return count;
+#endif
}
-FORCE_INLINE void _mm_free(void *addr)
+// Count the number of bits set to 1 in unsigned 64-bit integer a, and
+// return that count in dst.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_popcnt_u64
+FORCE_INLINE int64_t _mm_popcnt_u64(uint64_t a)
{
- free(addr);
+#if defined(__aarch64__) || defined(_M_ARM64)
+#if __has_builtin(__builtin_popcountll)
+ return __builtin_popcountll(a);
+#elif defined(_MSC_VER)
+ return _CountOneBits64(a);
+#else
+ return (int64_t) vaddlv_u8(vcnt_u8(vcreate_u8(a)));
+#endif
+#else
+ uint64_t count = 0;
+ uint8x8_t input_val, count8x8_val;
+ uint16x4_t count16x4_val;
+ uint32x2_t count32x2_val;
+ uint64x1_t count64x1_val;
+
+ input_val = vld1_u8((uint8_t *) &a);
+ count8x8_val = vcnt_u8(input_val);
+ count16x4_val = vpaddl_u8(count8x8_val);
+ count32x2_val = vpaddl_u16(count16x4_val);
+ count64x1_val = vpaddl_u32(count32x2_val);
+ vst1_u64(&count, count64x1_val);
+ return count;
+#endif
}
-// Starting with the initial value in crc, accumulates a CRC32 value for
-// unsigned 8-bit integer v.
-// https://msdn.microsoft.com/en-us/library/bb514036(v=vs.100)
-FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t crc, uint8_t v)
+FORCE_INLINE void _sse2neon_mm_set_denormals_zero_mode(unsigned int flag)
{
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
- __asm__ __volatile__("crc32cb %w[c], %w[c], %w[v]\n\t"
- : [c] "+r"(crc)
- : [v] "r"(v));
+ // AArch32 Advanced SIMD arithmetic always uses the Flush-to-zero setting,
+ // regardless of the value of the FZ bit.
+ union {
+ fpcr_bitfield field;
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t value;
#else
- crc ^= v;
- for (int bit = 0; bit < 8; bit++) {
- if (crc & 1)
- crc = (crc >> 1) ^ UINT32_C(0x82f63b78);
- else
- crc = (crc >> 1);
- }
+ uint32_t value;
#endif
- return crc;
-}
+ } r;
-// Starting with the initial value in crc, accumulates a CRC32 value for
-// unsigned 16-bit integer v.
-// https://msdn.microsoft.com/en-us/library/bb531411(v=vs.100)
-FORCE_INLINE uint32_t _mm_crc32_u16(uint32_t crc, uint16_t v)
-{
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
- __asm__ __volatile__("crc32ch %w[c], %w[c], %w[v]\n\t"
- : [c] "+r"(crc)
- : [v] "r"(v));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ r.value = _sse2neon_get_fpcr();
#else
- crc = _mm_crc32_u8(crc, v & 0xff);
- crc = _mm_crc32_u8(crc, (v >> 8) & 0xff);
+ __asm__ __volatile__("vmrs %0, FPSCR" : "=r"(r.value)); /* read */
#endif
- return crc;
-}
-// Starting with the initial value in crc, accumulates a CRC32 value for
-// unsigned 32-bit integer v.
-// https://msdn.microsoft.com/en-us/library/bb531394(v=vs.100)
-FORCE_INLINE uint32_t _mm_crc32_u32(uint32_t crc, uint32_t v)
-{
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
- __asm__ __volatile__("crc32cw %w[c], %w[c], %w[v]\n\t"
- : [c] "+r"(crc)
- : [v] "r"(v));
+ r.field.bit24 = (flag & _MM_DENORMALS_ZERO_MASK) == _MM_DENORMALS_ZERO_ON;
+
+#if defined(__aarch64__) || defined(_M_ARM64)
+ _sse2neon_set_fpcr(r.value);
#else
- crc = _mm_crc32_u16(crc, v & 0xffff);
- crc = _mm_crc32_u16(crc, (v >> 16) & 0xffff);
+ __asm__ __volatile__("vmsr FPSCR, %0" ::"r"(r)); /* write */
#endif
- return crc;
}
-// Starting with the initial value in crc, accumulates a CRC32 value for
-// unsigned 64-bit integer v.
-// https://msdn.microsoft.com/en-us/library/bb514033(v=vs.100)
-FORCE_INLINE uint64_t _mm_crc32_u64(uint64_t crc, uint64_t v)
+// Return the current 64-bit value of the processor's time-stamp counter.
+// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=rdtsc
+FORCE_INLINE uint64_t _rdtsc(void)
{
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
- __asm__ __volatile__("crc32cx %w[c], %w[c], %x[v]\n\t"
- : [c] "+r"(crc)
- : [v] "r"(v));
+#if defined(__aarch64__) || defined(_M_ARM64)
+ uint64_t val;
+
+ /* According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the
+ * system counter is at least 56 bits wide; from Armv8.6, the counter
+ * must be 64 bits wide. So the system counter could be less than 64
+ * bits wide and it is attributed with the flag 'cap_user_time_short'
+ * is true.
+ */
+#if defined(_MSC_VER)
+ val = _ReadStatusReg(ARM64_SYSREG(3, 3, 14, 0, 2));
#else
- crc = _mm_crc32_u32((uint32_t)(crc), v & 0xffffffff);
- crc = _mm_crc32_u32((uint32_t)(crc), (v >> 32) & 0xffffffff);
+ __asm__ __volatile__("mrs %0, cntvct_el0" : "=r"(val));
+#endif
+
+ return val;
+#else
+ uint32_t pmccntr, pmuseren, pmcntenset;
+ // Read the user mode Performance Monitoring Unit (PMU)
+ // User Enable Register (PMUSERENR) access permissions.
+ __asm__ __volatile__("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren));
+ if (pmuseren & 1) { // Allows reading PMUSERENR for user mode code.
+ __asm__ __volatile__("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset));
+ if (pmcntenset & 0x80000000UL) { // Is it counting?
+ __asm__ __volatile__("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));
+ // The counter is set up to count every 64th cycle
+ return (uint64_t) (pmccntr) << 6;
+ }
+ }
+
+ // Fallback to syscall as we can't enable PMUSERENR in user mode.
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (uint64_t) (tv.tv_sec) * 1000000 + tv.tv_usec;
#endif
- return crc;
}
#if defined(__GNUC__) || defined(__clang__)
@@ -6196,7 +9193,7 @@ FORCE_INLINE uint64_t _mm_crc32_u64(uint64_t crc, uint64_t v)
#pragma pop_macro("FORCE_INLINE")
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC pop_options
#endif
diff --git a/src_c/joystick.c b/src_c/joystick.c
index fbacd54bb8..22acfd2b1e 100644
--- a/src_c/joystick.c
+++ b/src_c/joystick.c
@@ -28,14 +28,11 @@
#include "doc/joystick_doc.h"
static pgJoystickObject *joylist_head = NULL;
-#ifndef BUILD_STATIC
-static PyObject *joy_instance_map = NULL;
-#endif // BUILD_STATIC joy_instance_map already defined in src_c/event.c:57
static PyTypeObject pgJoystick_Type;
static PyObject *
pgJoystick_New(int);
static int
-_joy_map_insert(pgJoystickObject *jstick);
+pgJoystick_GetDeviceIndexByInstanceID(int);
#define pgJoystick_Check(x) ((x)->ob_type == &pgJoystick_Type)
static PyObject *
@@ -95,7 +92,7 @@ joy_dealloc(PyObject *self)
jstick->next->prev = jstick->prev;
}
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
static PyObject *
@@ -130,39 +127,9 @@ joy_init(PyObject *self, PyObject *_null)
}
}
- if (-1 == _joy_map_insert(jstick)) {
- return NULL;
- }
-
Py_RETURN_NONE;
}
-static int
-_joy_map_insert(pgJoystickObject *jstick)
-{
- SDL_JoystickID instance_id;
- PyObject *k, *v;
-
- if (!joy_instance_map) {
- return -1;
- }
-
- instance_id = SDL_JoystickInstanceID(jstick->joy);
- if (instance_id < 0) {
- PyErr_SetString(pgExc_SDLError, SDL_GetError());
- return -1;
- }
- k = PyLong_FromLong(instance_id);
- v = PyLong_FromLong(jstick->id);
- if (k && v) {
- PyDict_SetItem(joy_instance_map, k, v);
- }
- Py_XDECREF(k);
- Py_XDECREF(v);
-
- return 0;
-}
-
static PyObject *
joy_quit(PyObject *self, PyObject *_null)
{
@@ -546,6 +513,20 @@ static PyTypeObject pgJoystick_Type = {
.tp_methods = joy_methods,
};
+static int
+pgJoystick_GetDeviceIndexByInstanceID(int instance_id)
+{
+ pgJoystickObject *cur;
+ cur = joylist_head;
+ while (cur) {
+ if (SDL_JoystickInstanceID(cur->joy) == instance_id) {
+ return cur->id;
+ }
+ cur = cur->next;
+ }
+ return -1;
+}
+
static PyObject *
pgJoystick_New(int id)
{
@@ -588,11 +569,6 @@ pgJoystick_New(int id)
}
joylist_head = jstick;
- if (-1 == _joy_map_insert(jstick)) {
- Py_DECREF(jstick);
- return NULL;
- }
-
return (PyObject *)jstick;
}
@@ -632,17 +608,6 @@ MODINIT_DEFINE(joystick)
return NULL;
}
- /* Grab the instance -> device id mapping */
- module = PyImport_ImportModule("pygame.event");
- if (!module) {
- return NULL;
- }
- joy_instance_map = PyObject_GetAttrString(module, "_joy_instance_map");
- Py_DECREF(module);
- if (!joy_instance_map) {
- return NULL;
- }
-
/* create the module */
module = PyModule_Create(&_module);
if (module == NULL) {
@@ -660,6 +625,7 @@ MODINIT_DEFINE(joystick)
/* export the c api */
c_api[0] = &pgJoystick_Type;
c_api[1] = pgJoystick_New;
+ c_api[2] = pgJoystick_GetDeviceIndexByInstanceID;
apiobj = encapsulate_api(c_api, "joystick");
if (PyModule_AddObject(module, PYGAMEAPI_LOCAL_ENTRY, apiobj)) {
Py_XDECREF(apiobj);
diff --git a/src_c/key.c b/src_c/key.c
index dd30b2b6be..e7f28e744e 100644
--- a/src_c/key.c
+++ b/src_c/key.c
@@ -62,7 +62,7 @@ key_get_repeat(PyObject *self, PyObject *_null)
/*
* pgScancodeWrapper is for key_get_pressed in SDL2.
* It converts key symbol indices to scan codes, as suggested in
- * https://github.com/pygame/pygame/issues/659
+ * https://github.com/pygame-community/pygame-ce/issues/519
* so that they work with SDL_GetKeyboardState().
*/
#define _PG_SCANCODEWRAPPER_TYPE_NAME "ScancodeWrapper"
diff --git a/src_c/math.c b/src_c/math.c
index 1c50eec54e..011a27cdad 100644
--- a/src_c/math.c
+++ b/src_c/math.c
@@ -18,13 +18,14 @@
*/
/* Adjust gcc 4.4 optimization for floating point on x86-32 PCs running Linux.
- * This addresses bug 52:
- * https://github.com/pygame/pygame/issues/52
+ * This addresses bug 67:
+ * https://github.com/pygame-community/pygame-ce/issues/67
* With this option, floats have consistent precision regardless of optimize
* level.
*/
#if defined(__GNUC__) && defined(__linux__) && defined(__i386__) && \
- __SIZEOF_POINTER__ == 4 && __GNUC__ == 4 && __GNUC_MINOR__ >= 4
+ __SIZEOF_POINTER__ == 4 && \
+ ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
#pragma GCC optimize("float-store")
#endif
@@ -55,7 +56,7 @@
#endif /* M_PI_2 */
#define VECTOR_EPSILON (1e-6)
-#define VECTOR_MAX_SIZE (4)
+#define VECTOR_MAX_SIZE (3)
#define STRING_BUF_SIZE_REPR (110)
#define STRING_BUF_SIZE_STR (103)
#define SWIZZLE_ERR_NO_ERR 0
@@ -96,9 +97,9 @@ static PyTypeObject pgVectorIter_Type;
#define RAD2DEG(angle) ((angle)*180. / M_PI)
typedef struct {
- PyObject_HEAD double *coords; /* Coordinates */
- Py_ssize_t dim; /* Dimension of the vector */
- double epsilon; /* Small value for comparisons */
+ PyObject_HEAD double coords[VECTOR_MAX_SIZE]; /* Coordinates */
+ Py_ssize_t dim; /* Dimension of the vector */
+ double epsilon; /* Small value for comparisons */
} pgVector;
typedef struct {
@@ -594,7 +595,6 @@ pgVector_NEW(Py_ssize_t dim)
static void
vector_dealloc(pgVector *self)
{
- PyMem_Free(self->coords);
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -2152,11 +2152,6 @@ vector2_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (vec != NULL) {
vec->dim = 2;
vec->epsilon = VECTOR_EPSILON;
- vec->coords = PyMem_New(double, vec->dim);
- if (vec->coords == NULL) {
- Py_TYPE(vec)->tp_free((PyObject *)vec);
- return NULL;
- }
}
return (PyObject *)vec;
@@ -2263,7 +2258,7 @@ _vector2_rotate_helper(double *dst_coords, const double *src_coords,
if (fmod(angle + epsilon, M_PI_2) < 2 * epsilon) {
switch ((int)((angle + epsilon) / M_PI_2)) {
case 0: /* 0 degrees */
- case 4: /* 360 degree (see issue 214) */
+ case 4: /* 360 degree (see pygame-ce issue 229) */
dst_coords[0] = src_coords[0];
dst_coords[1] = src_coords[1];
break;
@@ -2590,11 +2585,6 @@ vector3_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (vec != NULL) {
vec->dim = 3;
vec->epsilon = VECTOR_EPSILON;
- vec->coords = PyMem_New(double, vec->dim);
- if (vec->coords == NULL) {
- Py_TYPE(vec)->tp_free((PyObject *)vec);
- return NULL;
- }
}
return (PyObject *)vec;
@@ -2728,7 +2718,7 @@ _vector3_rotate_helper(double *dst_coords, const double *src_coords,
if (fmod(angle + epsilon, M_PI_2) < 2 * epsilon) {
switch ((int)((angle + epsilon) / M_PI_2)) {
case 0: /* 0 degrees */
- case 4: /* 360 degrees (see issue 214) */
+ case 4: /* 360 degrees (see pygame-ce issue 229) */
memcpy(dst_coords, src_coords, 3 * sizeof(src_coords[0]));
break;
case 1: /* 90 degrees */
@@ -3260,7 +3250,8 @@ vector3_cross(pgVector *self, PyObject *other)
pgVector *ret;
double *ret_coords;
double *self_coords;
- double *other_coords;
+ double other_coords_static_mem[3];
+ double *other_coords = (double *)&other_coords_static_mem;
if (!pgVectorCompatible_Check(other, self->dim)) {
PyErr_SetString(PyExc_TypeError, "cannot calculate cross Product");
@@ -3272,21 +3263,13 @@ vector3_cross(pgVector *self, PyObject *other)
other_coords = ((pgVector *)other)->coords;
}
else {
- other_coords = PyMem_New(double, self->dim);
- if (!other_coords) {
- return PyErr_NoMemory();
- }
-
if (!PySequence_AsVectorCoords(other, other_coords, 3)) {
- PyMem_Free(other_coords);
return NULL;
}
}
ret = _vector_subtype_new(self);
if (ret == NULL) {
- if (!pgVector_Check(other))
- PyMem_Free(other_coords);
return NULL;
}
ret_coords = ret->coords;
@@ -3297,9 +3280,6 @@ vector3_cross(pgVector *self, PyObject *other)
ret_coords[2] = ((self_coords[0] * other_coords[1]) -
(self_coords[1] * other_coords[0]));
- if (!pgVector_Check(other))
- PyMem_Free(other_coords);
-
return (PyObject *)ret;
}
@@ -3514,7 +3494,7 @@ static void
vectoriter_dealloc(vectoriter *it)
{
Py_XDECREF(it->vec);
- PyObject_Free(it);
+ Py_TYPE(it)->tp_free(it);
}
static PyObject *
@@ -3593,7 +3573,7 @@ static void
vector_elementwiseproxy_dealloc(vector_elementwiseproxy *it)
{
Py_XDECREF(it->vec);
- PyObject_Free(it);
+ Py_TYPE(it)->tp_free(it);
}
static PyObject *
@@ -3627,13 +3607,9 @@ vector_elementwiseproxy_richcompare(PyObject *o1, PyObject *o2, int op)
dim = vec->dim;
if (pgVectorCompatible_Check(other, dim)) {
- double *other_coords = PyMem_New(double, dim);
+ double other_coords[VECTOR_MAX_SIZE];
- if (other_coords == NULL) {
- return NULL;
- }
if (!PySequence_AsVectorCoords(other, other_coords, dim)) {
- PyMem_Free(other_coords);
return NULL;
}
/* use diff == diff to check for NaN */
@@ -3690,11 +3666,9 @@ vector_elementwiseproxy_richcompare(PyObject *o1, PyObject *o2, int op)
}
break;
default:
- PyMem_Free(other_coords);
PyErr_BadInternalCall();
return NULL;
}
- PyMem_Free(other_coords);
}
else if (RealNumber_Check(other)) {
/* the following PyFloat_AsDouble call should never fail because
diff --git a/src_c/mixer.c b/src_c/mixer.c
index 33caca607d..18e6ee86cc 100644
--- a/src_c/mixer.c
+++ b/src_c/mixer.c
@@ -1160,6 +1160,37 @@ chan_unpause(PyObject *self, PyObject *_null)
Py_RETURN_NONE;
}
+static PyObject *
+chan_set_source_location(PyObject *self, PyObject *args)
+{
+ int channelnum = pgChannel_AsInt(self);
+ Sint16 angle;
+ float angle_f;
+ Uint8 distance;
+ float distance_f;
+ PyThreadState *_save;
+
+ if (!PyArg_ParseTuple(args, "ff", &angle_f, &distance_f))
+ return NULL;
+
+ angle = (Sint16)roundf(fmodf(angle_f, 360));
+ distance_f = roundf(distance_f);
+ if (0 > distance_f || 256 <= distance_f) {
+ return RAISE(PyExc_ValueError,
+ "distance out of range, expected (0, 255)");
+ }
+ distance = (Uint8)distance_f;
+
+ MIXER_INIT_CHECK();
+ _save = PyEval_SaveThread();
+ if (!Mix_SetPosition(channelnum, angle, distance)) {
+ PyEval_RestoreThread(_save);
+ return RAISE(pgExc_SDLError, Mix_GetError());
+ }
+ PyEval_RestoreThread(_save);
+ Py_RETURN_NONE;
+}
+
static PyObject *
chan_set_volume(PyObject *self, PyObject *args)
{
@@ -1290,6 +1321,8 @@ static PyMethodDef channel_methods[] = {
{"pause", (PyCFunction)chan_pause, METH_NOARGS, DOC_MIXER_CHANNEL_PAUSE},
{"unpause", (PyCFunction)chan_unpause, METH_NOARGS,
DOC_MIXER_CHANNEL_UNPAUSE},
+ {"set_source_location", chan_set_source_location, METH_VARARGS,
+ DOC_MIXER_CHANNEL_SETSOURCELOCATION},
{"set_volume", chan_set_volume, METH_VARARGS, DOC_MIXER_CHANNEL_SETVOLUME},
{"get_volume", (PyCFunction)chan_get_volume, METH_NOARGS,
DOC_MIXER_CHANNEL_GETVOLUME},
@@ -1311,7 +1344,7 @@ static PyMethodDef channel_methods[] = {
static void
channel_dealloc(PyObject *self)
{
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
static int
diff --git a/src_c/mouse.c b/src_c/mouse.c
index eba97b246d..4c7b2ea0e9 100644
--- a/src_c/mouse.c
+++ b/src_c/mouse.c
@@ -76,7 +76,6 @@ mouse_get_pos(PyObject *self, PyObject *_null)
if (sdlRenderer != NULL) {
SDL_Rect vprect;
float scalex, scaley;
- int w, h;
SDL_RenderGetScale(sdlRenderer, &scalex, &scaley);
SDL_RenderGetViewport(sdlRenderer, &vprect);
@@ -84,19 +83,17 @@ mouse_get_pos(PyObject *self, PyObject *_null)
x = (int)(x / scalex);
y = (int)(y / scaley);
- SDL_RenderGetLogicalSize(sdlRenderer, &w, &h);
-
x -= vprect.x;
y -= vprect.y;
if (x < 0)
x = 0;
- if (x >= w)
- x = w - 1;
+ if (x >= vprect.w)
+ x = vprect.w - 1;
if (y < 0)
y = 0;
- if (y >= h)
- y = h - 1;
+ if (y >= vprect.h)
+ y = vprect.h - 1;
}
}
diff --git a/src_c/simd_blitters_avx2.c b/src_c/simd_blitters_avx2.c
index c51aee57f1..032e5a3093 100644
--- a/src_c/simd_blitters_avx2.c
+++ b/src_c/simd_blitters_avx2.c
@@ -453,12 +453,8 @@ blit_blend_rgba_mul_avx2(SDL_BlitInfo *info)
0x80, 12, 0x80, 11, 0x80, 10, 0x80, 9, 0x80, 8);
mm_zero = _mm_setzero_si128();
- mm_two_five_fives = _mm_set_epi64x(0x00FF00FF00FF00FF, 0x00FF00FF00FF00FF);
-
- mm256_two_five_fives = _mm256_set_epi8(
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF);
+ mm_two_five_fives = _mm_set1_epi64x(0x00FF00FF00FF00FF);
+ mm256_two_five_fives = _mm256_set1_epi16(0x00FF);
while (height--) {
if (pre_8_width > 0) {
@@ -578,16 +574,12 @@ blit_blend_rgb_mul_avx2(SDL_BlitInfo *info)
0x80, 12, 0x80, 11, 0x80, 10, 0x80, 9, 0x80, 8);
mm_zero = _mm_setzero_si128();
- mm_two_five_fives = _mm_set_epi64x(0x00FF00FF00FF00FF, 0x00FF00FF00FF00FF);
- mm_alpha_mask = _mm_cvtsi32_si128(amask);
- mm256_two_five_fives = _mm256_set_epi8(
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
- 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF);
+ mm_two_five_fives = _mm_set1_epi64x(0x00FF00FF00FF00FF);
+ mm256_two_five_fives = _mm256_set1_epi16(0x00FF);
- mm256_alpha_mask = _mm256_set_epi32(amask, amask, amask, amask, amask,
- amask, amask, amask);
+ mm_alpha_mask = _mm_cvtsi32_si128(amask);
+ mm256_alpha_mask = _mm256_set1_epi32(amask);
while (height--) {
if (pre_8_width > 0) {
@@ -772,8 +764,7 @@ blit_blend_rgb_add_avx2(SDL_BlitInfo *info)
__m256i mm256_src, mm256_dst, mm256_alpha_mask;
mm_alpha_mask = _mm_cvtsi32_si128(amask);
- mm256_alpha_mask = _mm256_set_epi32(amask, amask, amask, amask, amask,
- amask, amask, amask);
+ mm256_alpha_mask = _mm256_set1_epi32(amask);
while (height--) {
if (pre_8_width > 0) {
@@ -925,8 +916,7 @@ blit_blend_rgb_sub_avx2(SDL_BlitInfo *info)
__m256i mm256_src, mm256_dst, mm256_alpha_mask;
mm_alpha_mask = _mm_cvtsi32_si128(amask);
- mm256_alpha_mask = _mm256_set_epi32(amask, amask, amask, amask, amask,
- amask, amask, amask);
+ mm256_alpha_mask = _mm256_set1_epi32(amask);
while (height--) {
if (pre_8_width > 0) {
@@ -1078,8 +1068,7 @@ blit_blend_rgb_max_avx2(SDL_BlitInfo *info)
__m256i mm256_src, mm256_dst, mm256_alpha_mask;
mm_alpha_mask = _mm_cvtsi32_si128(amask);
- mm256_alpha_mask = _mm256_set_epi32(amask, amask, amask, amask, amask,
- amask, amask, amask);
+ mm256_alpha_mask = _mm256_set1_epi32(amask);
while (height--) {
if (pre_8_width > 0) {
@@ -1231,8 +1220,7 @@ blit_blend_rgb_min_avx2(SDL_BlitInfo *info)
__m256i mm256_src, mm256_dst, mm256_alpha_mask;
mm_alpha_mask = _mm_cvtsi32_si128(amask);
- mm256_alpha_mask = _mm256_set_epi32(amask, amask, amask, amask, amask,
- amask, amask, amask);
+ mm256_alpha_mask = _mm256_set1_epi32(amask);
while (height--) {
if (pre_8_width > 0) {
@@ -1351,10 +1339,7 @@ blit_blend_premultiplied_avx2(SDL_BlitInfo *info)
12 + a_index, 0x80, 12 + a_index, 0x80, 12 + a_index, 0x80,
8 + a_index, 0x80, 8 + a_index, 0x80, 8 + a_index, 0x80, 8 + a_index);
- mm256_ones = _mm256_set_epi8(
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01);
+ mm256_ones = _mm256_set1_epi16(0x0001);
while (height--) {
if (pre_8_width > 0) {
diff --git a/src_c/simd_blitters_sse2.c b/src_c/simd_blitters_sse2.c
index 0539517596..0ed96a4847 100644
--- a/src_c/simd_blitters_sse2.c
+++ b/src_c/simd_blitters_sse2.c
@@ -663,7 +663,7 @@ blit_blend_rgba_mul_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_zero, mm_two_five_fives;
mm_zero = _mm_setzero_si128();
- mm_two_five_fives = _mm_set_epi64x(0x00FF00FF00FF00FF, 0x00FF00FF00FF00FF);
+ mm_two_five_fives = _mm_set1_epi64x(0x00FF00FF00FF00FF);
while (height--) {
if (pre_2_width > 0) {
@@ -754,7 +754,7 @@ blit_blend_rgb_mul_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_zero, mm_two_five_fives, mm_alpha_mask;
mm_zero = _mm_setzero_si128();
- mm_two_five_fives = _mm_set_epi64x(0x00FF00FF00FF00FF, 0x00FF00FF00FF00FF);
+ mm_two_five_fives = _mm_set1_epi64x(0x00FF00FF00FF00FF);
mm_alpha_mask = _mm_set_epi64x(0x0000000000000000, amask64);
while (height--) {
@@ -910,7 +910,7 @@ blit_blend_rgb_add_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_alpha_mask;
- mm_alpha_mask = _mm_set_epi32(amask, amask, amask, amask);
+ mm_alpha_mask = _mm_set1_epi32(amask);
while (height--) {
if (pre_4_width > 0) {
@@ -1038,7 +1038,7 @@ blit_blend_rgb_sub_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_alpha_mask;
- mm_alpha_mask = _mm_set_epi32(amask, amask, amask, amask);
+ mm_alpha_mask = _mm_set1_epi32(amask);
while (height--) {
if (pre_4_width > 0) {
@@ -1166,7 +1166,7 @@ blit_blend_rgb_max_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_alpha_mask;
- mm_alpha_mask = _mm_set_epi32(amask, amask, amask, amask);
+ mm_alpha_mask = _mm_set1_epi32(amask);
while (height--) {
if (pre_4_width > 0) {
@@ -1294,7 +1294,7 @@ blit_blend_rgb_min_sse2(SDL_BlitInfo *info)
__m128i mm_src, mm_dst, mm_alpha_mask;
- mm_alpha_mask = _mm_set_epi32(amask, amask, amask, amask);
+ mm_alpha_mask = _mm_set1_epi32(amask);
while (height--) {
if (pre_4_width > 0) {
diff --git a/src_c/static.c b/src_c/static.c
index df6bae3581..4f142148a1 100644
--- a/src_c/static.c
+++ b/src_c/static.c
@@ -5,6 +5,7 @@
#define PYGAMEAPI_JOYSTICK_INTERNAL
#define PYGAMEAPI_BASE_INTERNAL
#define PYGAMEAPI_SURFACE_INTERNAL
+#define PYGAMEAPI_WINDOW_INTERNAL
#define pgSurface_New(surface) (pgSurfaceObject *)pgSurface_New2((surface), 1)
#define pgSurface_NewNoOwn(surface) \
@@ -155,6 +156,9 @@ PyInit_gfxdraw(void);
PyMODINIT_FUNC
PyInit_audio(void);
+PyMODINIT_FUNC
+PyInit__window(void);
+
// pygame_static module
void
@@ -283,6 +287,8 @@ PyInit_pygame_static()
load_submodule("pygame.mixer", PyInit_mixer_music(), "music");
+ load_submodule("pygame._window", PyInit__window(), "_window");
+
return PyModule_Create(&mod_pygame_static);
}
@@ -355,14 +361,14 @@ PyInit_pygame_static()
#undef pgEvent_Type
#undef pgEvent_New
+#include "joystick.c"
+
#include "event.c"
#include "mouse.c"
#include "key.c"
-#include "joystick.c"
-
#include "time.c"
#include "system.c"
@@ -397,3 +403,5 @@ PyInit_pygame_static()
#undef MAX
#undef MIN
#include "scale2x.c"
+
+#include "window.c"
diff --git a/src_c/surface.c b/src_c/surface.c
index b79a758bea..ab16b863ed 100644
--- a/src_c/surface.c
+++ b/src_c/surface.c
@@ -194,9 +194,11 @@ surf_get_height(PyObject *self, PyObject *args);
static PyObject *
surf_get_pitch(PyObject *self, PyObject *args);
static PyObject *
-surf_get_rect(PyObject *self, PyObject *args, PyObject *kwargs);
+surf_get_rect(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames);
static PyObject *
-surf_get_frect(PyObject *self, PyObject *args, PyObject *kwargs);
+surf_get_frect(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames);
static PyObject *
surf_get_width(PyObject *self, PyObject *args);
static PyObject *
@@ -356,9 +358,9 @@ static struct PyMethodDef surface_methods[] = {
{"get_size", surf_get_size, METH_NOARGS, DOC_SURFACE_GETSIZE},
{"get_width", surf_get_width, METH_NOARGS, DOC_SURFACE_GETWIDTH},
{"get_height", surf_get_height, METH_NOARGS, DOC_SURFACE_GETHEIGHT},
- {"get_rect", (PyCFunction)surf_get_rect, METH_VARARGS | METH_KEYWORDS,
+ {"get_rect", (PyCFunction)surf_get_rect, METH_FASTCALL | METH_KEYWORDS,
DOC_SURFACE_GETRECT},
- {"get_frect", (PyCFunction)surf_get_frect, METH_VARARGS | METH_KEYWORDS,
+ {"get_frect", (PyCFunction)surf_get_frect, METH_FASTCALL | METH_KEYWORDS,
DOC_SURFACE_GETFRECT},
{"get_pitch", surf_get_pitch, METH_NOARGS, DOC_SURFACE_GETPITCH},
{"get_bitsize", surf_get_bitsize, METH_NOARGS, DOC_SURFACE_GETBITSIZE},
@@ -730,7 +732,8 @@ surface_init(pgSurfaceObject *self, PyObject *args, PyObject *kwds)
* could cause issues.
* pygame Surfaces are supposed to be (0, 0, 0, 255) by default.
* This is a simple fix to fill it with (0, 0, 0, 255) if necessary.
- * See Github issue: https://github.com/pygame/pygame/issues/1395
+ * See Github issue:
+ * https://github.com/pygame-community/pygame-ce/issues/796
*/
if (Amask != 0) {
SDL_FillRect(surface, NULL,
@@ -1489,6 +1492,7 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
/* will be updated later, initialize to make static analyzer happy
*/
int bpp = 0;
+ SDL_Palette *palette = SDL_AllocPalette(default_palette_size);
SDL_PixelFormat format;
memcpy(&format, surf->format, sizeof(format));
@@ -1582,14 +1586,30 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
format.BytesPerPixel = (bpp + 7) / 8;
if (format.BitsPerPixel > 8)
/* Allow a 8 bit source surface with an empty palette to be
- * converted to a format without a palette (Issue #131).
- * If the target format has a non-NULL palette pointer then
- * SDL_ConvertSurface checks that the palette is not empty--
- * that at least one entry is not black.
+ * converted to a format without a palette (pygame-ce issue
+ * #146). If the target format has a non-NULL palette pointer
+ * then SDL_ConvertSurface checks that the palette is not
+ * empty-- that at least one entry is not black.
*/
format.palette = NULL;
+ if (SDL_ISPIXELFORMAT_INDEXED(SDL_MasksToPixelFormatEnum(
+ format.BitsPerPixel, format.Rmask, format.Gmask,
+ format.Bmask, format.Amask))) {
+ if (SDL_ISPIXELFORMAT_INDEXED(surf->format->format)) {
+ SDL_SetPixelFormatPalette(&format, surf->format->palette);
+ }
+ else {
+ /* Give the surface something other than an all white
+ * palette.
+ */
+ SDL_SetPaletteColors(palette, default_palette_colors, 0,
+ default_palette_size);
+ SDL_SetPixelFormatPalette(&format, palette);
+ }
+ }
newsurf = SDL_ConvertSurface(surf, &format, 0);
SDL_SetSurfaceBlendMode(newsurf, SDL_BLENDMODE_NONE);
+ SDL_FreePalette(palette);
}
}
else {
@@ -2532,26 +2552,24 @@ surf_get_height(PyObject *self, PyObject *_null)
return PyLong_FromLong(surf->h);
}
-static PyObject *
-surf_get_rect(PyObject *self, PyObject *args, PyObject *kwargs)
+static inline PyObject *
+_get_rect_helper(PyObject *rect, PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames, char *type)
{
- PyObject *rect;
- SDL_Surface *surf = pgSurface_AsSurface(self);
-
- if (PyTuple_GET_SIZE(args) > 0) {
- return RAISE(PyExc_TypeError,
- "get_rect only accepts keyword arguments");
+ if (nargs > 0) {
+ Py_DECREF(rect);
+ return PyErr_Format(PyExc_TypeError,
+ "get_%s only accepts keyword arguments", type);
}
- SURF_INIT_CHECK(surf)
-
- rect = pgRect_New4(0, 0, surf->w, surf->h);
- if (rect && kwargs) {
- PyObject *key, *value;
- Py_ssize_t pos = 0;
+ if (rect && kwnames) {
+ Py_ssize_t i, sequence_len;
+ PyObject **sequence_items;
+ sequence_items = PySequence_Fast_ITEMS(kwnames);
+ sequence_len = PyTuple_GET_SIZE(kwnames);
- while (PyDict_Next(kwargs, &pos, &key, &value)) {
- if ((PyObject_SetAttr(rect, key, value) == -1)) {
+ for (i = 0; i < sequence_len; ++i) {
+ if ((PyObject_SetAttr(rect, sequence_items[i], args[i]) == -1)) {
Py_DECREF(rect);
return NULL;
}
@@ -2561,31 +2579,27 @@ surf_get_rect(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
-surf_get_frect(PyObject *self, PyObject *args, PyObject *kwargs)
+surf_get_rect(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames)
{
- PyObject *rect;
SDL_Surface *surf = pgSurface_AsSurface(self);
+ SURF_INIT_CHECK(surf)
- if (PyTuple_GET_SIZE(args) > 0) {
- return RAISE(PyExc_TypeError,
- "get_frect only accepts keyword arguments");
- }
+ PyObject *rect = pgRect_New4(0, 0, surf->w, surf->h);
+
+ return _get_rect_helper(rect, args, nargs, kwnames, "rect");
+}
+static PyObject *
+surf_get_frect(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
+ PyObject *kwnames)
+{
+ SDL_Surface *surf = pgSurface_AsSurface(self);
SURF_INIT_CHECK(surf)
- rect = pgFRect_New4(0.f, 0.f, (float)surf->w, (float)surf->h);
- if (rect && kwargs) {
- PyObject *key, *value;
- Py_ssize_t pos = 0;
+ PyObject *rect = pgFRect_New4(0.f, 0.f, (float)surf->w, (float)surf->h);
- while (PyDict_Next(kwargs, &pos, &key, &value)) {
- if ((PyObject_SetAttr(rect, key, value) == -1)) {
- Py_DECREF(rect);
- return NULL;
- }
- }
- }
- return rect;
+ return _get_rect_helper(rect, args, nargs, kwnames, "frect");
}
static PyObject *
diff --git a/src_c/surflock.c b/src_c/surflock.c
index cf63e22cd9..ad7919ae0c 100644
--- a/src_c/surflock.c
+++ b/src_c/surflock.c
@@ -190,7 +190,7 @@ _lifelock_dealloc(PyObject *self)
pgSurface_UnlockBy((pgSurfaceObject *)lifelock->surface,
lifelock->lockobj);
Py_DECREF(lifelock->surface);
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
static PyObject *
diff --git a/src_c/time.c b/src_c/time.c
index f1ca641bf5..eb237cae8b 100644
--- a/src_c/time.c
+++ b/src_c/time.c
@@ -463,7 +463,7 @@ clock_dealloc(PyObject *self)
{
PyClockObject *_clock = (PyClockObject *)self;
Py_XDECREF(_clock->rendered);
- PyObject_Free(self);
+ Py_TYPE(self)->tp_free(self);
}
PyObject *
diff --git a/src_c/transform.c b/src_c/transform.c
index c251f55130..3549b6a912 100644
--- a/src_c/transform.c
+++ b/src_c/transform.c
@@ -413,6 +413,7 @@ scale_to(pgSurfaceObject *srcobj, pgSurfaceObject *dstobj, int width,
{
SDL_Surface *src = NULL;
SDL_Surface *retsurf = NULL;
+ SDL_Surface *modsurf = NULL;
int stretch_result_num = 0;
if (width < 0 || height < 0)
@@ -421,12 +422,32 @@ scale_to(pgSurfaceObject *srcobj, pgSurfaceObject *dstobj, int width,
src = pgSurface_AsSurface(srcobj);
if (!dstobj) {
- retsurf = newsurf_fromsurf(src, width, height);
+ modsurf = retsurf = newsurf_fromsurf(src, width, height);
if (!retsurf)
return NULL;
}
else {
- retsurf = pgSurface_AsSurface(dstobj);
+ modsurf = retsurf = pgSurface_AsSurface(dstobj);
+ if (retsurf->format->BytesPerPixel != src->format->BytesPerPixel ||
+ retsurf->format->Rmask != src->format->Rmask ||
+ retsurf->format->Gmask != src->format->Gmask ||
+ retsurf->format->Bmask != src->format->Bmask) {
+ return RAISE(PyExc_ValueError,
+ "Source and destination surfaces need to be "
+ "compatible formats.");
+ }
+
+ /* If the surface formats are otherwise compatible but the alpha is
+ * not the same, use a proxy surface to modify the pixels of the
+ * existing dstobj return surface. Otherwise SDL_SoftStretch
+ * rejects the input.
+ * For example, RGBA and RGBX surfaces are compatible in this way. */
+ if (retsurf->format->Amask != src->format->Amask) {
+ modsurf = SDL_CreateRGBSurfaceWithFormatFrom(
+ retsurf->pixels, retsurf->w, retsurf->h,
+ retsurf->format->BitsPerPixel, retsurf->pitch,
+ src->format->format);
+ }
}
if (retsurf->w != width || retsurf->h != height) {
@@ -442,11 +463,15 @@ scale_to(pgSurfaceObject *srcobj, pgSurfaceObject *dstobj, int width,
pgSurface_Lock(srcobj);
Py_BEGIN_ALLOW_THREADS;
- stretch_result_num = SDL_SoftStretch(src, NULL, retsurf, NULL);
+ stretch_result_num = SDL_SoftStretch(src, NULL, modsurf, NULL);
Py_END_ALLOW_THREADS;
pgSurface_Unlock(srcobj);
+ if (modsurf != retsurf) {
+ SDL_FreeSurface(modsurf);
+ }
+
if (stretch_result_num < 0) {
return (SDL_Surface *)(RAISE(pgExc_SDLError, SDL_GetError()));
}
@@ -3144,6 +3169,19 @@ blur(pgSurfaceObject *srcobj, pgSurfaceObject *dstobj, int radius,
retsurf = pgSurface_AsSurface(dstobj);
}
+ Uint8 *ret_start = retsurf->pixels;
+ Uint8 *ret_end = ret_start + retsurf->h * retsurf->pitch;
+ Uint8 *src_start = src->pixels;
+ Uint8 *src_end = src_start + src->h * src->pitch;
+ if ((ret_start <= src_start && ret_end >= src_start) ||
+ (src_start <= ret_start && src_end >= ret_start)) {
+ return RAISE(
+ PyExc_ValueError,
+ "Blur routines do not support dest_surfaces that share pixels "
+ "with the source surface. Likely the surfaces are the same, one "
+ "of them is a subsurface, or they are sharing the same buffer.");
+ }
+
if ((retsurf->w) != (src->w) || (retsurf->h) != (src->h)) {
return RAISE(PyExc_ValueError,
"Destination surface not the same size.");
diff --git a/src_c/window.c b/src_c/window.c
new file mode 100644
index 0000000000..c0a2cf5051
--- /dev/null
+++ b/src_c/window.c
@@ -0,0 +1,803 @@
+#define PYGAMEAPI_WINDOW_INTERNAL
+
+#include "pygame.h"
+
+#include "pgcompat.h"
+
+#include "doc/sdl2_video_doc.h"
+
+#ifndef PYGAMEAPI_DISPLAY_INTERNAL // to pass the static check
+// Copied from display.c
+#if !defined(__APPLE__)
+static char *icon_defaultname = "pygame_icon.bmp";
+static int icon_colorkey = 0;
+#else
+static char *icon_defaultname = "pygame_icon_mac.bmp";
+static int icon_colorkey = -1;
+#endif
+
+static char *pkgdatamodule_name = "pygame.pkgdata";
+static char *imagemodule_name = "pygame.image";
+static char *resourcefunc_name = "getResource";
+static char *load_basicfunc_name = "load_basic";
+
+// Copied from display.c
+static void
+pg_close_file(PyObject *fileobj)
+{
+ PyObject *result = PyObject_CallMethod(fileobj, "close", NULL);
+ if (result) {
+ Py_DECREF(result);
+ }
+ else {
+ PyErr_Clear();
+ }
+}
+
+// Copied from display.c
+static PyObject *
+pg_display_resource(char *filename)
+{
+ PyObject *imagemodule = NULL;
+ PyObject *load_basicfunc = NULL;
+ PyObject *pkgdatamodule = NULL;
+ PyObject *resourcefunc = NULL;
+ PyObject *fresult = NULL;
+ PyObject *result = NULL;
+ PyObject *name = NULL;
+
+ pkgdatamodule = PyImport_ImportModule(pkgdatamodule_name);
+ if (!pkgdatamodule)
+ goto display_resource_end;
+
+ resourcefunc = PyObject_GetAttrString(pkgdatamodule, resourcefunc_name);
+ if (!resourcefunc)
+ goto display_resource_end;
+
+ imagemodule = PyImport_ImportModule(imagemodule_name);
+ if (!imagemodule)
+ goto display_resource_end;
+
+ load_basicfunc = PyObject_GetAttrString(imagemodule, load_basicfunc_name);
+ if (!load_basicfunc)
+ goto display_resource_end;
+
+ fresult = PyObject_CallFunction(resourcefunc, "s", filename);
+ if (!fresult)
+ goto display_resource_end;
+
+ name = PyObject_GetAttrString(fresult, "name");
+ if (name != NULL) {
+ if (PyUnicode_Check(name)) {
+ pg_close_file(fresult);
+ Py_DECREF(fresult);
+ fresult = name;
+ name = NULL;
+ }
+ }
+ else {
+ PyErr_Clear();
+ }
+
+ result = PyObject_CallFunction(load_basicfunc, "O", fresult);
+ if (!result)
+ goto display_resource_end;
+
+display_resource_end:
+ Py_XDECREF(pkgdatamodule);
+ Py_XDECREF(resourcefunc);
+ Py_XDECREF(imagemodule);
+ Py_XDECREF(load_basicfunc);
+ Py_XDECREF(fresult);
+ Py_XDECREF(name);
+ return result;
+}
+
+#endif // PYGAMEAPI_DISPLAY_INTERNAL
+
+static PyTypeObject pgWindow_Type;
+
+#define pgWindow_Check(x) \
+ (PyObject_IsInstance((x), (PyObject *)&pgWindow_Type))
+
+static PyObject *
+get_grabbed_window(PyObject *self, PyObject *_null)
+{
+ SDL_Window *grabbed = SDL_GetGrabbedWindow();
+ PyObject *win_obj = NULL;
+ if (grabbed) {
+ win_obj = SDL_GetWindowData(grabbed, "pg_window");
+ if (!win_obj) {
+ Py_RETURN_NONE;
+ }
+ Py_INCREF(win_obj);
+ return win_obj;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_destroy(pgWindowObject *self, PyObject *_null)
+{
+ if (self->_win) {
+ SDL_DestroyWindow(self->_win);
+ self->_win = NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_set_windowed(pgWindowObject *self, PyObject *_null)
+{
+ if (SDL_SetWindowFullscreen(self->_win, 0)) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_set_fullscreen(pgWindowObject *self, PyObject *args, PyObject *kwargs)
+{
+ SDL_bool desktop = SDL_FALSE;
+ int flags = SDL_WINDOW_FULLSCREEN;
+ char *kwids[] = {"desktop", NULL};
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p", kwids, &desktop)) {
+ return NULL;
+ }
+ if (desktop) {
+ flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
+ }
+ if (SDL_SetWindowFullscreen(self->_win, flags)) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_focus(pgWindowObject *self, PyObject *args, PyObject *kwargs)
+{
+ SDL_bool input_only = SDL_FALSE;
+ char *kwids[] = {"input_only", NULL};
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p", kwids, &input_only)) {
+ return NULL;
+ }
+ if (input_only) {
+ if (SDL_SetWindowInputFocus(self->_win)) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ }
+ else {
+ SDL_RaiseWindow(self->_win);
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_hide(pgWindowObject *self, PyObject *_null)
+{
+ SDL_HideWindow(self->_win);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_show(pgWindowObject *self, PyObject *_null)
+{
+ SDL_ShowWindow(self->_win);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_restore(pgWindowObject *self, PyObject *_null)
+{
+ SDL_RestoreWindow(self->_win);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_maximize(pgWindowObject *self, PyObject *_null)
+{
+ SDL_MaximizeWindow(self->_win);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_minimize(pgWindowObject *self, PyObject *_null)
+{
+ SDL_MinimizeWindow(self->_win);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_set_modal_for(pgWindowObject *self, PyObject *arg)
+{
+ if (!pgWindow_Check(arg)) {
+ return RAISE(PyExc_TypeError,
+ "Argument to set_modal_for must be a Window.");
+ }
+ if (!SDL_SetWindowModalFor(self->_win, ((pgWindowObject *)arg)->_win)) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+window_set_icon(pgWindowObject *self, PyObject *arg)
+{
+ if (!pgSurface_Check(arg)) {
+ return RAISE(PyExc_TypeError,
+ "Argument to set_icon must be a Surface.");
+ }
+ SDL_SetWindowIcon(self->_win, pgSurface_AsSurface(arg));
+ Py_RETURN_NONE;
+}
+
+static int
+window_set_grab(pgWindowObject *self, PyObject *arg, void *v)
+{
+ int enable = PyObject_IsTrue(arg);
+ if (enable == -1)
+ return -1;
+
+ SDL_SetWindowGrab(self->_win, enable);
+
+ return 0;
+}
+
+static PyObject *
+window_get_grab(pgWindowObject *self, void *v)
+{
+ return PyBool_FromLong(SDL_GetWindowGrab(self->_win));
+}
+
+static int
+window_set_title(pgWindowObject *self, PyObject *arg, void *v)
+{
+ const char *title;
+ if (!PyUnicode_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "Argument to set_title must be a str.");
+ return -1;
+ }
+ title = PyUnicode_AsUTF8(arg);
+ SDL_SetWindowTitle(self->_win, title);
+ return 0;
+}
+
+static PyObject *
+window_get_title(pgWindowObject *self, void *v)
+{
+ const char *title = SDL_GetWindowTitle(self->_win);
+ return PyUnicode_FromString(title);
+}
+
+static int
+window_set_resizable(pgWindowObject *self, PyObject *arg, void *v)
+{
+ int enable = PyObject_IsTrue(arg);
+ if (enable == -1)
+ return -1;
+
+ SDL_SetWindowResizable(self->_win, enable);
+
+ return 0;
+}
+
+static PyObject *
+window_get_resizable(pgWindowObject *self, void *v)
+{
+ return PyBool_FromLong(SDL_GetWindowFlags(self->_win) &
+ SDL_WINDOW_RESIZABLE);
+}
+
+static int
+window_set_borderless(pgWindowObject *self, PyObject *arg, void *v)
+{
+ int enable = PyObject_IsTrue(arg);
+ if (enable == -1)
+ return -1;
+
+ SDL_SetWindowBordered(self->_win, !enable);
+
+ return 0;
+}
+
+static PyObject *
+window_get_borderless(pgWindowObject *self, void *v)
+{
+ return PyBool_FromLong(SDL_GetWindowFlags(self->_win) &
+ SDL_WINDOW_BORDERLESS);
+}
+
+static PyObject *
+window_get_window_id(pgWindowObject *self, PyObject *_null)
+{
+ Uint32 window_id = SDL_GetWindowID(self->_win);
+ if (!window_id) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ return PyLong_FromLong(window_id);
+}
+
+static int
+window_set_size(pgWindowObject *self, PyObject *arg, void *v)
+{
+ int w, h;
+
+ if (!pg_TwoIntsFromObj(arg, &w, &h)) {
+ PyErr_SetString(PyExc_TypeError, "invalid size argument");
+ return -1;
+ }
+
+ if (w <= 0 || h <= 0) {
+ PyErr_SetString(
+ PyExc_ValueError,
+ "width or height should not be less than or equal to zero.");
+ return -1;
+ }
+
+ SDL_SetWindowSize(self->_win, w, h);
+
+ return 0;
+}
+
+static PyObject *
+window_get_size(pgWindowObject *self, void *v)
+{
+ int w, h;
+ PyObject *out = NULL;
+
+ SDL_GetWindowSize(self->_win, &w, &h);
+ out = Py_BuildValue("(ii)", w, h);
+
+ if (!out)
+ return NULL;
+
+ return out;
+}
+
+static int
+window_set_position(pgWindowObject *self, PyObject *arg, void *v)
+{
+ int x, y;
+
+ if (PyLong_Check(arg)) {
+ x = y = PyLong_AsLong(arg);
+ if (x != SDL_WINDOWPOS_CENTERED && x != SDL_WINDOWPOS_UNDEFINED) {
+ PyErr_SetString(PyExc_TypeError, "invalid position argument");
+ return -1;
+ }
+ }
+ else if (!pg_TwoIntsFromObj(arg, &x, &y)) {
+ PyErr_SetString(PyExc_TypeError, "invalid position argument");
+ return -1;
+ }
+
+ SDL_SetWindowPosition(self->_win, x, y);
+
+ return 0;
+}
+
+static PyObject *
+window_get_position(pgWindowObject *self, void *v)
+{
+ int x, y;
+ PyObject *out = NULL;
+
+ SDL_GetWindowPosition(self->_win, &x, &y);
+ out = Py_BuildValue("(ii)", x, y);
+
+ if (!out)
+ return NULL;
+
+ return out;
+}
+
+static int
+window_set_opacity(pgWindowObject *self, PyObject *arg, void *v)
+{
+ float opacity;
+ opacity = (float)PyFloat_AsDouble(arg);
+ if (PyErr_Occurred()) {
+ return -1;
+ }
+ if (SDL_SetWindowOpacity(self->_win, opacity)) {
+ PyErr_SetString(pgExc_SDLError, SDL_GetError());
+ return -1;
+ }
+ return 0;
+}
+
+static PyObject *
+window_get_opacity(pgWindowObject *self, void *v)
+{
+ float opacity;
+ if (SDL_GetWindowOpacity(self->_win, &opacity)) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ return PyFloat_FromDouble((double)opacity);
+}
+
+static PyObject *
+window_get_display_index(pgWindowObject *self, PyObject *_null)
+{
+ int index = SDL_GetWindowDisplayIndex(self->_win);
+ if (index < 0) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+ return PyLong_FromLong(index);
+}
+
+static PyObject *
+mouse_get_relative_mode(pgWindowObject *self, void *v)
+{
+ return PyBool_FromLong(SDL_GetRelativeMouseMode());
+}
+
+static int
+mouse_set_relative_mode(pgWindowObject *self, PyObject *arg, void *v)
+{
+ SDL_bool mode = SDL_FALSE;
+ if (PyObject_IsTrue(arg)) {
+ mode = SDL_TRUE;
+ }
+ if (SDL_SetRelativeMouseMode(mode)) {
+ PyErr_SetString(pgExc_SDLError, SDL_GetError());
+ return -1;
+ }
+ return 0;
+}
+
+static void
+window_dealloc(pgWindowObject *self, PyObject *_null)
+{
+ if (!self->_is_borrowed && self->_win) {
+ SDL_DestroyWindow(self->_win);
+ }
+ Py_TYPE(self)->tp_free(self);
+}
+
+static int
+window_init(pgWindowObject *self, PyObject *args, PyObject *kwargs)
+{
+ char *title = "pygame window";
+ PyObject *size = NULL;
+ int size_w = 640, size_h = 480;
+ PyObject *position = NULL;
+ int pos_x = SDL_WINDOWPOS_UNDEFINED;
+ int pos_y = SDL_WINDOWPOS_UNDEFINED;
+ Uint32 flags = 0;
+ SDL_Window *_win = NULL;
+
+ Py_ssize_t dict_pos = 0;
+ PyObject *_key, *_value, *_kw;
+ const char *_key_str;
+ int _value_bool;
+
+ _kw = PyDict_New();
+ if (!_kw)
+ return -1;
+
+ if (kwargs) {
+ while (PyDict_Next(kwargs, &dict_pos, &_key, &_value)) {
+ if (!PyUnicode_Check(_key)) {
+ PyErr_SetString(PyExc_TypeError, "keywords must be strings");
+ return -1;
+ }
+
+ _key_str = PyUnicode_AsUTF8(_key);
+ if (!_key_str)
+ return -1;
+
+ if (!strcmp(_key_str, "title") || !strcmp(_key_str, "size") ||
+ !strcmp(_key_str, "position")) {
+ PyDict_SetItem(_kw, _key, _value);
+ }
+
+ // handle **flags
+ else {
+ _value_bool = PyObject_IsTrue(_value);
+ if (_value_bool == -1)
+ return -1;
+
+ if (!strcmp(_key_str, "opengl")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_OPENGL;
+ }
+ else if (!strcmp(_key_str, "fullscreen")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_FULLSCREEN;
+ }
+ else if (!strcmp(_key_str, "fullscreen_desktop")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+ }
+ else if (!strcmp(_key_str, "hidden")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_HIDDEN;
+ }
+ else if (!strcmp(_key_str, "borderless")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_BORDERLESS;
+ }
+ else if (!strcmp(_key_str, "resizable")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_RESIZABLE;
+ }
+ else if (!strcmp(_key_str, "minimized")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_MINIMIZED;
+ }
+ else if (!strcmp(_key_str, "maximized")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_MAXIMIZED;
+ }
+ else if (!strcmp(_key_str, "input_grabbed")) {
+ if (_value_bool)
+#if SDL_VERSION_ATLEAST(2, 0, 16)
+ flags |= SDL_WINDOW_MOUSE_GRABBED;
+#else
+ flags |= SDL_WINDOW_INPUT_GRABBED;
+#endif
+ }
+ else if (!strcmp(_key_str, "input_focus")) {
+ if (_value_bool) {
+ flags |= SDL_WINDOW_INPUT_FOCUS;
+ }
+ }
+ else if (!strcmp(_key_str, "mouse_focus")) {
+ if (_value_bool) {
+ flags |= SDL_WINDOW_MOUSE_FOCUS;
+ }
+ }
+ else if (!strcmp(_key_str, "foreign")) {
+ if (_value_bool) {
+ flags |= SDL_WINDOW_FOREIGN;
+ }
+ }
+ else if (!strcmp(_key_str, "allow_high_dpi")) {
+ if (_value_bool) {
+ flags |= SDL_WINDOW_ALLOW_HIGHDPI;
+ }
+ }
+ else if (!strcmp(_key_str, "mouse_capture")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_MOUSE_CAPTURE;
+ }
+ else if (!strcmp(_key_str, "always_on_top")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_ALWAYS_ON_TOP;
+ }
+ else if (!strcmp(_key_str, "skip_taskbar")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_SKIP_TASKBAR;
+ }
+ else if (!strcmp(_key_str, "utility")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_UTILITY;
+ }
+ else if (!strcmp(_key_str, "tooltip")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_TOOLTIP;
+ }
+ else if (!strcmp(_key_str, "popup_menu")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_POPUP_MENU;
+ }
+ else if (!strcmp(_key_str, "vulkan")) {
+ if (_value_bool)
+ flags |= SDL_WINDOW_VULKAN;
+ }
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "__init__ got an unexpected flag \'%s\'",
+ _key_str);
+ return -1;
+ }
+ }
+ }
+ }
+
+ char *kwids[] = {"title", "size", "position", NULL};
+ if (!PyArg_ParseTupleAndKeywords(args, _kw, "|sOO", kwids, &title, &size,
+ &position)) {
+ return -1;
+ }
+
+ if (size) {
+ if (!pg_TwoIntsFromObj(size, &size_w, &size_h)) {
+ PyErr_SetString(PyExc_TypeError, "invalid size argument");
+ return -1;
+ }
+ }
+
+ if (size_w <= 0 || size_h <= 0) {
+ PyErr_SetString(
+ PyExc_ValueError,
+ "width or height should not be less than or equal to zero.");
+ return -1;
+ }
+
+ if (position) {
+ if (Py_TYPE(position) == &PyLong_Type) {
+ pos_x = pos_y = PyLong_AsLong(position);
+ if (pos_x != SDL_WINDOWPOS_CENTERED &&
+ pos_x != SDL_WINDOWPOS_UNDEFINED) {
+ PyErr_SetString(PyExc_TypeError, "invalid positon argument");
+ return -1;
+ }
+ }
+ else if (!pg_TwoIntsFromObj(position, &pos_x, &pos_y)) {
+ PyErr_SetString(PyExc_TypeError, "invalid positon argument");
+ return -1;
+ }
+ }
+
+ _win = SDL_CreateWindow(title, pos_x, pos_y, size_w, size_h, flags);
+ if (!_win) {
+ PyErr_SetString(pgExc_SDLError, SDL_GetError());
+ return -1;
+ }
+ self->_win = _win;
+ self->_is_borrowed = SDL_FALSE;
+
+ SDL_SetWindowData(_win, "pg_window", self);
+
+ PyObject *icon = pg_display_resource(icon_defaultname);
+ if (!icon) {
+ return -1;
+ }
+ if (icon_colorkey != -1) {
+ if (SDL_SetColorKey(pgSurface_AsSurface(icon), SDL_TRUE,
+ icon_colorkey) < 0) {
+ PyErr_SetString(pgExc_SDLError, SDL_GetError());
+ return -1;
+ }
+ }
+ SDL_SetWindowIcon(self->_win, pgSurface_AsSurface(icon));
+
+ return 0;
+}
+
+static PyObject *
+window_from_display_module(PyTypeObject *cls, PyObject *_null)
+{
+ SDL_Window *window;
+ pgWindowObject *self;
+ window = pg_GetDefaultWindow();
+ if (!window) {
+ return RAISE(pgExc_SDLError, SDL_GetError());
+ }
+
+ self = (pgWindowObject *)(cls->tp_new(cls, NULL, NULL));
+ self->_win = window;
+ self->_is_borrowed = SDL_TRUE;
+ SDL_SetWindowData(window, "pg_window", self);
+ return (PyObject *)self;
+}
+
+static PyMethodDef window_methods[] = {
+ {"destroy", (PyCFunction)window_destroy, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_DESTROY},
+ {"set_windowed", (PyCFunction)window_set_windowed, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_SETWINDOWED},
+ {"set_fullscreen", (PyCFunction)window_set_fullscreen,
+ METH_VARARGS | METH_KEYWORDS, DOC_SDL2_VIDEO_WINDOW_SETFULLSCREEN},
+ {"focus", (PyCFunction)window_focus, METH_VARARGS | METH_KEYWORDS,
+ DOC_SDL2_VIDEO_WINDOW_FOCUS},
+ {"hide", (PyCFunction)window_hide, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_HIDE},
+ {"show", (PyCFunction)window_show, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_SHOW},
+ {"restore", (PyCFunction)window_restore, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_RESTORE},
+ {"maximize", (PyCFunction)window_maximize, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_MAXIMIZE},
+ {"minimize", (PyCFunction)window_minimize, METH_NOARGS,
+ DOC_SDL2_VIDEO_WINDOW_MINIMIZE},
+ {"set_modal_for", (PyCFunction)window_set_modal_for, METH_O,
+ DOC_SDL2_VIDEO_WINDOW_SETMODALFOR},
+ {"set_icon", (PyCFunction)window_set_icon, METH_O,
+ DOC_SDL2_VIDEO_WINDOW_SETICON},
+ {"from_display_module", (PyCFunction)window_from_display_module,
+ METH_CLASS | METH_NOARGS, DOC_SDL2_VIDEO_WINDOW_FROMDISPLAYMODULE},
+ {NULL, NULL, 0, NULL}};
+
+static PyGetSetDef _window_getset[] = {
+ {"grab", (getter)window_get_grab, (setter)window_set_grab,
+ DOC_SDL2_VIDEO_WINDOW_GRAB, NULL},
+ {"title", (getter)window_get_title, (setter)window_set_title,
+ DOC_SDL2_VIDEO_WINDOW_TITLE, NULL},
+ {"resizable", (getter)window_get_resizable, (setter)window_set_resizable,
+ DOC_SDL2_VIDEO_WINDOW_RESIZABLE, NULL},
+ {"borderless", (getter)window_get_borderless,
+ (setter)window_set_borderless, DOC_SDL2_VIDEO_WINDOW_BORDERLESS, NULL},
+ {"relative_mouse", (getter)mouse_get_relative_mode,
+ (setter)mouse_set_relative_mode, DOC_SDL2_VIDEO_WINDOW_RELATIVEMOUSE,
+ NULL},
+ {"size", (getter)window_get_size, (setter)window_set_size,
+ DOC_SDL2_VIDEO_WINDOW_SIZE, NULL},
+ {"position", (getter)window_get_position, (setter)window_set_position,
+ DOC_SDL2_VIDEO_WINDOW_POSITION, NULL},
+ {"opacity", (getter)window_get_opacity, (setter)window_set_opacity,
+ DOC_SDL2_VIDEO_WINDOW_OPACITY, NULL},
+ {"display_index", (getter)window_get_display_index, NULL,
+ DOC_SDL2_VIDEO_WINDOW_DISPLAYINDEX, NULL},
+ {"id", (getter)window_get_window_id, NULL, DOC_SDL2_VIDEO_WINDOW_ID, NULL},
+ {NULL, 0, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyTypeObject pgWindow_Type = {
+ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "pygame._window.Window",
+ .tp_basicsize = sizeof(pgWindowObject),
+ .tp_dealloc = (destructor)window_dealloc,
+ .tp_doc = DOC_SDL2_VIDEO_WINDOW,
+ .tp_methods = window_methods,
+ .tp_init = (initproc)window_init,
+ .tp_new = PyType_GenericNew,
+ .tp_getset = _window_getset};
+
+static PyMethodDef _window_methods[] = {
+ {"get_grabbed_window", (PyCFunction)get_grabbed_window, METH_NOARGS,
+ DOC_SDL2_VIDEO_GETGRABBEDWINDOW},
+ {NULL, NULL, 0, NULL}};
+
+MODINIT_DEFINE(_window)
+{
+ PyObject *module, *apiobj;
+ static void *c_api[PYGAMEAPI_WINDOW_NUMSLOTS];
+
+ static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
+ "_window",
+ "docs_needed",
+ -1,
+ _window_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL};
+
+ /* imported needed apis; Do this first so if there is an error
+ the module is not loaded.
+ */
+ import_pygame_base();
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
+
+ import_pygame_surface();
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
+
+ import_pygame_rect();
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
+
+ if (PyType_Ready(&pgWindow_Type) < 0) {
+ return NULL;
+ }
+
+ /* create the module */
+ module = PyModule_Create(&_module);
+ if (module == 0) {
+ return NULL;
+ }
+
+ Py_INCREF(&pgWindow_Type);
+ if (PyModule_AddObject(module, "Window", (PyObject *)&pgWindow_Type)) {
+ Py_DECREF(&pgWindow_Type);
+ Py_DECREF(module);
+ return NULL;
+ }
+
+ c_api[0] = &pgWindow_Type;
+ apiobj = encapsulate_api(c_api, "_window");
+ if (PyModule_AddObject(module, PYGAMEAPI_LOCAL_ENTRY, apiobj)) {
+ Py_XDECREF(apiobj);
+ Py_DECREF(module);
+ return NULL;
+ }
+
+ return module;
+}
diff --git a/src_py/__init__.py b/src_py/__init__.py
index 1412345538..5b6cad82e1 100644
--- a/src_py/__init__.py
+++ b/src_py/__init__.py
@@ -25,6 +25,7 @@
import os
import sys
+import platform
# Choose Windows display driver
if os.name == "nt":
@@ -378,12 +379,13 @@ def __color_reduce(c):
copyreg.pickle(Color, __color_reduce, __color_constructor)
-# Thanks for supporting pygame. Without support now, there won't be pygame later.
+# Thanks for supporting pygame-ce.
+# Without support now, there won't be pygame-ce later.
if "PYGAME_HIDE_SUPPORT_PROMPT" not in os.environ:
print(
- "pygame-ce {} (SDL {}.{}.{}, Python {}.{}.{})".format( # pylint: disable=consider-using-f-string
- ver, *get_sdl_version() + sys.version_info[0:3]
- )
+ f"pygame-ce {ver} (SDL {'.'.join(map(str, get_sdl_version()))}, "
+ f"Python {platform.python_version()})"
)
+
# cleanup namespace
-del pygame, os, sys, MissingModule, copyreg, packager_imports
+del pygame, os, sys, platform, MissingModule, copyreg, packager_imports
diff --git a/src_py/_camera_vidcapture.py b/src_py/_camera_vidcapture.py
deleted file mode 100644
index 56df43d544..0000000000
--- a/src_py/_camera_vidcapture.py
+++ /dev/null
@@ -1,117 +0,0 @@
-"""pygame.camera.Camera implementation using the videocapture module for windows.
-
-http://videocapture.sourceforge.net/
-
-Binary windows wheels:
- https://www.lfd.uci.edu/~gohlke/pythonlibs/#videocapture
-"""
-import pygame
-
-
-def list_cameras():
- """Always only lists one camera.
-
- Functionality not supported in videocapture module.
- """
- return [0]
-
- # this just cycles through all the cameras trying to open them
- # cameras = []
- # for x in range(256):
- # try:
- # c = Camera(x)
- # except:
- # break
- # cameras.append(x)
- # return cameras
-
-
-def init():
- global vidcap
- try:
- import vidcap as vc
- except ImportError:
- from VideoCapture import vidcap as vc
- vidcap = vc
-
-
-def quit():
- global vidcap
- vidcap = None
-
-
-class Camera:
- # pylint: disable=unused-argument
- def __init__(self, device=0, size=(640, 480), mode="RGB", show_video_window=0):
- """device: VideoCapture enumerates the available video capture devices
- on your system. If you have more than one device, specify
- the desired one here. The device number starts from 0.
-
- show_video_window: 0 ... do not display a video window (the default)
- 1 ... display a video window
-
- Mainly used for debugging, since the video window
- can not be closed or moved around.
- """
- self.dev = vidcap.new_Dev(device, show_video_window)
- width, height = size
- self.dev.setresolution(width, height)
-
- def display_capture_filter_properties(self):
- """Displays a dialog containing the property page of the capture filter.
-
- For VfW drivers you may find the option to select the resolution most
- likely here.
- """
- self.dev.displaycapturefilterproperties()
-
- def display_capture_pin_properties(self):
- """Displays a dialog containing the property page of the capture pin.
-
- For WDM drivers you may find the option to select the resolution most
- likely here.
- """
- self.dev.displaycapturepinproperties()
-
- def set_resolution(self, width, height):
- """Sets the capture resolution. (without dialog)"""
- self.dev.setresolution(width, height)
-
- def get_buffer(self):
- """Returns a string containing the raw pixel data."""
- return self.dev.getbuffer()
-
- def start(self):
- """Not implemented."""
-
- def set_controls(self, **kwargs):
- """Not implemented."""
-
- def stop(self):
- """Not implemented."""
-
- def get_image(self, dest_surf=None):
- """ """
- return self.get_surface(dest_surf)
-
- def get_surface(self, dest_surf=None):
- """Returns a pygame Surface."""
- abuffer, width, height = self.get_buffer()
- if not abuffer:
- return None
- surf = pygame.image.frombuffer(abuffer, (width, height), "BGR")
- surf = pygame.transform.flip(surf, 0, 1)
- # if there is a destination surface given, we blit onto that.
- if dest_surf:
- dest_surf.blit(surf, (0, 0))
- else:
- dest_surf = surf
- return dest_surf
-
-
-if __name__ == "__main__":
- import pygame.examples.camera
-
- pygame.camera.Camera = Camera
- pygame.camera.list_cameras = list_cameras
- pygame.examples.camera.main()
diff --git a/src_py/_sdl2/window.py b/src_py/_sdl2/window.py
new file mode 100644
index 0000000000..6867ff7b80
--- /dev/null
+++ b/src_py/_sdl2/window.py
@@ -0,0 +1 @@
+from .video import _Window as Window # pylint: disable=wildcard-import
diff --git a/src_py/camera.py b/src_py/camera.py
index b453d04065..d218dc670a 100644
--- a/src_py/camera.py
+++ b/src_py/camera.py
@@ -104,20 +104,6 @@ def _setup_backend(backend):
list_cameras = _camera.list_cameras
Camera = _camera.Camera
- elif backend == "videocapture":
- from pygame import _camera_vidcapture
-
- warnings.warn(
- "The VideoCapture backend is not recommended and may be removed."
- "For Python3 and Windows 8+, there is now a native Windows "
- "backend built into pygame.",
- DeprecationWarning,
- stacklevel=2,
- )
-
- _camera_vidcapture.init()
- list_cameras = _camera_vidcapture.list_cameras
- Camera = _camera_vidcapture.Camera
else:
raise ValueError("unrecognized backend name")
@@ -136,9 +122,6 @@ def get_backends():
possible_backends.append("OpenCV")
- if sys.platform == "win32":
- possible_backends.append("VideoCapture")
-
# see if we have any user specified defaults in environments.
camera_env = os.environ.get("PYGAME_CAMERA", "").lower()
if camera_env == "opencv": # prioritize opencv
@@ -146,11 +129,6 @@ def get_backends():
possible_backends.remove("OpenCV")
possible_backends = ["OpenCV"] + possible_backends
- if camera_env in ("vidcapture", "videocapture"): # prioritize vidcapture
- if "VideoCapture" in possible_backends:
- possible_backends.remove("VideoCapture")
- possible_backends = ["VideoCapture"] + possible_backends
-
return possible_backends
@@ -175,8 +153,8 @@ def init(backend=None):
_setup_backend(backend)
except ImportError:
emsg = f"Backend '{backend}' is not supported on your platform!"
- if backend in ("opencv", "opencv-mac", "videocapture"):
- dep = "vidcap" if backend == "videocapture" else "OpenCV"
+ if backend in ("opencv", "opencv-mac"):
+ dep = "OpenCV"
emsg += (
f" Make sure you have '{dep}' installed to be able to use this backend"
)
diff --git a/src_py/surfarray.py b/src_py/surfarray.py
index a16f8ef569..e621906645 100644
--- a/src_py/surfarray.py
+++ b/src_py/surfarray.py
@@ -60,7 +60,7 @@
for type_name in "float32 float64 float96".split():
if hasattr(numpy, type_name):
numpy_floats.append(getattr(numpy, type_name))
-# Added below due to deprecation of numpy.float. See issue #2814
+# Added below due to deprecation of numpy.float. See pygame-ce issue #1440
numpy_floats.append(float)
# Pixel sizes corresponding to NumPy supported integer sizes, and therefore
diff --git a/src_py/sysfont.py b/src_py/sysfont.py
index 1ec038aaee..d720f6c2c3 100644
--- a/src_py/sysfont.py
+++ b/src_py/sysfont.py
@@ -18,10 +18,11 @@
# Pete Shinners
# pete@shinners.org
"""sysfont, used in the font module to find system fonts"""
-
import warnings
import os
import sys
+import itertools
+import difflib
from os.path import basename, dirname, exists, join, splitext
from pygame.font import Font
@@ -386,6 +387,37 @@ def font_constructor(fontpath, size, bold, italic):
return font
+def _load_single_font(name, bold=False, italic=False):
+ fontname = None
+ gotbold = False
+ gotitalic = False
+ single_name = _simplename(name)
+ styles = Sysfonts.get(single_name)
+ if not styles:
+ styles = Sysalias.get(single_name)
+ if styles:
+ plainname = styles.get((False, False))
+ fontname = styles.get((bold, italic))
+ if not (fontname or plainname):
+ # Neither requested style, nor plain font exists, so
+ # return a font with the name requested, but an
+ # arbitrary style.
+ (style, fontname) = list(styles.items())[0]
+ # Attempt to style it as requested. This can't
+ # unbold or unitalicize anything, but it can
+ # fake bold and/or fake italicize.
+ if bold and style[0]:
+ gotbold = True
+ if italic and style[1]:
+ gotitalic = True
+ elif not fontname:
+ fontname = plainname
+ elif plainname != fontname:
+ gotbold = bold
+ gotitalic = italic
+ return fontname, gotbold, gotitalic
+
+
# the exported functions
@@ -418,7 +450,6 @@ def SysFont(name, size, bold=False, italic=False, constructor=None):
initsysfonts()
gotbold = gotitalic = False
- fontname = None
if name:
if isinstance(name, (str, bytes)):
name = name.split(b"," if isinstance(name, bytes) else ",")
@@ -429,30 +460,7 @@ def SysFont(name, size, bold=False, italic=False, constructor=None):
name[idx] = single_name.decode()
for single_name in name:
- single_name = _simplename(single_name)
- styles = Sysfonts.get(single_name)
- if not styles:
- styles = Sysalias.get(single_name)
- if styles:
- plainname = styles.get((False, False))
- fontname = styles.get((bold, italic))
- if not (fontname or plainname):
- # Neither requested style, nor plain font exists, so
- # return a font with the name requested, but an
- # arbitrary style.
- (style, fontname) = list(styles.items())[0]
- # Attempt to style it as requested. This can't
- # unbold or unitalicize anything, but it can
- # fake bold and/or fake italicize.
- if bold and style[0]:
- gotbold = True
- if italic and style[1]:
- gotitalic = True
- elif not fontname:
- fontname = plainname
- elif plainname != fontname:
- gotbold = bold
- gotitalic = italic
+ fontname, gotbold, gotitalic = _load_single_font(single_name)
if fontname:
break
@@ -460,14 +468,25 @@ def SysFont(name, size, bold=False, italic=False, constructor=None):
if len(name) > 1:
names = "', '".join(name)
warnings.warn(
- f"None of the specified system fonts "
+ "None of the specified system fonts "
f"('{names}') could be found. "
- f"Using the default font instead."
+ "Using the default font instead."
)
else:
+ # Identifies the closest matches to the font provided by
+ # the user from the list of available fonts.
+ matches = difflib.get_close_matches(
+ _simplename(name[0]), itertools.chain(Sysfonts, Sysalias), 3
+ )
+ if matches:
+ match_text = "Did you mean: '" + "', '".join(matches) + "'? "
+ else:
+ match_text = ""
+
warnings.warn(
f"The system font '{name[0]}' couldn't be "
- "found. Using the default font instead."
+ f"found. {match_text}"
+ "Using the default font instead."
)
set_bold = set_italic = False
diff --git a/test/color_test.py b/test/color_test.py
index 8876f262d6..dc7895a5da 100644
--- a/test/color_test.py
+++ b/test/color_test.py
@@ -527,7 +527,7 @@ def test_add(self):
self.assertEqual(c3.b, 164)
self.assertEqual(c3.a, 255)
- # Issue #286: Is type checking done for Python 3.x?
+ # pygame-ce issue #301: Is type checking done for Python 3.x?
self.assertRaises(TypeError, operator.add, c1, None)
self.assertRaises(TypeError, operator.add, None, c1)
@@ -556,7 +556,7 @@ def test_sub(self):
self.assertEqual(c3.b, 91)
self.assertEqual(c3.a, 0)
- # Issue #286: Is type checking done for Python 3.x?
+ # pygame-ce issue #301: Is type checking done for Python 3.x?
self.assertRaises(TypeError, operator.sub, c1, None)
self.assertRaises(TypeError, operator.sub, None, c1)
@@ -585,7 +585,7 @@ def test_mul(self):
self.assertEqual(c3.b, 9)
self.assertEqual(c3.a, 255)
- # Issue #286: Is type checking done for Python 3.x?
+ # pygame-ce issue #301: Is type checking done for Python 3.x?
self.assertRaises(TypeError, operator.mul, c1, None)
self.assertRaises(TypeError, operator.mul, None, c1)
@@ -614,7 +614,7 @@ def test_div(self):
self.assertEqual(c3.b, 2)
self.assertEqual(c3.a, 0)
- # Issue #286: Is type checking done for Python 3.x?
+ # pygame-ce issue #301: Is type checking done for Python 3.x?
self.assertRaises(TypeError, operator.floordiv, c1, None)
self.assertRaises(TypeError, operator.floordiv, None, c1)
@@ -646,7 +646,7 @@ def test_mod(self):
self.assertEqual(c3.b, 7)
self.assertEqual(c3.a, 15)
- # Issue #286: Is type checking done for Python 3.x?
+ # pygame-ce issue #301: Is type checking done for Python 3.x?
self.assertRaises(TypeError, operator.mod, c1, None)
self.assertRaises(TypeError, operator.mod, None, c1)
@@ -867,7 +867,7 @@ def test_i1i2i3__all_elements_within_limits(self):
self.assertTrue(-0.5 <= i2 <= 0.5)
self.assertTrue(-0.5 <= i3 <= 0.5)
- def test_issue_269(self):
+ def test_issue_284(self):
"""PyColor OverflowError on HSVA with hue value of 360
>>> c = pygame.Color(0)
diff --git a/test/display_test.py b/test/display_test.py
index b77d639eb4..4e14504798 100644
--- a/test/display_test.py
+++ b/test/display_test.py
@@ -582,7 +582,7 @@ def test_set_mode_vector2(self):
def test_set_mode_unscaled(self):
"""Ensures a window created with SCALED can become smaller."""
- # see https://github.com/pygame/pygame/issues/2327
+ # see https://github.com/pygame-community/pygame-ce/issues/1194
screen = pygame.display.set_mode((300, 300), pygame.SCALED)
self.assertEqual(screen.get_size(), (300, 300))
@@ -906,7 +906,7 @@ def test_screen_size_opengl(self):
class X11CrashTest(unittest.TestCase):
def test_x11_set_mode_crash_gh1654(self):
- # Test for https://github.com/pygame/pygame/issues/1654
+ # Test for https://github.com/pygame-community/pygame-ce/issues/924
# If unfixed, this will trip a segmentation fault
pygame.display.init()
pygame.display.quit()
diff --git a/test/draw_test.py b/test/draw_test.py
index abc7d158c2..15e993b90c 100644
--- a/test/draw_test.py
+++ b/test/draw_test.py
@@ -4069,7 +4069,7 @@ def test_1_pixel_high_or_wide_shapes(self):
self.assertEqual(self.surface.get_at((5, y)), RED)
def test_draw_symetric_cross(self):
- """non-regression on issue #234 : x and y where handled inconsistently.
+ """non-regression on pygame-ce issue #249 : x and y where handled inconsistently.
Also, the result is/was different whether we fill or not the polygon.
"""
@@ -4104,7 +4104,7 @@ def test_draw_symetric_cross(self):
self.assertEqual(self.surface.get_at((x, y)), RED)
def test_illumine_shape(self):
- """non-regression on issue #313"""
+ """non-regression on pygame-ce issue #328"""
rect = pygame.Rect((0, 0, 20, 20))
path_data = [
(0, 0),
@@ -4728,7 +4728,7 @@ def test_rect__fill(self):
self.assertNotEqual(color_at_pt, self.color)
- # Issue #310: Cannot draw rectangles that are 1 pixel high
+ # pygame-ce issue #325: Cannot draw rectangles that are 1 pixel high
bgcolor = pygame.Color("black")
self.surf.fill(bgcolor)
hrect = pygame.Rect(1, 1, self.surf_w - 2, 1)
diff --git a/test/event_test.py b/test/event_test.py
index 52fe95b606..c22c50f67e 100644
--- a/test/event_test.py
+++ b/test/event_test.py
@@ -93,7 +93,7 @@ def test_Event(self):
self.assertEqual(e.other_attr, "1")
# Event now uses tp_dictoffset and tp_members:
- # https://github.com/pygame/pygame/issues/62
+ # https://github.com/pygame-community/pygame-ce/issues/77
self.assertEqual(e.type, pygame.USEREVENT)
self.assertIs(e.dict, e.__dict__)
diff --git a/test/font_test.py b/test/font_test.py
index 4d85f5e8ee..53b02f06b6 100644
--- a/test/font_test.py
+++ b/test/font_test.py
@@ -177,7 +177,7 @@ def test_match_font_italic(self):
any(pygame_font.match_font(font, italic=True) for font in fonts)
)
- def test_issue_742(self):
+ def test_issue_553(self):
"""that the font background does not crash."""
surf = pygame.Surface((320, 240))
font = pygame_font.Font(None, 24)
@@ -186,7 +186,7 @@ def test_issue_742(self):
image.set_alpha(255)
surf.blit(image, (0, 0))
- # not issue 742, but be sure to test that background color is
+ # not pygame-ce issue 553, but be sure to test that background color is
# correctly issued on this mode
self.assertEqual(surf.get_at((0, 0)), pygame.Color(0, 0, 0))
@@ -695,7 +695,7 @@ def test_load_from_file_bytes(self):
bfont_path = font_path.encode(filesystem_encoding, filesystem_errors)
f = pygame_font.Font(bfont_path, 20)
- def test_issue_3144(self):
+ def test_issue_1587(self):
fpath = os.path.join(FONTDIR, "PlayfairDisplaySemibold.ttf")
# issue in SDL_ttf 2.0.18 DLL on Windows
diff --git a/test/freetype_test.py b/test/freetype_test.py
index 25444c9b91..2eab183143 100644
--- a/test/freetype_test.py
+++ b/test/freetype_test.py
@@ -202,7 +202,7 @@ def test_freetype_Font_kerning__enabled(self):
Note: This does not test what changes occur to a rendered font by
having kerning enabled.
- Related to issue #367.
+ Related to pygame-ce issue #371.
"""
surface = pygame.Surface((10, 10), 0, 32)
TEST_TEXT = "Freetype Font"
@@ -1481,10 +1481,10 @@ def test_undefined_character_code(self):
self.assertIsNone(metrics[0])
self.assertIsInstance(metrics[1], tuple)
- def test_issue_242(self):
- """Issue #242: get_rect() uses 0 as default style"""
+ def test_issue_257(self):
+ """pygame-ce issue #257: get_rect() uses 0 as default style"""
- # Issue #242: freetype.Font.get_rect() ignores style defaults when
+ # pygame-ce issue #257: freetype.Font.get_rect() ignores style defaults when
# the style argument is not given
#
# The text boundary rectangle returned by freetype.Font.get_rect()
@@ -1541,10 +1541,10 @@ def test_issue_242(self):
finally:
font.underline = prev_style
- def test_issue_237(self):
- """Issue #237: Memory overrun when rendered with underlining"""
+ def test_issue_252(self):
+ """pygame-ce issue #252: Memory overrun when rendered with underlining"""
- # Issue #237: Memory overrun when text without descenders is rendered
+ # pygame-ce issue #252: Memory overrun when text without descenders is rendered
# with underlining
#
# The bug crashes the Python interpreter. The bug is caught with C
@@ -1564,10 +1564,10 @@ def test_issue_237(self):
font.underline_adjustment = adj
s, r = font.render("Amazon", size=19)
- def test_issue_243(self):
- """Issue Y: trailing space ignored in boundary calculation"""
+ def test_issue_258(self):
+ """pygame-ce issue #258: trailing space ignored in boundary calculation"""
- # Issue #243: For a string with trailing spaces, freetype ignores the
+ # pygame-ce issue #258: For a string with trailing spaces, freetype ignores the
# last space in boundary calculations
#
font = self._TEST_FONTS["fixed"]
diff --git a/test/gfxdraw_test.py b/test/gfxdraw_test.py
index 33ee2c51ef..ad21542b76 100644
--- a/test/gfxdraw_test.py
+++ b/test/gfxdraw_test.py
@@ -600,7 +600,7 @@ def test_aatrigon__with_horizontal_edge(self):
difference between the 2 aatrigons is the order the points are drawn.
The order of the points should have no impact on the final drawing.
- Related to issue #622.
+ Related to pygame-ce issue #506.
"""
bg_color = pygame.Color("white")
line_color = pygame.Color("black")
@@ -733,7 +733,7 @@ def test_aapolygon__with_horizontal_edge(self):
aapolygon() and the other using multiple line() calls. They should
produce the same final drawing.
- Related to issue #622.
+ Related to pygame-ce issue #506.
"""
bg_color = pygame.Color("white")
line_color = pygame.Color("black")
diff --git a/test/image_test.py b/test/image_test.py
index 8a8e50a8ed..2d9265dc7b 100644
--- a/test/image_test.py
+++ b/test/image_test.py
@@ -104,7 +104,7 @@ def testLoadBytesIO(self):
"SDL_image 2.0.5 and older has a big endian bug in jpeg saving",
)
def testSaveJPG(self):
- """JPG equivalent to issue #211 - color channel swapping
+ """JPG equivalent to pygame-ce issue #226 - color channel swapping
Make sure the SDL surface color masks represent the rgb memory format
required by the JPG library. The masks are machine endian dependent
diff --git a/test/math_test.py b/test/math_test.py
index cd7d888efc..f3d72f9ea8 100644
--- a/test/math_test.py
+++ b/test/math_test.py
@@ -550,7 +550,7 @@ def test_rotate(self):
v2 = v1.rotate(0)
self.assertEqual(v1.x, v2.x)
self.assertEqual(v1.y, v2.y)
- # issue 214
+ # pygame-ce issue 229
self.assertEqual(Vector2(0, 1).rotate(359.99999999), Vector2(0, 1))
def test_rotate_rad(self):
@@ -1666,7 +1666,7 @@ def test_rotate(self):
self.assertEqual(v1.x, v2.x)
self.assertEqual(v1.y, v2.y)
self.assertEqual(v1.z, v2.z)
- # issue 214
+ # pygame-ce issue 229
self.assertEqual(
Vector3(0, 1, 0).rotate(359.9999999, Vector3(0, 0, 1)), Vector3(0, 1, 0)
)
diff --git a/test/mixer_music_test.py b/test/mixer_music_test.py
index 882e13635e..8f0d7ad30b 100644
--- a/test/mixer_music_test.py
+++ b/test/mixer_music_test.py
@@ -418,7 +418,7 @@ def todo_test_set_pos(self):
self.fail()
def test_init(self):
- """issue #955. unload music whenever mixer.quit() is called"""
+ """pygame-ce issue #622. unload music whenever mixer.quit() is called"""
import tempfile
import shutil
diff --git a/test/mixer_test.py b/test/mixer_test.py
index 47d50ac174..651f6ad2f8 100644
--- a/test/mixer_test.py
+++ b/test/mixer_test.py
@@ -1,10 +1,11 @@
import sys
import os
import unittest
+import time
import pathlib
import platform
-from pygame.tests.test_utils import example_path
+from pygame.tests.test_utils import example_path, prompt, question
import pygame
from pygame import mixer
@@ -123,7 +124,7 @@ def test_quit(self):
self.assertRaises(pygame.error, mixer.get_num_channels)
# TODO: FIXME: appveyor and pypy (on linux) fails here sometimes.
- @unittest.skipIf(sys.platform.startswith("win"), "See github issue 892.")
+ @unittest.skipIf(sys.platform.startswith("win"), "See pygame-ce issue 601.")
@unittest.skipIf(IS_PYPY, "random errors here with pypy")
def test_sound_args(self):
def get_bytes(snd):
@@ -897,6 +898,55 @@ def todo_test_unpause(self):
self.fail()
+ def test_set_source_location(self):
+ ch = mixer.Channel(0)
+ ch.set_source_location(-3.14, 6.25)
+ self.assertRaises(ValueError, lambda: ch.set_source_location(0, -1))
+ self.assertRaises(ValueError, lambda: ch.set_source_location(0, 256.0))
+ self.assertRaises(TypeError, lambda: ch.set_source_location("", 6.25))
+
+
+class ChannelInteractiveTest(unittest.TestCase):
+ __tags__ = ["interactive"]
+
+ def tearDown(self):
+ mixer.quit()
+ mixer.pre_init(0, 0, 0, 0)
+
+ def setUp(self):
+ mixer.init()
+ filename = example_path(os.path.join("data", "house_lo.mp3"))
+ self.snd = mixer.Sound(filename)
+
+ def test_set_source_location(self):
+ prompt("Please wear earphones before the test for set_source_location() starts")
+ ch = self.snd.play()
+ angle = 0
+ distance = 100
+ while ch.get_busy():
+ ch.set_source_location(angle, distance)
+ angle += 1
+ angle %= 360
+ time.sleep(0.01)
+ ans = question("You heard the sound was running around you. Is that correct?")
+ self.assertTrue(ans)
+
+ ch = self.snd.play()
+ angle = 0
+ distance = 0
+ direction = 0
+ while ch.get_busy():
+ ch.set_source_location(angle, distance)
+ if distance == 0 or distance == 255:
+ direction = 1 - direction
+ distance += 1 if direction else -1
+ time.sleep(0.01)
+
+ ans = question(
+ "You heard the distance of the sound was changing. Is that correct?"
+ )
+ self.assertTrue(ans)
+
############################### SOUND CLASS TESTS ##############################
diff --git a/test/scrap_test.py b/test/scrap_test.py
index b92b81d4f7..bbde33a7da 100644
--- a/test/scrap_test.py
+++ b/test/scrap_test.py
@@ -216,7 +216,7 @@ class X11InteractiveTest(unittest.TestCase):
__tags__ = ["interactive"]
pygame.display.quit()
- def test_issue_208(self):
+ def test_issue_223(self):
"""PATCH: pygame.scrap on X11, fix copying into PRIMARY selection
Copying into theX11 PRIMARY selection (mouse copy/paste) would not
diff --git a/test/sprite_test.py b/test/sprite_test.py
index 21a850aa5f..9430c1d059 100644
--- a/test/sprite_test.py
+++ b/test/sprite_test.py
@@ -1111,7 +1111,7 @@ def _nondirty_intersections_redrawn(self, use_source_rect=False):
# use_source_rect - allows non-dirty sprites to be tested
# with (True) and without (False) a source_rect
#
- # This test was written to reproduce the behavior seen in issue #898.
+ # This test was written to reproduce the behavior seen in pygame-ce issue # 605.
# A non-dirty sprite (using source_rect) was being redrawn incorrectly
# after a dirty sprite intersected with it.
#
@@ -1207,7 +1207,7 @@ def test_nondirty_intersections_redrawn__with_source_rect(self):
"""Ensure non-dirty sprites using source_rects are correctly redrawn
when dirty sprites intersect with them.
- Related to issue #898.
+ Related to pygame-ce issue #605.
"""
self._nondirty_intersections_redrawn(True)
diff --git a/test/surface_test.py b/test/surface_test.py
index 34e2cbc862..f581082882 100644
--- a/test/surface_test.py
+++ b/test/surface_test.py
@@ -45,7 +45,7 @@ def test_surface_created_opaque_black(self):
surf = pygame.Surface((20, 20))
self.assertEqual(surf.get_at((0, 0)), (0, 0, 0, 255))
- # See https://github.com/pygame/pygame/issues/1395
+ # See https://github.com/pygame-community/pygame-ce/issues/796
pygame.display.set_mode((500, 500))
surf = pygame.Surface((20, 20))
self.assertEqual(surf.get_at((0, 0)), (0, 0, 0, 255))
@@ -228,7 +228,7 @@ def test_get_bounding_rect(self):
self.assertEqual(bound_rect.width, 31)
self.assertEqual(bound_rect.height, 31)
- # Issue #180
+ # pygame-ce issue #195
pygame.display.init()
try:
surf = pygame.Surface((4, 1), 0, 8)
@@ -1139,8 +1139,8 @@ class GeneralSurfaceTests(unittest.TestCase):
'requires a non-"dummy" SDL_VIDEODRIVER',
)
def test_image_convert_bug_131(self):
- # bug #131: Unable to Surface.convert(32) some 1-bit images.
- # https://github.com/pygame/pygame/issues/131
+ # bug #146: Unable to Surface.convert(32) some 1-bit images.
+ # https://github.com/pygame-community/pygame-ce/issues/146
pygame.display.init()
try:
@@ -1232,6 +1232,22 @@ def test_convert_alpha_SRCALPHA(self):
finally:
pygame.display.quit()
+ def test_convert_palettize(self):
+ pygame.display.init()
+ try:
+ pygame.display.set_mode((640, 480))
+
+ surf = pygame.Surface((150, 250))
+ surf.fill((255, 50, 0))
+ surf = surf.convert(8)
+ surf2 = pygame.Surface((150, 250), depth=8)
+ surf2.fill((255, 50, 0))
+
+ self.assertEqual(surf.get_at((50, 50)), surf2.get_at((50, 50)))
+
+ finally:
+ pygame.display.quit()
+
def test_src_alpha_issue_1289(self):
"""blit should be white."""
surf1 = pygame.Surface((1, 1), pygame.SRCALPHA, 32)
@@ -1796,7 +1812,7 @@ def test_convert_alpha__pixel_format_as_surface_subclass(self):
pygame.display.set_mode((60, 60))
# This is accepted as an argument, but its values are ignored.
- # See issue #599.
+ # See pygame-ce issue #493.
surface = convert_surface.convert_alpha(depth_surface)
self.assertIsNot(surface, depth_surface)
@@ -2397,7 +2413,7 @@ def test_set_alpha_value(self):
def test_palette_colorkey(self):
"""test bug discovered by robertpfeiffer
- https://github.com/pygame/pygame/issues/721
+ https://github.com/pygame-community/pygame-ce/issues/541
"""
surf = pygame.image.load(example_path(os.path.join("data", "alien2.png")))
key = surf.get_colorkey()
@@ -2508,7 +2524,7 @@ def test_subsurface(self):
self.assertEqual(s.get_masks(), surf.get_masks())
self.assertEqual(s.get_losses(), surf.get_losses())
- # Issue https://github.com/pygame/pygame/issues/2
+ # Issue https://github.com/pygame-community/pygame-ce/issues/17
surf = pygame.Surface.__new__(pygame.Surface)
self.assertRaises(pygame.error, surf.subsurface, (0, 0, 0, 0))
@@ -2640,7 +2656,7 @@ def test_scroll(self):
class SurfaceSubtypeTest(unittest.TestCase):
- """Issue #280: Methods that return a new Surface preserve subclasses"""
+ """pygame-ce issue #295: Methods that return a new Surface preserve subclasses"""
def setUp(self):
pygame.display.init()
@@ -3942,7 +3958,7 @@ def test_surface_premul_alpha(self):
class SurfaceSelfBlitTest(unittest.TestCase):
"""Blit to self tests.
- This test case is in response to https://github.com/pygame/pygame/issues/19
+ This test case is in response to https://github.com/pygame-community/pygame-ce/issues/34
"""
def setUp(self):
@@ -4019,11 +4035,11 @@ def test_overlap_check(self):
surf.blit(surf, (d_x, d_y), (s_x, s_y, 50, 50))
self.assertEqual(surf.get_at(test_posn), rectc_right)
- # https://github.com/pygame/pygame/issues/370#issuecomment-364625291
+ # https://github.com/pygame-community/pygame-ce/issues/374, final comment by illume
@unittest.skipIf("ppc64le" in platform.uname(), "known ppc64le issue")
def test_colorkey(self):
# Check a workaround for an SDL 1.2.13 surface self-blit problem
- # https://github.com/pygame/pygame/issues/19
+ # https://github.com/pygame-community/pygame-ce/issues/34
pygame.display.set_mode((100, 50)) # Needed for 8bit surface
bitsizes = [8, 16, 24, 32]
for bitsize in bitsizes:
@@ -4042,11 +4058,11 @@ def test_colorkey(self):
comp.blit(tmp, (0, 0))
self._assert_same(surf, comp)
- # https://github.com/pygame/pygame/issues/370#issuecomment-364625291
+ # https://github.com/pygame-community/pygame-ce/issues/374 final comment by illume
@unittest.skipIf("ppc64le" in platform.uname(), "known ppc64le issue")
def test_blanket_alpha(self):
# Check a workaround for an SDL 1.2.13 surface self-blit problem
- # https://github.com/pygame/pygame/issues/19
+ # https://github.com/pygame-community/pygame-ce/issues/34
pygame.display.set_mode((100, 50)) # Needed for 8bit surface
bitsizes = [8, 16, 24, 32]
for bitsize in bitsizes:
@@ -4125,7 +4141,7 @@ def do_blit(d, s):
self.assertRaises(pygame.error, do_blit, surf, sub)
def test_copy_alpha(self):
- """issue 581: alpha of surface copy with SRCALPHA is set to 0."""
+ """pygame-ce issue 487: alpha of surface copy with SRCALPHA is set to 0."""
surf = pygame.Surface((16, 16), pygame.SRCALPHA, 32)
self.assertEqual(surf.get_alpha(), 255)
surf2 = surf.copy()
diff --git a/test/surfarray_test.py b/test/surfarray_test.py
index 0863da77e0..b27dc0b460 100644
--- a/test/surfarray_test.py
+++ b/test/surfarray_test.py
@@ -471,25 +471,18 @@ def do_blit(surf, arr):
arr.shape = (1, 1, 1, 4)
self.assertRaises(ValueError, do_blit, surf, arr)
- # Issue #81: round from float to int
- try:
- rint
- except NameError:
- pass
- else:
- surf = pygame.Surface((10, 10), pygame.SRCALPHA, 32)
- w, h = surf.get_size()
- length = w * h
- for dtype in [float32, float64]:
- surf.fill((255, 255, 255, 0))
- farr = arange(0, length, dtype=dtype)
- farr.shape = w, h
- pygame.surfarray.blit_array(surf, farr)
- for x in range(w):
- for y in range(h):
- self.assertEqual(
- surf.get_at_mapped((x, y)), int(rint(farr[x, y]))
- )
+ # pygame-ce issue #96: round from float to int
+ surf = pygame.Surface((10, 10), pygame.SRCALPHA, 32)
+ w, h = surf.get_size()
+ length = w * h
+ for dtype in [float32, float64]:
+ surf.fill((255, 255, 255, 0))
+ farr = arange(0, length, dtype=dtype)
+ farr.shape = w, h
+ pygame.surfarray.blit_array(surf, farr)
+ for x in range(w):
+ for y in range(h):
+ self.assertEqual(surf.get_at_mapped((x, y)), int(rint(farr[x, y])))
# this test should be removed soon, when the function is deleted
def test_get_arraytype(self):
@@ -520,24 +513,17 @@ def test_make_surface(self):
surf = pygame.surfarray.make_surface(self._make_src_array3d(dtype))
self._assert_surface(surf)
- # Issue #81: round from float to int
- try:
- rint
- except NameError:
- pass
- else:
- w = 9
- h = 11
- length = w * h
- for dtype in [float32, float64]:
- farr = arange(0, length, dtype=dtype)
- farr.shape = w, h
- surf = pygame.surfarray.make_surface(farr)
- for x in range(w):
- for y in range(h):
- self.assertEqual(
- surf.get_at_mapped((x, y)), int(rint(farr[x, y]))
- )
+ # pygame-ce issue #96: round from float to int
+ w = 9
+ h = 11
+ length = w * h
+ for dtype in [float32, float64]:
+ farr = arange(0, length, dtype=dtype)
+ farr.shape = w, h
+ surf = pygame.surfarray.make_surface(farr)
+ for x in range(w):
+ for y in range(h):
+ self.assertEqual(surf.get_at_mapped((x, y)), int(rint(farr[x, y])))
def test_map_array(self):
arr3d = self._make_src_array3d(uint8)
diff --git a/test/test_utils/png.py b/test/test_utils/png.py
index bf4a1dbf41..c0dd2d5934 100644
--- a/test/test_utils/png.py
+++ b/test/test_utils/png.py
@@ -2431,7 +2431,7 @@ def testPtrns(self):
def testRGBtoRGBA(self):
"asRGBA8() on colour type 2 source." ""
- # Test for Issue 26
+ # Test for pygame-ce issue 41
r = Reader(bytes=_pngsuite["basn2c08"])
x, y, pixels, meta = r.asRGBA8()
# Test the pixels at row 9 columns 0 and 1.
@@ -2440,7 +2440,7 @@ def testRGBtoRGBA(self):
def testLtoRGBA(self):
"asRGBA() on grey source." ""
- # Test for Issue 60
+ # Test for pygame-ce issue 75
r = Reader(bytes=_pngsuite["basi0g08"])
x, y, pixels, meta = r.asRGBA()
row9 = list(list(pixels)[9])
@@ -2448,7 +2448,7 @@ def testLtoRGBA(self):
def testCtrns(self):
"Test colour type 2 and tRNS chunk."
- # Test for Issue 25
+ # Test for pygame-ce issue 40
r = Reader(bytes=_pngsuite["tbrn2c08"])
x, y, pixels, meta = r.asRGBA8()
# I just happen to know that the first pixel is transparent.
@@ -2621,7 +2621,7 @@ def testWinfo(self):
def testPackedIter(self):
"""Test iterator for row when using write_packed.
- Indicative for Issue 47.
+ Indicative for pygame-ce issue 62.
"""
w = Writer(16, 2, greyscale=True, alpha=False, bitdepth=1)
o = BytesIO()
diff --git a/test/transform_test.py b/test/transform_test.py
index 268681aae9..5559fa924e 100644
--- a/test/transform_test.py
+++ b/test/transform_test.py
@@ -99,7 +99,7 @@ def test_scale__alpha(self):
def test_scale__destination(self):
"""see if the destination surface can be passed in to use."""
- s = pygame.Surface((32, 32))
+ s = pygame.Surface((32, 32), depth=32)
s2 = pygame.transform.scale(s, (64, 64))
s3 = s2.copy()
@@ -120,6 +120,18 @@ def test_scale__destination(self):
# the wrong size surface is past in. Should raise an error.
self.assertRaises(ValueError, pygame.transform.smoothscale, s, (33, 64), s3)
+ alpha_surf = pygame.Surface((64, 64), pygame.SRCALPHA)
+ pygame.transform.scale(alpha_surf, (32, 32), s)
+
+ alpha_surf_weird = pygame.Surface(
+ (64, 64), pygame.SRCALPHA, 32, (0xFF000000, 0xFF0000, 0xFF00, 0xFF)
+ )
+ assert alpha_surf_weird.get_shifts() != alpha_surf.get_shifts()
+
+ self.assertRaises(
+ ValueError, pygame.transform.scale, alpha_surf_weird, (32, 32), s
+ )
+
def test_scale__vector2(self):
s = pygame.Surface((32, 32))
s2 = pygame.transform.scale(s, pygame.Vector2(64, 64))
@@ -1418,6 +1430,30 @@ def test_blur_indexed_surface(self):
self.assertRaises(ValueError, lambda: pygame.transform.box_blur(sf, 10))
self.assertRaises(ValueError, lambda: pygame.transform.gaussian_blur(sf, 10))
+ def test_blur_in_place(self):
+ # When source and destination surfaces are the same,
+ # A ValueError should be raised.
+
+ data_fname = example_path("data")
+ path = os.path.join(data_fname, "peppers3.tif")
+ sf = pygame.image.load(path)
+ sub1 = sf.subsurface((0, 0, 128, 128))
+ sub2 = sf.subsurface((20, 20, 128, 128))
+
+ self.assertRaises(
+ ValueError, lambda: pygame.transform.box_blur(sf, 10, dest_surface=sf)
+ )
+ self.assertRaises(
+ ValueError, lambda: pygame.transform.box_blur(sub1, 10, dest_surface=sub2)
+ )
+ self.assertRaises(
+ ValueError, lambda: pygame.transform.gaussian_blur(sf, 10, dest_surface=sf)
+ )
+ self.assertRaises(
+ ValueError,
+ lambda: pygame.transform.gaussian_blur(sub1, 10, dest_surface=sub2),
+ )
+
def test_box_blur(self):
data1 = {
(1, 29): (67, 58, 26, 255),