Changeset 106274 in webkit


Ignore:
Timestamp:
Jan 30, 2012 12:01:39 PM (12 years ago)
Author:
aestes@apple.com
Message:

[Windows] Optionally invert colors when drawing to a WebView's backing store.
https://bugs.webkit.org/show_bug.cgi?id=77168

Reviewed by Sam Weinig.

Source/WebCore:

  • css/CSSPrimitiveValueMappings.h: Assert that CompositeDifference is

not converted to a CSS value. Exposing a new compositing operation to
CSS is outside the scope of this patch.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):

  • platform/graphics/GraphicsTypes.h: Add CompositeDifference as a

CompositeOperator. Also, remove an outdated comment.

  • platform/graphics/cg/GraphicsContextCG.cpp:

(WebCore::GraphicsContext::setPlatformCompositeOperation): Map
CompositeDifference to kCGBlendModeDifference.

Source/WebKit/win:

  • WebView.cpp:

(WebView::WebView): Initialize m_shouldInvertColors to false.
(WebView::paintIntoBackingStore): If m_shouldInvertColors is true, draw
an opaque white quad using the CompositeDifference blend mode. This
blend operation instructs CoreGraphics to take the difference between
the source pixel (white) and the background pixel, resulting in an
inverted pixel.

  • WebView.h: Define m_shouldInvertColors.
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106273 r106274  
     12012-01-26  Andy Estes  <aestes@apple.com>
     2
     3        [Windows] Optionally invert colors when drawing to a WebView's backing store.
     4        https://bugs.webkit.org/show_bug.cgi?id=77168
     5
     6        Reviewed by Sam Weinig.
     7
     8        * css/CSSPrimitiveValueMappings.h: Assert that CompositeDifference is
     9        not converted to a CSS value. Exposing a new compositing operation to
     10        CSS is outside the scope of this patch.
     11        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     12        * platform/graphics/GraphicsTypes.h: Add CompositeDifference as a
     13        CompositeOperator. Also, remove an outdated comment.
     14        * platform/graphics/cg/GraphicsContextCG.cpp:
     15        (WebCore::GraphicsContext::setPlatformCompositeOperation): Map
     16        CompositeDifference to kCGBlendModeDifference.
     17
    1182012-01-28  Matthew Delaney  <mdelaney@apple.com>
    219
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r105694 r106274  
    286286            m_value.ident = CSSValuePlusLighter;
    287287            break;
     288        case CompositeDifference:
     289            ASSERT_NOT_REACHED();
     290            break;
    288291    }
    289292}
  • trunk/Source/WebCore/platform/graphics/GraphicsTypes.h

    r88144 r106274  
    3131namespace WebCore {
    3232
    33     // Note: These constants exactly match the NSCompositeOperator constants of
    34     // AppKit on Mac OS X Tiger. If these ever change, we'll need to change the
    35     // Mac OS X Tiger platform code to map one to the other.
    3633    enum CompositeOperator {
    3734        CompositeClear,
     
    4744        CompositeXOR,
    4845        CompositePlusDarker,
    49         CompositePlusLighter
     46        CompositePlusLighter,
     47        CompositeDifference
    5048    };
    5149
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r106273 r106274  
    16041604        target = kCGBlendModePlusLighter;
    16051605        break;
     1606    case CompositeDifference:
     1607        target = kCGBlendModeDifference;
     1608        break;
    16061609    }
    16071610    CGContextSetBlendMode(platformContext(), target);
  • trunk/Source/WebKit/win/ChangeLog

    r105757 r106274  
     12012-01-26  Andy Estes  <aestes@apple.com>
     2
     3        [Windows] Optionally invert colors when drawing to a WebView's backing store.
     4        https://bugs.webkit.org/show_bug.cgi?id=77168
     5
     6        Reviewed by Sam Weinig.
     7
     8        * WebView.cpp:
     9        (WebView::WebView): Initialize m_shouldInvertColors to false.
     10        (WebView::paintIntoBackingStore): If m_shouldInvertColors is true, draw
     11        an opaque white quad using the CompositeDifference blend mode. This
     12        blend operation instructs CoreGraphics to take the difference between
     13        the source pixel (white) and the background pixel, resulting in an
     14        inverted pixel.
     15        * WebView.h: Define m_shouldInvertColors.
     16
    1172012-01-23  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebKit/win/WebView.cpp

    r105757 r106274  
    333333WebView::WebView()
    334334    : m_refCount(0)
     335    , m_shouldInvertColors(false)
    335336#if !ASSERT_DISABLED
    336337    , m_deletionHasBegun(false)
     
    11551156        gc.clip(dirtyRect);
    11561157        frameView->paint(&gc, dirtyRect);
     1158        if (m_shouldInvertColors)
     1159            gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB, CompositeDifference);
    11571160    }
    11581161    gc.restore();
  • trunk/Source/WebKit/win/WebView.h

    r105757 r106274  
    10021002#endif
    10031003
     1004    bool m_shouldInvertColors;
     1005
    10041006protected:
    10051007    static bool registerWebViewWindowClass();
Note: See TracChangeset for help on using the changeset viewer.