Closed
Bug 980547
Opened 11 years ago
Closed 11 years ago
Add a Moz2D helper to copy the pixels from a DataSourceSurface's data to a packed array
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: jwatt, Assigned: jwatt)
References
Details
Attachments
(1 file, 1 obsolete file)
2.97 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
I'd like to add a Moz2D helper to copy the pixel data from a DataSourceSurface's data to a packed array. SurfaceToPackedBGRA does something similar, but it allocates the array that will contain the packed data. I want to avoid this allocation (and a subsequent copy) when the array for the packed data is already available. Specifically I'm thinking about the lpBits variable in nsDragService::CreateDragImage (widget/windows/nsDragService.cpp) since that is allocated by CreateDIBSection and we want to copy to it even in the case that |imgSurface->Data()| is not packed.
![]() |
Assignee | |
Comment 1•11 years ago
|
||
Attachment #8387105 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 2•11 years ago
|
||
Also convert to use Map instead of calling GetData/GetStride.
Attachment #8387105 -
Attachment is obsolete: true
Attachment #8387105 -
Flags: review?(bas)
Attachment #8387124 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 3•11 years ago
|
||
Err, than should be |delete []|, obviously. Fixed locally.
Comment 4•11 years ago
|
||
Comment on attachment 8387124 [details] [diff] [review]
patch
Review of attachment 8387124 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/DataSurfaceHelpers.h
@@ +38,5 @@
> + int32_t aStride, int32_t aBytesPerPixel)
> +{
> + int bytesPerRow = aSize.width * aBytesPerPixel;
> +
> + if (aStride == bytesPerRow) {
Personally I'd just always do the row by row approach, the advantage of a single memcpy is going to be minimal. I don't feel strongly though.
@@ +78,3 @@
>
> + CopySurfaceDataToPackedArray(map.mData, imageBuffer, size,
> + map.mStride, 4 * sizeof(uint8_t));
nit: If you're going to do sizeof(uint8_t) as far as I'm concerned you might as well just do 4 :)
Attachment #8387124 -
Flags: review?(bas) → review+
![]() |
Assignee | |
Comment 5•11 years ago
|
||
This was committed in https://hg.mozilla.org/integration/mozilla-inbound/rev/ee113a965f7a with the wrong commit message (the commit message for bug 980885).
![]() |
Assignee | |
Comment 6•11 years ago
|
||
And it stuck.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Target Milestone: --- → mozilla30
You need to log in
before you can comment on or make changes to this bug.
Description
•