comparison src/macterm.c @ 69512:eafd737138ea

(XCreatePixmap) [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: Create GWorld in ARGB pixel format. (mac_copy_area, mac_copy_area_with_mask) [USE_CG_DRAWING]: Remove functions. (x_draw_image_foreground) [USE_CG_DRAWING]: Use mac_draw_cg_image instead of mac_copy_area/mac_copy_area_with_mask.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 16 Mar 2006 08:05:56 +0000
parents 72158718da16
children bc015cae7e3e b901f4f12f33 e3bacb89536a
comparison
equal deleted inserted replaced
69511:65b669e90ff5 69512:eafd737138ea
651 QDErr err; 651 QDErr err;
652 652
653 SetPortWindowPort (w); 653 SetPortWindowPort (w);
654 654
655 SetRect (&r, 0, 0, width, height); 655 SetRect (&r, 0, 0, width, height);
656 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0); 656 #if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
657 if (depth == 1)
658 #endif
659 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0);
660 #if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
661 else
662 /* CreateCGImageFromPixMaps requires ARGB format. */
663 err = QTNewGWorld (&pixmap, k32ARGBPixelFormat, &r, NULL, NULL, 0);
664 #endif
657 if (err != noErr) 665 if (err != noErr)
658 return NULL; 666 return NULL;
659 return pixmap; 667 return pixmap;
660 } 668 }
661 669
1334 return 1; 1342 return 1;
1335 } 1343 }
1336 #endif 1344 #endif
1337 1345
1338 1346
1347 #if !USE_CG_DRAWING
1339 /* Mac replacement for XCopyArea: dest must be window. */ 1348 /* Mac replacement for XCopyArea: dest must be window. */
1340 1349
1341 static void 1350 static void
1342 mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y) 1351 mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
1343 Pixmap src; 1352 Pixmap src;
1347 unsigned int width, height; 1356 unsigned int width, height;
1348 int dest_x, dest_y; 1357 int dest_x, dest_y;
1349 { 1358 {
1350 Rect src_r, dest_r; 1359 Rect src_r, dest_r;
1351 1360
1352 #if USE_CG_DRAWING
1353 mac_prepare_for_quickdraw (f);
1354 #endif
1355 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1361 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1356 1362
1357 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1363 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
1358 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); 1364 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
1359 1365
1394 unsigned int width, height; 1400 unsigned int width, height;
1395 int dest_x, dest_y; 1401 int dest_x, dest_y;
1396 { 1402 {
1397 Rect src_r, dest_r; 1403 Rect src_r, dest_r;
1398 1404
1399 #if USE_CG_DRAWING
1400 mac_prepare_for_quickdraw (f);
1401 #endif
1402 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1405 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1403 1406
1404 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1407 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
1405 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); 1408 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
1406 1409
1429 UnlockPixels (GetGWorldPixMap (src)); 1432 UnlockPixels (GetGWorldPixMap (src));
1430 mac_end_clip (gc); 1433 mac_end_clip (gc);
1431 1434
1432 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1435 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1433 } 1436 }
1437 #endif /* !USE_CG_DRAWING */
1434 1438
1435 1439
1436 /* Mac replacement for XCopyArea: used only for scrolling. */ 1440 /* Mac replacement for XCopyArea: used only for scrolling. */
1437 1441
1438 static void 1442 static void
3283 3287
3284 if (s->img->pixmap) 3288 if (s->img->pixmap)
3285 { 3289 {
3286 x_set_glyph_string_clipping (s); 3290 x_set_glyph_string_clipping (s);
3287 3291
3292 #if USE_CG_DRAWING
3293 mac_draw_cg_image (s->img->data.ptr_val,
3294 s->f, s->gc, s->slice.x, s->slice.y,
3295 s->slice.width, s->slice.height, x, y, 1);
3296 #endif
3288 if (s->img->mask) 3297 if (s->img->mask)
3298 #if !USE_CG_DRAWING
3289 mac_copy_area_with_mask (s->img->pixmap, s->img->mask, 3299 mac_copy_area_with_mask (s->img->pixmap, s->img->mask,
3290 s->f, s->gc, s->slice.x, s->slice.y, 3300 s->f, s->gc, s->slice.x, s->slice.y,
3291 s->slice.width, s->slice.height, x, y); 3301 s->slice.width, s->slice.height, x, y);
3302 #else
3303 ;
3304 #endif
3292 else 3305 else
3293 { 3306 {
3307 #if !USE_CG_DRAWING
3294 mac_copy_area (s->img->pixmap, 3308 mac_copy_area (s->img->pixmap,
3295 s->f, s->gc, s->slice.x, s->slice.y, 3309 s->f, s->gc, s->slice.x, s->slice.y,
3296 s->slice.width, s->slice.height, x, y); 3310 s->slice.width, s->slice.height, x, y);
3311 #endif
3297 3312
3298 /* When the image has a mask, we can expect that at 3313 /* When the image has a mask, we can expect that at
3299 least part of a mouse highlight or a block cursor will 3314 least part of a mouse highlight or a block cursor will
3300 be visible. If the image doesn't have a mask, make 3315 be visible. If the image doesn't have a mask, make
3301 a block cursor visible by drawing a rectangle around 3316 a block cursor visible by drawing a rectangle around