From: mtklein Date: Wed, 6 Aug 2014 18:57:00 +0000 (-0700) Subject: SkPicture: try to no-op away clone(). X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~6456 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ba15ae3e13a6da0a9735fcc04166ed4d3ddcd67;p=platform%2Fupstream%2FlibSkiaSharp.git SkPicture: try to no-op away clone(). Will actually enable this by #defining SK_PICTURE_CLONE_NOOP in Chrome's SkUserConfig.h as a separate CL after this rolls in. BUG=skia: R=reed@google.com, robertphillips@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/447753003 --- diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 0b7a1db..b402297 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -151,7 +151,9 @@ SkPicture::~SkPicture() { #ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE // fRecord TODO, fix by deleting this method SkPicture* SkPicture::clone() const { - +#ifdef SK_PICTURE_CLONE_NOOP + return SkRef(const_cast(this)); +#else SkAutoTDelete newData; if (fData.get()) { @@ -204,6 +206,7 @@ SkPicture* SkPicture::clone() const { clone->fUniqueID = this->uniqueID(); // need to call method to ensure != 0 return clone; +#endif } #endif//SK_SUPPORT_LEGACY_PICTURE_CLONE @@ -496,7 +499,7 @@ SkPicture::SkPicture(int width, int height, SkRecord* record) } // Note that we are assuming that this entry point will only be called from -// one thread. Currently the only client of this method is +// one thread. Currently the only client of this method is // SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single // thread. void SkPicture::addDeletionListener(DeletionListener* listener) const {