OLD | NEW |
---|---|
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.h" | 5 #include "ui/gfx/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <d3dx10.h> | 8 #include <d3dx10.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 LoadEffects(); | 344 LoadEffects(); |
345 Resize(last_bounds_); | 345 Resize(last_bounds_); |
346 InitVertexLayout(); | 346 InitVertexLayout(); |
347 CreateVertexBuffer(); | 347 CreateVertexBuffer(); |
348 CreateIndexBuffer(); | 348 CreateIndexBuffer(); |
349 } | 349 } |
350 | 350 |
351 void CompositorWin::UpdatePerspective(const ui::Transform& transform, | 351 void CompositorWin::UpdatePerspective(const ui::Transform& transform, |
352 const gfx::Size& view_size) { | 352 const gfx::Size& view_size) { |
353 // Apply transform from view. | 353 // Apply transform from view. |
354 const SkMatrix& sk_matrix(transform.matrix()); | 354 const SkMatrix44& m(transform.matrix()); |
355 // Use -1 * kMTransY for y-translation as origin for views is upper left. | 355 // Use -1 * kMTransY for y-translation as origin for views is upper left. |
356 D3DXMATRIX transform_matrix( | 356 D3DXMATRIX transform_matrix( |
357 // row 1 | 357 m.get(0,0), m.get(1,0), m.get(2,0), m.get(3,0), |
rjkroege
2011/06/10 17:52:14
same comment as the GL case. Is there not a way to
| |
358 sk_matrix[SkMatrix::kMScaleX], sk_matrix[SkMatrix::kMSkewX], 0.0f, | 358 m.get(0,1), m.get(1,1), m.get(2,1), m.get(3,1), |
359 sk_matrix[SkMatrix::kMPersp0], | 359 m.get(0,2), m.get(1,2), m.get(2,2), m.get(3,2), |
360 // row 2 | 360 m.get(0,3), m.get(1,3), m.get(2,3), m.get(3,3)); |
361 sk_matrix[SkMatrix::kMSkewY], sk_matrix[SkMatrix::kMScaleY], 0.0f, | |
362 sk_matrix[SkMatrix::kMPersp1], | |
363 // row 3 | |
364 0.0f, 0.0f, 1.0f, sk_matrix[SkMatrix::kMPersp2], | |
365 // row 4. | |
366 sk_matrix[SkMatrix::kMTransX], -sk_matrix[SkMatrix::kMTransY], 0.0f, | |
367 1.0f); | |
368 | 361 |
369 // Scale so x and y are from 0-2. | 362 // Scale so x and y are from 0-2. |
370 D3DXMATRIX scale_matrix; | 363 D3DXMATRIX scale_matrix; |
371 D3DXMatrixScaling( | 364 D3DXMatrixScaling( |
372 &scale_matrix, | 365 &scale_matrix, |
373 2.0f / static_cast<float>(last_bounds_.width()), | 366 2.0f / static_cast<float>(last_bounds_.width()), |
374 2.0f / static_cast<float>(last_bounds_.height()), | 367 2.0f / static_cast<float>(last_bounds_.height()), |
375 1.0f); | 368 1.0f); |
376 | 369 |
377 // Translate so x and y are from -1,-1 to 1,1. | 370 // Translate so x and y are from -1,-1 to 1,1. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 } // namespace | 817 } // namespace |
825 | 818 |
826 // static | 819 // static |
827 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { | 820 Compositor* Compositor::Create(gfx::AcceleratedWidget widget) { |
828 CompositorWin* compositor = new CompositorWin(widget); | 821 CompositorWin* compositor = new CompositorWin(widget); |
829 compositor->Init(); | 822 compositor->Init(); |
830 return compositor; | 823 return compositor; |
831 } | 824 } |
832 | 825 |
833 } // namespace ui | 826 } // namespace ui |
OLD | NEW |