Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkBBHFactory.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkBBHFactory_DEFINED
9#define SkBBHFactory_DEFINED
10
13
14// TODO(kjlubick) fix client users and then make this a forward declare
15#include "include/core/SkRect.h" // IWYU pragma: keep
16
17#include <cstddef>
18#include <vector>
19
20class SkBBoxHierarchy : public SkRefCnt {
21public:
22 struct Metadata {
23 bool isDraw; // The corresponding SkRect bounds a draw command, not a pure state change.
24 };
25
26 /**
27 * Insert N bounding boxes into the hierarchy.
28 */
29 virtual void insert(const SkRect[], int N) = 0;
30 virtual void insert(const SkRect[], const Metadata[], int N);
31
32 /**
33 * Populate results with the indices of bounding boxes intersecting that query.
34 */
35 virtual void search(const SkRect& query, std::vector<int>* results) const = 0;
36
37 /**
38 * Return approximate size in memory of *this.
39 */
40 virtual size_t bytesUsed() const = 0;
41
42protected:
43 SkBBoxHierarchy() = default;
46};
47
49public:
50 /**
51 * Allocate a new SkBBoxHierarchy. Return NULL on failure.
52 */
54 virtual ~SkBBHFactory() {}
55
56protected:
57 SkBBHFactory() = default;
58 SkBBHFactory(const SkBBHFactory&) = delete;
60};
61
63public:
64 sk_sp<SkBBoxHierarchy> operator()() const override;
65};
66
67#endif
#define SK_API
Definition SkAPI.h:35
#define N
Definition beziers.cpp:19
virtual sk_sp< SkBBoxHierarchy > operator()() const =0
SkBBHFactory(const SkBBHFactory &)=delete
SkBBHFactory()=default
SkBBHFactory & operator=(const SkBBHFactory &)=delete
virtual ~SkBBHFactory()
virtual size_t bytesUsed() const =0
virtual void search(const SkRect &query, std::vector< int > *results) const =0
virtual void insert(const SkRect[], int N)=0
SkBBoxHierarchy()=default
SkBBoxHierarchy & operator=(const SkBBoxHierarchy &)=delete
SkBBoxHierarchy(const SkBBoxHierarchy &)=delete