diff options
author | Cary Clark <caryclark@skia.org> | 2018-06-12 16:49:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-13 17:21:16 +0000 |
commit | 1e447dfb7702460fc3dea5634c1e69d274b1b739 (patch) | |
tree | e5672237f39e292bc5c790bf72ee14830eed5b43 /src | |
parent | 4010c792c6bd0378087225ae16b0131bd2c303f2 (diff) |
minor fixes to SkRRect
Move methods that are not publicly callable
to SkRRectPriv.h. Name params, add a trailing
comma to the enum list.
R=reed@google.com,bsalomon@google.com
Bug: skia:6898
Change-Id: If93f712656dde563567a647624e58ce9a9d74494
Reviewed-on: https://skia-review.googlesource.com/134423
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPath_serial.cpp | 6 | ||||
-rw-r--r-- | src/core/SkRRect.cpp | 12 | ||||
-rw-r--r-- | src/core/SkRRectPriv.h | 7 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/core/SkPath_serial.cpp b/src/core/SkPath_serial.cpp index e538a462db..3adcec2d63 100644 --- a/src/core/SkPath_serial.cpp +++ b/src/core/SkPath_serial.cpp @@ -11,7 +11,7 @@ #include "SkMath.h" #include "SkPathPriv.h" #include "SkPathRef.h" -#include "SkRRect.h" +#include "SkRRectPriv.h" #include "SkSafeMath.h" enum SerializationOffsets { @@ -77,7 +77,7 @@ size_t SkPath::writeToMemoryAsRRect(void* storage) const { SkWBuffer buffer(storage); buffer.write32(packed); - rrect.writeToBuffer(&buffer); + SkRRectPriv::WriteToBuffer(rrect, &buffer); buffer.write32(SkToS32(start)); buffer.padToAlign4(); SkASSERT(sizeNeeded == buffer.pos()); @@ -177,7 +177,7 @@ size_t SkPath::readAsRRect(const void* storage, size_t length) { default: return 0; } - if (!rrect.readFromBuffer(&buffer)) { + if (!SkRRectPriv::ReadFromBuffer(&buffer, &rrect)) { return 0; } if (!buffer.readS32(&start) || start != SkTPin(start, 0, 7)) { diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp index 50a87fab3c..46e83aec0f 100644 --- a/src/core/SkRRect.cpp +++ b/src/core/SkRRect.cpp @@ -501,9 +501,9 @@ size_t SkRRect::writeToMemory(void* buffer) const { return kSizeInMemory; } -void SkRRect::writeToBuffer(SkWBuffer* buffer) const { +void SkRRectPriv::WriteToBuffer(const SkRRect& rr, SkWBuffer* buffer) { // Serialize only the rect and corners, but not the derived type tag. - buffer->write(this, kSizeInMemory); + buffer->write(&rr, SkRRect::kSizeInMemory); } size_t SkRRect::readFromMemory(const void* buffer, size_t length) { @@ -517,13 +517,13 @@ size_t SkRRect::readFromMemory(const void* buffer, size_t length) { return kSizeInMemory; } -bool SkRRect::readFromBuffer(SkRBuffer* buffer) { - if (buffer->available() < kSizeInMemory) { +bool SkRRectPriv::ReadFromBuffer(SkRBuffer* buffer, SkRRect* rr) { + if (buffer->available() < SkRRect::kSizeInMemory) { return false; } SkRRect storage; - return buffer->read(&storage, kSizeInMemory) && - (this->readFromMemory(&storage, kSizeInMemory) == kSizeInMemory); + return buffer->read(&storage, SkRRect::kSizeInMemory) && + (rr->readFromMemory(&storage, SkRRect::kSizeInMemory) == SkRRect::kSizeInMemory); } #include "SkString.h" diff --git a/src/core/SkRRectPriv.h b/src/core/SkRRectPriv.h index ea277f7f33..226af247cd 100644 --- a/src/core/SkRRectPriv.h +++ b/src/core/SkRRectPriv.h @@ -10,6 +10,9 @@ #include "SkRRect.h" +class SkRBuffer; +class SkWBuffer; + class SkRRectPriv { public: static bool IsCircle(const SkRRect& rr) { @@ -30,6 +33,10 @@ public: } static bool AllCornersCircular(const SkRRect& rr, SkScalar tolerance = SK_ScalarNearlyZero); + + static bool ReadFromBuffer(SkRBuffer* buffer, SkRRect* rr); + + static void WriteToBuffer(const SkRRect& rr, SkWBuffer* buffer); }; #endif |