• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "image/gpu_context.h"
17 
18 #include "impl_factory.h"
19 
20 namespace OHOS {
21 namespace Rosen {
22 namespace Drawing {
GPUContext()23 GPUContext::GPUContext() : impl_(ImplFactory::CreateGPUContextImpl()) {}
24 
BuildFromGL(const GPUContextOptions & options)25 bool GPUContext::BuildFromGL(const GPUContextOptions& options)
26 {
27     return impl_->BuildFromGL(options);
28 }
29 
GetResourceCacheLimits(int & maxResource,size_t & maxResourceBytes) const30 void GPUContext::GetResourceCacheLimits(int& maxResource, size_t& maxResourceBytes) const
31 {
32     impl_->GetResourceCacheLimits(maxResource, maxResourceBytes);
33 }
34 
SetResourceCacheLimits(int maxResource,size_t maxResourceBytes)35 void GPUContext::SetResourceCacheLimits(int maxResource, size_t maxResourceBytes)
36 {
37     impl_->SetResourceCacheLimits(maxResource, maxResourceBytes);
38 }
39 
Flush()40 void GPUContext::Flush()
41 {
42     impl_->Flush();
43 }
44 
PerformDeferredCleanup(std::chrono::milliseconds msNotUsed)45 void GPUContext::PerformDeferredCleanup(std::chrono::milliseconds msNotUsed)
46 {
47     impl_->PerformDeferredCleanup(msNotUsed);
48 }
49 
SetPersistentCache(PersistentCache * persistentCache)50 void GPUContextOptions::SetPersistentCache(PersistentCache* persistentCache)
51 {
52     persistentCache_ = persistentCache;
53 }
54 
GetPersistentCache() const55 GPUContextOptions::PersistentCache* GPUContextOptions::GetPersistentCache() const
56 {
57     return persistentCache_;
58 }
59 } // namespace Drawing
60 } // namespace Rosen
61 } // namespace OHOS
62