8cca61c8e000fcb965f16c60f0ddde1cc9d3e61f
3 ** Copyright 2009 Samsung Electronics Co, Ltd.
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
21 #define LOG_TAG "SKIA"
22 #include <utils/Log.h>
26 struct blit_op_table optbl
[] = {
27 { (int)BLIT_OP_SOLID_FILL
, "FILL" },
28 { (int)BLIT_OP_CLR
, "CLR" },
29 { (int)BLIT_OP_SRC
, "SRC" },
30 { (int)BLIT_OP_DST
, "DST" },
31 { (int)BLIT_OP_SRC_OVER
, "SRC_OVER" },
32 { (int)BLIT_OP_DST_OVER
, "DST_OVER" },
33 { (int)BLIT_OP_SRC_IN
, "SRC_IN" },
34 { (int)BLIT_OP_DST_IN
, "DST_IN" },
35 { (int)BLIT_OP_SRC_OUT
, "SRC_OUT" },
36 { (int)BLIT_OP_DST_OUT
, "DST_OUT" },
37 { (int)BLIT_OP_SRC_ATOP
, "SRC_ATOP" },
38 { (int)BLIT_OP_DST_ATOP
, "DST_ATOP" },
39 { (int)BLIT_OP_XOR
, "XOR" },
40 { (int)BLIT_OP_ADD
, "ADD" },
41 { (int)BLIT_OP_MULTIPLY
, "MULTIPLY" },
42 { (int)BLIT_OP_SCREEN
, "SCREEN" },
43 { (int)BLIT_OP_DARKEN
, "DARKEN" },
44 { (int)BLIT_OP_LIGHTEN
, "LIGHTEN" },
45 { (int)BLIT_OP_DISJ_SRC_OVER
, "DISJ_SRC_OVER" },
46 { (int)BLIT_OP_DISJ_DST_OVER
, "DISJ_DST_OVER" },
47 { (int)BLIT_OP_DISJ_SRC_IN
, "DISJ_SRC_IN" },
48 { (int)BLIT_OP_DISJ_DST_IN
, "DISJ_DST_IN" },
49 { (int)BLIT_OP_DISJ_SRC_OUT
, "DISJ_SRC_OUT" },
50 { (int)BLIT_OP_DISJ_DST_OUT
, "DISJ_DST_OUT" },
51 { (int)BLIT_OP_DISJ_SRC_ATOP
, "DISJ_SRC_ATOP" },
52 { (int)BLIT_OP_DISJ_DST_ATOP
, "DISJ_DST_ATOP" },
53 { (int)BLIT_OP_DISJ_XOR
, "DISJ_XOR" },
54 { (int)BLIT_OP_CONJ_SRC_OVER
, "CONJ_SRC_OVER" },
55 { (int)BLIT_OP_CONJ_DST_OVER
, "CONJ_DST_OVER" },
56 { (int)BLIT_OP_CONJ_SRC_IN
, "CONJ_SRC_IN" },
57 { (int)BLIT_OP_CONJ_DST_IN
, "CONJ_DST_IN" },
58 { (int)BLIT_OP_CONJ_SRC_OUT
, "CONJ_SRC_OUT" },
59 { (int)BLIT_OP_CONJ_DST_OUT
, "CONJ_DST_OUT" },
60 { (int)BLIT_OP_CONJ_SRC_ATOP
, "CONJ_SRC_ATOP" },
61 { (int)BLIT_OP_CONJ_DST_ATOP
, "CONJ_DST_ATOP" },
62 { (int)BLIT_OP_CONJ_XOR
, "CONJ_XOR" },
63 { (int)BLIT_OP_USER_COEFF
, "USER_COEFF" },
64 { (int)BLIT_OP_END
, "" },
68 void VOID_FUNC(const char *format
, ...)
79 if (m_flagCreate
== true)
80 PRINT("%s::this is not Destroyed fail\n", __func__
);
83 bool FimgApi::Create(void)
87 if (t_Lock() == false) {
88 PRINT("%s::t_Lock() fail\n", __func__
);
92 if (m_flagCreate
== true) {
93 PRINT("%s::Already Created fail\n", __func__
);
97 if (t_Create() == false) {
98 PRINT("%s::t_Create() fail\n", __func__
);
113 bool FimgApi::Destroy(void)
117 if (t_Lock() == false) {
118 PRINT("%s::t_Lock() fail\n", __func__
);
122 if (m_flagCreate
== false) {
123 PRINT("%s::Already Destroyed fail\n", __func__
);
127 if (t_Destroy() == false) {
128 PRINT("%s::t_Destroy() fail\n", __func__
);
132 m_flagCreate
= false;
143 bool FimgApi::Stretch(struct fimg2d_blit
*cmd
)
147 if (t_Lock() == false) {
148 PRINT("%s::t_Lock() fail\n", __func__
);
152 if (m_flagCreate
== false) {
153 PRINT("%s::This is not Created fail\n", __func__
);
157 if (t_Stretch(cmd
) == false) {
170 bool FimgApi::Sync(void)
174 if (m_flagCreate
== false) {
175 PRINT("%s::This is not Created fail\n", __func__
);
179 if (t_Sync() == false)
189 bool FimgApi::t_Create(void)
191 PRINT("%s::This is empty virtual function fail\n", __func__
);
195 bool FimgApi::t_Destroy(void)
197 PRINT("%s::This is empty virtual function fail\n", __func__
);
201 bool FimgApi::t_Stretch(struct fimg2d_blit
*cmd
)
203 PRINT("%s::This is empty virtual function fail\n", __func__
);
207 bool FimgApi::t_Sync(void)
209 PRINT("%s::This is empty virtual function fail\n", __func__
);
213 bool FimgApi::t_Lock(void)
215 PRINT("%s::This is empty virtual function fail\n", __func__
);
219 bool FimgApi::t_UnLock(void)
221 PRINT("%s::This is empty virtual function fail\n", __func__
);
225 //---------------------------------------------------------------------------//
227 //---------------------------------------------------------------------------//
228 extern "C" int stretchFimgApi(struct fimg2d_blit
*cmd
)
230 FimgApi
* fimgApi
= createFimgApi();
232 if (fimgApi
== NULL
) {
233 PRINT("%s::createFimgApi() fail\n", __func__
);
237 if (fimgApi
->Stretch(cmd
) == false) {
239 destroyFimgApi(fimgApi
);
245 destroyFimgApi(fimgApi
);
250 extern "C" int SyncFimgApi(void)
252 FimgApi
* fimgApi
= createFimgApi();
253 if (fimgApi
== NULL
) {
254 PRINT("%s::createFimgApi() fail\n", __func__
);
258 if (fimgApi
->Sync() == false) {
260 destroyFimgApi(fimgApi
);
266 destroyFimgApi(fimgApi
);
271 void printDataBlit(char *title
, struct fimg2d_blit
*cmd
)
273 SLOGI("%s\n", title
);
275 SLOGI(" sequence_no. = %u\n", cmd
->seq_no
);
276 SLOGI(" blit_op = %d(%s)\n", cmd
->op
, optbl
[cmd
->op
].str
);
277 SLOGI(" fill_color = %X\n", cmd
->param
.solid_color
);
278 SLOGI(" global_alpha = %u\n", (unsigned int)cmd
->param
.g_alpha
);
279 SLOGI(" PREMULT = %s\n", cmd
->param
.premult
== PREMULTIPLIED
? "PREMULTIPLIED" : "NON-PREMULTIPLIED");
280 SLOGI(" do_dither = %s\n", cmd
->param
.dither
== true ? "dither" : "no-dither");
282 printDataBlitRotate(cmd
->param
.rotate
);
284 printDataBlitScale(&cmd
->param
.scaling
);
286 printDataBlitImage("SRC", cmd
->src
);
287 printDataBlitImage("DST", cmd
->dst
);
288 printDataBlitImage("MSK", cmd
->msk
);
290 printDataBlitRect("SRC", &cmd
->src
->rect
);
291 printDataBlitRect("DST", &cmd
->dst
->rect
);
292 printDataBlitRect("MSK", &cmd
->msk
->rect
);
295 void printDataBlitImage(char *title
, struct fimg2d_image
*image
)
298 SLOGI(" Image_%s\n", title
);
299 SLOGI(" addr = %X\n", image
->addr
.start
);
300 SLOGI(" format = %d\n", image
->fmt
);
302 SLOGI(" Image_%s : NULL\n", title
);
305 void printDataBlitRect(char *title
, struct fimg2d_rect
*rect
)
308 SLOGI(" RECT_%s\n", title
);
309 SLOGI(" (x1, y1) = (%d, %d)\n", rect
->x1
, rect
->y1
);
310 SLOGI(" (x2, y2) = (%d, %d)\n", rect
->x2
, rect
->y2
);
311 SLOGI(" (width, height) = (%d, %d)\n", rect
->x2
- rect
->x1
, rect
->y2
- rect
->y1
);
313 SLOGI(" RECT_%s : NULL\n", title
);
316 void printDataBlitRotate(int rotate
)
318 SLOGI(" ROTATE : %d\n", rotate
);
321 void printDataBlitScale(struct fimg2d_scale
*scaling
)
324 SLOGI(" scale_mode : %s\n", scaling
->mode
== 0 ?
326 (scaling
->mode
== 1 ? "SCALING_NEAREST" : "SCALING_BILINEAR"));
327 SLOGI(" src : (src_w, src_h) = (%d, %d)\n", scaling
->src_w
, scaling
->src_h
);
328 SLOGI(" dst : (dst_w, dst_h) = (%d, %d)\n", scaling
->dst_w
, scaling
->dst_h
);
329 SLOGI(" scaling_factor : (scale_w, scale_y) = (%3.2f, %3.2f)\n", (double)scaling
->dst_w
/ scaling
->src_w
, (double)scaling
->dst_h
/ scaling
->src_h
);