Bug 1083753, part 2 - Port the code that uses nsRenderingContext::FillRect(nsRect) to Moz2D. r=mattwoodrow

This commit is contained in:
Jonathan Watt
2014-10-19 13:22:22 +01:00
parent 6a0b572f7b
commit 40da0a5dbd
16 changed files with 108 additions and 141 deletions

View File

@@ -4,6 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMathMLContainerFrame.h"
#include "gfxUtils.h"
#include "mozilla/gfx/2D.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsStyleContext.h"
@@ -20,6 +24,7 @@
#include "nsMathMLElement.h"
using namespace mozilla;
using namespace mozilla::gfx;
//
// nsMathMLContainerFrame implementation
@@ -94,12 +99,15 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
aCtx->SetFont(fm);
nsPoint pt = ToReferenceFrame();
aCtx->SetColor(NS_RGB(255,0,0));
aCtx->FillRect(nsRect(pt, mFrame->GetSize()));
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
DrawTarget* drawTarget = aCtx->GetDrawTarget();
Rect rect = NSRectToRect(nsRect(pt, mFrame->GetSize()), appUnitsPerDevPixel,
*drawTarget);
ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
drawTarget->FillRect(rect, red);
aCtx->SetColor(NS_RGB(255,255,255));
nscoord ascent = aCtx->FontMetrics()->MaxAscent();
NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
aCtx->DrawString(errorMsg.get(), uint32_t(errorMsg.Length()),
pt.x, pt.y+ascent);