diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkDevice.cpp | 2 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 27 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.h | 9 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 2 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.h | 6 | ||||
-rw-r--r-- | src/svg/SkSVGDevice.cpp | 12 | ||||
-rw-r--r-- | src/svg/SkSVGDevice.h | 3 |
8 files changed, 16 insertions, 51 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 5a613fff2e..75d481e98f 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -48,6 +48,7 @@ SkImageInfo SkBaseDevice::imageInfo() const { return SkImageInfo::MakeUnknown(); } +#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { const SkBitmap& bitmap = this->onAccessBitmap(); if (changePixels) { @@ -55,6 +56,7 @@ const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { } return bitmap; } +#endif SkPixelGeometry SkBaseDevice::CreateInfo::AdjustGeometry(const SkImageInfo& info, TileUsage tileUsage, diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index f8033ec12f..314281c0ad 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -182,14 +182,9 @@ SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height , fContext(SkRef(drawContext->accessRenderTarget()->getContext())) , fRenderTarget(drawContext->renderTarget()) , fDrawContext(std::move(drawContext)) { + fSize.set(width, height); fOpaque = SkToBool(flags & kIsOpaque_Flag); - SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; - SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(width, height); - SkPixelRef* pr = new SkGrPixelRef(info, fRenderTarget.get()); - fLegacyBitmap.setInfo(info); - fLegacyBitmap.setPixelRef(pr)->unref(); - if (flags & kNeedClear_Flag) { this->clearAll(); } @@ -284,23 +279,11 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz } fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels, rowBytes, flags); - // need to bump our genID for compatibility with clients that "know" we have a bitmap - fLegacyBitmap.notifyPixelsChanged(); - return true; } -const SkBitmap& SkGpuDevice::onAccessBitmap() { - ASSERT_SINGLE_OWNER - return fLegacyBitmap; -} - bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) { ASSERT_SINGLE_OWNER - // For compatibility with clients the know we're backed w/ a bitmap, and want to inspect its - // genID. When we can hide/remove that fact, we can eliminate this call to notify. - // ... ugh. - fLegacyBitmap.notifyPixelsChanged(); return false; } @@ -370,14 +353,6 @@ void SkGpuDevice::replaceDrawContext(bool shouldRetainContent) { fRenderTarget = newDC->renderTarget(); -#ifdef SK_DEBUG - SkImageInfo info = fRenderTarget->surfacePriv().info(fOpaque ? kOpaque_SkAlphaType : - kPremul_SkAlphaType); - SkASSERT(info == fLegacyBitmap.info()); -#endif - SkPixelRef* pr = new SkGrPixelRef(fLegacyBitmap.info(), fRenderTarget.get()); - fLegacyBitmap.setPixelRef(pr)->unref(); - fDrawContext = newDC; } diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index 0b1e6a3cd9..d341b39ed6 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -81,7 +81,10 @@ public: GrDrawContext* accessDrawContext() override; SkImageInfo imageInfo() const override { - return fLegacyBitmap.info(); + SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; + SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(fSize.fWidth, + fSize.fHeight); + return info; } void drawPaint(const SkDraw&, const SkPaint& paint) override; @@ -141,7 +144,6 @@ public: void onAttachToCanvas(SkCanvas* canvas) override; void onDetachFromCanvas() override; - const SkBitmap& onAccessBitmap() override; bool onAccessPixels(SkPixmap*) override; // for debugging purposes only @@ -161,8 +163,7 @@ private: SkAutoTUnref<const SkClipStack> fClipStack; SkIPoint fClipOrigin; GrClipStackClip fClip; - // remove when our clients don't rely on accessBitmap() - SkBitmap fLegacyBitmap; + SkISize fSize; bool fOpaque; enum Flags { diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index fa3781476f..8d5601d01c 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -34,8 +34,6 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface, case SkSurface::kDiscardWrite_BackendHandleAccess: // for now we don't special-case on Discard, but we may in the future. surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMode); - // legacy: need to dirty the bitmap's genID in our device (curse it) - surface->getDevice()->accessBitmap(false).notifyPixelsChanged(); break; } diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index bcbff3285c..8370eabd6a 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -658,8 +658,7 @@ SkPDFDevice::SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* do , fDocument(doc) { SkASSERT(pageSize.width() > 0); SkASSERT(pageSize.height() > 0); - fLegacyBitmap.setInfo( - SkImageInfo::MakeUnknown(pageSize.width(), pageSize.height())); + if (flip) { // Skia generally uses the top left as the origin but PDF // natively has the origin at the bottom left. This matrix @@ -1402,7 +1401,8 @@ void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, } SkImageInfo SkPDFDevice::imageInfo() const { - return fLegacyBitmap.info(); + SkImageInfo info = SkImageInfo::MakeUnknown(fPageSize.width(), fPageSize.height()); + return info; } void SkPDFDevice::onAttachToCanvas(SkCanvas* canvas) { diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h index ca78663347..f8497c63ff 100644 --- a/src/pdf/SkPDFDevice.h +++ b/src/pdf/SkPDFDevice.h @@ -193,10 +193,6 @@ public: }; protected: - const SkBitmap& onAccessBitmap() override { - return fLegacyBitmap; - } - sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) override; void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData* value) override; @@ -264,8 +260,6 @@ private: SkScalar fRasterDpi; - SkBitmap fLegacyBitmap; - SkPDFDocument* fDocument; //////////////////////////////////////////////////////////////////////////// diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index f0805b5432..4330901b7e 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -572,11 +572,10 @@ SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkXMLWriter* writer) { SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer) : INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry)) , fWriter(writer) - , fResourceBucket(new ResourceBucket) { + , fResourceBucket(new ResourceBucket) + , fSize(size) { SkASSERT(writer); - fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height())); - fWriter->writeHeader(); // The root <svg> tag gets closed by the destructor. @@ -592,11 +591,8 @@ SkSVGDevice::~SkSVGDevice() { } SkImageInfo SkSVGDevice::imageInfo() const { - return fLegacyBitmap.info(); -} - -const SkBitmap& SkSVGDevice::onAccessBitmap() { - return fLegacyBitmap; + SkImageInfo info = SkImageInfo::MakeUnknown(fSize.fWidth, fSize.fHeight); + return info; } void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h index 3323471fb3..bf86e15c51 100644 --- a/src/svg/SkSVGDevice.h +++ b/src/svg/SkSVGDevice.h @@ -55,7 +55,6 @@ protected: void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) override; - const SkBitmap& onAccessBitmap() override; private: SkSVGDevice(const SkISize& size, SkXMLWriter* writer); @@ -69,7 +68,7 @@ private: SkXMLWriter* fWriter; SkAutoTDelete<AutoElement> fRootElement; SkAutoTDelete<ResourceBucket> fResourceBucket; - SkBitmap fLegacyBitmap; + SkISize fSize; typedef SkBaseDevice INHERITED; }; |