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 a14562fd8cbfbde3057e5e84cf0119f33197e9fd..dc446e2f1dec36614dbfac9f9a5b5566b1e9f1da 100644 |
--- a/third_party/WebKit/Source/platform/fonts/Font.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/Font.cpp |
@@ -35,12 +35,13 @@ |
#include "platform/fonts/SimpleFontData.h" |
#include "platform/fonts/shaping/CachingWordShaper.h" |
#include "platform/geometry/FloatRect.h" |
+#include "platform/graphics/paint/PaintCanvas.h" |
+#include "platform/graphics/paint/PaintFlags.h" |
#include "platform/text/BidiResolver.h" |
#include "platform/text/Character.h" |
#include "platform/text/TextRun.h" |
#include "platform/text/TextRunIterator.h" |
#include "platform/transforms/AffineTransform.h" |
-#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 "wtf/StdLibExtras.h" |
@@ -121,11 +122,11 @@ float Font::buildGlyphBuffer(const TextRunPaintInfo& runInfo, |
return width; |
} |
-bool Font::drawText(SkCanvas* canvas, |
+bool Font::drawText(PaintCanvas* canvas, |
const TextRunPaintInfo& runInfo, |
const FloatPoint& point, |
float deviceScaleFactor, |
- const SkPaint& paint) const { |
+ const PaintFlags& paint) const { |
// Don't draw anything while we are using custom fonts that are in the process |
// of loading. |
if (shouldSkipDrawing()) |
@@ -146,12 +147,12 @@ bool Font::drawText(SkCanvas* canvas, |
return true; |
} |
-bool Font::drawBidiText(SkCanvas* canvas, |
+bool Font::drawBidiText(PaintCanvas* canvas, |
const TextRunPaintInfo& runInfo, |
const FloatPoint& point, |
CustomFontNotReadyAction customFontNotReadyAction, |
float deviceScaleFactor, |
- const SkPaint& paint) const { |
+ const PaintFlags& 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 +202,12 @@ bool Font::drawBidiText(SkCanvas* canvas, |
return true; |
} |
-void Font::drawEmphasisMarks(SkCanvas* canvas, |
+void Font::drawEmphasisMarks(PaintCanvas* canvas, |
const TextRunPaintInfo& runInfo, |
const AtomicString& mark, |
const FloatPoint& point, |
float deviceScaleFactor, |
- const SkPaint& paint) const { |
+ const PaintFlags& paint) const { |
if (shouldSkipDrawing()) |
return; |
@@ -361,8 +362,8 @@ class GlyphBufferBloberizer { |
} // anonymous namespace |
-void Font::drawGlyphBuffer(SkCanvas* canvas, |
- const SkPaint& paint, |
+void Font::drawGlyphBuffer(PaintCanvas* canvas, |
+ const PaintFlags& paint, |
const TextRunPaintInfo& runInfo, |
const GlyphBuffer& glyphBuffer, |
const FloatPoint& point, |
@@ -374,7 +375,7 @@ void Font::drawGlyphBuffer(SkCanvas* canvas, |
blob = bloberizer.next(); |
ASSERT(blob.first); |
- SkAutoCanvasRestore autoRestore(canvas, false); |
+ PaintCanvasAutoRestore autoRestore(canvas, false); |
if (blob.second == CCWRotation) { |
canvas->save(); |
@@ -400,7 +401,7 @@ void Font::drawGlyphBuffer(SkCanvas* canvas, |
static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer, |
const Font* font, |
- const SkPaint& paint, |
+ const PaintFlags& paint, |
float deviceScaleFactor, |
const std::tuple<float, float>& bounds, |
SkScalar* interceptsBuffer) { |
@@ -408,6 +409,7 @@ static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer, |
GlyphBufferBloberizer bloberizer(glyphBuffer, font, deviceScaleFactor); |
std::pair<sk_sp<SkTextBlob>, BlobRotation> blob; |
+ SkPaint skPaint = ToSkPaint(paint); |
danakj
2017/01/20 23:34:14
Why do you wanna SkPaint?
enne (OOO)
2017/01/24 01:51:28
See my comments in comment #1. I'll just remove t
|
int numIntervals = 0; |
while (!bloberizer.done()) { |
blob = bloberizer.next(); |
@@ -423,30 +425,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 PaintFlags& 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; |
} |