[pitivi] coptimizations: Pass into gst-indent
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] coptimizations: Pass into gst-indent
- Date: Thu, 11 Jun 2015 09:14:57 +0000 (UTC)
commit 1d94732762dbe5fd59aeb3f5b40f10133627824d
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Jan 6 14:56:55 2015 +0100
coptimizations: Pass into gst-indent
Reviewers: Mathieu_Du
Differential Revision: http://phabricator.freedesktop.org/D110
pitivi/coptimizations/renderer.c | 104 +++++++++++++++++++-------------------
1 files changed, 52 insertions(+), 52 deletions(-)
---
diff --git a/pitivi/coptimizations/renderer.c b/pitivi/coptimizations/renderer.c
index db9c65b..b122000 100644
--- a/pitivi/coptimizations/renderer.c
+++ b/pitivi/coptimizations/renderer.c
@@ -10,7 +10,8 @@ static Pycairo_CAPI_t *Pycairo_CAPI;
* width and height.
* It will average samples if needed.
*/
-static PyObject* py_fill_surface(PyObject* self, PyObject* args)
+static PyObject *
+py_fill_surface (PyObject * self, PyObject * args)
{
PyObject *samples;
PyObject *sampleObj;
@@ -27,60 +28,57 @@ static PyObject* py_fill_surface(PyObject* self, PyObject* args)
double accum;
double lastAccum = 0.;
- if (!PyArg_ParseTuple(args, "O!ii", &PyList_Type, &samples, &width, &height))
+ if (!PyArg_ParseTuple (args, "O!ii", &PyList_Type, &samples, &width, &height))
return NULL;
- length = PyList_Size(samples);
+ length = PyList_Size (samples);
- surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
- ctx = cairo_create(surface);
+ ctx = cairo_create (surface);
- cairo_set_source_rgb(ctx, 0.2, 0.6, 0.0);
- cairo_set_line_width(ctx, 0.5);
- cairo_move_to(ctx, 0, height);
+ cairo_set_source_rgb (ctx, 0.2, 0.6, 0.0);
+ cairo_set_line_width (ctx, 0.5);
+ cairo_move_to (ctx, 0, height);
pixelsPerSample = width / (float) length;
currentPixel = 0.;
samplesInAccum = 0;
accum = 0.;
- for (i = 0; i < length; i++)
- {
- /* Guaranteed to return something */
- sampleObj = PyList_GetItem(samples, i);
- sample = PyFloat_AsDouble(sampleObj);
-
- /* If the object was not a float or convertible to float */
- if (PyErr_Occurred())
- {
- cairo_surface_finish(surface);
- Py_DECREF(samples);
- return NULL;
- }
-
- currentPixel += pixelsPerSample;
- samplesInAccum += 1;
- accum += sample;
- if (currentPixel > 1.0)
- {
- accum /= samplesInAccum;
- cairo_line_to(ctx, x, height - accum);
- lastAccum = accum;
- accum = 0;
- currentPixel -= 1.0;
- samplesInAccum = 0;
- lastX = x;
- }
- x += pixelsPerSample;
+ for (i = 0; i < length; i++) {
+ /* Guaranteed to return something */
+ sampleObj = PyList_GetItem (samples, i);
+ sample = PyFloat_AsDouble (sampleObj);
+
+ /* If the object was not a float or convertible to float */
+ if (PyErr_Occurred ()) {
+ cairo_surface_finish (surface);
+ Py_DECREF (samples);
+ return NULL;
+ }
+
+ currentPixel += pixelsPerSample;
+ samplesInAccum += 1;
+ accum += sample;
+ if (currentPixel > 1.0) {
+ accum /= samplesInAccum;
+ cairo_line_to (ctx, x, height - accum);
+ lastAccum = accum;
+ accum = 0;
+ currentPixel -= 1.0;
+ samplesInAccum = 0;
+ lastX = x;
}
+ x += pixelsPerSample;
+ }
- Py_DECREF(samples);
- cairo_line_to(ctx, width, height);
- cairo_close_path(ctx);
- cairo_fill_preserve(ctx);
+ Py_DECREF (samples);
+ cairo_line_to (ctx, width, height);
+ cairo_close_path (ctx);
+ cairo_fill_preserve (ctx);
- return PycairoSurface_FromSurface(surface, NULL);
+ return PycairoSurface_FromSurface (surface, NULL);
}
static PyMethodDef renderer_methods[] = {
@@ -89,21 +87,23 @@ static PyMethodDef renderer_methods[] = {
};
static PyModuleDef module = {
- PyModuleDef_HEAD_INIT,
- "renderer",
- "Pitivi renderer module.",
- -1,
- renderer_methods, NULL, NULL, NULL, NULL
+ PyModuleDef_HEAD_INIT,
+ "renderer",
+ "Pitivi renderer module.",
+ -1,
+ renderer_methods, NULL, NULL, NULL, NULL
};
-PyMODINIT_FUNC PyInit_renderer(void) {
- if (import_cairo() < 0) {
- g_print("Cairo import failed.");
+PyMODINIT_FUNC
+PyInit_renderer (void)
+{
+ if (import_cairo () < 0) {
+ g_print ("Cairo import failed.");
}
- PyObject* m;
- m = PyModule_Create(&module);
+ PyObject *m;
+ m = PyModule_Create (&module);
if (m == NULL)
- return NULL;
+ return NULL;
return m;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]