Bug 1379404 - Part 4. Prevent unnecessary AzureState copy in GlyphBufferAzure::Flush. r=mattwoodrow

~AzureState is expensive, especially in GlyphBufferAzure::Flush, which is a high
fan-in function.

MozReview-Commit-ID: 4JfjMje0Kgs

--HG--
extra : rebase_source : bbc2f06871d9bde9130ddb95d053d16a3f2a091d
This commit is contained in:
cku 2017-07-09 00:49:24 +08:00
Родитель e9501d8277
Коммит 8aeea96caf
3 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -1645,7 +1645,7 @@ private:
buf.mGlyphs = mGlyphBuffer;
buf.mNumGlyphs = mNumGlyphs;
gfxContext::AzureState state = mRunParams.context->CurrentState();
const gfxContext::AzureState &state = mRunParams.context->CurrentState();
if (mRunParams.drawMode & DrawMode::GLYPH_FILL) {
if (state.pattern || mFontParams.contextPaint) {
Pattern *pat;
@ -1661,7 +1661,9 @@ private:
}
if (!fillPattern) {
if (state.pattern) {
pat = state.pattern->GetPattern(mRunParams.dt,
RefPtr<gfxPattern> statePattern =
mRunParams.context->CurrentState().pattern;
pat = statePattern->GetPattern(mRunParams.dt,
state.patternTransformChanged ?
&state.patternTransform : nullptr);
} else {

Просмотреть файл

@ -106,7 +106,7 @@ gfxPattern::GetInverseMatrix() const
Pattern*
gfxPattern::GetPattern(const DrawTarget *aTarget,
Matrix *aOriginalUserToDevice)
const Matrix *aOriginalUserToDevice)
{
Matrix patternToUser = mPatternToUserSpace;

Просмотреть файл

@ -48,7 +48,7 @@ public:
* to the current transform.
*/
mozilla::gfx::Pattern *GetPattern(const mozilla::gfx::DrawTarget *aTarget,
mozilla::gfx::Matrix *aOriginalUserToDevice = nullptr);
const mozilla::gfx::Matrix *aOriginalUserToDevice = nullptr);
bool IsOpaque();
// clamp, repeat, reflect