diff options
author | fmalita <fmalita@chromium.org> | 2015-06-15 13:15:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-15 13:15:31 -0700 |
commit | 109a23d64ff9cf210e6b0aa8940b4fcea3f05a97 (patch) | |
tree | 3e64cbec385ca708853c135515af6f6247dbdd58 /src | |
parent | e0ef4a71570f5c7ef60004fc86adad072e1f8719 (diff) |
Remove the SkCanvas comment API
No longer used in Chromium/Blink.
R=reed@google.com,robertphillips@google.com,mtklein@google.com
Review URL: https://codereview.chromium.org/1153593003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPictureFlat.h | 6 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 24 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 27 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 4 | ||||
-rw-r--r-- | src/core/SkRecordDraw.cpp | 7 | ||||
-rw-r--r-- | src/core/SkRecorder.cpp | 12 | ||||
-rw-r--r-- | src/core/SkRecorder.h | 4 | ||||
-rw-r--r-- | src/core/SkRecords.h | 7 | ||||
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 16 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 12 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 21 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 12 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.h | 4 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.cpp | 24 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.h | 38 |
15 files changed, 15 insertions, 203 deletions
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 103eeceb16..2511615994 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -57,9 +57,9 @@ enum DrawType { SKEW, TRANSLATE, NOOP, - BEGIN_COMMENT_GROUP, - COMMENT, - END_COMMENT_GROUP, + BEGIN_COMMENT_GROUP, // deprecated (M44) + COMMENT, // deprecated (M44) + END_COMMENT_GROUP, // deprecated (M44) // new ops -- feel free to re-alphabetize on next version bump DRAW_DRRECT, diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 4f775cf9fd..f4fdc8b83a 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -204,18 +204,18 @@ void SkPicturePlayback::handleOp(SkReader32* reader, reader->readRRect(&inner); canvas->drawDRRect(outer, inner, paint); } break; - case BEGIN_COMMENT_GROUP: { - const char* desc = reader->readString(); - canvas->beginCommentGroup(desc); - } break; - case COMMENT: { - const char* kywd = reader->readString(); - const char* value = reader->readString(); - canvas->addComment(kywd, value); - } break; - case END_COMMENT_GROUP: { - canvas->endCommentGroup(); - } break; + case BEGIN_COMMENT_GROUP: + reader->readString(); + // deprecated (M44) + break; + case COMMENT: + reader->readString(); + reader->readString(); + // deprecated (M44) + break; + case END_COMMENT_GROUP: + // deprecated (M44) + break; case DRAW_OVAL: { const SkPaint& paint = *fPictureData->getPaint(reader); canvas->drawOval(reader->skipT<SkRect>(), paint); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 07811fb128..c85af901c6 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -815,33 +815,6 @@ void SkPictureRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors this->validate(initialOffset, size); } -void SkPictureRecord::beginCommentGroup(const char* description) { - // op/size + length of string + \0 terminated chars - size_t length = strlen(description); - size_t size = 2 * kUInt32Size + SkAlign4(length + 1); - size_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size); - fWriter.writeString(description, length); - this->validate(initialOffset, size); -} - -void SkPictureRecord::addComment(const char* kywd, const char* value) { - // op/size + 2x length of string + 2x \0 terminated chars - size_t kywdLen = strlen(kywd); - size_t valueLen = strlen(value); - size_t size = 3 * kUInt32Size + SkAlign4(kywdLen + 1) + SkAlign4(valueLen + 1); - size_t initialOffset = this->addDraw(COMMENT, &size); - fWriter.writeString(kywd, kywdLen); - fWriter.writeString(value, valueLen); - this->validate(initialOffset, size); -} - -void SkPictureRecord::endCommentGroup() { - // op/size - size_t size = 1 * kUInt32Size; - size_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size); - this->validate(initialOffset, size); -} - /////////////////////////////////////////////////////////////////////////////// SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) { diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index af65013b55..2aeb69dcd4 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -29,10 +29,6 @@ public: SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); virtual ~SkPictureRecord(); - void beginCommentGroup(const char* description) override; - void addComment(const char* kywd, const char* value) override; - void endCommentGroup() override; - const SkTDArray<const SkPicture* >& getPictureRefs() const { return fPictureRefs; } diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index 65e6d490db..7db7680e28 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -86,10 +86,6 @@ DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); DRAW(ClipRegion, clipRegion(r.region, r.op)); -DRAW(BeginCommentGroup, beginCommentGroup(r.description)); -DRAW(AddComment, addComment(r.key, r.value)); -DRAW(EndCommentGroup, endCommentGroup()); - DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.paint)); DRAW(DrawBitmapRectToRect, @@ -289,9 +285,6 @@ private: void trackBounds(const ClipRRect&) { this->pushControl(); } void trackBounds(const ClipPath&) { this->pushControl(); } void trackBounds(const ClipRegion&) { this->pushControl(); } - void trackBounds(const BeginCommentGroup&) { this->pushControl(); } - void trackBounds(const AddComment&) { this->pushControl(); } - void trackBounds(const EndCommentGroup&) { this->pushControl(); } // For all other ops, we can calculate and store the bounds directly now. template <typename T> void trackBounds(const T& op) { diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index 0989132cd2..4562a87f67 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -350,15 +350,3 @@ void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op); } -void SkRecorder::beginCommentGroup(const char* description) { - APPEND(BeginCommentGroup, this->copy(description)); -} - -void SkRecorder::addComment(const char* key, const char* value) { - APPEND(AddComment, this->copy(key), this->copy(value)); -} - -void SkRecorder::endCommentGroup() { - APPEND(EndCommentGroup); -} - diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index b6f153dc54..7fab62d023 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -116,10 +116,6 @@ public: void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; - void beginCommentGroup(const char*) override; - void addComment(const char*, const char*) override; - void endCommentGroup() override; - SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return NULL; } void flushMiniRecorder(); diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h index 2ce963367a..f4de5bdc3b 100644 --- a/src/core/SkRecords.h +++ b/src/core/SkRecords.h @@ -36,9 +36,6 @@ namespace SkRecords { M(ClipRRect) \ M(ClipRect) \ M(ClipRegion) \ - M(BeginCommentGroup) \ - M(AddComment) \ - M(EndCommentGroup) \ M(DrawBitmap) \ M(DrawBitmapNine) \ M(DrawBitmapRectToRect) \ @@ -253,10 +250,6 @@ RECORD3(ClipRRect, SkIRect, devBounds, SkRRect, rrect, RegionOpAndAA, opA RECORD3(ClipRect, SkIRect, devBounds, SkRect, rect, RegionOpAndAA, opAA); RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op); -RECORD1(BeginCommentGroup, PODArray<char>, description); -RECORD2(AddComment, PODArray<char>, key, PODArray<char>, value); -RECORD0(EndCommentGroup); - // While not strictly required, if you have an SkPaint, it's fastest to put it first. RECORD4(DrawBitmap, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 7f8d61ca9f..9fd81b05eb 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -238,10 +238,6 @@ public: return bytesAllocated; } - void beginCommentGroup(const char* description) override; - void addComment(const char* kywd, const char* value) override; - void endCommentGroup() override; - /** * Flatten an SkBitmap to send to the reader, where it will be referenced * according to slot. @@ -1146,18 +1142,6 @@ void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4 } } -void SkGPipeCanvas::beginCommentGroup(const char* description) { - // ignore for now -} - -void SkGPipeCanvas::addComment(const char* kywd, const char* value) { - // ignore for now -} - -void SkGPipeCanvas::endCommentGroup() { - // ignore for now -} - void SkGPipeCanvas::flushRecording(bool detachCurrentBlock) { this->doNotify(); if (detachCurrentBlock) { diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 54ca691dce..5cbf2f4bcc 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -490,18 +490,6 @@ void SkDumpCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4] texCoords[2].x(), texCoords[2].y(), texCoords[3].x(), texCoords[3].y()); } -void SkDumpCanvas::beginCommentGroup(const char* description) { - this->dump(kBeginCommentGroup_Verb, NULL, "beginCommentGroup(%s)", description); -} - -void SkDumpCanvas::addComment(const char* kywd, const char* value) { - this->dump(kAddComment_Verb, NULL, "addComment(%s, %s)", kywd, value); -} - -void SkDumpCanvas::endCommentGroup() { - this->dump(kEndCommentGroup_Verb, NULL, "endCommentGroup()"); -} - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index 14ad6d6f81..8ae842237f 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -308,24 +308,3 @@ SkDrawFilter* SkNWayCanvas::setDrawFilter(SkDrawFilter* filter) { } return this->INHERITED::setDrawFilter(filter); } - -void SkNWayCanvas::beginCommentGroup(const char* description) { - Iter iter(fList); - while (iter.next()) { - iter->beginCommentGroup(description); - } -} - -void SkNWayCanvas::addComment(const char* kywd, const char* value) { - Iter iter(fList); - while (iter.next()) { - iter->addComment(kywd, value); - } -} - -void SkNWayCanvas::endCommentGroup() { - Iter iter(fList); - while (iter.next()) { - iter->endCommentGroup(); - } -} diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 21272d7d24..df0a6d8d9c 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -432,18 +432,6 @@ void SkDebugCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, con SkDebugf("SkDebugCanvas::onDrawImageRect unimplemented\n"); } -void SkDebugCanvas::beginCommentGroup(const char* description) { - this->addDrawCommand(new SkBeginCommentGroupCommand(description)); -} - -void SkDebugCanvas::addComment(const char* kywd, const char* value) { - this->addDrawCommand(new SkCommentCommand(kywd, value)); -} - -void SkDebugCanvas::endCommentGroup() { - this->addDrawCommand(new SkEndCommentGroupCommand()); -} - void SkDebugCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { this->addDrawCommand(new SkDrawOvalCommand(oval, paint)); } diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 8cf16d2f02..06338e2a50 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -142,10 +142,6 @@ public: // Inherited from SkCanvas //////////////////////////////////////////////////////////////////////////////// - void beginCommentGroup(const char* description) override; - void addComment(const char* kywd, const char* value) override; - void endCommentGroup() override; - static const int kVizImageHeight = 256; static const int kVizImageWidth = 256; diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 09b18896bc..7e2af084f2 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -25,13 +25,11 @@ SkDrawCommand::~SkDrawCommand() { const char* SkDrawCommand::GetCommandString(OpType type) { switch (type) { - case kBeginCommentGroup_OpType: return "BeginCommentGroup"; case kBeginDrawPicture_OpType: return "BeginDrawPicture"; case kClipPath_OpType: return "ClipPath"; case kClipRegion_OpType: return "ClipRegion"; case kClipRect_OpType: return "ClipRect"; case kClipRRect_OpType: return "ClipRRect"; - case kComment_OpType: return "Comment"; case kConcat_OpType: return "Concat"; case kDrawBitmap_OpType: return "DrawBitmap"; case kDrawBitmapNine_OpType: return "DrawBitmapNine"; @@ -52,7 +50,6 @@ const char* SkDrawCommand::GetCommandString(OpType type) { case kDrawTextBlob_OpType: return "DrawTextBlob"; case kDrawTextOnPath_OpType: return "DrawTextOnPath"; case kDrawVertices_OpType: return "DrawVertices"; - case kEndCommentGroup_OpType: return "EndCommentGroup"; case kEndDrawPicture_OpType: return "EndDrawPicture"; case kRestore_OpType: return "Restore"; case kSave_OpType: return "Save"; @@ -361,27 +358,6 @@ bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { return true; } -SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description) - : INHERITED(kBeginCommentGroup_OpType) - , fDescription(description) { - SkString* temp = new SkString; - temp->appendf("Description: %s", description); - fInfo.push(temp); -} - -SkCommentCommand::SkCommentCommand(const char* kywd, const char* value) - : INHERITED(kComment_OpType) - , fKywd(kywd) - , fValue(value) { - SkString* temp = new SkString; - temp->appendf("%s: %s", kywd, value); - fInfo.push(temp); -} - -SkEndCommentGroupCommand::SkEndCommentGroupCommand() - : INHERITED(kEndCommentGroup_OpType) { -} - SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) : INHERITED(kDrawOval_OpType) { fOval = oval; diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h index 538dd23c20..307599fdb7 100644 --- a/src/utils/debugger/SkDrawCommand.h +++ b/src/utils/debugger/SkDrawCommand.h @@ -15,13 +15,11 @@ class SK_API SkDrawCommand { public: enum OpType { - kBeginCommentGroup_OpType, kBeginDrawPicture_OpType, kClipPath_OpType, kClipRegion_OpType, kClipRect_OpType, kClipRRect_OpType, - kComment_OpType, kConcat_OpType, kDrawBitmap_OpType, kDrawBitmapNine_OpType, @@ -42,7 +40,6 @@ public: kDrawTextBlob_OpType, kDrawTextOnPath_OpType, kDrawVertices_OpType, - kEndCommentGroup_OpType, kEndDrawPicture_OpType, kRestore_OpType, kSave_OpType, @@ -267,41 +264,6 @@ private: typedef SkDrawCommand INHERITED; }; -class SkBeginCommentGroupCommand : public SkDrawCommand { -public: - SkBeginCommentGroupCommand(const char* description); - void execute(SkCanvas* canvas) const override { - canvas->beginCommentGroup(fDescription.c_str()); - }; -private: - SkString fDescription; - - typedef SkDrawCommand INHERITED; -}; - -class SkCommentCommand : public SkDrawCommand { -public: - SkCommentCommand(const char* kywd, const char* value); - void execute(SkCanvas* canvas) const override { - canvas->addComment(fKywd.c_str(), fValue.c_str()); - }; -private: - SkString fKywd; - SkString fValue; - - typedef SkDrawCommand INHERITED; -}; - -class SkEndCommentGroupCommand : public SkDrawCommand { -public: - SkEndCommentGroupCommand(); - void execute(SkCanvas* canvas) const override { - canvas->endCommentGroup(); - }; -private: - typedef SkDrawCommand INHERITED; -}; - class SkDrawOvalCommand : public SkDrawCommand { public: SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |