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

Unified Diff: Source/platform/graphics/DisplayList.h

Issue 536573002: Modifications to DisplayList for better Slimming Paint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Testing FIXME Created 6 years, 3 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
Index: Source/platform/graphics/DisplayList.h
diff --git a/Source/platform/graphics/DisplayList.h b/Source/platform/graphics/DisplayList.h
index 9d8623c1b7f656483476aae946adcf33d2378cf4..a4a9d68912491dd007fce3ff51745beaaa503ddd 100644
--- a/Source/platform/graphics/DisplayList.h
+++ b/Source/platform/graphics/DisplayList.h
@@ -32,15 +32,13 @@
#define DisplayList_h
#include "platform/geometry/FloatRect.h"
-
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutPoint.h"
+#include "third_party/skia/include/core/SkPicture.h"
#include "wtf/FastAllocBase.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
-class SkCanvas;
-class SkPicture;
-class SkPictureRecorder;
-
namespace blink {
class IntSize;
@@ -49,25 +47,50 @@ class PLATFORM_EXPORT DisplayList FINAL : public WTF::RefCounted<DisplayList> {
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(DisplayList);
public:
- DisplayList(const FloatRect&);
- ~DisplayList();
+ static PassRefPtr<DisplayList> create(const FloatRect& bounds)
+ {
+ return adoptRef(new DisplayList(bounds));
+ }
+
+ virtual ~DisplayList() { }
- const FloatRect& bounds() const;
+ const FloatRect& bounds() const { return m_bounds; }
// This entry point will return 0 when the DisplayList is in the
// midst of recording (i.e., between a beginRecording/endRecording pair)
Stephen White 2014/09/08 19:51:01 beginRecording()/endRecording() seem to be gone; s
// and if no recording has ever been completed. Otherwise it will return
// the picture created by the last endRecording call.
- SkPicture* picture() const;
+ SkPicture* picture() const { return m_picture.get(); }
+ void setPicture(SkPicture* picture) { m_picture = adoptRef(picture); }
- SkCanvas* beginRecording(const IntSize&, uint32_t recordFlags = 0);
- bool isRecording() const { return m_recorder; }
- void endRecording();
+ // FIXME: Need unit testing of these methods and their effect
+ const SkMatrix& transform() const { return m_transform; }
+ void setTransform(const SkMatrix& transform) { m_transform = transform; }
+ void setTransformFromPaintOffset(const LayoutPoint& paintOffset)
+ {
+ SkMatrix m;
+ m.setTranslate(paintOffset.x().toFloat(), paintOffset.y().toFloat());
+ setTransform(m);
+ }
+ void clearTransform() { m_transform.reset(); }
+
+ // FIXME: Need unit testing of these methods and their effect
+ const SkRect& clip() const { return m_clip; }
+ void setClip(const IntRect& rect) { m_clip = rect; }
+ void setClip(const FloatRect& rect) { m_clip = rect; }
+ void clearClip() { m_clip.setEmpty(); }
private:
+ DisplayList(const FloatRect& bounds) : m_bounds(bounds)
+ {
+ clearTransform();
+ clearClip();
+ }
+
FloatRect m_bounds;
+ SkMatrix m_transform;
+ SkRect m_clip; // TODO: Do we need to support other types of clips here?
RefPtr<SkPicture> m_picture;
- OwnPtr<SkPictureRecorder> m_recorder;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698