Changeset 214763 in webkit


Ignore:
Timestamp:
Apr 3, 2017 3:29:39 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r214100 - [Cairo] Handle the blend mode in GraphicsContext::drawPattern
https://bugs.webkit.org/show_bug.cgi?id=169746

Reviewed by Žan Doberšek.

We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
is optional and defaults to Normal.

  • platform/graphics/cairo/CairoUtilities.cpp:

(WebCore::toCairoCompositeOperator):
(WebCore::toCairoOperator):

  • platform/graphics/cairo/CairoUtilities.h:
  • platform/graphics/cairo/GraphicsContextCairo.cpp:

(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::drawPattern):

Location:
releases/WebKitGTK/webkit-2.16/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog

    r214761 r214763  
     12017-03-17  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [Cairo] Handle the blend mode in GraphicsContext::drawPattern
     4        https://bugs.webkit.org/show_bug.cgi?id=169746
     5
     6        Reviewed by Žan Doberšek.
     7
     8        We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
     9        This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
     10        it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
     11        CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
     12        is optional and defaults to Normal.
     13
     14        * platform/graphics/cairo/CairoUtilities.cpp:
     15        (WebCore::toCairoCompositeOperator):
     16        (WebCore::toCairoOperator):
     17        * platform/graphics/cairo/CairoUtilities.h:
     18        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     19        (WebCore::GraphicsContext::setPlatformCompositeOperation):
     20        (WebCore::GraphicsContext::drawPattern):
     21
    1222017-03-16  Simon Fraser  <simon.fraser@apple.com>
    223
  • releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp

    r212431 r214763  
    109109}
    110110
    111 cairo_operator_t toCairoOperator(CompositeOperator op)
     111static cairo_operator_t toCairoCompositeOperator(CompositeOperator op)
    112112{
    113113    switch (op) {
     
    144144    }
    145145}
    146 cairo_operator_t toCairoOperator(BlendMode blendOp)
     146
     147cairo_operator_t toCairoOperator(CompositeOperator op, BlendMode blendOp)
    147148{
    148149    switch (blendOp) {
    149150    case BlendModeNormal:
    150         return CAIRO_OPERATOR_OVER;
     151        return toCairoCompositeOperator(op);
    151152    case BlendModeMultiply:
    152153        return CAIRO_OPERATOR_MULTIPLY;
  • releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/CairoUtilities.h

    r200129 r214763  
    8080void appendWebCorePathToCairoContext(cairo_t* context, const Path& path);
    8181void appendRegionToCairoContext(cairo_t*, const cairo_region_t*);
    82 cairo_operator_t toCairoOperator(CompositeOperator op);
    83 cairo_operator_t toCairoOperator(BlendMode blendOp);
     82cairo_operator_t toCairoOperator(CompositeOperator, BlendMode = BlendModeNormal);
    8483void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSize& imageSize, const FloatRect& tileRect,
    8584                               const AffineTransform& patternTransform, const FloatPoint& phase, cairo_operator_t op, const FloatRect& destRect);
  • releases/WebKitGTK/webkit-2.16/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r213796 r214763  
    10371037        return;
    10381038
    1039     cairo_operator_t cairo_op;
    1040     if (blendOp == BlendModeNormal)
    1041         cairo_op = toCairoOperator(op);
    1042     else
    1043         cairo_op = toCairoOperator(blendOp);
    1044 
    1045     cairo_set_operator(platformContext()->cr(), cairo_op);
     1039    cairo_set_operator(platformContext()->cr(), toCairoOperator(op, blendOp));
    10461040}
    10471041
     
    11841178
    11851179    cairo_t* cr = platformContext()->cr();
    1186     drawPatternToCairoContext(cr, surface.get(), IntSize(image.size()), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
     1180    drawPatternToCairoContext(cr, surface.get(), IntSize(image.size()), tileRect, patternTransform, phase, toCairoOperator(op, blendMode), destRect);
    11871181}
    11881182
Note: See TracChangeset for help on using the changeset viewer.