Loading libs/hwui/AutoBackendTextureRelease.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "AutoBackendTextureRelease.h" #include <SkImage.h> #include <include/gpu/ganesh/SkImageGanesh.h> #include "renderthread/RenderThread.h" #include "utils/Color.h" #include "utils/PaintUtils.h" Loading Loading @@ -83,10 +85,10 @@ void AutoBackendTextureRelease::makeImage(AHardwareBuffer* buffer, AHardwareBuffer_describe(buffer, &desc); SkColorType colorType = GrAHardwareBufferUtils::GetSkColorTypeFromBufferFormat(desc.format); // The following ref will be counteracted by Skia calling releaseProc, either during // MakeFromTexture if there is a failure, or later when SkImage is discarded. It must // be called before MakeFromTexture, otherwise Skia may remove HWUI's ref on failure. // BorrowTextureFrom if there is a failure, or later when SkImage is discarded. It must // be called before BorrowTextureFrom, otherwise Skia may remove HWUI's ref on failure. ref(); mImage = SkImage::MakeFromTexture( mImage = SkImages::BorrowTextureFrom( context, mBackendTexture, kTopLeft_GrSurfaceOrigin, colorType, kPremul_SkAlphaType, uirenderer::DataSpaceToColorSpace(dataspace), releaseProc, this); } Loading libs/hwui/HardwareBitmapUploader.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <SkBitmap.h> #include <SkCanvas.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageInfo.h> #include <SkRefCnt.h> #include <gui/TraceUtils.h> Loading Loading @@ -262,7 +263,8 @@ private: } sk_sp<SkImage> image = SkImage::MakeFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); SkImages::TextureFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); mGrContext->submit(true); uploadSucceeded = (image.get() != nullptr); Loading libs/hwui/Readback.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <SkCanvas.h> #include <SkColorSpace.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageInfo.h> #include <SkMatrix.h> #include <SkPaint.h> Loading Loading @@ -108,7 +109,8 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<Copy sk_sp<SkColorSpace> colorSpace = DataSpaceToColorSpace(static_cast<android_dataspace>(dataspace)); sk_sp<SkImage> image = SkImage::MakeFromAHardwareBuffer(sourceBuffer.get(), kPremul_SkAlphaType, colorSpace); SkImages::DeferredFromAHardwareBuffer(sourceBuffer.get(), kPremul_SkAlphaType, colorSpace); if (!image.get()) { return request->onCopyFinished(CopyResult::UnknownError); Loading libs/hwui/hwui/Bitmap.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ #include <SkColor.h> #include <SkEncodedImageFormat.h> #include <SkHighContrastFilter.h> #include <SkImageEncoder.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageEncoder.h> #include <SkImagePriv.h> #include <SkJpegGainmapEncoder.h> #include <SkPixmap.h> Loading Loading @@ -264,7 +265,8 @@ Bitmap::Bitmap(AHardwareBuffer* buffer, const SkImageInfo& info, size_t rowBytes mPixelStorage.hardware.buffer = buffer; AHardwareBuffer_acquire(buffer); setImmutable(); // HW bitmaps are always immutable mImage = SkImage::MakeFromAHardwareBuffer(buffer, mInfo.alphaType(), mInfo.refColorSpace()); mImage = SkImages::DeferredFromAHardwareBuffer(buffer, mInfo.alphaType(), mInfo.refColorSpace()); } #endif Loading Loading @@ -373,7 +375,7 @@ sk_sp<SkImage> Bitmap::makeImage() { // TODO: refactor Bitmap to not derive from SkPixelRef, which would allow caching here. #ifdef __ANDROID__ // pinnable images are only supported with the Ganesh GPU backend compiled in. image = sk_image_factory::MakePinnableFromRasterBitmap(skiaBitmap); image = SkImages::PinnableRasterFromBitmap(skiaBitmap); #else image = SkMakeImageFromRasterBitmap(skiaBitmap, kNever_SkCopyPixelsMode); #endif Loading libs/hwui/jni/android_graphics_HardwareRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ public: // actually cross thread boundaries here, make a copy so it's immutable proper if (bitmap && !bitmap->isImmutable()) { ATRACE_NAME("Copying mutable bitmap"); return SkImage::MakeFromBitmap(*bitmap); return SkImages::RasterFromBitmap(*bitmap); } if (img->isTextureBacked()) { ATRACE_NAME("Readback of texture image"); Loading @@ -493,7 +493,7 @@ public: return sk_ref_sp(img); } bm.setImmutable(); return sk_image_factory::MakePinnableFromRasterBitmap(bm); return SkImages::PinnableRasterFromBitmap(bm); } return sk_ref_sp(img); } Loading Loading
libs/hwui/AutoBackendTextureRelease.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "AutoBackendTextureRelease.h" #include <SkImage.h> #include <include/gpu/ganesh/SkImageGanesh.h> #include "renderthread/RenderThread.h" #include "utils/Color.h" #include "utils/PaintUtils.h" Loading Loading @@ -83,10 +85,10 @@ void AutoBackendTextureRelease::makeImage(AHardwareBuffer* buffer, AHardwareBuffer_describe(buffer, &desc); SkColorType colorType = GrAHardwareBufferUtils::GetSkColorTypeFromBufferFormat(desc.format); // The following ref will be counteracted by Skia calling releaseProc, either during // MakeFromTexture if there is a failure, or later when SkImage is discarded. It must // be called before MakeFromTexture, otherwise Skia may remove HWUI's ref on failure. // BorrowTextureFrom if there is a failure, or later when SkImage is discarded. It must // be called before BorrowTextureFrom, otherwise Skia may remove HWUI's ref on failure. ref(); mImage = SkImage::MakeFromTexture( mImage = SkImages::BorrowTextureFrom( context, mBackendTexture, kTopLeft_GrSurfaceOrigin, colorType, kPremul_SkAlphaType, uirenderer::DataSpaceToColorSpace(dataspace), releaseProc, this); } Loading
libs/hwui/HardwareBitmapUploader.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <SkBitmap.h> #include <SkCanvas.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageInfo.h> #include <SkRefCnt.h> #include <gui/TraceUtils.h> Loading Loading @@ -262,7 +263,8 @@ private: } sk_sp<SkImage> image = SkImage::MakeFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); SkImages::TextureFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); mGrContext->submit(true); uploadSucceeded = (image.get() != nullptr); Loading
libs/hwui/Readback.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <SkCanvas.h> #include <SkColorSpace.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageInfo.h> #include <SkMatrix.h> #include <SkPaint.h> Loading Loading @@ -108,7 +109,8 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<Copy sk_sp<SkColorSpace> colorSpace = DataSpaceToColorSpace(static_cast<android_dataspace>(dataspace)); sk_sp<SkImage> image = SkImage::MakeFromAHardwareBuffer(sourceBuffer.get(), kPremul_SkAlphaType, colorSpace); SkImages::DeferredFromAHardwareBuffer(sourceBuffer.get(), kPremul_SkAlphaType, colorSpace); if (!image.get()) { return request->onCopyFinished(CopyResult::UnknownError); Loading
libs/hwui/hwui/Bitmap.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ #include <SkColor.h> #include <SkEncodedImageFormat.h> #include <SkHighContrastFilter.h> #include <SkImageEncoder.h> #include <SkImage.h> #include <SkImageAndroid.h> #include <SkImageEncoder.h> #include <SkImagePriv.h> #include <SkJpegGainmapEncoder.h> #include <SkPixmap.h> Loading Loading @@ -264,7 +265,8 @@ Bitmap::Bitmap(AHardwareBuffer* buffer, const SkImageInfo& info, size_t rowBytes mPixelStorage.hardware.buffer = buffer; AHardwareBuffer_acquire(buffer); setImmutable(); // HW bitmaps are always immutable mImage = SkImage::MakeFromAHardwareBuffer(buffer, mInfo.alphaType(), mInfo.refColorSpace()); mImage = SkImages::DeferredFromAHardwareBuffer(buffer, mInfo.alphaType(), mInfo.refColorSpace()); } #endif Loading Loading @@ -373,7 +375,7 @@ sk_sp<SkImage> Bitmap::makeImage() { // TODO: refactor Bitmap to not derive from SkPixelRef, which would allow caching here. #ifdef __ANDROID__ // pinnable images are only supported with the Ganesh GPU backend compiled in. image = sk_image_factory::MakePinnableFromRasterBitmap(skiaBitmap); image = SkImages::PinnableRasterFromBitmap(skiaBitmap); #else image = SkMakeImageFromRasterBitmap(skiaBitmap, kNever_SkCopyPixelsMode); #endif Loading
libs/hwui/jni/android_graphics_HardwareRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ public: // actually cross thread boundaries here, make a copy so it's immutable proper if (bitmap && !bitmap->isImmutable()) { ATRACE_NAME("Copying mutable bitmap"); return SkImage::MakeFromBitmap(*bitmap); return SkImages::RasterFromBitmap(*bitmap); } if (img->isTextureBacked()) { ATRACE_NAME("Readback of texture image"); Loading @@ -493,7 +493,7 @@ public: return sk_ref_sp(img); } bm.setImmutable(); return sk_image_factory::MakePinnableFromRasterBitmap(bm); return SkImages::PinnableRasterFromBitmap(bm); } return sk_ref_sp(img); } Loading