summaryrefslogtreecommitdiffstats
path: root/cc/raster/scoped_gpu_raster.h
blob: d9613b3c5fbd6e60c4b7cd5d5ad0a1ad5cc1307d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_RASTER_SCOPED_GPU_RASTER_H_
#define CC_RASTER_SCOPED_GPU_RASTER_H_

#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/output/context_provider.h"

namespace cc {

// The following class is needed to modify GL resources using GPU
// raster. The user must ensure that they only use GPU raster on
// GL resources while an instance of this class is alive.
class CC_EXPORT ScopedGpuRaster {
 public:
  explicit ScopedGpuRaster(ContextProvider* context_provider);
  ~ScopedGpuRaster();

 private:
  void BeginGpuRaster();
  void EndGpuRaster();

  ContextProvider* context_provider_;

  DISALLOW_COPY_AND_ASSIGN(ScopedGpuRaster);
};

}  // namespace cc

#endif  // CC_RASTER_SCOPED_GPU_RASTER_H_