зеркало из https://github.com/mozilla/gecko-dev.git
bug 842514 - consistently use signed types for appUnitsPerDevPixel variables. r=roc
This commit is contained in:
Родитель
b233d5c3ea
Коммит
9cd7d9f8bb
|
@ -2300,7 +2300,7 @@ struct NS_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcesso
|
|||
|
||||
uint32_t numRuns;
|
||||
const gfxTextRun::GlyphRun *runs = mTextRun->GetGlyphRuns(&numRuns);
|
||||
const uint32_t appUnitsPerDevUnit = mAppUnitsPerDevPixel;
|
||||
const int32_t appUnitsPerDevUnit = mAppUnitsPerDevPixel;
|
||||
const double devUnitsPerAppUnit = 1.0/double(appUnitsPerDevUnit);
|
||||
Point baselineOrigin =
|
||||
Point(point.x * devUnitsPerAppUnit, point.y * devUnitsPerAppUnit);
|
||||
|
@ -2424,7 +2424,7 @@ struct NS_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcesso
|
|||
gfxFontGroup* mFontgrp;
|
||||
|
||||
// dev pixel conversion factor
|
||||
uint32_t mAppUnitsPerDevPixel;
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
|
||||
// operation (fill or stroke)
|
||||
CanvasRenderingContext2D::TextDrawOperation mOp;
|
||||
|
|
|
@ -479,10 +479,10 @@ public:
|
|||
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(CanvasRenderingContext2D)
|
||||
|
||||
enum CanvasMultiGetterType {
|
||||
CMG_STYLE_STRING = 0,
|
||||
CMG_STYLE_PATTERN = 1,
|
||||
CMG_STYLE_GRADIENT = 2
|
||||
enum CanvasMultiGetterType {
|
||||
CMG_STYLE_STRING = 0,
|
||||
CMG_STYLE_PATTERN = 1,
|
||||
CMG_STYLE_GRADIENT = 2
|
||||
};
|
||||
|
||||
enum Style {
|
||||
|
@ -902,11 +902,11 @@ protected:
|
|||
friend class AdjustedTarget;
|
||||
|
||||
// other helpers
|
||||
void GetAppUnitsValues(uint32_t *perDevPixel, uint32_t *perCSSPixel)
|
||||
void GetAppUnitsValues(int32_t *perDevPixel, int32_t *perCSSPixel)
|
||||
{
|
||||
// If we don't have a canvas element, we just return something generic.
|
||||
uint32_t devPixel = 60;
|
||||
uint32_t cssPixel = 60;
|
||||
int32_t devPixel = 60;
|
||||
int32_t cssPixel = 60;
|
||||
|
||||
nsIPresShell *ps = GetPresShell();
|
||||
nsPresContext *pc;
|
||||
|
|
|
@ -729,7 +729,7 @@ nsDeviceContext::SetPixelScale(float aScale)
|
|||
NS_NOTREACHED("Invalid pixel scale value");
|
||||
return false;
|
||||
}
|
||||
uint32_t oldAppUnitsPerDevPixel = mAppUnitsPerDevPixel;
|
||||
int32_t oldAppUnitsPerDevPixel = mAppUnitsPerDevPixel;
|
||||
mPixelScale = aScale;
|
||||
UpdateScaledAppUnits();
|
||||
return oldAppUnitsPerDevPixel != mAppUnitsPerDevPixel;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
* is usually a factor of AppUnitsPerCSSPixel(), although that is
|
||||
* not guaranteed.
|
||||
*/
|
||||
uint32_t AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
|
||||
int32_t AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
|
||||
|
||||
/**
|
||||
* Convert device pixels which is used for gfx/thebes to nearest
|
||||
|
@ -243,7 +243,7 @@ protected:
|
|||
nscoord mWidth;
|
||||
nscoord mHeight;
|
||||
uint32_t mDepth;
|
||||
uint32_t mAppUnitsPerDevPixel;
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
int32_t mAppUnitsPerDevNotScaledPixel;
|
||||
int32_t mAppUnitsPerPhysicalInch;
|
||||
float mPixelScale;
|
||||
|
|
|
@ -200,7 +200,7 @@ public:
|
|||
gfxFontGroup* GetThebesFontGroup() { return mFontGroup; }
|
||||
gfxUserFontSet* GetUserFontSet() { return mFontGroup->GetUserFontSet(); }
|
||||
|
||||
uint32_t AppUnitsPerDevPixel() { return mP2A; }
|
||||
int32_t AppUnitsPerDevPixel() { return mP2A; }
|
||||
|
||||
protected:
|
||||
const gfxFont::Metrics& GetMetrics() const;
|
||||
|
@ -209,7 +209,7 @@ protected:
|
|||
nsRefPtr<gfxFontGroup> mFontGroup;
|
||||
nsCOMPtr<nsIAtom> mLanguage;
|
||||
nsDeviceContext *mDeviceContext;
|
||||
uint32_t mP2A;
|
||||
int32_t mP2A;
|
||||
bool mTextRunRTL;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
// These accessors will never return null.
|
||||
gfxContext *ThebesContext() { return mThebes; }
|
||||
nsDeviceContext *DeviceContext() { return mDeviceContext; }
|
||||
uint32_t AppUnitsPerDevPixel() { return NSToIntRound(mP2A); }
|
||||
int32_t AppUnitsPerDevPixel() { return NSToIntRound(mP2A); }
|
||||
|
||||
// Graphics state
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ gfxDWriteShaper::ShapeText(gfxContext *aContext,
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t appUnitsPerDevPixel = aShapedText->GetAppUnitsPerDevUnit();
|
||||
int32_t appUnitsPerDevPixel = aShapedText->GetAppUnitsPerDevUnit();
|
||||
|
||||
UINT32 maxGlyphs = 0;
|
||||
trymoreglyphs:
|
||||
|
|
|
@ -64,7 +64,7 @@ gfxGDIShaper::ShapeText(gfxContext *aContext,
|
|||
aShapedText->GetCharacterGlyphs();
|
||||
uint32_t i;
|
||||
int32_t lastWidth = 0;
|
||||
uint32_t appUnitsPerDevPixel = aShapedText->GetAppUnitsPerDevUnit();
|
||||
int32_t appUnitsPerDevPixel = aShapedText->GetAppUnitsPerDevUnit();
|
||||
for (i = 0; i < length; ++i) {
|
||||
uint32_t offset = aOffset + i;
|
||||
int32_t advancePixels = partialWidthArray[i] - lastWidth;
|
||||
|
|
|
@ -219,7 +219,7 @@ nsCaret::Metrics nsCaret::ComputeMetrics(nsIFrame* aFrame, int32_t aOffset, nsco
|
|||
|
||||
// Round them to device pixels. Always round down, except that anything
|
||||
// between 0 and 1 goes up to 1 so we don't let the caret disappear.
|
||||
uint32_t tpp = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
int32_t tpp = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
Metrics result;
|
||||
result.mCaretWidth = NS_ROUND_BORDER_TO_PIXELS(caretWidth, tpp);
|
||||
result.mBidiIndicatorSize = NS_ROUND_BORDER_TO_PIXELS(bidiIndicatorSize, tpp);
|
||||
|
|
|
@ -1660,7 +1660,7 @@ nsPresContext::UIResolutionChangedInternal()
|
|||
mPendingUIResolutionChanged = false;
|
||||
|
||||
mDeviceContext->CheckDPIChange();
|
||||
if (uint32_t(mCurAppUnitsPerDevPixel) != AppUnitsPerDevPixel()) {
|
||||
if (mCurAppUnitsPerDevPixel != AppUnitsPerDevPixel()) {
|
||||
AppUnitsPerDevPixelChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ public:
|
|||
float ScreenWidthInchesForFontInflation(bool* aChanged = nullptr);
|
||||
|
||||
static int32_t AppUnitsPerCSSPixel() { return nsDeviceContext::AppUnitsPerCSSPixel(); }
|
||||
uint32_t AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
|
||||
int32_t AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
|
||||
static int32_t AppUnitsPerCSSInch() { return nsDeviceContext::AppUnitsPerCSSInch(); }
|
||||
|
||||
static nscoord CSSPixelsToAppUnits(int32_t aPixels)
|
||||
|
|
|
@ -2333,7 +2333,7 @@ nsGfxScrollFrameInner::GetLineScrollAmount() const
|
|||
Preferences::AddIntVarCache(&sMinLineScrollAmountInPixels,
|
||||
"mousewheel.min_line_scroll_amount", 1);
|
||||
}
|
||||
uint32_t appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
|
||||
int32_t appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
|
||||
nscoord minScrollAmountInAppUnits =
|
||||
std::max(1, sMinLineScrollAmountInPixels) * appUnitsPerDevPixel;
|
||||
nscoord horizontalAmount = fm ? fm->AveCharWidth() : 0;
|
||||
|
|
|
@ -800,7 +800,7 @@ nsSVGUtils::PaintFrameWithEffects(nsRenderingContext *aContext,
|
|||
// GetCanvasTM().
|
||||
overflowRect = overflowRect + aFrame->GetPosition();
|
||||
}
|
||||
uint32_t appUnitsPerDevPx = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
int32_t appUnitsPerDevPx = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
gfxMatrix tm = GetCanvasTM(aFrame, nsISVGChildFrame::FOR_PAINTING);
|
||||
if (aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
|
||||
gfxMatrix childrenOnlyTM;
|
||||
|
|
|
@ -314,7 +314,7 @@ public:
|
|||
*/
|
||||
void UpdateWidgetGeometry();
|
||||
|
||||
uint32_t AppUnitsPerDevPixel() const
|
||||
int32_t AppUnitsPerDevPixel() const
|
||||
{
|
||||
return mContext->AppUnitsPerDevPixel();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче