Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: cc/output/shader.h

Issue 959283004: Background filters are affected by masks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more robust fuzzy comparator Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/program_binding.h ('k') | cc/output/shader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CC_OUTPUT_SHADER_H_ 5 #ifndef CC_OUTPUT_SHADER_H_
6 #define CC_OUTPUT_SHADER_H_ 6 #define CC_OUTPUT_SHADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 BLEND_MODE_DIFFERENCE, 52 BLEND_MODE_DIFFERENCE,
53 BLEND_MODE_EXCLUSION, 53 BLEND_MODE_EXCLUSION,
54 BLEND_MODE_MULTIPLY, 54 BLEND_MODE_MULTIPLY,
55 BLEND_MODE_HUE, 55 BLEND_MODE_HUE,
56 BLEND_MODE_SATURATION, 56 BLEND_MODE_SATURATION,
57 BLEND_MODE_COLOR, 57 BLEND_MODE_COLOR,
58 BLEND_MODE_LUMINOSITY, 58 BLEND_MODE_LUMINOSITY,
59 LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY 59 LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY
60 }; 60 };
61 61
62 enum MaskMode {
63 NO_MASK = 0,
64 HAS_MASK = 1,
65 LAST_MASK_VALUE = HAS_MASK
66 };
67
62 struct ShaderLocations { 68 struct ShaderLocations {
63 ShaderLocations(); 69 ShaderLocations();
64 70
65 int sampler = -1; 71 int sampler = -1;
66 int quad = -1; 72 int quad = -1;
67 int edge = -1; 73 int edge = -1;
68 int viewport = -1; 74 int viewport = -1;
69 int mask_sampler = -1; 75 int mask_sampler = -1;
70 int mask_tex_coord_scale = -1; 76 int mask_tex_coord_scale = -1;
71 int mask_tex_coord_offset = -1; 77 int mask_tex_coord_offset = -1;
72 int matrix = -1; 78 int matrix = -1;
73 int alpha = -1; 79 int alpha = -1;
74 int color_matrix = -1; 80 int color_matrix = -1;
75 int color_offset = -1; 81 int color_offset = -1;
76 int tex_transform = -1; 82 int tex_transform = -1;
77 int backdrop = -1; 83 int backdrop = -1;
78 int backdrop_rect = -1; 84 int backdrop_rect = -1;
85 int original_backdrop = -1;
79 }; 86 };
80 87
81 // Note: The highp_threshold_cache must be provided by the caller to make 88 // Note: The highp_threshold_cache must be provided by the caller to make
82 // the caching multi-thread/context safe in an easy low-overhead manner. 89 // the caching multi-thread/context safe in an easy low-overhead manner.
83 // The caller must make sure to clear highp_threshold_cache to 0, so it can be 90 // The caller must make sure to clear highp_threshold_cache to 0, so it can be
84 // reinitialized, if a new or different context is used. 91 // reinitialized, if a new or different context is used.
85 CC_EXPORT TexCoordPrecision 92 CC_EXPORT TexCoordPrecision
86 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context, 93 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context,
87 int* highp_threshold_cache, 94 int* highp_threshold_cache,
88 int highp_threshold_min, 95 int highp_threshold_min,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 private: 346 private:
340 int matrix_location_; 347 int matrix_location_;
341 int tex_matrix_location_; 348 int tex_matrix_location_;
342 349
343 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); 350 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform);
344 }; 351 };
345 352
346 class FragmentTexBlendMode { 353 class FragmentTexBlendMode {
347 public: 354 public:
348 int backdrop_location() const { return backdrop_location_; } 355 int backdrop_location() const { return backdrop_location_; }
356 int original_backdrop_location() const { return original_backdrop_location_; }
349 int backdrop_rect_location() const { return backdrop_rect_location_; } 357 int backdrop_rect_location() const { return backdrop_rect_location_; }
350 358
351 BlendMode blend_mode() const { return blend_mode_; } 359 BlendMode blend_mode() const { return blend_mode_; }
352 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; } 360 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; }
353 bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; } 361 bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; }
362 void set_mask_for_background(bool mask_for_background) {
363 mask_for_background_ = mask_for_background;
364 }
365 bool mask_for_background() const { return mask_for_background_; }
354 366
355 protected: 367 protected:
356 FragmentTexBlendMode(); 368 FragmentTexBlendMode();
357 369
358 std::string SetBlendModeFunctions(std::string shader_string) const; 370 std::string SetBlendModeFunctions(std::string shader_string) const;
359 371
360 int backdrop_location_; 372 int backdrop_location_;
373 int original_backdrop_location_;
361 int backdrop_rect_location_; 374 int backdrop_rect_location_;
362 375
363 private: 376 private:
364 BlendMode blend_mode_; 377 BlendMode blend_mode_;
378 bool mask_for_background_;
365 379
366 std::string GetHelperFunctions() const; 380 std::string GetHelperFunctions() const;
367 std::string GetBlendFunction() const; 381 std::string GetBlendFunction() const;
368 std::string GetBlendFunctionBodyForRGB() const; 382 std::string GetBlendFunctionBodyForRGB() const;
369 }; 383 };
370 384
371 class FragmentTexAlphaBinding : public FragmentTexBlendMode { 385 class FragmentTexAlphaBinding : public FragmentTexBlendMode {
372 public: 386 public:
373 FragmentTexAlphaBinding(); 387 FragmentTexAlphaBinding();
374 388
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 int tex_transform_location_; 881 int tex_transform_location_;
868 int frequency_location_; 882 int frequency_location_;
869 int color_location_; 883 int color_location_;
870 884
871 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); 885 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard);
872 }; 886 };
873 887
874 } // namespace cc 888 } // namespace cc
875 889
876 #endif // CC_OUTPUT_SHADER_H_ 890 #endif // CC_OUTPUT_SHADER_H_
OLDNEW
« no previous file with comments | « cc/output/program_binding.h ('k') | cc/output/shader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698