aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-04-12 12:57:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-12 17:46:17 +0000
commit4ccd862d2940c47e7815c1309814e3de1c791e84 (patch)
tree505c83228e8a34843f54283f44c21e447661ae01 /src
parent6d2cf4726c0aa63c7ca5f17dba0b93d3534d9cb6 (diff)
android-only api to reset the fields of a pixelref
BUG=skia:6494 Change-Id: I97c8a93849a13f0c5fd57c8a150ecc2ce363d8f3 Reviewed-on: https://skia-review.googlesource.com/13250 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPixelRef.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 942f127ed3..1b14e260b5 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -106,6 +106,23 @@ SkPixelRef::~SkPixelRef() {
this->callGenIDChangeListeners();
}
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+// This is undefined if there are clients in-flight trying to use us
+void SkPixelRef::android_only_reset(const SkImageInfo& info, size_t rowBytes,
+ sk_sp<SkColorTable> ctable) {
+ validate_pixels_ctable(info, ctable.get());
+
+ *const_cast<SkImageInfo*>(&fInfo) = info;
+ fCTable = std::move(ctable);
+ // note: we do not change fRec.fPixels
+ fRec.fRowBytes = rowBytes;
+ fRec.fColorTable = fCTable.get();
+
+ // conservative, since its possible the "new" settings are the same as the old.
+ this->notifyPixelsChanged();
+}
+#endif
+
void SkPixelRef::needsNewGenID() {
fTaggedGenID.store(0);
SkASSERT(!this->genIDIsUnique()); // This method isn't threadsafe, so the assert should be fine.