void SourceSurfaceD2D1::DrawTargetWillChange() { // At this point in time this should always be true here. MOZ_ASSERT(mRealizedBitmap); RefPtr<ID2D1Bitmap1> oldBitmap = mRealizedBitmap; D2D1_BITMAP_PROPERTIES1 props; props.dpiX = 96; props.dpiY = 96; props.pixelFormat = D2DPixelFormat(mFormat); props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap)); if (FAILED(hr)) { gfxCriticalError() << "Failed to create bitmap to make DrawTarget copy. Size: " << mSize << " Code: " << hexa(hr); MarkIndependent(); return; } D2D1_POINT_2U point = D2D1::Point2U(0, 0); D2D1_RECT_U rect = D2D1::RectU(0, 0, mSize.width, mSize.height); mRealizedBitmap->CopyFromBitmap(&point, oldBitmap, &rect); mImage = mRealizedBitmap; DrawTargetD2D1::mVRAMUsageSS += mSize.width * mSize.height * BytesPerPixel(mFormat); // We now no longer depend on the source surface content remaining the same. MarkIndependent(); }
void SourceSurfaceD2DTarget::DrawTargetWillChange() { RefPtr<ID3D10Texture2D> oldTexture = mTexture; D3D10_TEXTURE2D_DESC desc; mTexture->GetDesc(&desc); // Our original texture might implement the keyed mutex flag. We shouldn't // need that here. We actually specifically don't want it since we don't lock // our texture for usage! desc.MiscFlags = 0; // Get a copy of the surface data so the content at snapshot time was saved. Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture)); Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture); mBitmap = nullptr; DrawTargetD2D::mVRAMUsageSS += desc.Width * desc.Height * BytesPerPixel(mFormat); mOwnsCopy = true; // We now no longer depend on the source surface content remaining the same. MarkIndependent(); }
void SourceSurfaceD2DTarget::DrawTargetWillChange() { RefPtr<ID3D10Texture2D> oldTexture = mTexture; D3D10_TEXTURE2D_DESC desc; mTexture->GetDesc(&desc); // Get a copy of the surface data so the content at snapshot time was saved. Factory::GetDirect3D10Device()->CreateTexture2D(&desc, NULL, byRef(mTexture)); Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture); mBitmap = NULL; // We now no longer depend on the source surface content remaining the same. MarkIndependent(); }
void SourceSurfaceD2DTarget::DrawTargetWillChange() { RefPtr<ID3D10Texture2D> oldTexture = mTexture; D3D10_TEXTURE2D_DESC desc; mTexture->GetDesc(&desc); // Get a copy of the surface data so the content at snapshot time was saved. Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture)); Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture); mBitmap = nullptr; DrawTargetD2D::mVRAMUsageSS += desc.Width * desc.Height * BytesPerPixel(mFormat); mOwnsCopy = true; // We now no longer depend on the source surface content remaining the same. MarkIndependent(); }
SourceSurfaceCairo::~SourceSurfaceCairo() { MarkIndependent(); cairo_surface_destroy(mSurface); }
SourceSurfaceSkia::~SourceSurfaceSkia() { MaybeUnlock(); MarkIndependent(); }
SourceSurfaceSkia::~SourceSurfaceSkia() { MarkIndependent(); }