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

Unified Diff: cc/paint/paint_canvas.h

Issue 2768143002: Back PaintRecord with PaintOpBuffer instead of SkPicture (Closed)
Patch Set: More unit tests Created 3 years, 8 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: cc/paint/paint_canvas.h
diff --git a/cc/paint/paint_canvas.h b/cc/paint/paint_canvas.h
index 778841f61a9a7212d71d85322f5e58c9bae34658..829ad0409508d528fa39f65238c126c7af2cbeec 100644
--- a/cc/paint/paint_canvas.h
+++ b/cc/paint/paint_canvas.h
@@ -10,19 +10,24 @@
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "cc/paint/paint_export.h"
-#include "cc/paint/paint_record.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace cc {
class DisplayItemList;
class PaintFlags;
+class PaintOpBuffer;
+
+using PaintRecord = PaintOpBuffer;
class CC_PAINT_EXPORT PaintCanvas {
public:
virtual ~PaintCanvas() {}
virtual SkMetaData& getMetaData() = 0;
+
+ // TODO(enne): this only appears to mostly be used to determine if this is
+ // recording or not, so could be simplified or removed.
virtual SkImageInfo imageInfo() const = 0;
// TODO(enne): It would be nice to get rid of flush() entirely, as it
@@ -48,7 +53,7 @@ class CC_PAINT_EXPORT PaintCanvas {
int y) = 0;
virtual int save() = 0;
virtual int saveLayer(const SkRect* bounds, const PaintFlags* flags) = 0;
- virtual int saveLayerAlpha(const SkRect* bounds, U8CPU alpha) = 0;
+ virtual int saveLayerAlpha(const SkRect* bounds, uint8_t alpha) = 0;
virtual void restore() = 0;
virtual int getSaveCount() const = 0;
@@ -99,6 +104,8 @@ class CC_PAINT_EXPORT PaintCanvas {
virtual bool getDeviceClipBounds(SkIRect* bounds) const = 0;
virtual void drawColor(SkColor color, SkBlendMode mode) = 0;
void drawColor(SkColor color) { drawColor(color, SkBlendMode::kSrcOver); }
+
+ // TODO(enne): This is a synonym for drawColor with kSrc. Remove it.
virtual void clear(SkColor color) = 0;
virtual void drawLine(SkScalar x0,
@@ -181,9 +188,15 @@ class CC_PAINT_EXPORT PaintCanvas {
SkIRect* clip_bounds) = 0;
virtual bool ToPixmap(SkPixmap* output) = 0;
- virtual void AnnotateRectWithURL(const SkRect& rect, SkData* data) = 0;
- virtual void AnnotateNamedDestination(const SkPoint& point, SkData* data) = 0;
- virtual void AnnotateLinkToDestination(const SkRect& rect, SkData* data) = 0;
+
+ enum class AnnotationType {
+ URL,
+ NAMED_DESTINATION,
+ LINK_TO_DESTINATION,
+ };
+ virtual void Annotate(AnnotationType type,
+ const SkRect& rect,
+ sk_sp<SkData> data) = 0;
// TODO(enne): maybe this should live on PaintRecord, but that's not
// possible when PaintRecord is a typedef.
@@ -192,18 +205,6 @@ class CC_PAINT_EXPORT PaintCanvas {
protected:
friend class PaintSurface;
friend class PaintRecorder;
- friend CC_PAINT_EXPORT void PaintCanvasAnnotateRectWithURL(
- PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data);
- friend CC_PAINT_EXPORT void PaintCanvasAnnotateNamedDestination(
- PaintCanvas* canvas,
- const SkPoint& point,
- SkData* data);
- friend CC_PAINT_EXPORT void PaintCanvasAnnotateLinkToDestination(
- PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data);
friend CC_PAINT_EXPORT bool ToPixmap(PaintCanvas* canvas, SkPixmap* output);
};
@@ -251,18 +252,6 @@ CC_PAINT_EXPORT void SetIsPreviewMetafile(PaintCanvas* canvas, bool is_preview);
CC_PAINT_EXPORT bool IsPreviewMetafile(PaintCanvas* canvas);
#endif
-CC_PAINT_EXPORT void PaintCanvasAnnotateRectWithURL(PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data);
-
-CC_PAINT_EXPORT void PaintCanvasAnnotateNamedDestination(PaintCanvas* canvas,
- const SkPoint& point,
- SkData* data);
-
-CC_PAINT_EXPORT void PaintCanvasAnnotateLinkToDestination(PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data);
-
} // namespace cc
#endif // CC_PAINT_PAINT_CANVAS_H_

Powered by Google App Engine
This is Rietveld 408576698