ui: Cache the output of View::OnPaint when the View isn't invalid.
[chromium-blink-merge.git] / cc / resources / drawing_display_item.h
blobda302d87d9c82096443b1eef9470693ea86faf1d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_DRAWING_DISPLAY_ITEM_H_
6 #define CC_RESOURCES_DRAWING_DISPLAY_ITEM_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/resources/display_item.h"
11 #include "skia/ext/refptr.h"
12 #include "ui/gfx/geometry/point_f.h"
14 class SkCanvas;
15 class SkDrawPictureCallback;
16 class SkPicture;
18 namespace cc {
20 class CC_EXPORT DrawingDisplayItem : public DisplayItem {
21 public:
22 ~DrawingDisplayItem() override;
24 static scoped_ptr<DrawingDisplayItem> Create(
25 skia::RefPtr<SkPicture> picture) {
26 return make_scoped_ptr(new DrawingDisplayItem(picture));
29 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override;
31 bool IsSuitableForGpuRasterization() const override;
32 int ApproximateOpCount() const override;
33 size_t PictureMemoryUsage() const override;
34 void AsValueInto(base::trace_event::TracedValue* array) const override;
36 scoped_ptr<DrawingDisplayItem> Clone();
38 protected:
39 explicit DrawingDisplayItem(skia::RefPtr<SkPicture> picture);
41 private:
42 skia::RefPtr<SkPicture> picture_;
45 } // namespace cc
47 #endif // CC_RESOURCES_DRAWING_DISPLAY_ITEM_H_