mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 740580 - Add Azure support to nsCanvasFrame; r=Bas
This commit is contained in:
parent
30547a76e4
commit
1bf615d117
@ -16,6 +16,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
// for focus
|
||||
#include "nsIScrollableFrame.h"
|
||||
@ -217,13 +218,32 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
|
||||
// to snap for this context, because we checked HasNonIntegerTranslation above.
|
||||
destRect.Round();
|
||||
surf = static_cast<gfxASurface*>(Frame()->Properties().Get(nsIFrame::CachedBackgroundImage()));
|
||||
nsRefPtr<gfxASurface> destSurf = dest->CurrentSurface();
|
||||
if (surf && surf->GetType() == destSurf->GetType()) {
|
||||
BlitSurface(dest, destRect, surf);
|
||||
return;
|
||||
if (dest->IsCairo()) {
|
||||
nsRefPtr<gfxASurface> destSurf = dest->CurrentSurface();
|
||||
if (surf && surf->GetType() == destSurf->GetType()) {
|
||||
BlitSurface(dest, mDestRect, surf);
|
||||
return;
|
||||
}
|
||||
surf = destSurf->CreateSimilarSurface(
|
||||
gfxASurface::CONTENT_COLOR_ALPHA,
|
||||
gfxIntSize(ceil(mDestRect.width), ceil(mDestRect.height)));
|
||||
} else {
|
||||
if (surf) {
|
||||
mozilla::gfx::DrawTarget* dt = dest->GetDrawTarget();
|
||||
mozilla::RefPtr<mozilla::gfx::SourceSurface> source =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surf);
|
||||
if (source) {
|
||||
// Could be non-integer pixel alignment
|
||||
dt->DrawSurface(source,
|
||||
mozilla::gfx::Rect(mDestRect.x, mDestRect.y, mDestRect.width, mDestRect.height),
|
||||
mozilla::gfx::Rect(0, 0, mDestRect.width, mDestRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
surf = gfxPlatform::GetPlatform()->CreateOffscreenImageSurface(
|
||||
gfxIntSize(ceil(mDestRect.width), ceil(mDestRect.height)),
|
||||
gfxASurface::CONTENT_COLOR_ALPHA);
|
||||
}
|
||||
surf = destSurf->CreateSimilarSurface(gfxASurface::CONTENT_COLOR_ALPHA,
|
||||
gfxIntSize(destRect.width, destRect.height));
|
||||
if (surf) {
|
||||
ctx = new gfxContext(surf);
|
||||
ctx->Translate(-gfxPoint(destRect.x, destRect.y));
|
||||
|
Loading…
Reference in New Issue
Block a user