Chromium Code Reviews

Unified Diff: include/gpu/GrTypesPriv.h

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Centralize ugly cast. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: include/gpu/GrTypesPriv.h
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 6a6fd54c7ba5488b2bbfd19eb7c9a3350fe93a41..8c7d6bda65150b6cd055a235f136077f4897c008 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -10,6 +10,7 @@
#include "GrTypes.h"
#include "SkRect.h"
+#include "SkRefCnt.h"
/**
* Types of shader-language-specific boxed variables we can create. (Currently only GrGLShaderVars,
@@ -476,4 +477,9 @@ enum class GrBackendObjectOwnership : bool {
kOwned = true
};
+template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> const * sp) {
+ static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size.");
+ return reinterpret_cast<T * const *>(sp);
+}
+
#endif

Powered by Google App Engine