Loading cmds/screencap/screencap.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ int main(int argc, char** argv) if (png) { const SkImageInfo info = SkImageInfo::Make(w, h, flinger2skia(f), kPremul_SkAlphaType); SkAutoTUnref<SkData> data(SkImageEncoder::EncodeData(info, base, s*bytesPerPixel(f), sk_sp<SkData> data(SkImageEncoder::EncodeData(info, base, s*bytesPerPixel(f), SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality)); if (data.get()) { write(fd, data->data(), data->size()); Loading core/jni/android/graphics/BitmapFactory.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -365,7 +365,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding SkColorType decodeColorType = codec->computeOutputColorType(prefColorType); // Construct a color table for the decode if necessary SkAutoTUnref<SkColorTable> colorTable(nullptr); sk_sp<SkColorTable> colorTable(nullptr); SkPMColor* colorPtr = nullptr; int* colorCount = nullptr; int maxColors = 256; Loading Loading @@ -399,7 +399,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding } SkBitmap decodingBitmap; if (!decodingBitmap.setInfo(bitmapInfo) || !decodingBitmap.tryAllocPixels(decodeAllocator, colorTable)) { !decodingBitmap.tryAllocPixels(decodeAllocator, colorTable.get())) { // SkAndroidCodec should recommend a valid SkImageInfo, so setInfo() // should only only fail if the calculated value for rowBytes is too // large. Loading core/jni/android/graphics/BitmapRegionDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -39,18 +39,20 @@ #include <jni.h> #include <sys/stat.h> #include <memory> using namespace android; static jobject createBitmapRegionDecoder(JNIEnv* env, std::unique_ptr<SkStreamRewindable> stream) { SkAutoTDelete<SkBitmapRegionDecoder> brd( std::unique_ptr<SkBitmapRegionDecoder> brd( SkBitmapRegionDecoder::Create(stream.release(), SkBitmapRegionDecoder::kAndroidCodec_Strategy)); if (NULL == brd) { if (!brd) { doThrowIOE(env, "Image format not supported"); return nullObjectReturn("CreateBitmapRegionDecoder returned null"); } return GraphicsJNI::createBitmapRegionDecoder(env, brd.detach()); return GraphicsJNI::createBitmapRegionDecoder(env, brd.release()); } static jobject nativeNewInstanceFromByteArray(JNIEnv* env, jobject, jbyteArray byteArray, Loading core/jni/android/graphics/FontFamily.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ static jboolean FontFamily_addFont(JNIEnv* env, jobject clazz, jlong familyPtr, SkFontMgr::FontParameters params; params.setCollectionIndex(ttcIndex); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), params)); if (face == NULL) { ALOGE("addFont failed to create font"); Loading Loading @@ -172,7 +172,7 @@ static jboolean FontFamily_addFontWeightStyle(JNIEnv* env, jobject clazz, jlong params.setCollectionIndex(ttcIndex); params.setAxes(skiaAxes.get(), skiaAxesLength); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), params)); if (face == NULL) { ALOGE("addFont failed to create font, invalid request"); Loading Loading @@ -216,7 +216,7 @@ static jboolean FontFamily_addFontFromAsset(JNIEnv* env, jobject, jlong familyPt sk_sp<SkData> data(SkData::MakeWithProc(buf, asset->getLength(), releaseAsset, asset)); std::unique_ptr<SkStreamAsset> fontData(new SkMemoryStream(std::move(data))); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), SkFontMgr::FontParameters())); if (face == NULL) { ALOGE("addFontFromAsset failed to create font %s", str.c_str()); Loading core/jni/android/graphics/Shader.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, j // The current shader will no longer need a direct reference owned by Shader.java // as all the data needed is contained within the newly created LocalMatrixShader. SkASSERT(shaderHandle); SkAutoTUnref<SkShader> currentShader(reinterpret_cast<SkShader*>(shaderHandle)); sk_sp<SkShader> currentShader(reinterpret_cast<SkShader*>(shaderHandle)); // Attempt to peel off an existing proxy shader and get the proxy's matrix. If // the proxy existed and it's matrix equals the desired matrix then just return Loading @@ -74,10 +74,10 @@ static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, j // API enforces that all local matrices are set using this call and // not passed to the constructor of the Shader. SkMatrix proxyMatrix; SkAutoTUnref<SkShader> baseShader(currentShader->refAsALocalMatrixShader(&proxyMatrix)); sk_sp<SkShader> baseShader = currentShader->makeAsALocalMatrixShader(&proxyMatrix); if (baseShader.get()) { if (proxyMatrix == *matrix) { return reinterpret_cast<jlong>(currentShader.detach()); return reinterpret_cast<jlong>(currentShader.release()); } return reinterpret_cast<jlong>(baseShader->makeWithLocalMatrix(*matrix).release()); } Loading Loading
cmds/screencap/screencap.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ int main(int argc, char** argv) if (png) { const SkImageInfo info = SkImageInfo::Make(w, h, flinger2skia(f), kPremul_SkAlphaType); SkAutoTUnref<SkData> data(SkImageEncoder::EncodeData(info, base, s*bytesPerPixel(f), sk_sp<SkData> data(SkImageEncoder::EncodeData(info, base, s*bytesPerPixel(f), SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality)); if (data.get()) { write(fd, data->data(), data->size()); Loading
core/jni/android/graphics/BitmapFactory.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -365,7 +365,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding SkColorType decodeColorType = codec->computeOutputColorType(prefColorType); // Construct a color table for the decode if necessary SkAutoTUnref<SkColorTable> colorTable(nullptr); sk_sp<SkColorTable> colorTable(nullptr); SkPMColor* colorPtr = nullptr; int* colorCount = nullptr; int maxColors = 256; Loading Loading @@ -399,7 +399,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding } SkBitmap decodingBitmap; if (!decodingBitmap.setInfo(bitmapInfo) || !decodingBitmap.tryAllocPixels(decodeAllocator, colorTable)) { !decodingBitmap.tryAllocPixels(decodeAllocator, colorTable.get())) { // SkAndroidCodec should recommend a valid SkImageInfo, so setInfo() // should only only fail if the calculated value for rowBytes is too // large. Loading
core/jni/android/graphics/BitmapRegionDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -39,18 +39,20 @@ #include <jni.h> #include <sys/stat.h> #include <memory> using namespace android; static jobject createBitmapRegionDecoder(JNIEnv* env, std::unique_ptr<SkStreamRewindable> stream) { SkAutoTDelete<SkBitmapRegionDecoder> brd( std::unique_ptr<SkBitmapRegionDecoder> brd( SkBitmapRegionDecoder::Create(stream.release(), SkBitmapRegionDecoder::kAndroidCodec_Strategy)); if (NULL == brd) { if (!brd) { doThrowIOE(env, "Image format not supported"); return nullObjectReturn("CreateBitmapRegionDecoder returned null"); } return GraphicsJNI::createBitmapRegionDecoder(env, brd.detach()); return GraphicsJNI::createBitmapRegionDecoder(env, brd.release()); } static jobject nativeNewInstanceFromByteArray(JNIEnv* env, jobject, jbyteArray byteArray, Loading
core/jni/android/graphics/FontFamily.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ static jboolean FontFamily_addFont(JNIEnv* env, jobject clazz, jlong familyPtr, SkFontMgr::FontParameters params; params.setCollectionIndex(ttcIndex); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), params)); if (face == NULL) { ALOGE("addFont failed to create font"); Loading Loading @@ -172,7 +172,7 @@ static jboolean FontFamily_addFontWeightStyle(JNIEnv* env, jobject clazz, jlong params.setCollectionIndex(ttcIndex); params.setAxes(skiaAxes.get(), skiaAxesLength); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), params)); if (face == NULL) { ALOGE("addFont failed to create font, invalid request"); Loading Loading @@ -216,7 +216,7 @@ static jboolean FontFamily_addFontFromAsset(JNIEnv* env, jobject, jlong familyPt sk_sp<SkData> data(SkData::MakeWithProc(buf, asset->getLength(), releaseAsset, asset)); std::unique_ptr<SkStreamAsset> fontData(new SkMemoryStream(std::move(data))); SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); sk_sp<SkTypeface> face(fm->createFromStream(fontData.release(), SkFontMgr::FontParameters())); if (face == NULL) { ALOGE("addFontFromAsset failed to create font %s", str.c_str()); Loading
core/jni/android/graphics/Shader.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, j // The current shader will no longer need a direct reference owned by Shader.java // as all the data needed is contained within the newly created LocalMatrixShader. SkASSERT(shaderHandle); SkAutoTUnref<SkShader> currentShader(reinterpret_cast<SkShader*>(shaderHandle)); sk_sp<SkShader> currentShader(reinterpret_cast<SkShader*>(shaderHandle)); // Attempt to peel off an existing proxy shader and get the proxy's matrix. If // the proxy existed and it's matrix equals the desired matrix then just return Loading @@ -74,10 +74,10 @@ static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, j // API enforces that all local matrices are set using this call and // not passed to the constructor of the Shader. SkMatrix proxyMatrix; SkAutoTUnref<SkShader> baseShader(currentShader->refAsALocalMatrixShader(&proxyMatrix)); sk_sp<SkShader> baseShader = currentShader->makeAsALocalMatrixShader(&proxyMatrix); if (baseShader.get()) { if (proxyMatrix == *matrix) { return reinterpret_cast<jlong>(currentShader.detach()); return reinterpret_cast<jlong>(currentShader.release()); } return reinterpret_cast<jlong>(baseShader->makeWithLocalMatrix(*matrix).release()); } Loading