| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef CC_OUTPUT_SOFTWARE_RENDERER_H_ | 5 #ifndef CC_OUTPUT_SOFTWARE_RENDERER_H_ |
| 6 #define CC_OUTPUT_SOFTWARE_RENDERER_H_ | 6 #define CC_OUTPUT_SOFTWARE_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/output/direct_renderer.h" | 10 #include "cc/output/direct_renderer.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 void SwapBuffers(std::vector<ui::LatencyInfo> latency_info) override; | 32 void SwapBuffers(std::vector<ui::LatencyInfo> latency_info) override; |
| 33 | 33 |
| 34 void SetDisablePictureQuadImageFiltering(bool disable) { | 34 void SetDisablePictureQuadImageFiltering(bool disable) { |
| 35 disable_picture_quad_image_filtering_ = disable; | 35 disable_picture_quad_image_filtering_ = disable; |
| 36 } | 36 } |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 bool CanPartialSwap() override; | 39 bool CanPartialSwap() override; |
| 40 ResourceFormat BackbufferFormat() const override; | 40 ResourceFormat BackbufferFormat() const override; |
| 41 void BindFramebufferToOutputSurface(DrawingFrame* frame) override; | 41 void BindFramebufferToOutputSurface() override; |
| 42 bool BindFramebufferToTexture(DrawingFrame* frame, | 42 bool BindFramebufferToTexture(const ScopedResource* texture) override; |
| 43 const ScopedResource* texture) override; | |
| 44 void SetScissorTestRect(const gfx::Rect& scissor_rect) override; | 43 void SetScissorTestRect(const gfx::Rect& scissor_rect) override; |
| 45 void PrepareSurfaceForPass(DrawingFrame* frame, | 44 void PrepareSurfaceForPass(SurfaceInitializationMode initialization_mode, |
| 46 SurfaceInitializationMode initialization_mode, | |
| 47 const gfx::Rect& render_pass_scissor) override; | 45 const gfx::Rect& render_pass_scissor) override; |
| 48 void DoDrawQuad(DrawingFrame* frame, | 46 void DoDrawQuad(const DrawQuad* quad, const gfx::QuadF* draw_region) override; |
| 49 const DrawQuad* quad, | 47 void BeginDrawingFrame() override; |
| 50 const gfx::QuadF* draw_region) override; | 48 void FinishDrawingFrame() override; |
| 51 void BeginDrawingFrame(DrawingFrame* frame) override; | 49 bool FlippedFramebuffer() const override; |
| 52 void FinishDrawingFrame(DrawingFrame* frame) override; | |
| 53 bool FlippedFramebuffer(const DrawingFrame* frame) const override; | |
| 54 void EnsureScissorTestEnabled() override; | 50 void EnsureScissorTestEnabled() override; |
| 55 void EnsureScissorTestDisabled() override; | 51 void EnsureScissorTestDisabled() override; |
| 56 void CopyCurrentRenderPassToBitmap( | 52 void CopyCurrentRenderPassToBitmap( |
| 57 DrawingFrame* frame, | |
| 58 std::unique_ptr<CopyOutputRequest> request) override; | 53 std::unique_ptr<CopyOutputRequest> request) override; |
| 59 void DidChangeVisibility() override; | 54 void DidChangeVisibility() override; |
| 60 | 55 |
| 61 private: | 56 private: |
| 62 void ClearCanvas(SkColor color); | 57 void ClearCanvas(SkColor color); |
| 63 void ClearFramebuffer(DrawingFrame* frame); | 58 void ClearFramebuffer(); |
| 64 void SetClipRect(const gfx::Rect& rect); | 59 void SetClipRect(const gfx::Rect& rect); |
| 65 bool IsSoftwareResource(ResourceId resource_id) const; | 60 bool IsSoftwareResource(ResourceId resource_id) const; |
| 66 | 61 |
| 67 void DrawDebugBorderQuad(const DrawingFrame* frame, | 62 void DrawDebugBorderQuad(const DebugBorderDrawQuad* quad); |
| 68 const DebugBorderDrawQuad* quad); | 63 void DrawPictureQuad(const PictureDrawQuad* quad); |
| 69 void DrawPictureQuad(const DrawingFrame* frame, | 64 void DrawRenderPassQuad(const RenderPassDrawQuad* quad); |
| 70 const PictureDrawQuad* quad); | 65 void DrawSolidColorQuad(const SolidColorDrawQuad* quad); |
| 71 void DrawRenderPassQuad(const DrawingFrame* frame, | 66 void DrawTextureQuad(const TextureDrawQuad* quad); |
| 72 const RenderPassDrawQuad* quad); | 67 void DrawTileQuad(const TileDrawQuad* quad); |
| 73 void DrawSolidColorQuad(const DrawingFrame* frame, | 68 void DrawUnsupportedQuad(const DrawQuad* quad); |
| 74 const SolidColorDrawQuad* quad); | |
| 75 void DrawTextureQuad(const DrawingFrame* frame, | |
| 76 const TextureDrawQuad* quad); | |
| 77 void DrawTileQuad(const DrawingFrame* frame, | |
| 78 const TileDrawQuad* quad); | |
| 79 void DrawUnsupportedQuad(const DrawingFrame* frame, | |
| 80 const DrawQuad* quad); | |
| 81 bool ShouldApplyBackgroundFilters( | 69 bool ShouldApplyBackgroundFilters( |
| 82 const RenderPassDrawQuad* quad, | 70 const RenderPassDrawQuad* quad, |
| 83 const FilterOperations* background_filters) const; | 71 const FilterOperations* background_filters) const; |
| 84 sk_sp<SkImage> ApplyImageFilter(SkImageFilter* filter, | 72 sk_sp<SkImage> ApplyImageFilter(SkImageFilter* filter, |
| 85 const RenderPassDrawQuad* quad, | 73 const RenderPassDrawQuad* quad, |
| 86 const SkBitmap& to_filter, | 74 const SkBitmap& to_filter, |
| 87 SkIRect* auto_bounds) const; | 75 SkIRect* auto_bounds) const; |
| 88 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( | 76 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( |
| 89 const DrawingFrame* frame, | |
| 90 const RenderPassDrawQuad* quad, | 77 const RenderPassDrawQuad* quad, |
| 91 const gfx::Transform& contents_device_transform, | 78 const gfx::Transform& contents_device_transform, |
| 92 const FilterOperations* background_filters, | 79 const FilterOperations* background_filters, |
| 93 gfx::Rect* unclipped_rect) const; | 80 gfx::Rect* unclipped_rect) const; |
| 94 SkBitmap GetBackdropBitmap(const gfx::Rect& bounding_rect) const; | 81 SkBitmap GetBackdropBitmap(const gfx::Rect& bounding_rect) const; |
| 95 sk_sp<SkShader> GetBackgroundFilterShader( | 82 sk_sp<SkShader> GetBackgroundFilterShader( |
| 96 const DrawingFrame* frame, | |
| 97 const RenderPassDrawQuad* quad, | 83 const RenderPassDrawQuad* quad, |
| 98 SkShader::TileMode content_tile_mode) const; | 84 SkShader::TileMode content_tile_mode) const; |
| 99 | 85 |
| 100 bool disable_picture_quad_image_filtering_ = false; | 86 bool disable_picture_quad_image_filtering_ = false; |
| 101 | 87 |
| 102 bool is_scissor_enabled_ = false; | 88 bool is_scissor_enabled_ = false; |
| 103 gfx::Rect scissor_rect_; | 89 gfx::Rect scissor_rect_; |
| 104 | 90 |
| 105 SoftwareOutputDevice* output_device_; | 91 SoftwareOutputDevice* output_device_; |
| 106 SkCanvas* root_canvas_ = nullptr; | 92 SkCanvas* root_canvas_ = nullptr; |
| 107 SkCanvas* current_canvas_ = nullptr; | 93 SkCanvas* current_canvas_ = nullptr; |
| 108 SkPaint current_paint_; | 94 SkPaint current_paint_; |
| 109 std::unique_ptr<ResourceProvider::ScopedWriteLockSoftware> | 95 std::unique_ptr<ResourceProvider::ScopedWriteLockSoftware> |
| 110 current_framebuffer_lock_; | 96 current_framebuffer_lock_; |
| 111 std::unique_ptr<SkCanvas> current_framebuffer_canvas_; | 97 std::unique_ptr<SkCanvas> current_framebuffer_canvas_; |
| 112 | 98 |
| 113 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); | 99 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); |
| 114 }; | 100 }; |
| 115 | 101 |
| 116 } // namespace cc | 102 } // namespace cc |
| 117 | 103 |
| 118 #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_ | 104 #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_ |
| OLD | NEW |