Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 1efef24

Browse files
Merge branch 'bugfix-11402' of https://github.com/runrevmichael/livecode into feature-image_filter_update
Conflicts: libgraphics/src/w32text.cpp thirdparty
2 parents 4df76f7 + d1bb592 commit 1efef24

33 files changed

Lines changed: 323 additions & 222 deletions

engine/src/graphicscontext.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,8 @@ void MCGraphicsContext::setfillstyle(uint2 style, MCPatternRef p, int2 x, int2 y
543543
t_transform = MCGAffineTransformMakeScale(t_scale, t_scale);
544544
t_transform = MCGAffineTransformTranslate(t_transform, x, y);
545545

546-
MCGContextSetFillPattern(m_gcontext, p->image, t_transform, kMCGImageFilterBilinear);
546+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was bilinear).
547+
MCGContextSetFillPattern(m_gcontext, p->image, t_transform, kMCGImageFilterMedium);
547548
m_pattern = MCPatternRetain(p);
548549
m_pattern_x = x;
549550
m_pattern_y = y;
@@ -676,15 +677,16 @@ void MCGraphicsContext::setgradient(MCGradientFill *p_gradient)
676677
break;
677678
}
678679

680+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types.
679681
MCGImageFilter t_filter;
680-
t_filter = kMCGImageFilterNearest;
682+
t_filter = kMCGImageFilterNone;
681683
switch (p_gradient -> quality)
682684
{
683685
case kMCGradientQualityNormal:
684-
t_filter = kMCGImageFilterNearest;
686+
t_filter = kMCGImageFilterNone;
685687
break;
686688
case kMCGradientQualityGood:
687-
t_filter = kMCGImageFilterBilinear;
689+
t_filter = kMCGImageFilterMedium;
688690
break;
689691
}
690692

engine/src/idraw.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,21 @@ void MCImage::drawme(MCDC *dc, int2 sx, int2 sy, uint2 sw, uint2 sh, int2 dx, in
117117
// IM-2013-10-30: [[ FullscreenMode ]] Get scale factor from the returned frame
118118
t_image.scale_factor = t_frame->density;
119119

120+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types.
120121
switch (resizequality)
121122
{
122-
case INTERPOLATION_NEAREST:
123-
case INTERPOLATION_BOX:
124-
t_image . filter = kMCGImageFilterNearest;
125-
break;
126-
case INTERPOLATION_BILINEAR:
127-
t_image . filter = kMCGImageFilterBilinear;
128-
break;
129-
case INTERPOLATION_BICUBIC:
130-
t_image . filter = kMCGImageFilterBilinear;
131-
break;
123+
case INTERPOLATION_NEAREST:
124+
t_image . filter = kMCGImageFilterNone;
125+
break;
126+
case INTERPOLATION_BOX:
127+
t_image . filter = kMCGImageFilterMedium;
128+
break;
129+
case INTERPOLATION_BILINEAR:
130+
t_image . filter = kMCGImageFilterMedium;
131+
break;
132+
case INTERPOLATION_BICUBIC:
133+
t_image . filter = kMCGImageFilterHigh;
134+
break;
132135
}
133136

134137
t_image . bitmap = t_frame->image;

engine/src/image.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,8 +2495,20 @@ bool MCImage::copybitmap(MCGFloat p_scale, bool p_premultiplied, MCImageBitmap *
24952495
t_combined_transform = MCGAffineTransformConcat(t_combined_transform, t_transform);
24962496
t_combined_transform = MCGAffineTransformConcat(t_combined_transform, MCGAffineTransformMakeScale(1.0 / t_frame->density, 1.0 / t_frame->density));
24972497

2498-
MCGImageFilter t_filter;
2499-
t_filter = resizequality == INTERPOLATION_BICUBIC ? kMCGImageFilterBicubic : (resizequality == INTERPOLATION_BILINEAR ? kMCGImageFilterBilinear : kMCGImageFilterNearest);
2498+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types.
2499+
MCGImageFilter t_filter;
2500+
switch (resizequality)
2501+
{
2502+
case INTERPOLATION_NEAREST:
2503+
t_filter = kMCGImageFilterNone;
2504+
break;
2505+
case INTERPOLATION_BILINEAR:
2506+
t_filter = kMCGImageFilterMedium;
2507+
break;
2508+
case INTERPOLATION_BICUBIC:
2509+
t_filter = kMCGImageFilterHigh;
2510+
break;
2511+
}
25002512

25012513
t_success = MCImageBitmapCopyWithTransform(t_frame->image, t_premultiplied, t_combined_transform, t_filter, r_bitmap);
25022514

@@ -2548,8 +2560,20 @@ bool MCImage::lockbitmap(MCImageBitmap *&r_bitmap, bool p_premultiplied, bool p_
25482560
MCGAffineTransform t_combined_transform;
25492561
t_combined_transform = MCGAffineTransformConcat(t_transform, MCGAffineTransformMakeScale(1.0 / m_locked_frame->density, 1.0 / m_locked_frame->density));
25502562

2551-
MCGImageFilter t_filter;
2552-
t_filter = resizequality == INTERPOLATION_BICUBIC ? kMCGImageFilterBicubic : (resizequality == INTERPOLATION_BILINEAR ? kMCGImageFilterBilinear : kMCGImageFilterNearest);
2563+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types.
2564+
MCGImageFilter t_filter;
2565+
switch (resizequality)
2566+
{
2567+
case INTERPOLATION_NEAREST:
2568+
t_filter = kMCGImageFilterNone;
2569+
break;
2570+
case INTERPOLATION_BILINEAR:
2571+
t_filter = kMCGImageFilterMedium;
2572+
break;
2573+
case INTERPOLATION_BICUBIC:
2574+
t_filter = kMCGImageFilterHigh;
2575+
break;
2576+
}
25532577

25542578
bool t_success;
25552579
t_success = MCImageBitmapCopyWithTransform(m_locked_frame->image, true, t_combined_transform, t_filter, m_transformed_bitmap);

engine/src/image_rep_mutable.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,8 @@ void MCMutableImageRep::put_brush(int2 x, int2 y, MCBrush *bmptr)
854854
MCGContextRef t_context = nil;
855855
/* UNCHECKED */ MCGContextCreateWithRaster(m_draw_mask, t_context);
856856
MCGRectangle t_dst = MCGRectangleMake(x, y, bwidth, bheight);
857-
MCGContextDrawImage(t_context, bmptr->image, t_dst, kMCGImageFilterNearest);
857+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
858+
MCGContextDrawImage(t_context, bmptr->image, t_dst, kMCGImageFilterNone);
858859
MCGContextRelease(t_context);
859860
}
860861

@@ -1192,7 +1193,8 @@ void MCMutableImageRep::apply_fill_paint(MCGContextRef p_context, MCPatternRef p
11921193
else if (p_pattern == nil)
11931194
MCGContextSetFillRGBAColor(p_context, p_color.red / 65535.0, p_color.green / 65535.0, p_color.blue / 65535.0, 1.0);
11941195
else
1195-
MCGContextSetFillPattern(p_context, p_pattern->image, MCGAffineTransformMakeScale(1.0 / p_pattern->scale, 1.0 / p_pattern->scale), kMCGImageFilterNearest);
1196+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
1197+
MCGContextSetFillPattern(p_context, p_pattern->image, MCGAffineTransformMakeScale(1.0 / p_pattern->scale, 1.0 / p_pattern->scale), kMCGImageFilterNone);
11961198
}
11971199

11981200
void MCMutableImageRep::apply_stroke_paint(MCGContextRef p_context, MCPatternRef p_pattern, const MCColor &p_color)
@@ -1202,7 +1204,8 @@ void MCMutableImageRep::apply_stroke_paint(MCGContextRef p_context, MCPatternRef
12021204
else if (p_pattern == nil)
12031205
MCGContextSetStrokeRGBAColor(p_context, p_color.red / 65535.0, p_color.green / 65535.0, p_color.blue / 65535.0, 1.0);
12041206
else
1205-
MCGContextSetStrokePattern(p_context, p_pattern->image, MCGAffineTransformMakeScale(1.0 / p_pattern->scale, 1.0 / p_pattern->scale), kMCGImageFilterNearest);
1207+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
1208+
MCGContextSetStrokePattern(p_context, p_pattern->image, MCGAffineTransformMakeScale(1.0 / p_pattern->scale, 1.0 / p_pattern->scale), kMCGImageFilterNone);
12061209
}
12071210

12081211
void MCMutableImageRep::fill_path(MCGPathRef p_path)
@@ -1429,7 +1432,8 @@ void MCMutableImageRep::fillimage(const MCRectangle &drect)
14291432
/* UNCHECKED */ MCGContextCreateWithPixels(m_bitmap->width, m_bitmap->height, m_bitmap->stride, m_bitmap->data, true, t_context);
14301433

14311434
apply_fill_paint(t_context, MCbrushpattern, MCbrushcolor);
1432-
MCGContextDrawPixels(t_context, m_draw_mask, MCGRectangleMake(0, 0, m_bitmap->width, m_bitmap->height), kMCGImageFilterNearest);
1435+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
1436+
MCGContextDrawPixels(t_context, m_draw_mask, MCGRectangleMake(0, 0, m_bitmap->width, m_bitmap->height), kMCGImageFilterNone);
14331437

14341438
MCGContextRelease(t_context);
14351439

@@ -1443,7 +1447,8 @@ void MCMutableImageRep::eraseimage(const MCRectangle &drect)
14431447

14441448
MCGContextSetBlendMode(t_context, kMCGBlendModeClear);
14451449
MCGContextSetFillRGBAColor(t_context, 1, 1, 1, 1);
1446-
MCGContextDrawPixels(t_context, m_draw_mask, MCGRectangleMake(0, 0, m_bitmap->width, m_bitmap->height), kMCGImageFilterNearest);
1450+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
1451+
MCGContextDrawPixels(t_context, m_draw_mask, MCGRectangleMake(0, 0, m_bitmap->width, m_bitmap->height), kMCGImageFilterNone);
14471452

14481453
MCGContextRelease(t_context);
14491454

engine/src/lnxgtktheme.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,8 @@ bool MCThemeDraw(MCGContextRef p_context, MCThemeDrawType p_type, MCThemeDrawInf
16761676
t_dest.size.height = p_info->crect.height;
16771677

16781678
// MM-2013-12-16: [[ Bug 11567 ]] Use bilinear filter when drawing theme elements.
1679-
MCGContextDrawPixels(p_context, t_raster, t_dest, kMCGImageFilterBilinear);
1679+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was bilinear).
1680+
MCGContextDrawPixels(p_context, t_raster, t_dest, kMCGImageFilterMedium);
16801681

16811682
if (!t_cached)
16821683
((MCScreenDC*)MCscreen)->destroyimage(t_argb_image);

engine/src/lnxstack.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,8 @@ class MCLinuxStackSurface: public MCStackSurface
900900
// MW-2013-11-08: [[ Bug ]] Make sure we set the blend/alpha on the context.
901901
MCGContextSetBlendMode(t_context, p_blend);
902902
MCGContextSetOpacity(t_context, p_alpha);
903-
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNearest);
903+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
904+
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNone);
904905
}
905906

906907
UnlockGraphics();

engine/src/mblandroiddc.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,11 @@ class MCAndroidStackSurface: public MCStackSurface
630630
t_success = LockGraphics(t_region, t_context);
631631

632632
if (t_success)
633-
{
633+
{
634634
MCGContextSetBlendMode(t_context, p_blend);
635635
MCGContextSetOpacity(t_context, p_alpha);
636-
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNearest);
636+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
637+
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNone);
637638
}
638639

639640
UnlockGraphics();
@@ -775,7 +776,8 @@ class MCOpenGLStackSurface: public MCStackSurface
775776
{
776777
MCGContextSetBlendMode(t_context, p_blend);
777778
MCGContextSetOpacity(t_context, p_alpha);
778-
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNearest);
779+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
780+
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNone);
779781
}
780782

781783
UnlockGraphics();

engine/src/mbliphonegfx.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ bool Composite(MCGRectangle p_dst_rect, MCGImageRef p_src, MCGRectangle p_src_re
195195

196196
if (t_success)
197197
{
198-
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNearest);
198+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was nearest).
199+
MCGContextDrawRectOfImage(t_context, p_src, p_src_rect, p_dst_rect, kMCGImageFilterNone);
199200
}
200201

201202
UnlockGraphics();

engine/src/osxans.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,14 @@ static bool filter_to_type_list(const char *p_filter, char ***r_types, uint32_t
276276
/* UNCHECKED */ MCCStringFree(t_types);
277277
}
278278

279-
return t_success;
279+
return t_success;
280280
}
281281

282282
////////////////////////////////////////////////////////////////////////////////
283283

284-
@interface FileDialogAccessoryView : NSView
284+
// MM-2014-01-09: [[ Bug 11402 ]] The update to libskia required a compiler update.
285+
// Update interface definition in order to appease the new cmpiler.
286+
@interface FileDialogAccessoryView : NSView <NSOpenSavePanelDelegate>
285287
{
286288
NSTextField *m_label;
287289
NSPopUpButton *m_options;

engine/src/osxtheme.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ bool MCThemeDraw(MCGContextRef p_context, MCThemeDrawType p_type, MCThemeDrawInf
10761076

10771077
MCGRectangle t_dst = MCGRectangleMake(t_rect.x, t_rect.y, t_raster.width, t_raster.height);
10781078
// MM-2013-12-16: [[ Bug 11567 ]] Use bilinear filter when drawing theme elements.
1079-
MCGContextDrawPixels(p_context, t_raster, t_dst, kMCGImageFilterBilinear);
1079+
// MM-2014-01-27: [[ UpdateImageFilters ]] Updated to use new libgraphics image filter types (was bilinear).
1080+
MCGContextDrawPixels(p_context, t_raster, t_dst, kMCGImageFilterMedium);
10801081
}
10811082

10821083
if (t_colorspace != nil)

0 commit comments

Comments
 (0)