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

Unified Diff: cc/output/ca_layer_overlay.h

Issue 2156913003: Refactor CALayerOverlay to pull out CALayerOverlaySharedState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp36
Patch Set: Rebase. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/output/ca_layer_overlay.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/ca_layer_overlay.h
diff --git a/cc/output/ca_layer_overlay.h b/cc/output/ca_layer_overlay.h
index 09dc7f83bb62c22e05ce8bc0fffa053b7742f009..e26145c93f48f514793bdc18f8d17f0a78851f80 100644
--- a/cc/output/ca_layer_overlay.h
+++ b/cc/output/ca_layer_overlay.h
@@ -5,6 +5,7 @@
#ifndef CC_OUTPUT_CA_LAYER_OVERLAY_H_
#define CC_OUTPUT_CA_LAYER_OVERLAY_H_
+#include "base/memory/ref_counted.h"
#include "cc/quads/render_pass.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkMatrix44.h"
@@ -15,33 +16,50 @@ namespace cc {
class DrawQuad;
class ResourceProvider;
+// Holds information that is frequently shared between consecutive
+// CALayerOverlays.
+class CC_EXPORT CALayerOverlaySharedState
+ : public base::RefCounted<CALayerOverlaySharedState> {
+ public:
+ CALayerOverlaySharedState() {}
+
+ // Layers in a non-zero sorting context exist in the same 3D space and should
+ // intersect.
+ unsigned sorting_context_id = 0;
+ // If |is_clipped| is true, then clip to |clip_rect| in the target space.
+ bool is_clipped = false;
+ gfx::RectF clip_rect;
+ // The opacity property for the CAayer.
+ float opacity = 1;
+ // The transform to apply to the CALayer.
+ SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor);
+
+ private:
+ friend class base::RefCounted<CALayerOverlaySharedState>;
+ ~CALayerOverlaySharedState() {}
+};
+
+// Holds all information necessary to construct a CALayer from a DrawQuad.
class CC_EXPORT CALayerOverlay {
public:
CALayerOverlay();
CALayerOverlay(const CALayerOverlay& other);
~CALayerOverlay();
- // If |is_clipped| is true, then clip to |clip_rect| in the target space.
- bool is_clipped = false;
- gfx::RectF clip_rect;
- // Layers in a non-zero sorting context exist in the same 3D space and should
- // intersect.
- unsigned sorting_context_id = 0;
+ // State that is frequently shared between consecutive CALayerOverlays.
+ scoped_refptr<CALayerOverlaySharedState> shared_state;
+
// Texture that corresponds to an IOSurface to set as the content of the
// CALayer. If this is 0 then the CALayer is a solid color.
unsigned contents_resource_id = 0;
// The contents rect property for the CALayer.
gfx::RectF contents_rect;
- // The opacity property for the CAayer.
- float opacity = 1;
+ // The bounds for the CALayer in pixels.
+ gfx::RectF bounds_rect;
// The background color property for the CALayer.
SkColor background_color = SK_ColorTRANSPARENT;
// The edge anti-aliasing mask property for the CALayer.
unsigned edge_aa_mask = 0;
- // The bounds for the CALayer in pixels.
- gfx::RectF bounds_rect;
- // The transform to apply to the CALayer.
- SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor);
// The minification and magnification filters for the CALayer.
unsigned filter;
};
« no previous file with comments | « no previous file | cc/output/ca_layer_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698