OSDN Git Service

Use bytesWritten instead of getOffset on SkDynamicMemoryWStream.
authorBen Wagner <bungeman@google.com>
Thu, 15 Dec 2016 23:06:03 +0000 (18:06 -0500)
committerBen Wagner <bungeman@google.com>
Thu, 15 Dec 2016 23:06:03 +0000 (18:06 -0500)
These two methods do the same thing and bytesWritten makes more sense
and is also a proper SkWStream override. As a result, getOffset is being
removed. This updates the calling code.

Test: refactoring CL. Existing unit tests still pass.
Change-Id: I2e2b60c1c86d07c5ab7ec6518d689e8bf700e5d2

camera/JpegStub.cpp

index 084f5fc..48a3a71 100644 (file)
@@ -48,7 +48,7 @@ extern "C" int JpegStub_compress(JpegStub* stub, const void* image,
     if (encoder->encode(stream, pY, width, height, offsets, quality)) {
         ALOGV("%s: Compressed JPEG: %d[%dx%d] -> %zu bytes",
               __FUNCTION__, (width * height * 12) / 8,
-              width, height, stream->getOffset());
+              width, height, stream->bytesWritten());
         return 0;
     } else {
         ALOGE("%s: JPEG compression failed", __FUNCTION__);
@@ -65,5 +65,5 @@ extern "C" void JpegStub_getCompressedImage(JpegStub* stub, void* buff) {
 extern "C" size_t JpegStub_getCompressedSize(JpegStub* stub) {
     SkDynamicMemoryWStream* stream =
         (SkDynamicMemoryWStream*)stub->mInternalStream;
-    return stream->getOffset();
+    return stream->bytesWritten();
 }