| Index: third_party/WebKit/Source/platform/fonts/Font.cpp
|
| diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp
|
| index 185d7137847b53cc8073f105ff83d13736cacf63..36341e6878609b88d0c7db340631a3abd06238aa 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/Font.cpp
|
| +++ b/third_party/WebKit/Source/platform/fonts/Font.cpp
|
| @@ -43,6 +43,8 @@
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkPaint.h"
|
| #include "third_party/skia/include/core/SkTextBlob.h"
|
| +#include "skia/ext/cdl_canvas.h"
|
| +#include "skia/ext/cdl_paint.h"
|
| #include "wtf/StdLibExtras.h"
|
| #include "wtf/text/CharacterNames.h"
|
| #include "wtf/text/Unicode.h"
|
| @@ -121,11 +123,11 @@ float Font::buildGlyphBuffer(const TextRunPaintInfo& runInfo,
|
| return width;
|
| }
|
|
|
| -bool Font::drawText(SkCanvas* canvas,
|
| +bool Font::drawText(CdlCanvas* canvas,
|
| const TextRunPaintInfo& runInfo,
|
| const FloatPoint& point,
|
| float deviceScaleFactor,
|
| - const SkPaint& paint) const {
|
| + const CdlPaint& paint) const {
|
| // Don't draw anything while we are using custom fonts that are in the process
|
| // of loading.
|
| if (shouldSkipDrawing())
|
| @@ -146,12 +148,12 @@ bool Font::drawText(SkCanvas* canvas,
|
| return true;
|
| }
|
|
|
| -bool Font::drawBidiText(SkCanvas* canvas,
|
| +bool Font::drawBidiText(CdlCanvas* canvas,
|
| const TextRunPaintInfo& runInfo,
|
| const FloatPoint& point,
|
| CustomFontNotReadyAction customFontNotReadyAction,
|
| float deviceScaleFactor,
|
| - const SkPaint& paint) const {
|
| + const CdlPaint& paint) const {
|
| // Don't draw anything while we are using custom fonts that are in the process
|
| // of loading, except if the 'force' argument is set to true (in which case it
|
| // will use a fallback font).
|
| @@ -201,12 +203,12 @@ bool Font::drawBidiText(SkCanvas* canvas,
|
| return true;
|
| }
|
|
|
| -void Font::drawEmphasisMarks(SkCanvas* canvas,
|
| +void Font::drawEmphasisMarks(CdlCanvas* canvas,
|
| const TextRunPaintInfo& runInfo,
|
| const AtomicString& mark,
|
| const FloatPoint& point,
|
| float deviceScaleFactor,
|
| - const SkPaint& paint) const {
|
| + const CdlPaint& paint) const {
|
| if (shouldSkipDrawing())
|
| return;
|
|
|
| @@ -349,8 +351,8 @@ class GlyphBufferBloberizer {
|
|
|
| } // anonymous namespace
|
|
|
| -void Font::drawGlyphBuffer(SkCanvas* canvas,
|
| - const SkPaint& paint,
|
| +void Font::drawGlyphBuffer(CdlCanvas* canvas,
|
| + const CdlPaint& paint,
|
| const TextRunPaintInfo& runInfo,
|
| const GlyphBuffer& glyphBuffer,
|
| const FloatPoint& point,
|
| @@ -362,7 +364,7 @@ void Font::drawGlyphBuffer(SkCanvas* canvas,
|
| blob = bloberizer.next();
|
| ASSERT(blob.first);
|
|
|
| - SkAutoCanvasRestore autoRestore(canvas, false);
|
| + CdlAutoCanvasRestore autoRestore(canvas, false);
|
| if (blob.second == CCWRotation) {
|
| canvas->save();
|
|
|
| @@ -388,7 +390,7 @@ void Font::drawGlyphBuffer(SkCanvas* canvas,
|
|
|
| static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer,
|
| const Font* font,
|
| - const SkPaint& paint,
|
| + const CdlPaint& paint,
|
| float deviceScaleFactor,
|
| const std::tuple<float, float>& bounds,
|
| SkScalar* interceptsBuffer) {
|
| @@ -396,6 +398,7 @@ static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer,
|
| GlyphBufferBloberizer bloberizer(glyphBuffer, font, deviceScaleFactor);
|
| std::pair<sk_sp<SkTextBlob>, BlobRotation> blob;
|
|
|
| + SkPaint skPaint = ToSkPaint(paint);
|
| int numIntervals = 0;
|
| while (!bloberizer.done()) {
|
| blob = bloberizer.next();
|
| @@ -411,30 +414,32 @@ static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer,
|
| SkScalar* offsetInterceptsBuffer = nullptr;
|
| if (interceptsBuffer)
|
| offsetInterceptsBuffer = &interceptsBuffer[numIntervals];
|
| - numIntervals += paint.getTextBlobIntercepts(blob.first.get(), boundsArray,
|
| - offsetInterceptsBuffer);
|
| + numIntervals += skPaint.getTextBlobIntercepts(blob.first.get(), boundsArray,
|
| + offsetInterceptsBuffer);
|
| }
|
| return numIntervals;
|
| }
|
|
|
| void Font::getTextIntercepts(const TextRunPaintInfo& runInfo,
|
| float deviceScaleFactor,
|
| - const SkPaint& paint,
|
| + const CdlPaint& paint,
|
| const std::tuple<float, float>& bounds,
|
| Vector<TextIntercept>& intercepts) const {
|
| if (shouldSkipDrawing())
|
| return;
|
|
|
| + SkPaint skPaint = ToSkPaint(paint);
|
| if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) {
|
| SkScalar boundsArray[2] = {std::get<0>(bounds), std::get<1>(bounds)};
|
| - int numIntervals = paint.getTextBlobIntercepts(
|
| + int numIntervals = skPaint.getTextBlobIntercepts(
|
| runInfo.cachedTextBlob->get(), boundsArray, nullptr);
|
| if (!numIntervals)
|
| return;
|
| DCHECK_EQ(numIntervals % 2, 0);
|
| intercepts.resize(numIntervals / 2);
|
| - paint.getTextBlobIntercepts(runInfo.cachedTextBlob->get(), boundsArray,
|
| - reinterpret_cast<SkScalar*>(intercepts.data()));
|
| + skPaint.getTextBlobIntercepts(
|
| + runInfo.cachedTextBlob->get(), boundsArray,
|
| + reinterpret_cast<SkScalar*>(intercepts.data()));
|
| return;
|
| }
|
|
|
|
|