Open Bug 592037 Opened 14 years ago Updated 2 years ago

Remove mSize from gfx***Surface implementations and use cairo functionality directly

Categories

(Core :: Graphics, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: romaxa, Unassigned)

Details

(Whiteboard: not-ready)

Attachments

(1 file, 5 obsolete files)

Joe proposed to remove stored mSize at all from gfx***Surface implemetations 
https://bugzilla.mozilla.org/show_bug.cgi?id=556487#c103
Assignee: nobody → reportbase
I removed msize from gfxImageSurface and changed gfxASurface::CairoSurface to be a const method.

Note: the gfxImageSurface constructor takes a pointer to an image buffer and constructs a cairo surface which takes this image buffer as a parameter and at the same time gfxImageSurface keeps that buffer as a member variable.  This should not necessary, as the buffer can always be retrieved from the cairo surface object.  Would be a simple matter to clean this up.
This patch removes msize from gfxImageSurface.  That information is available from the cairo_surface.  No need to store it again.
Attachment #473705 - Flags: review?(joe)
Comment on attachment 473705 [details] [diff] [review]
This patch removes msize from gfxImageSurface


> gfxSharedImageSurface::gfxSharedImageSurface(const mozilla::ipc::Shmem &aShmem)

>-    if (!InitSurface(PR_FALSE))
>+	gfxIntSize size(shmInfo->width, shmInfo->height);
>+    if (!InitSurface(size, PR_FALSE))
>         NS_RUNTIMEABORT("Shared memory is bad");

Indentation's a little wonky here.

Looks wonderful otherwise. r=joe
Attachment #473705 - Flags: review?(joe) → review+
Attached patch Fixed tab/spacing Push ME (obsolete) — Splinter Review
Small formatting change (push)
Attachment #473705 - Attachment is obsolete: true
Attachment #474263 - Flags: review?(joe)
Comment on attachment 474263 [details] [diff] [review]
Fixed tab/spacing Push ME

Only indentation fixed... moving r+
Attachment #474263 - Attachment description: Fixed tab/spacing Push → Fixed tab/spacing Push ME
Attachment #474263 - Attachment mime type: application/octet-stream → text/plain
Attachment #474263 - Flags: review?(joe) → review+
Attachment #473705 - Attachment is obsolete: false
Keywords: checkin-needed
Attachment #474263 - Attachment is patch: true
Still needs approval2.0.
Keywords: checkin-needed
Comment on attachment 474263 [details] [diff] [review]
Fixed tab/spacing Push ME

I think it is enough safe for 2.0.
Joe any help with this?
Attachment #474263 - Flags: approval2.0?
Comment on attachment 474263 [details] [diff] [review]
Fixed tab/spacing Push ME

low risk.
Attachment #474263 - Flags: approval2.0? → approval2.0+
Comment on attachment 474263 [details] [diff] [review]
Fixed tab/spacing Push ME

Patch is not applying on latest m-c.

Also I found some style issues:
>+PRInt32 gfxImageSurface::GetDataSize() const 
>+{ 
>+	return mStride*Height(); 
                      ^^ spaces needed 
>+}
>+
>+gfxIntSize gfxImageSurface::GetSize() const 
                                             ^ whitespace
>+{ 
>+	return gfxIntSize(Width(),Height()); 
  ^ here is the tab.. use spaces  ^ space missing here
Also I think this can be moved into gfxImageSurface header.


>+}
>+
>+PRInt32 gfxImageSurface::Width() const 
                                        ^ white space

>-    const gfxIntSize& GetSize() const { return mSize; }
>-    PRInt32 Width() const { return mSize.width; }
>-    PRInt32 Height() const { return mSize.height; }
>+    gfxIntSize GetSize() const;
>+    PRInt32 Width() const;
>+    PRInt32 Height() const;
This is fail to apply on latest m-c.... because const gfxIntSize& GetSize() const is virtual now...


Could you update patch plz?
Attachment #474263 - Flags: feedback-
This patch is a roll up of the previous two patches.  Fixed bitrot and formatting issues.
Attachment #473705 - Attachment is obsolete: true
Attachment #474263 - Attachment is obsolete: true
Attachment #476083 - Flags: review?(joe)
Comment on attachment 476083 [details] [diff] [review]
Fixed some bitrot and formatting issues

This patch doesn't seem to remove mSize
Attachment #476083 - Flags: review?(joe) → review-
Attached patch Removed msize (obsolete) — Splinter Review
Removed msize. It was not removed from the bitrotted version.
Attachment #476083 - Attachment is obsolete: true
Attachment #476114 - Flags: review?(joe)
Attachment #476114 - Attachment is patch: true
Attachment #476114 - Attachment mime type: application/octet-stream → text/plain
Attachment #476114 - Flags: review?(joe)
Attachment #476114 - Flags: review+
Attachment #476114 - Flags: approval2.0+
Comment on attachment 476114 [details] [diff] [review]
Removed msize


>+
> long
> gfxImageSurface::ComputeStride() const
> {
>     long stride;
> 
>     if (mFormat == ImageFormatARGB32)
>-        stride = mSize.width * 4;
>+        stride = Width() * 4;

this will crash if ComputeStride called before image surface created:
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1284709363.1284709584.20870.gz&fulltext=1#err0


###!!! ASSERTION: gfxASurface::CairoSurface called with mSurface == nsnull!: 'mSurface != nsnull', file ../../dist/include/gfxASurface.h, line 117
gfxASurface::CairoSurface [gfxASurface.h:118]
gfxImageSurface::Width [gfx/thebes/gfxImageSurface.cpp:148]
gfxImageSurface::ComputeStride [gfx/thebes/gfxImageSurface.cpp:162]
gfxImageSurface::gfxImageSurface [gfx/thebes/gfxImageSurface.cpp:91]
imgFrame::Init [modules/libpr0n/src/imgFrame.cpp:232]


I think we should call ComputeStride with aSize argument because  ComputeStride called usually before image surface created.
Attachment #476114 - Flags: review-
Moved ComputeStride into base class and made it a static method.  Fixes crash.
Attachment #476114 - Attachment is obsolete: true
Attachment #476426 - Flags: review?(joe)
Moved ComputeStride into base class and made it a static method.  Fixed formatting issues.  Fixed crash.
Attachment #476426 - Attachment is obsolete: true
Attachment #476531 - Flags: review?(joe)
Attachment #476426 - Flags: review?(joe)
Comment on attachment 476531 [details] [diff] [review]
Moved ComputeStride into base class and made it a static method.

ok, it seems not cause problems on try server, and don't crash.
Attachment #476531 - Flags: feedback+
Comment on attachment 476531 [details] [diff] [review]
Moved ComputeStride into base class and made it a static method.

Please add a crashtest for the way the previous patch failed too.
Attachment #476531 - Flags: review?(joe) → review+
Comment on attachment 474263 [details] [diff] [review]
Fixed tab/spacing Push ME

(bookkeeping)
Attachment #474263 - Flags: approval2.0+
The patch no longer applies cleanly on trunk.
Whiteboard: not-ready

The bug assignee didn't login in Bugzilla in the last 7 months.
:bhood, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: reportbase → nobody
Flags: needinfo?(bhood)
Flags: needinfo?(bhood)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: