• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 "bridge/declarative_frontend/jsview/js_rendering_context_settings.h"
17 #include "bridge/declarative_frontend/jsview/js_rendering_context.h"
18 #include "bridge/declarative_frontend/jsview/js_view_common_def.h"
19 
20 namespace OHOS::Ace::Framework {
21 
JSRenderingContextSettings()22 JSRenderingContextSettings::JSRenderingContextSettings()
23 {
24 }
25 
Constructor(const JSCallbackInfo & args)26 void JSRenderingContextSettings::Constructor(const JSCallbackInfo& args)
27 {
28     auto jsRenderingContextSettings = Referenced::MakeRefPtr<JSRenderingContextSettings>();
29     jsRenderingContextSettings->IncRefCount();
30     args.SetReturnValue(Referenced::RawPtr(jsRenderingContextSettings));
31     bool anti = false;
32     bool alpha = false;
33     if (args.Length() > 0) {
34         JSViewAbstract::ParseJsBool(args[0], anti);
35     }
36     if (args.Length() > 1) {
37         JSViewAbstract::ParseJsBool(args[1], alpha);
38     }
39     jsRenderingContextSettings->SetAntialias(anti);
40     jsRenderingContextSettings->SetAlpha(alpha);
41 }
42 
Destructor(JSRenderingContextSettings * controller)43 void JSRenderingContextSettings::Destructor(JSRenderingContextSettings* controller)
44 {
45     if (controller != nullptr) {
46         controller->DecRefCount();
47     }
48 }
49 
JSBind(BindingTarget globalObj)50 void JSRenderingContextSettings::JSBind(BindingTarget globalObj)
51 {
52     JSClass<JSRenderingContextSettings>::Declare("RenderingContextSettings");
53     JSClass<JSRenderingContextSettings>::Bind(globalObj, JSRenderingContextSettings::Constructor,
54         JSRenderingContextSettings::Destructor);
55 }
56 
57 } // namespace OHOS::Ace::Framework
58