Skia
2D Graphics Library
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 
11 #include "include/core/SkRect.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/core/SkTypes.h"
14 #include <vector>
15 
16 class SkBBoxHierarchy : public SkRefCnt {
17 public:
18  struct Metadata {
19  bool isDraw; // The corresponding SkRect bounds a draw command, not a pure state change.
20  };
21 
25  virtual void insert(const SkRect[], int N) = 0;
26  virtual void insert(const SkRect[], const Metadata[], int N);
27 
31  virtual void search(const SkRect& query, std::vector<int>* results) const = 0;
32 
36  virtual size_t bytesUsed() const = 0;
37 
38 protected:
39  SkBBoxHierarchy() = default;
40  SkBBoxHierarchy(const SkBBoxHierarchy&) = delete;
42 };
43 
45 public:
49  virtual sk_sp<SkBBoxHierarchy> operator()() const = 0;
50  virtual ~SkBBHFactory() {}
51 
52 protected:
53  SkBBHFactory() = default;
54  SkBBHFactory(const SkBBHFactory&) = delete;
55  SkBBHFactory& operator=(const SkBBHFactory&) = delete;
56 };
57 
59 public:
61 };
62 
63 #endif
SkBBoxHierarchy::insert
virtual void insert(const SkRect[], int N)=0
Insert N bounding boxes into the hierarchy.
SkBBoxHierarchy::SkBBoxHierarchy
SkBBoxHierarchy()=default
N
#define N
Definition: skcms.cc:2080
SkBBoxHierarchy::search
virtual void search(const SkRect &query, std::vector< int > *results) const =0
Populate results with the indices of bounding boxes intersecting that query.
SkRefCnt
Definition: SkRefCnt.h:118
SkTypes.h
SkBBoxHierarchy::Metadata
Definition: SkBBHFactory.h:18
SkBBHFactory
Definition: SkBBHFactory.h:44
SkBBHFactory::SkBBHFactory
SkBBHFactory()=default
SkRect.h
SkBBHFactory::SkBBHFactory
SkBBHFactory(const SkBBHFactory &)=delete
SkRTreeFactory::operator()
sk_sp< SkBBoxHierarchy > operator()() const override
Allocate a new SkBBoxHierarchy.
SkBBHFactory::~SkBBHFactory
virtual ~SkBBHFactory()
Definition: SkBBHFactory.h:50
SkBBHFactory::operator=
SkBBHFactory & operator=(const SkBBHFactory &)=delete
SkRefCnt.h
SkBBoxHierarchy::bytesUsed
virtual size_t bytesUsed() const =0
Return approximate size in memory of *this.
sk_sp< SkBBoxHierarchy >
SkBBoxHierarchy
Definition: SkBBHFactory.h:16
SkBBHFactory::operator()
virtual sk_sp< SkBBoxHierarchy > operator()() const =0
Allocate a new SkBBoxHierarchy.
SK_API
#define SK_API
Definition: SkTypes.h:181
SkBBoxHierarchy::insert
virtual void insert(const SkRect[], const Metadata[], int N)
SkBBoxHierarchy::operator=
SkBBoxHierarchy & operator=(const SkBBoxHierarchy &)=delete
SkRTreeFactory
Definition: SkBBHFactory.h:58
SkBBoxHierarchy::Metadata::isDraw
bool isDraw
Definition: SkBBHFactory.h:19
SkBBoxHierarchy::SkBBoxHierarchy
SkBBoxHierarchy(const SkBBoxHierarchy &)=delete
SkRect
Definition: SkRect.h:572