Bug 115981 - toDataURL can return an empty image in some cases
Summary: toDataURL can return an empty image in some cases
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-12 00:49 PDT by Dean Jackson
Modified: 2013-05-13 14:30 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.86 KB, patch)
2013-05-12 00:53 PDT, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch for landing (7.48 KB, patch)
2013-05-13 14:11 PDT, Dean Jackson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2013-05-12 00:49:42 PDT
In some accelerated rendering cases, toDataURL can produce an empty image on canvas elements, especially if that canvas element is not on-screen.

<rdar://problem/13760256>
Comment 1 Dean Jackson 2013-05-12 00:53:57 PDT
Created attachment 201482 [details]
Patch
Comment 2 Darin Adler 2013-05-12 01:20:48 PDT
Comment on attachment 201482 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp:453
> +        CGContextFlush(context()->platformContext());
> +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
> +        m_data.m_lastFlushTime = currentTimeMS();
> +#endif

Could we make this share code with the ImageBuffer::context flush? Or is that not worth it?
Comment 3 Dean Jackson 2013-05-12 08:23:24 PDT
Comment on attachment 201482 [details]
Patch

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

>> Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp:453
>> +#endif
> 
> Could we make this share code with the ImageBuffer::context flush? Or is that not worth it?

There were a bunch of places which called flush in this manner. I did consider gathering them all so that we didn't have the ugly #if spewing across the whole file. I'll take another look before committing.
Comment 4 Dean Jackson 2013-05-13 14:11:37 PDT
Created attachment 201632 [details]
Patch for landing
Comment 5 Dean Jackson 2013-05-13 14:30:12 PDT
Committed r150040: <http://trac.webkit.org/changeset/150040>