Comments clean up for C++ API
Change-Id: I7ced3653a32fa8eaa62cd218002d22f5551c404a
diff --git a/cpp/Allocation.cpp b/cpp/Allocation.cpp
index fcba9e9..7d3a541 100644
--- a/cpp/Allocation.cpp
+++ b/cpp/Allocation.cpp
@@ -143,7 +143,6 @@
const void *typeID = RS::dispatch->AllocationGetType(mRS->getContext(), getID());
if(typeID != nullptr) {
- sp<const Type> old = mType;
sp<Type> t = new Type((void *)typeID, mRS);
t->updateFromNative();
updateCacheInfo(t);
diff --git a/cpp/BaseObj.cpp b/cpp/BaseObj.cpp
index e32d0a6..c1a3e55 100644
--- a/cpp/BaseObj.cpp
+++ b/cpp/BaseObj.cpp
@@ -58,7 +58,7 @@
}
bool BaseObj::equals(sp<const BaseObj> obj) {
- // Early-out check to see if both BaseObjs are actually the same
+ // Early-out check to see if both BaseObjs are actually the same.
if (this == obj.get())
return true;
return mID == obj->mID;
diff --git a/cpp/Element.cpp b/cpp/Element.cpp
index 402306e..e7461b6 100644
--- a/cpp/Element.cpp
+++ b/cpp/Element.cpp
@@ -156,14 +156,14 @@
int noPaddingFieldCount = 0;
size_t fieldCount = mElementsCount;
- // Find out how many elements are not padding
+ // Find out how many elements are not padding.
for (size_t ct = 0; ct < fieldCount; ct ++) {
if (mElementNames[ct][0] != '#') {
noPaddingFieldCount ++;
}
}
- // Make a map that points us at non-padding elements
+ // Make a map that points us at non-padding elements.
size_t i = 0;
for (size_t ct = 0; ct < fieldCount; ct ++) {
if (mElementNames[ct][0] != '#') {
@@ -194,7 +194,7 @@
memcpy(mElements, elements, mElementsCount * sizeof(android::RSC::sp<Element>));
memcpy(mArraySizes, arraySizes, mElementsCount * sizeof(uint32_t));
- //copy strings (char array)
+ // Copy strings (char array).
memcpy(mElementNameLengths, elementNameLengths, mElementsCount * sizeof(size_t));
for (size_t ct = 0; ct < mElementsCount; ct++ ) {
size_t elemNameLen = mElementNameLengths[ct];
@@ -392,10 +392,12 @@
return true;
}
- // Ignore mKind because it is allowed to be different (user vs. pixel).
- // We also ignore mNormalized because it can be different. The mType
- // field must be non-null since we require name equivalence for
- // user-created Elements.
+ /*
+ * Ignore mKind because it is allowed to be different (user vs. pixel).
+ * We also ignore mNormalized because it can be different. The mType
+ * field must be non-null since we require name equivalence for
+ * user-created Elements.
+ */
return ((mSizeBytes == e->mSizeBytes) &&
(mType != RS_TYPE_NONE) &&
(mType == e->mType) &&
@@ -407,7 +409,7 @@
mSkipPadding = false;
mElementsVecSize = 8;
mElementsCount = 0;
- // Initialize space
+ // Initialize space.
mElements = (android::RSC::sp<const Element> *)calloc(mElementsVecSize, sizeof(android::RSC::sp<Element>));
mElementNames = (char **)calloc(mElementsVecSize, sizeof(char *));
mElementNameLengths = (size_t*)calloc(mElementsVecSize, sizeof(size_t));
@@ -415,7 +417,7 @@
}
Element::Builder::~Builder() {
- // free allocated space
+ // Free allocated space.
free(mElements);
for (size_t ct = 0; ct < mElementsCount; ct++ ) {
free(mElementNames[ct]);
@@ -446,7 +448,7 @@
}
if (mElementsCount >= mElementsVecSize) {
- //if pre-allocated space is full, allocate a larger one.
+ // If pre-allocated space is full, allocate a larger one.
mElementsVecSize += 8;
android::RSC::sp<const Element> * newElements = (android::RSC::sp<const Element> *)calloc(mElementsVecSize, sizeof(android::RSC::sp<Element>));
@@ -459,7 +461,7 @@
memcpy(newElementNameLengths, mElementNameLengths, mElementsCount * sizeof(size_t));
memcpy(newArraySizes, mArraySizes, mElementsCount * sizeof(uint32_t));
- //free the old arrays
+ // Free the old arrays.
free(mElements);
free(mElementNames);
free(mArraySizes);
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index 73a9a56..e0be0a6 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -79,8 +79,8 @@
return RS::init(name, RS_VERSION, flags);
}
-// this will only open API 19+ libRS
-// because that's when we changed libRS to extern "C" entry points
+// This will only open API 19+ libRS, because that's when
+// we changed libRS to extern "C" entry points.
static bool loadSO(const char* filename, int targetApi) {
void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
if (handle == nullptr) {
@@ -92,7 +92,6 @@
ALOGV("%s init failed!", filename);
return false;
}
- //ALOGE("Successfully loaded %s", filename);
return true;
}
@@ -117,8 +116,8 @@
RS::dispatch = new dispatchTable;
- // attempt to load libRS, load libRSSupport on failure
- // if property is set, proceed directly to libRSSupport
+ // Attempt to load libRS, load libRSSupport on failure.
+ // If property is set, proceed directly to libRSSupport.
if (getProp("debug.rs.forcecompat") == 0) {
usingNative = loadSO("libRS.so", targetApi);
}
@@ -156,7 +155,8 @@
return false;
}
memcpy(mCacheDir, name, nameLen);
- mCacheDir[nameLen] = 0; //add the null character even if the user does not.
+ // Add the null character even if the user does not.
+ mCacheDir[nameLen] = 0;
mCacheDirLen = nameLen + 1;
mDev = RS::dispatch->DeviceCreate();
@@ -247,10 +247,12 @@
case RS_MESSAGE_TO_CLIENT_NONE:
case RS_MESSAGE_TO_CLIENT_EXCEPTION:
case RS_MESSAGE_TO_CLIENT_RESIZE:
- // teardown. But we want to avoid starving other threads during
- // teardown by yielding until the next line in the destructor can
- // execute to set mRun = false. Note that the FIFO sends an
- // empty NONE message when it reaches its destructor.
+ /*
+ * Teardown. We want to avoid starving other threads during
+ * teardown by yielding until the next line in the destructor can
+ * execute to set mRun = false. Note that the FIFO sends an
+ * empty NONE message when it reaches its destructor.
+ */
usleep(1000);
break;
case RS_MESSAGE_TO_CLIENT_USER:
diff --git a/cpp/Sampler.cpp b/cpp/Sampler.cpp
index 1216efd..e2e8fac 100644
--- a/cpp/Sampler.cpp
+++ b/cpp/Sampler.cpp
@@ -63,7 +63,7 @@
sp<Sampler> Sampler::create(sp<RS> rs, RsSamplerValue min, RsSamplerValue mag,
RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy) {
- // we aren't supporting wrapR in C++ API atm, so always pass wrap for that
+ // We aren't supporting wrapR in C++ API atm, so always pass wrap for that.
void* id = RS::dispatch->SamplerCreate(rs->getContext(), min, mag, wrapS, wrapT,
RS_SAMPLER_WRAP, anisotropy);
return new Sampler(rs, id, min, mag, wrapS, wrapT, anisotropy);
diff --git a/cpp/ScriptIntrinsics.cpp b/cpp/ScriptIntrinsics.cpp
index 54ce465..0a2df33 100644
--- a/cpp/ScriptIntrinsics.cpp
+++ b/cpp/ScriptIntrinsics.cpp
@@ -175,7 +175,6 @@
Script::forEach(11, in, out, nullptr, 0);
}
-// Numbering jumps here
void ScriptIntrinsicBlend::forEachMultiply(sp<Allocation> in, sp<Allocation> out) {
if (in->getType()->getElement()->isCompatible(mElement) == false ||
out->getType()->getElement()->isCompatible(mElement) == false) {
@@ -184,7 +183,6 @@
Script::forEach(14, in, out, nullptr, 0);
}
-// Numbering jumps here
void ScriptIntrinsicBlend::forEachAdd(sp<Allocation> in, sp<Allocation> out) {
if (in->getType()->getElement()->isCompatible(mElement) == false ||
out->getType()->getElement()->isCompatible(mElement) == false) {
diff --git a/cpp/Type.cpp b/cpp/Type.cpp
index 2910170..6e9a759 100644
--- a/cpp/Type.cpp
+++ b/cpp/Type.cpp
@@ -20,10 +20,10 @@
#include "RenderScript.h"
#include "rsCppInternal.h"
-// from system/graphics.h
+// From system/graphics.h
enum {
- HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
- HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
+ HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
+ HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
};
using namespace android;
diff --git a/cpp/rsDispatch.cpp b/cpp/rsDispatch.cpp
index 39c1396..fd09c87 100644
--- a/cpp/rsDispatch.cpp
+++ b/cpp/rsDispatch.cpp
@@ -24,8 +24,8 @@
#define REDUCE_API_LEVEL INT_MAX
bool loadSymbols(void* handle, dispatchTable& dispatchTab, int device_api) {
- //fucntion to set the native lib path for 64bit compat lib.
#ifdef __LP64__
+ // Function to set the native lib path for 64bit compat lib.
dispatchTab.SetNativeLibDir = (SetNativeLibDirFnPtr)dlsym(handle, "rsaContextSetNativeLibDir");
if (dispatchTab.SetNativeLibDir == NULL) {
LOG_API("Couldn't initialize dispatchTab.SetNativeLibDir");
@@ -367,7 +367,7 @@
}
// API_23 functions
if (device_api >= 23) {
- //ScriptGroup V2 functions
+ // ScriptGroup V2 functions
dispatchTab.ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate");
if (dispatchTab.ScriptInvokeIDCreate == NULL) {
LOG_API("Couldn't initialize dispatchTab.ScriptInvokeIDCreate");
diff --git a/cpp/rsDispatch.h b/cpp/rsDispatch.h
index a401754..5c449f2 100644
--- a/cpp/rsDispatch.h
+++ b/cpp/rsDispatch.h
@@ -103,7 +103,7 @@
struct dispatchTable {
SetNativeLibDirFnPtr SetNativeLibDir;
- // inserted by hand from rs.h
+ // Inserted by hand from rs.h
AllocationGetTypeFnPtr AllocationGetType;
TypeGetNativeDataFnPtr TypeGetNativeData;
ElementGetNativeDataFnPtr ElementGetNativeData;
@@ -189,10 +189,10 @@
bool loadSymbols(void* handle, dispatchTable& dispatchTab, int device_api = 0);
-//USAGE_IO for RS Support lib
+// USAGE_IO for RS Support lib
typedef void (*sAllocationSetSurfaceFnPtr) (JNIEnv *, jobject, RsContext, RsAllocation, RsNativeWindow, dispatchTable);
struct ioSuppDT {
- //USAGE_IO_OUTPUT
+ // USAGE_IO_OUTPUT
sAllocationSetSurfaceFnPtr sAllocationSetSurface;
};