Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: ui/gfx/compositor/compositor_gl.cc

Issue 7044062: Use SkMatrix44 for the underlying implementation of ui::Transform (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Gardening patch Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/compositor/compositor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/compositor/compositor_gl.h" 5 #include "ui/gfx/compositor/compositor_gl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 t.ConcatScale(1, -1); 266 t.ConcatScale(1, -1);
267 267
268 t.ConcatTransform(transform); // Add view transform. 268 t.ConcatTransform(transform); // Add view transform.
269 269
270 t.ConcatTranslate(0, -window_size.height()); 270 t.ConcatTranslate(0, -window_size.height());
271 t.ConcatScale(1, -1); 271 t.ConcatScale(1, -1);
272 t.ConcatTranslate(-window_size.width()/2.0f, -window_size.height()/2.0f); 272 t.ConcatTranslate(-window_size.width()/2.0f, -window_size.height()/2.0f);
273 t.ConcatScale(2.0f/window_size.width(), 2.0f/window_size.height()); 273 t.ConcatScale(2.0f/window_size.width(), 2.0f/window_size.height());
274 274
275 GLfloat m[16]; 275 GLfloat m[16];
276 const SkMatrix& matrix = t.matrix(); 276 t.matrix().asColMajorf(m);
277
278 // Convert 3x3 view transform matrix (row major) into 4x4 GL matrix (column
279 // major). Assume 2-D rotations/translations restricted to XY plane.
280
281 m[ 0] = matrix[0];
282 m[ 1] = matrix[3];
283 m[ 2] = 0;
284 m[ 3] = matrix[6];
285
286 m[ 4] = matrix[1];
287 m[ 5] = matrix[4];
288 m[ 6] = 0;
289 m[ 7] = matrix[7];
290
291 m[ 8] = 0;
292 m[ 9] = 0;
293 m[10] = 1;
294 m[11] = 0;
295
296 m[12] = matrix[2];
297 m[13] = matrix[5];
298 m[14] = 0;
299 m[15] = matrix[8];
300 277
301 static const GLfloat vertices[] = { -1., -1., +0., +0., +1., 278 static const GLfloat vertices[] = { -1., -1., +0., +0., +1.,
302 +1., -1., +0., +1., +1., 279 +1., -1., +0., +1., +1.,
303 +1., +1., +0., +1., +0., 280 +1., +1., +0., +1., +0.,
304 -1., +1., +0., +0., +0. }; 281 -1., +1., +0., +0., +0. };
305 282
306 glVertexAttribPointer(program.a_pos_loc(), 3, GL_FLOAT, 283 glVertexAttribPointer(program.a_pos_loc(), 3, GL_FLOAT,
307 GL_FALSE, 5 * sizeof(GLfloat), vertices); 284 GL_FALSE, 5 * sizeof(GLfloat), vertices);
308 glVertexAttribPointer(program.a_tex_loc(), 2, GL_FLOAT, 285 glVertexAttribPointer(program.a_tex_loc(), 2, GL_FLOAT,
309 GL_FALSE, 5 * sizeof(GLfloat), &vertices[3]); 286 GL_FALSE, 5 * sizeof(GLfloat), &vertices[3]);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 // on this thread long enough to perform the GL bindings. 391 // on this thread long enough to perform the GL bindings.
415 // TODO(wjmaclean) Remove this when GL initialisation cleaned up. 392 // TODO(wjmaclean) Remove this when GL initialisation cleaned up.
416 base::ThreadRestrictions::ScopedAllowIO allow_io; 393 base::ThreadRestrictions::ScopedAllowIO allow_io;
417 if (gfx::GLSurface::InitializeOneOff() && 394 if (gfx::GLSurface::InitializeOneOff() &&
418 gfx::GetGLImplementation() != gfx::kGLImplementationNone) 395 gfx::GetGLImplementation() != gfx::kGLImplementationNone)
419 return new CompositorGL(widget, size); 396 return new CompositorGL(widget, size);
420 return NULL; 397 return NULL;
421 } 398 }
422 399
423 } // namespace ui 400 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/compositor/compositor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698