зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1342720 - Optimize away the cost of creating and destroying nsBidi from CanvasRenderingContext2D::DrawOrMeasureText(); r=baku
The ICU implementation of ~nsBidi is particularly expensive because it calls free() several times.
This commit is contained in:
Родитель
0c87943561
Коммит
0fea8eec91
|
@ -57,7 +57,6 @@
|
|||
#include "gfxUtils.h"
|
||||
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsBidi.h"
|
||||
#include "nsBidiPresUtils.h"
|
||||
#include "Layers.h"
|
||||
#include "LayerUserData.h"
|
||||
|
@ -4276,7 +4275,6 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
|
||||
// calls bidi algo twice since it needs the full text width and the
|
||||
// bounding boxes before rendering anything
|
||||
nsBidi bidiEngine;
|
||||
rv = nsBidiPresUtils::ProcessText(textToDraw.get(),
|
||||
textToDraw.Length(),
|
||||
isRTL ? NSBIDI_RTL : NSBIDI_LTR,
|
||||
|
@ -4286,7 +4284,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
nullptr,
|
||||
0,
|
||||
&totalWidthCoord,
|
||||
&bidiEngine);
|
||||
&mBidiEngine);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -4401,7 +4399,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
nullptr,
|
||||
0,
|
||||
nullptr,
|
||||
&bidiEngine);
|
||||
&mBidiEngine);
|
||||
|
||||
|
||||
mTarget->SetTransform(oldTransform);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "FilterSupport.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "Layers.h"
|
||||
#include "nsBidi.h"
|
||||
|
||||
class nsGlobalWindow;
|
||||
class nsXULElement;
|
||||
|
@ -864,6 +865,8 @@ protected:
|
|||
|
||||
nsTArray<RegionInfo> mHitRegionsOptions;
|
||||
|
||||
nsBidi mBidiEngine;
|
||||
|
||||
/**
|
||||
* Returns true if a shadow should be drawn along with a
|
||||
* drawing operation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче