GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / cc / resources / float_clip_display_item.h
blobaf88c50a20ace409d886bbea5db7a8cea9e3b3dc
1 // Copyright 2015 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_FLOAT_CLIP_DISPLAY_ITEM_H_
6 #define CC_RESOURCES_FLOAT_CLIP_DISPLAY_ITEM_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/resources/display_item.h"
13 #include "ui/gfx/geometry/rect_f.h"
15 class SkCanvas;
16 class SkDrawPictureCallback;
18 namespace cc {
20 class CC_EXPORT FloatClipDisplayItem : public DisplayItem {
21 public:
22 ~FloatClipDisplayItem() override;
24 static scoped_ptr<FloatClipDisplayItem> Create(gfx::RectF clip_rect) {
25 return make_scoped_ptr(new FloatClipDisplayItem(clip_rect));
28 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override;
30 bool IsSuitableForGpuRasterization() const override;
31 int ApproximateOpCount() const override;
32 size_t PictureMemoryUsage() const override;
33 void AsValueInto(base::trace_event::TracedValue* array) const override;
35 protected:
36 explicit FloatClipDisplayItem(gfx::RectF clip_rect);
38 private:
39 gfx::RectF clip_rect_;
42 class CC_EXPORT EndFloatClipDisplayItem : public DisplayItem {
43 public:
44 ~EndFloatClipDisplayItem() override;
46 static scoped_ptr<EndFloatClipDisplayItem> Create() {
47 return make_scoped_ptr(new EndFloatClipDisplayItem());
50 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override;
52 bool IsSuitableForGpuRasterization() const override;
53 int ApproximateOpCount() const override;
54 size_t PictureMemoryUsage() const override;
55 void AsValueInto(base::trace_event::TracedValue* array) const override;
57 protected:
58 EndFloatClipDisplayItem();
61 } // namespace cc
63 #endif // CC_RESOURCES_FLOAT_CLIP_DISPLAY_ITEM_H_