diff options
author | fmalita <fmalita@chromium.org> | 2016-09-13 10:00:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-13 10:00:23 -0700 |
commit | 37283c28aa5bea2204c18956e74f83b238d7a891 (patch) | |
tree | 6ac125088f1df0c6d9380e323e873c72c8416b0b /tools/debugger | |
parent | ec44099979acd3e83ad93a15dbd9301856a90572 (diff) |
Use sk_sp text blob APIs
SkTextBlobBuilder::build() -> make()
SkAutoTUnref<const SkTextBlob> -> sk_sp<SkTextBlob>
drawTextBlob(const SkTextBlob*) -> drawTextBlob(const sk_sp<SkTextBlob>&)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335493005
Review-Url: https://codereview.chromium.org/2335493005
Diffstat (limited to 'tools/debugger')
-rw-r--r-- | tools/debugger/SkDebugCanvas.cpp | 6 | ||||
-rw-r--r-- | tools/debugger/SkDrawCommand.cpp | 10 | ||||
-rw-r--r-- | tools/debugger/SkDrawCommand.h | 10 |
3 files changed, 14 insertions, 12 deletions
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp index 86125b891d..4c633ab8fc 100644 --- a/tools/debugger/SkDebugCanvas.cpp +++ b/tools/debugger/SkDebugCanvas.cpp @@ -9,8 +9,9 @@ #include "SkClipStack.h" #include "SkDebugCanvas.h" #include "SkDrawCommand.h" -#include "SkPaintFilterCanvas.h" #include "SkOverdrawMode.h" +#include "SkPaintFilterCanvas.h" +#include "SkTextBlob.h" #if SK_SUPPORT_GPU #include "GrAuditTrail.h" @@ -677,7 +678,8 @@ void SkDebugCanvas::onDrawTextRSXform(const void* text, size_t byteLength, const void SkDebugCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { - this->addDrawCommand(new SkDrawTextBlobCommand(blob, x, y, paint)); + this->addDrawCommand(new SkDrawTextBlobCommand(sk_ref_sp(const_cast<SkTextBlob*>(blob)), + x, y, paint)); } void SkDebugCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp index 6ca3fe074e..0f8101306b 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -2796,10 +2796,10 @@ static const char* gPositioningLabels[] = { "kFull_Positioning", }; -SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, +SkDrawTextBlobCommand::SkDrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y, const SkPaint& paint) : INHERITED(kDrawTextBlob_OpType) - , fBlob(SkRef(blob)) + , fBlob(std::move(blob)) , fXPos(x) , fYPos(y) , fPaint(paint) { @@ -2813,7 +2813,7 @@ SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, unsigned runs = 0; SkPaint runPaint(paint); - SkTextBlobRunIterator iter(blob); + SkTextBlobRunIterator iter(blob.get()); while (!iter.done()) { SkAutoTDelete<SkString> tmpStr(new SkString); tmpStr->printf("==== Run [%d] ====", runs++); @@ -2846,7 +2846,7 @@ bool SkDrawTextBlobCommand::render(SkCanvas* canvas) const { SkRect bounds = fBlob->bounds().makeOffset(fXPos, fYPos); xlate_and_scale_to_bounds(canvas, bounds); - canvas->drawTextBlob(fBlob.get(), fXPos, fYPos, fPaint); + canvas->drawTextBlob(fBlob, fXPos, fYPos, fPaint); canvas->restore(); @@ -2949,7 +2949,7 @@ SkDrawTextBlobCommand* SkDrawTextBlobCommand::fromJSON(Json::Value& command, SkScalar y = command[SKDEBUGCANVAS_ATTRIBUTE_Y].asFloat(); SkPaint paint; extract_json_paint(command[SKDEBUGCANVAS_ATTRIBUTE_PAINT], urlDataManager, &paint); - return new SkDrawTextBlobCommand(builder.build(), x, y, paint); + return new SkDrawTextBlobCommand(builder.make(), x, y, paint); } SkDrawPatchCommand::SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4], diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h index 2e5f9c659a..07dd477f6a 100644 --- a/tools/debugger/SkDrawCommand.h +++ b/tools/debugger/SkDrawCommand.h @@ -625,7 +625,7 @@ private: class SkDrawTextBlobCommand : public SkDrawCommand { public: - SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); + SkDrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y, const SkPaint& paint); void execute(SkCanvas* canvas) const override; bool render(SkCanvas* canvas) const override; @@ -633,10 +633,10 @@ public: static SkDrawTextBlobCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); private: - SkAutoTUnref<const SkTextBlob> fBlob; - SkScalar fXPos; - SkScalar fYPos; - SkPaint fPaint; + sk_sp<SkTextBlob> fBlob; + SkScalar fXPos; + SkScalar fYPos; + SkPaint fPaint; typedef SkDrawCommand INHERITED; }; |