Add ICU message format support
[chromium-blink-merge.git] / cc / output / software_renderer.h
blob3fc163d6fea712a7f45e6d6ffadb626160e1f669
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
3 // found in the LICENSE file.
5 #ifndef CC_OUTPUT_SOFTWARE_RENDERER_H_
6 #define CC_OUTPUT_SOFTWARE_RENDERER_H_
8 #include "base/basictypes.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/direct_renderer.h"
13 namespace cc {
15 class OutputSurface;
16 class RendererClient;
17 class ResourceProvider;
18 class SoftwareOutputDevice;
20 class CheckerboardDrawQuad;
21 class DebugBorderDrawQuad;
22 class PictureDrawQuad;
23 class RenderPassDrawQuad;
24 class SolidColorDrawQuad;
25 class TextureDrawQuad;
26 class TileDrawQuad;
28 class CC_EXPORT SoftwareRenderer : public DirectRenderer {
29 public:
30 static scoped_ptr<SoftwareRenderer> Create(
31 RendererClient* client,
32 const RendererSettings* settings,
33 OutputSurface* output_surface,
34 ResourceProvider* resource_provider);
36 ~SoftwareRenderer() override;
37 const RendererCapabilitiesImpl& Capabilities() const override;
38 void Finish() override;
39 void SwapBuffers(const CompositorFrameMetadata& metadata) override;
40 void DiscardBackbuffer() override;
41 void EnsureBackbuffer() override;
43 protected:
44 void BindFramebufferToOutputSurface(DrawingFrame* frame) override;
45 bool BindFramebufferToTexture(DrawingFrame* frame,
46 const ScopedResource* texture,
47 const gfx::Rect& target_rect) override;
48 void SetScissorTestRect(const gfx::Rect& scissor_rect) override;
49 void PrepareSurfaceForPass(DrawingFrame* frame,
50 SurfaceInitializationMode initialization_mode,
51 const gfx::Rect& render_pass_scissor) override;
53 void DoDrawQuad(DrawingFrame* frame,
54 const DrawQuad* quad,
55 const gfx::QuadF* draw_region) override;
56 void BeginDrawingFrame(DrawingFrame* frame) override;
57 void FinishDrawingFrame(DrawingFrame* frame) override;
58 bool FlippedFramebuffer(const DrawingFrame* frame) const override;
59 void EnsureScissorTestEnabled() override;
60 void EnsureScissorTestDisabled() override;
61 void CopyCurrentRenderPassToBitmap(
62 DrawingFrame* frame,
63 scoped_ptr<CopyOutputRequest> request) override;
65 SoftwareRenderer(RendererClient* client,
66 const RendererSettings* settings,
67 OutputSurface* output_surface,
68 ResourceProvider* resource_provider);
70 void DidChangeVisibility() override;
72 private:
73 void ClearCanvas(SkColor color);
74 void ClearFramebuffer(DrawingFrame* frame);
75 void SetClipRect(const gfx::Rect& rect);
76 bool IsSoftwareResource(ResourceId resource_id) const;
78 void DrawCheckerboardQuad(const DrawingFrame* frame,
79 const CheckerboardDrawQuad* quad);
80 void DrawDebugBorderQuad(const DrawingFrame* frame,
81 const DebugBorderDrawQuad* quad);
82 void DrawPictureQuad(const DrawingFrame* frame,
83 const PictureDrawQuad* quad);
84 void DrawRenderPassQuad(const DrawingFrame* frame,
85 const RenderPassDrawQuad* quad);
86 void DrawSolidColorQuad(const DrawingFrame* frame,
87 const SolidColorDrawQuad* quad);
88 void DrawTextureQuad(const DrawingFrame* frame,
89 const TextureDrawQuad* quad);
90 void DrawTileQuad(const DrawingFrame* frame,
91 const TileDrawQuad* quad);
92 void DrawUnsupportedQuad(const DrawingFrame* frame,
93 const DrawQuad* quad);
95 RendererCapabilitiesImpl capabilities_;
96 bool is_scissor_enabled_;
97 bool is_backbuffer_discarded_;
98 gfx::Rect scissor_rect_;
100 SoftwareOutputDevice* output_device_;
101 SkCanvas* root_canvas_;
102 SkCanvas* current_canvas_;
103 SkPaint current_paint_;
104 scoped_ptr<ResourceProvider::ScopedWriteLockSoftware>
105 current_framebuffer_lock_;
106 skia::RefPtr<SkCanvas> current_framebuffer_canvas_;
108 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer);
111 } // namespace cc
113 #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_