OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
7 | 7 |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/base/scoped_ptr_deque.h" | 10 #include "cc/base/scoped_ptr_deque.h" |
11 #include "cc/base/scoped_ptr_vector.h" | 11 #include "cc/base/scoped_ptr_vector.h" |
12 #include "cc/output/direct_renderer.h" | 12 #include "cc/output/direct_renderer.h" |
13 #include "cc/output/gl_renderer_draw_cache.h" | 13 #include "cc/output/gl_renderer_draw_cache.h" |
14 #include "cc/output/program_binding.h" | 14 #include "cc/output/program_binding.h" |
15 #include "cc/output/renderer.h" | 15 #include "cc/output/renderer.h" |
16 #include "cc/quads/checkerboard_draw_quad.h" | |
17 #include "cc/quads/debug_border_draw_quad.h" | 16 #include "cc/quads/debug_border_draw_quad.h" |
18 #include "cc/quads/io_surface_draw_quad.h" | 17 #include "cc/quads/io_surface_draw_quad.h" |
19 #include "cc/quads/render_pass_draw_quad.h" | 18 #include "cc/quads/render_pass_draw_quad.h" |
20 #include "cc/quads/solid_color_draw_quad.h" | 19 #include "cc/quads/solid_color_draw_quad.h" |
21 #include "cc/quads/tile_draw_quad.h" | 20 #include "cc/quads/tile_draw_quad.h" |
22 #include "cc/quads/yuv_video_draw_quad.h" | 21 #include "cc/quads/yuv_video_draw_quad.h" |
23 #include "ui/gfx/geometry/quad_f.h" | 22 #include "ui/gfx/geometry/quad_f.h" |
24 | 23 |
25 class SkBitmap; | 24 class SkBitmap; |
26 | 25 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 private: | 146 private: |
148 friend class GLRendererShaderPixelTest; | 147 friend class GLRendererShaderPixelTest; |
149 friend class GLRendererShaderTest; | 148 friend class GLRendererShaderTest; |
150 | 149 |
151 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); | 150 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); |
152 | 151 |
153 void DiscardPixels(); | 152 void DiscardPixels(); |
154 void ClearFramebuffer(DrawingFrame* frame); | 153 void ClearFramebuffer(DrawingFrame* frame); |
155 void SetViewport(); | 154 void SetViewport(); |
156 | 155 |
157 void DrawCheckerboardQuad(const DrawingFrame* frame, | |
158 const CheckerboardDrawQuad* quad, | |
159 const gfx::QuadF* clip_region); | |
160 void DrawDebugBorderQuad(const DrawingFrame* frame, | 156 void DrawDebugBorderQuad(const DrawingFrame* frame, |
161 const DebugBorderDrawQuad* quad); | 157 const DebugBorderDrawQuad* quad); |
162 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { | 158 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { |
163 return blend_mode == SkXfermode::kSrcOver_Mode; | 159 return blend_mode == SkXfermode::kSrcOver_Mode; |
164 } | 160 } |
165 bool CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); | 161 bool CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); |
166 void ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); | 162 void ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); |
167 void RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode); | 163 void RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode); |
168 | 164 |
169 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( | 165 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 TileProgramAA; | 283 TileProgramAA; |
288 typedef ProgramBinding<VertexShaderTileAA, | 284 typedef ProgramBinding<VertexShaderTileAA, |
289 FragmentShaderRGBATexClampSwizzleAlphaAA> | 285 FragmentShaderRGBATexClampSwizzleAlphaAA> |
290 TileProgramSwizzleAA; | 286 TileProgramSwizzleAA; |
291 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> | 287 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> |
292 TileProgramOpaque; | 288 TileProgramOpaque; |
293 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha> | 289 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha> |
294 TileProgramSwizzle; | 290 TileProgramSwizzle; |
295 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque> | 291 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque> |
296 TileProgramSwizzleOpaque; | 292 TileProgramSwizzleOpaque; |
297 typedef ProgramBinding<VertexShaderPosTex, FragmentShaderCheckerboard> | |
298 TileCheckerboardProgram; | |
299 | 293 |
300 // Texture shaders. | 294 // Texture shaders. |
301 typedef ProgramBinding<VertexShaderPosTexTransform, | 295 typedef ProgramBinding<VertexShaderPosTexTransform, |
302 FragmentShaderRGBATexVaryingAlpha> TextureProgram; | 296 FragmentShaderRGBATexVaryingAlpha> TextureProgram; |
303 typedef ProgramBinding<VertexShaderPosTexTransform, | 297 typedef ProgramBinding<VertexShaderPosTexTransform, |
304 FragmentShaderRGBATexPremultiplyAlpha> | 298 FragmentShaderRGBATexPremultiplyAlpha> |
305 NonPremultipliedTextureProgram; | 299 NonPremultipliedTextureProgram; |
306 typedef ProgramBinding<VertexShaderPosTexTransform, | 300 typedef ProgramBinding<VertexShaderPosTexTransform, |
307 FragmentShaderTexBackgroundVaryingAlpha> | 301 FragmentShaderTexBackgroundVaryingAlpha> |
308 TextureBackgroundProgram; | 302 TextureBackgroundProgram; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 TexCoordPrecision precision, SamplerType sampler); | 349 TexCoordPrecision precision, SamplerType sampler); |
356 const TileProgramAA* GetTileProgramAA( | 350 const TileProgramAA* GetTileProgramAA( |
357 TexCoordPrecision precision, SamplerType sampler); | 351 TexCoordPrecision precision, SamplerType sampler); |
358 const TileProgramSwizzle* GetTileProgramSwizzle( | 352 const TileProgramSwizzle* GetTileProgramSwizzle( |
359 TexCoordPrecision precision, SamplerType sampler); | 353 TexCoordPrecision precision, SamplerType sampler); |
360 const TileProgramSwizzleOpaque* GetTileProgramSwizzleOpaque( | 354 const TileProgramSwizzleOpaque* GetTileProgramSwizzleOpaque( |
361 TexCoordPrecision precision, SamplerType sampler); | 355 TexCoordPrecision precision, SamplerType sampler); |
362 const TileProgramSwizzleAA* GetTileProgramSwizzleAA( | 356 const TileProgramSwizzleAA* GetTileProgramSwizzleAA( |
363 TexCoordPrecision precision, SamplerType sampler); | 357 TexCoordPrecision precision, SamplerType sampler); |
364 | 358 |
365 const TileCheckerboardProgram* GetTileCheckerboardProgram(); | |
366 | |
367 const RenderPassProgram* GetRenderPassProgram(TexCoordPrecision precision, | 359 const RenderPassProgram* GetRenderPassProgram(TexCoordPrecision precision, |
368 BlendMode blend_mode); | 360 BlendMode blend_mode); |
369 const RenderPassProgramAA* GetRenderPassProgramAA(TexCoordPrecision precision, | 361 const RenderPassProgramAA* GetRenderPassProgramAA(TexCoordPrecision precision, |
370 BlendMode blend_mode); | 362 BlendMode blend_mode); |
371 const RenderPassMaskProgram* GetRenderPassMaskProgram( | 363 const RenderPassMaskProgram* GetRenderPassMaskProgram( |
372 TexCoordPrecision precision, | 364 TexCoordPrecision precision, |
373 SamplerType sampler, | 365 SamplerType sampler, |
374 BlendMode blend_mode, | 366 BlendMode blend_mode, |
375 bool mask_for_background); | 367 bool mask_for_background); |
376 const RenderPassMaskProgramAA* GetRenderPassMaskProgramAA( | 368 const RenderPassMaskProgramAA* GetRenderPassMaskProgramAA( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 TileProgramAA | 419 TileProgramAA |
428 tile_program_aa_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1]; | 420 tile_program_aa_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1]; |
429 TileProgramSwizzle tile_program_swizzle_[LAST_TEX_COORD_PRECISION + | 421 TileProgramSwizzle tile_program_swizzle_[LAST_TEX_COORD_PRECISION + |
430 1][LAST_SAMPLER_TYPE + 1]; | 422 1][LAST_SAMPLER_TYPE + 1]; |
431 TileProgramSwizzleOpaque | 423 TileProgramSwizzleOpaque |
432 tile_program_swizzle_opaque_[LAST_TEX_COORD_PRECISION + | 424 tile_program_swizzle_opaque_[LAST_TEX_COORD_PRECISION + |
433 1][LAST_SAMPLER_TYPE + 1]; | 425 1][LAST_SAMPLER_TYPE + 1]; |
434 TileProgramSwizzleAA tile_program_swizzle_aa_[LAST_TEX_COORD_PRECISION + | 426 TileProgramSwizzleAA tile_program_swizzle_aa_[LAST_TEX_COORD_PRECISION + |
435 1][LAST_SAMPLER_TYPE + 1]; | 427 1][LAST_SAMPLER_TYPE + 1]; |
436 | 428 |
437 TileCheckerboardProgram tile_checkerboard_program_; | |
438 | |
439 TextureProgram | 429 TextureProgram |
440 texture_program_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1]; | 430 texture_program_[LAST_TEX_COORD_PRECISION + 1][LAST_SAMPLER_TYPE + 1]; |
441 NonPremultipliedTextureProgram | 431 NonPremultipliedTextureProgram |
442 nonpremultiplied_texture_program_[LAST_TEX_COORD_PRECISION + | 432 nonpremultiplied_texture_program_[LAST_TEX_COORD_PRECISION + |
443 1][LAST_SAMPLER_TYPE + 1]; | 433 1][LAST_SAMPLER_TYPE + 1]; |
444 TextureBackgroundProgram | 434 TextureBackgroundProgram |
445 texture_background_program_[LAST_TEX_COORD_PRECISION + | 435 texture_background_program_[LAST_TEX_COORD_PRECISION + |
446 1][LAST_SAMPLER_TYPE + 1]; | 436 1][LAST_SAMPLER_TYPE + 1]; |
447 NonPremultipliedTextureBackgroundProgram | 437 NonPremultipliedTextureBackgroundProgram |
448 nonpremultiplied_texture_background_program_[LAST_TEX_COORD_PRECISION + | 438 nonpremultiplied_texture_background_program_[LAST_TEX_COORD_PRECISION + |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 514 |
525 SkBitmap on_demand_tile_raster_bitmap_; | 515 SkBitmap on_demand_tile_raster_bitmap_; |
526 ResourceId on_demand_tile_raster_resource_id_; | 516 ResourceId on_demand_tile_raster_resource_id_; |
527 BoundGeometry bound_geometry_; | 517 BoundGeometry bound_geometry_; |
528 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 518 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
529 }; | 519 }; |
530 | 520 |
531 } // namespace cc | 521 } // namespace cc |
532 | 522 |
533 #endif // CC_OUTPUT_GL_RENDERER_H_ | 523 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |