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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ID3D10Device* device, | 51 ID3D10Device* device, |
52 ID3D10Effect* effect); | 52 ID3D10Effect* effect); |
53 | 53 |
54 // Texture: | 54 // Texture: |
55 virtual void SetCanvas(const SkCanvas& canvas, | 55 virtual void SetCanvas(const SkCanvas& canvas, |
56 const gfx::Point& origin, | 56 const gfx::Point& origin, |
57 const gfx::Size& overall_size) OVERRIDE; | 57 const gfx::Size& overall_size) OVERRIDE; |
58 virtual void Draw(const ui::TextureDrawParams& params) OVERRIDE; | 58 virtual void Draw(const ui::TextureDrawParams& params) OVERRIDE; |
59 | 59 |
60 virtual void Draw(const ui::TextureDrawParams& params, | 60 virtual void Draw(const ui::TextureDrawParams& params, |
61 const gfx::Rect& clip_bounds) OVERRIDE; | 61 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; |
62 | 62 |
63 private: | 63 private: |
64 ~ViewTexture(); | 64 ~ViewTexture(); |
65 | 65 |
66 void Errored(HRESULT result); | 66 void Errored(HRESULT result); |
67 | 67 |
68 void ConvertBitmapToD3DData(const SkBitmap& bitmap, | 68 void ConvertBitmapToD3DData(const SkBitmap& bitmap, |
69 scoped_array<uint32>* converted_data); | 69 scoped_array<uint32>* converted_data); |
70 | 70 |
71 void CreateVertexBuffer(const gfx::Size& size); | 71 void CreateVertexBuffer(const gfx::Size& size); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 UINT stride = sizeof(Vertex); | 266 UINT stride = sizeof(Vertex); |
267 UINT offset = 0; | 267 UINT offset = 0; |
268 ID3D10Buffer* vertex_buffer = vertex_buffer_.get(); | 268 ID3D10Buffer* vertex_buffer = vertex_buffer_.get(); |
269 device_->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset); | 269 device_->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset); |
270 device_->IASetIndexBuffer(compositor_->GetTextureIndexBuffer(), | 270 device_->IASetIndexBuffer(compositor_->GetTextureIndexBuffer(), |
271 DXGI_FORMAT_R32_UINT, 0); | 271 DXGI_FORMAT_R32_UINT, 0); |
272 device_->DrawIndexed(6, 0, 0); | 272 device_->DrawIndexed(6, 0, 0); |
273 } | 273 } |
274 | 274 |
275 void ViewTexture::Draw(const ui::TextureDrawParams& params, | 275 void ViewTexture::Draw(const ui::TextureDrawParams& params, |
276 const gfx::Rect& clip_bounds) { | 276 const gfx::Rect& clip_bounds_in_texture) { |
277 NOTIMPLEMENTED(); | 277 NOTIMPLEMENTED(); |
278 } | 278 } |
279 | 279 |
280 void ViewTexture::Errored(HRESULT result) { | 280 void ViewTexture::Errored(HRESULT result) { |
281 // TODO: figure out error handling. | 281 // TODO: figure out error handling. |
282 DCHECK(false); | 282 DCHECK(false); |
283 } | 283 } |
284 | 284 |
285 void ViewTexture::ConvertBitmapToD3DData( | 285 void ViewTexture::ConvertBitmapToD3DData( |
286 const SkBitmap& bitmap, | 286 const SkBitmap& bitmap, |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 816 |
817 // static | 817 // static |
818 Compositor* Compositor::Create(gfx::AcceleratedWidget widget, | 818 Compositor* Compositor::Create(gfx::AcceleratedWidget widget, |
819 const gfx::Size& size) { | 819 const gfx::Size& size) { |
820 CompositorWin* compositor = new CompositorWin(widget, size); | 820 CompositorWin* compositor = new CompositorWin(widget, size); |
821 compositor->Init(); | 821 compositor->Init(); |
822 return compositor; | 822 return compositor; |
823 } | 823 } |
824 | 824 |
825 } // namespace ui | 825 } // namespace ui |
OLD | NEW |