Bug 163270 - [Win][Direct2D] Add initial Pattern handling implementation
Summary: [Win][Direct2D] Add initial Pattern handling implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-10 22:57 PDT by Brent Fulgham
Modified: 2016-10-11 09:00 PDT (History)
5 users (show)

See Also:


Attachments
Patch (13.70 KB, patch)
2016-10-10 23:02 PDT, Brent Fulgham
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2016-10-10 22:57:14 PDT
Provide an implementation of the WebKit Pattern concept so that tiled images and border images can be drawn properly.

This get tests in fast/borders/border-image-01.html (and other) to work properly.
Comment 1 Brent Fulgham 2016-10-10 23:02:33 PDT
Created attachment 291233 [details]
Patch
Comment 2 Simon Fraser (smfr) 2016-10-10 23:10:56 PDT
Comment on attachment 291233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291233&action=review

> Source/WebCore/platform/graphics/GraphicsContext.h:561
> +    ID2D1Brush* solidStrokeBrush();
> +    ID2D1Brush* solidFillBrush();
> +    ID2D1Brush* patternStrokeBrush();
> +    ID2D1Brush* patternFillBrush();

Can these be const?
Comment 3 Simon Fraser (smfr) 2016-10-10 23:12:01 PDT
Comment on attachment 291233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291233&action=review

> Source/WebCore/platform/graphics/win/PatternDirect2D.cpp:58
> +    HRESULT hr = renderTarget->CreateBitmapBrush(tileImage()->nativeImage().get(), &bitmapBrushProperties, &brushProperties, &patternBrush);
> +    ASSERT(hr);
> +    return patternBrush;

What's the ownership model here? Does the caller need to release or destroy the brush? Can we use smart pointers to make this easier?
Comment 4 Brent Fulgham 2016-10-11 08:59:10 PDT
Comment on attachment 291233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291233&action=review

>> Source/WebCore/platform/graphics/GraphicsContext.h:561
>> +    ID2D1Brush* patternFillBrush();
> 
> Can these be const?

Yes. I'll fix them.

>> Source/WebCore/platform/graphics/win/PatternDirect2D.cpp:58
>> +    return patternBrush;
> 
> What's the ownership model here? Does the caller need to release or destroy the brush? Can we use smart pointers to make this easier?

You are right -- I should be using the adoptCOM utility function.
Comment 5 Brent Fulgham 2016-10-11 09:00:14 PDT
Committed r207140: <http://trac.webkit.org/changeset/207140>