Merge lp:~mc-return/compiz/compiz.merge-text-improvements into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: MC Return
Approved revision: 3754
Merged at revision: 3771
Proposed branch: lp:~mc-return/compiz/compiz.merge-text-improvements
Merge into: lp:compiz/0.9.10
Diff against target: 106 lines (+29/-22)
2 files modified
plugins/text/src/private.h (+3/-3)
plugins/text/src/text.cpp (+26/-19)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-text-improvements
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
MC Return Needs Resubmitting
Review via email: mp+173224@code.launchpad.net

Commit message

Text, speed improvements:

Introduced
const float halfPi = PI / 2.0f; and
const float triHalfPi = halfPi * 3;
and used those to draw the rounded background.
Introduced
GLfloat xPlusWidth = x + width; and
GLfloat yMinusHeight = y - height;
and used those coordinates for the vertexData array.

Text, cleanup:

Declaration of local variables outside of loops.
Fixed indentation.

Description of the change

Note:
triHalfPi could be PI * 1.5f also.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote :

Unrelated Jenkins failure:

99% tests passed, 1 tests failed out of 1474

Total Test time (real) = 2507.01 sec

The following tests FAILED:
 1267 - DecorPixmapProtocol.PostDeleteCausesClientMessage (Failed)

Revision history for this message
MC Return (mc-return) :
review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote :

The Jenkins failures seem to be unrelated - Re-approving.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/text/src/private.h'
2--- plugins/text/src/private.h 2013-07-01 10:44:23 +0000
3+++ plugins/text/src/private.h 2013-07-05 14:46:24 +0000
4@@ -77,9 +77,9 @@
5 bool render (const CompText::Attrib &attrib,
6 const CompString &text);
7
8- int mWidth;
9- int mHeight;
10- Pixmap mPixmap;
11+ int mWidth;
12+ int mHeight;
13+ Pixmap mPixmap;
14
15 private:
16
17
18=== modified file 'plugins/text/src/text.cpp'
19--- plugins/text/src/text.cpp 2013-05-17 13:15:13 +0000
20+++ plugins/text/src/text.cpp 2013-07-05 14:46:24 +0000
21@@ -109,25 +109,28 @@
22 * Draw a rounded rectangle path
23 */
24 void
25-TextSurface::drawBackground (int x,
26- int y,
27- int width,
28- int height,
29- int radius)
30+TextSurface::drawBackground (int x,
31+ int y,
32+ int width,
33+ int height,
34+ int radius)
35 {
36 int x0 = x;
37 int y0 = y;
38 int x1 = x + width;
39 int y1 = y + height;
40
41+ const float halfPi = PI / 2.0f;
42+ const float triHalfPi = halfPi * 3;
43+
44 cairo_new_path (cr);
45- cairo_arc (cr, x0 + radius, y1 - radius, radius, PI / 2, PI);
46+ cairo_arc (cr, x0 + radius, y1 - radius, radius, halfPi, PI);
47 cairo_line_to (cr, x0, y0 + radius);
48- cairo_arc (cr, x0 + radius, y0 + radius, radius, PI, 3 * PI / 2);
49+ cairo_arc (cr, x0 + radius, y0 + radius, radius, PI, triHalfPi);
50 cairo_line_to (cr, x1 - radius, y0);
51- cairo_arc (cr, x1 - radius, y0 + radius, radius, 3 * PI / 2, 2 * PI);
52+ cairo_arc (cr, x1 - radius, y0 + radius, radius, triHalfPi, 2 * PI);
53 cairo_line_to (cr, x1, y1 - radius);
54- cairo_arc (cr, x1 - radius, y1 - radius, radius, 0, PI / 2);
55+ cairo_arc (cr, x1 - radius, y1 - radius, radius, 0, halfPi);
56 cairo_close_path (cr);
57 }
58
59@@ -502,10 +505,14 @@
60
61 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
62
63- GLushort colorData[4];
64- GLfloat textureData[8];
65- GLfloat vertexData[12];
66- GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
67+ GLushort colorData[4];
68+ GLfloat textureData[8];
69+ GLfloat vertexData[12];
70+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
71+ GLTexture *tex;
72+ GLTexture::Matrix m;
73+ GLfloat xPlusWidth = x + width;
74+ GLfloat yMinusHeight = y - height;
75
76 colorData[0] = alpha * 65535;
77 colorData[1] = alpha * 65535;
78@@ -514,23 +521,23 @@
79
80 for (unsigned int i = 0; i < texture.size (); ++i)
81 {
82- GLTexture *tex = texture[i];
83- GLTexture::Matrix m = tex->matrix ();
84+ tex = texture[i];
85+ m = tex->matrix ();
86
87 tex->enable (GLTexture::Good);
88
89 streamingBuffer->begin (GL_TRIANGLE_STRIP);
90
91 vertexData[0] = x;
92- vertexData[1] = y - height;
93+ vertexData[1] = yMinusHeight;
94 vertexData[2] = 0;
95 vertexData[3] = x;
96 vertexData[4] = y;
97 vertexData[5] = 0;
98- vertexData[6] = x + width;
99- vertexData[7] = y - height;
100+ vertexData[6] = xPlusWidth;
101+ vertexData[7] = yMinusHeight;
102 vertexData[8] = 0;
103- vertexData[9] = x + width;
104+ vertexData[9] = xPlusWidth;
105 vertexData[10] = y;
106 vertexData[11] = 0;
107

Subscribers

People subscribed via source and target branches

to all changes: