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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const gfx::Size& view_size); | 98 const gfx::Size& view_size); |
99 | 99 |
100 // Returns the index buffer used for drawing a texture. | 100 // Returns the index buffer used for drawing a texture. |
101 ID3D10Buffer* GetTextureIndexBuffer(); | 101 ID3D10Buffer* GetTextureIndexBuffer(); |
102 | 102 |
103 // Compositor: | 103 // Compositor: |
104 virtual Texture* CreateTexture() OVERRIDE; | 104 virtual Texture* CreateTexture() OVERRIDE; |
105 | 105 |
106 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; | 106 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; |
107 | 107 |
108 virtual void ReadPixels(SkBitmap* bitmap) OVERRIDE; | 108 virtual bool ReadPixels(SkBitmap* bitmap) OVERRIDE; |
109 | 109 |
110 protected: | 110 protected: |
111 virtual void OnNotifyStart(bool clear) OVERRIDE; | 111 virtual void OnNotifyStart(bool clear) OVERRIDE; |
112 virtual void OnNotifyEnd() OVERRIDE; | 112 virtual void OnNotifyEnd() OVERRIDE; |
113 virtual void OnWidgetSizeChanged() OVERRIDE; | 113 virtual void OnWidgetSizeChanged() OVERRIDE; |
114 | 114 |
115 private: | 115 private: |
116 enum Direction { | 116 enum Direction { |
117 HORIZONTAL, | 117 HORIZONTAL, |
118 VERTICAL | 118 VERTICAL |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 #if !defined(NDEBUG) | 496 #if !defined(NDEBUG) |
497 // A warning is generated if a bound vertexbuffer is deleted. To avoid that | 497 // A warning is generated if a bound vertexbuffer is deleted. To avoid that |
498 // warning we reset the buffer here. We only do it for debug builds as it's | 498 // warning we reset the buffer here. We only do it for debug builds as it's |
499 // ok to effectively unbind the vertex buffer. | 499 // ok to effectively unbind the vertex buffer. |
500 vertex_buffer = vertex_buffer_.get(); | 500 vertex_buffer = vertex_buffer_.get(); |
501 device_->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset); | 501 device_->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset); |
502 device_->IASetIndexBuffer(index_buffer_.get(), DXGI_FORMAT_R32_UINT, 0); | 502 device_->IASetIndexBuffer(index_buffer_.get(), DXGI_FORMAT_R32_UINT, 0); |
503 #endif | 503 #endif |
504 } | 504 } |
505 | 505 |
506 void CompositorWin::ReadPixels(SkBitmap* bitmap) { | 506 bool CompositorWin::ReadPixels(SkBitmap* bitmap) { |
507 NOTIMPLEMENTED(); | 507 NOTIMPLEMENTED(); |
| 508 return false; |
508 } | 509 } |
509 | 510 |
510 void CompositorWin::OnWidgetSizeChanged() { | 511 void CompositorWin::OnWidgetSizeChanged() { |
511 dest_render_target_view_ = NULL; | 512 dest_render_target_view_ = NULL; |
512 depth_stencil_buffer_ = NULL; | 513 depth_stencil_buffer_ = NULL; |
513 depth_stencil_view_ = NULL; | 514 depth_stencil_view_ = NULL; |
514 | 515 |
515 main_render_target_view_ = NULL; | 516 main_render_target_view_ = NULL; |
516 main_texture_ = NULL; | 517 main_texture_ = NULL; |
517 main_texture_shader_view_ = NULL; | 518 main_texture_shader_view_ = NULL; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 // static | 801 // static |
801 Compositor* Compositor::Create(CompositorDelegate* delegate, | 802 Compositor* Compositor::Create(CompositorDelegate* delegate, |
802 gfx::AcceleratedWidget widget, | 803 gfx::AcceleratedWidget widget, |
803 const gfx::Size& size) { | 804 const gfx::Size& size) { |
804 CompositorWin* compositor = new CompositorWin(delegate, widget, size); | 805 CompositorWin* compositor = new CompositorWin(delegate, widget, size); |
805 compositor->Init(); | 806 compositor->Init(); |
806 return compositor; | 807 return compositor; |
807 } | 808 } |
808 | 809 |
809 } // namespace ui | 810 } // namespace ui |
OLD | NEW |