|
Lines 87-106
Link Here
|
| 87 |
static GpStatus |
87 |
static GpStatus |
| 88 |
draw_tile_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) |
88 |
draw_tile_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) |
| 89 |
{ |
89 |
{ |
| 90 |
cairo_surface_t *original; |
90 |
cairo_surface_t *original = NULL; |
| 91 |
cairo_surface_t *texture; |
91 |
cairo_surface_t *texture; |
| 92 |
cairo_pattern_t *pat; |
92 |
cairo_pattern_t *pat; |
| 93 |
GpStatus status; |
93 |
GpStatus status; |
| 94 |
GpRect *rect = &brush->rectangle; |
94 |
GpRect *rect = &brush->rectangle; |
| 95 |
cairo_t *ct2; |
95 |
cairo_t *ct2; |
|
|
96 |
BYTE *premul = NULL; |
| 96 |
|
97 |
|
| 97 |
if (rect == NULL) { |
98 |
if (!rect) |
| 98 |
return InvalidParameter; |
99 |
return InvalidParameter; |
| 99 |
} |
|
|
| 100 |
|
100 |
|
| 101 |
gdip_bitmap_ensure_surface (bitmap); |
101 |
gdip_bitmap_ensure_surface (bitmap); |
| 102 |
original = bitmap->surface; |
|
|
| 103 |
|
102 |
|
|
|
103 |
if (gdip_bitmap_format_needs_premultiplication (bitmap)) { |
| 104 |
premul = gdip_bitmap_get_premultiplied_scan0 (bitmap); |
| 105 |
if (premul) { |
| 106 |
BitmapData *data = bitmap->active_bitmap; |
| 107 |
original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, |
| 108 |
data->width, data->height, data->stride); |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
/* if premul isn't required (or couldn't be computed, e.g. out of memory) */ |
| 113 |
if (!original) |
| 114 |
original = bitmap->surface; |
| 115 |
|
| 104 |
/* Use the original as a pattern */ |
116 |
/* Use the original as a pattern */ |
| 105 |
pat = cairo_pattern_create_for_surface (original); |
117 |
pat = cairo_pattern_create_for_surface (original); |
| 106 |
status = gdip_get_pattern_status(pat); |
118 |
status = gdip_get_pattern_status(pat); |
|
Lines 137-142
Link Here
|
| 137 |
cairo_pattern_destroy (pat); |
149 |
cairo_pattern_destroy (pat); |
| 138 |
cairo_surface_destroy (texture); |
150 |
cairo_surface_destroy (texture); |
| 139 |
|
151 |
|
|
|
152 |
if (premul) { |
| 153 |
cairo_surface_destroy (original); |
| 154 |
GdipFree (premul); |
| 155 |
} |
| 140 |
return gdip_get_status (cairo_status (ct)); |
156 |
return gdip_get_status (cairo_status (ct)); |
| 141 |
} |
157 |
} |
| 142 |
|
158 |
|
|
Lines 437-459
Link Here
|
| 437 |
cairo_pattern_t *pattern; |
453 |
cairo_pattern_t *pattern; |
| 438 |
GpTexture *texture; |
454 |
GpTexture *texture; |
| 439 |
GpImage *img; |
455 |
GpImage *img; |
| 440 |
GpImage *gr_img; |
|
|
| 441 |
GpBitmap *gr_bmp; |
| 442 |
cairo_format_t format; |
| 443 |
unsigned int width; |
| 444 |
unsigned int height; |
| 445 |
GpStatus status = Ok; |
456 |
GpStatus status = Ok; |
| 446 |
BOOL dispose_bitmap; |
457 |
BOOL dispose_bitmap; |
| 447 |
|
458 |
|
| 448 |
if ((graphics == NULL) || (brush == NULL) || (graphics->ct == NULL)) { |
459 |
if (!graphics || !brush || !graphics->ct) |
| 449 |
return InvalidParameter; |
460 |
return InvalidParameter; |
| 450 |
} |
|
|
| 451 |
|
461 |
|
| 452 |
texture = (GpTexture *) brush; |
462 |
texture = (GpTexture *) brush; |
| 453 |
img = texture->image; |
463 |
img = texture->image; |
| 454 |
if (img == NULL) { |
464 |
if (!img) |
| 455 |
return InvalidParameter; |
465 |
return InvalidParameter; |
| 456 |
} |
|
|
| 457 |
|
466 |
|
| 458 |
if (img->type != ImageTypeBitmap) |
467 |
if (img->type != ImageTypeBitmap) |
| 459 |
return NotImplemented; |
468 |
return NotImplemented; |
|
Lines 470-478
Link Here
|
| 470 |
} else { |
479 |
} else { |
| 471 |
dispose_bitmap = FALSE; |
480 |
dispose_bitmap = FALSE; |
| 472 |
} |
481 |
} |
| 473 |
width = img->active_bitmap->width; |
|
|
| 474 |
height = img->active_bitmap->height; |
| 475 |
format = img->active_bitmap->pixel_format; |
| 476 |
|
482 |
|
| 477 |
ct = graphics->ct; |
483 |
ct = graphics->ct; |
| 478 |
|
484 |
|