Closed Bug 732988 Opened 12 years ago Closed 12 years ago

Make NPAPI Async plugin drawing scale correctly

Categories

(Core Graveyard :: Plug-ins, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla13

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(2 files, 3 obsolete files)

The NPAPI async spec says plugin surfaces should be scaled to cover the plugin child area.
Attachment #602921 - Flags: review?(roc)
Attachment #602922 - Flags: review?(roc)
Comment on attachment 602921 [details] [diff] [review]
Part 1: Add ScaleToSize API to ImageLayer

Review of attachment 602921 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/ImageLayers.h
@@ +583,5 @@
>  public:
> +  enum ScaleMode {
> +    SCALE_NONE,
> +    SCALE_STRETCH,
> +    SCALE_PRESERVE_ASPECT_RATIO_CONTAIN

Let's not add this (or comment it out) until it's supported.

And add a comment that STRETCH is not handled on GL or e10s yet.

@@ +607,5 @@
> +   * Set the size to scale the image to and the mode at which to scale.
> +   */
> +  void SetScaleToSize(const gfxIntSize &aSize, ScaleMode aMode)
> +  {
> +    mSize = aSize; mScaleMode = aMode;

two lines

@@ +645,3 @@
>    nsRefPtr<ImageContainer> mContainer;
>    gfxPattern::GraphicsFilter mFilter;
> +  gfxIntSize mSize;

Better call this "mScaleToSize" to avoid confusion. It's not the size of the image (UNLIKE mSize in BasicImageLayer).

::: gfx/layers/basic/BasicLayers.cpp
@@ -848,5 @@
>  class BasicImageLayer : public ImageLayer, public BasicImplData {
>  public:
>    BasicImageLayer(BasicLayerManager* aLayerManager) :
> -    ImageLayer(aLayerManager, static_cast<BasicImplData*>(this)),
> -    mSize(-1, -1)

You're removing this, but BasicShadowableImageLayer::Paint is still using it and ends up using the mSize in ImageLayer which is wrong!

@@ +929,5 @@
>    // The visible region can extend outside the image.  If we're not
>    // tiling, we don't want to draw into that area, so just draw within
>    // the image bounds.
>    const nsIntRect* tileSrcRect = GetTileSourceRect();
> +  AutoSetOperator setOpera7tor(aContext, GetOperator());

fix typo!

::: gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ +129,5 @@
>    if (!image) {
>      return;
>    }
>  
> +  gfxIntSize size = mScaleMode == SCALE_NONE ?  image->GetSize() : mSize;

only one space after ?

::: gfx/layers/d3d9/ImageLayerD3D9.cpp
@@ +324,5 @@
>    }
>  
>    SetShaderTransformAndOpacity();
>  
> +  gfxIntSize size = mScaleMode == SCALE_NONE ?  image->GetSize() : mSize;

only one space after ?
Attachment #602921 - Flags: review?(roc) → review-
Attachment #602921 - Attachment is obsolete: true
Attachment #604424 - Flags: review?(roc)
Comment on attachment 604424 [details] [diff] [review]
Part 1: Add ScaleToSize API to ImageLayer v2

Review of attachment 604424 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/ImageLayers.h
@@ +646,3 @@
>    nsRefPtr<ImageContainer> mContainer;
>    gfxPattern::GraphicsFilter mFilter;
> +  gfxIntSize mScaleToSize;

Comment that this is only valid of mScaleMode != SCALE_NONE.
Attachment #604424 - Flags: review?(roc) → review+
We need ShadowLayers support for this... who's going to do it and when?
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) (away February 21 to March 17) from comment #5)
> We need ShadowLayers support for this... who's going to do it and when?

It's a good question, I guess right now we don't use shadowlayers on any platform which supports it. But we will need it in the future. Benoit Girard might be a good person as he works on OMTC and might also work on the accelerated drawing model for Mac so will need to get in touch with some of the new plugin drawing code.
I guess one big question is who's going to do OMTC for Windows.
Updated to work with Mac drawing models as per e-mail discussion.
Attachment #602922 - Attachment is obsolete: true
Attachment #604776 - Flags: review?(roc)
Version: unspecified → Trunk
The old patch had an issue with shadowableImageLayer where mSize would not be updated correctly. This patch fixes that.
Attachment #604424 - Attachment is obsolete: true
Attachment #605043 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/709bce4da141
https://hg.mozilla.org/mozilla-central/rev/babf5e9f6036
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: