Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 50523004: Little changes to SkAnnotation in pipe: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 57d4a0fdc345ee57263420a44fb08ae19e7d6783..0b8819a80d45d8db5016563eb6914229cfda6ee4 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -1128,18 +1128,17 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) {
if (base.getAnnotation() != paint.getAnnotation()) {
if (NULL == paint.getAnnotation()) {
- this->writeOp(kSetAnnotation_DrawOp, 0, 0);
+ if (this->needOpBytes()) {
+ this->writeOp(kSetAnnotation_DrawOp, 0, 0);
+ }
} else {
SkOrderedWriteBuffer buffer(1024);
paint.getAnnotation()->writeToBuffer(buffer);
- size = buffer.bytesWritten();
-
- SkAutoMalloc storage(size);
- buffer.writeToMemory(storage.get());
-
- this->writeOp(kSetAnnotation_DrawOp, 0, 1);
- fWriter.write32(size);
- fWriter.write(storage.get(), size);
+ const size_t size = buffer.bytesWritten();
+ if (this->needOpBytes(size)) {
+ this->writeOp(kSetAnnotation_DrawOp, 0, size);
+ buffer.writeToMemory(fWriter.reserve(size));
+ }
}
}
}
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698