mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1231889 - Moz2Dify gfxWindowsNativeDrawing::PaintToContext(). r=mattwoodrow.
This commit is contained in:
parent
8da5bffaea
commit
f53f5f8cb0
@ -12,6 +12,7 @@
|
||||
#include "gfxAlphaRecovery.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Helpers.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -252,26 +253,22 @@ gfxWindowsNativeDrawing::PaintToContext()
|
||||
black->Stride(),
|
||||
black->GetSize(),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
{
|
||||
DrawTarget* dt = mContext->GetDrawTarget();
|
||||
AutoRestoreTransform autoRestoreTransform(dt);
|
||||
|
||||
mContext->Save();
|
||||
mContext->SetMatrix(
|
||||
mContext->CurrentMatrix().Translate(mNativeRect.TopLeft()));
|
||||
mContext->NewPath();
|
||||
mContext->Rectangle(gfxRect(gfxPoint(0.0, 0.0), mNativeRect.Size()));
|
||||
Matrix newTransform = dt->GetTransform();
|
||||
newTransform.PreTranslate(ToPoint(mNativeRect.TopLeft()));
|
||||
dt->SetTransform(newTransform);
|
||||
|
||||
RefPtr<gfxPattern> pat = new gfxPattern(source, Matrix());
|
||||
|
||||
gfxMatrix m;
|
||||
m.Scale(mScale.width, mScale.height);
|
||||
pat->SetMatrix(m);
|
||||
|
||||
if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
|
||||
pat->SetFilter(Filter::LINEAR);
|
||||
|
||||
pat->SetExtend(ExtendMode::CLAMP);
|
||||
mContext->SetPattern(pat);
|
||||
mContext->Fill();
|
||||
mContext->Restore();
|
||||
Rect rect(Point(0.0, 0.0), ToSize(mNativeRect.Size()));
|
||||
Matrix m = Matrix::Scaling(1.0 / mScale.width, 1.0 / mScale.height);
|
||||
Filter filter = (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
|
||||
? Filter::LINEAR
|
||||
: Filter::GOOD;
|
||||
SurfacePattern pat(source, ExtendMode::CLAMP, m, filter);
|
||||
dt->FillRect(rect, pat);
|
||||
}
|
||||
|
||||
mRenderState = RENDER_STATE_DONE;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user