mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
b=561168; convert canvas to use layers for rendering - followup #2; r=roc
This commit is contained in:
parent
57c2111dfe
commit
e5d92d3d03
@ -47,6 +47,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "gfx3DMatrix.h"
|
||||
#include "gfxColor.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsPaintEvent;
|
||||
@ -496,9 +497,18 @@ public:
|
||||
*/
|
||||
virtual void Updated(const nsIntRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Set the filter used to resample this image (if necessary).
|
||||
*/
|
||||
void SetFilter(gfxPattern::GraphicsFilter aFilter) { mFilter = aFilter; }
|
||||
gfxPattern::GraphicsFilter GetFilter() const { return mFilter; }
|
||||
|
||||
protected:
|
||||
CanvasLayer(LayerManager* aManager, void* aImplData)
|
||||
: Layer(aManager, aImplData) {}
|
||||
: Layer(aManager, aImplData), mFilter(gfxPattern::FILTER_GOOD) {}
|
||||
|
||||
gfxPattern::GraphicsFilter mFilter;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -488,6 +488,8 @@ BasicCanvasLayer::Paint(gfxContext* aContext)
|
||||
{
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(mSurface);
|
||||
|
||||
pat->SetFilter(mFilter);
|
||||
|
||||
gfxRect r(0, 0, mBounds.width, mBounds.height);
|
||||
gfxMatrix m;
|
||||
if (mNeedsYFlip) {
|
||||
|
@ -261,6 +261,7 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
transform.Translate(r.pos);
|
||||
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
||||
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
||||
|
||||
nsRefPtr<Layer> result = layer.forget();
|
||||
return result.forget();
|
||||
|
Loading…
Reference in New Issue
Block a user