Skip to content
Permalink
Browse files

Fixed shareable bitmap to actually share bbitmap

  • Loading branch information...
RAJAGOPALAN-GANGADHARAN authored and pulkomandy committed Jul 24, 2019
1 parent fa4cd2a commit a1084355da9276ae72073673471fa0930fde40b6
@@ -40,6 +40,7 @@ namespace WebKit {

static inline RefPtr<StillImage> createSurfaceFromBitmap(BitmapRef* bitmap)
{

RefPtr<StillImage> image = StillImage::create(bitmap);
return image;
}
@@ -55,23 +56,26 @@ BitmapRef* ShareableBitmap::bitmapObject() const
std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
RefPtr<StillImage> image = createBitmapSurface();

BView* surface = new BView(image->nativeImageForCurrentFrame(nullptr)->Bounds(),
"Shareable", 0, 0);
image->nativeImageForCurrentFrame(nullptr)->AddChild(surface);
surface->LockLooper();

return std::make_unique<GraphicsContext>(surface);
}

void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
RefPtr<StillImage> bitmapImage = createBitmapSurface();
BitmapRef* bitmap = new BitmapRef(BRect(B_ORIGIN,m_size),B_RGBA32,true);
status_t result = bitmap->ImportBits(data(),m_size.width()*m_size.height()*4, 4*m_size.width(),0,B_RGBA32);

BView* viewSurface = context.platformContext();

viewSurface->LockLooper();
viewSurface->SetHighColor(255,0,0,255);
viewSurface->FillRect(BRect(10,10,40,40));
//viewSurface->DrawBitmap(bitmapImage->nativeImageForCurrentFrame(nullptr).get(),BPoint(dstPoint));
viewSurface->UnlockLooper();
viewSurface->DrawBitmap(bitmap);
viewSurface->Sync();
viewSurface->UnlockLooper();
}

void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
@@ -134,7 +134,7 @@ void BWebView::stop()
WKPageClose(page);
}
void BWebView::didCommitNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo)
{
{fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
BView* view = ((BWebView*)clientInfo)->getRenderView();
view->LockLooper();
view->Invalidate();
@@ -152,27 +152,27 @@ void BWebView::didReceiveServerRedirectForProvisionalNavigation(WKPageRef page,
}
void BWebView::didFinishDocumentLoad(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo)
{

fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
}
void BWebView::didFinishNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData,const void* clientInfo)
{
{fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
BLooper* looper = ((BWebView*)clientInfo)->getAppLooper();
BMessage message(DID_FINISH_NAVIGATION);
looper->PostMessage(&message);
}

void BWebView::didFailNavigation(WKPageRef page, WKNavigationRef navigation,WKErrorRef, WKTypeRef userData,const void* clientInfo)
{

fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
}

void BWebView::didFinishProgress(WKPageRef page,const void* clientInfo)
{

fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
}

double BWebView::didChangeProgress()
{
{fprintf(stderr,"\n %s \n",__PRETTY_FUNCTION__);
auto page = WKViewGetPage(fViewPort.get());
return WKPageGetEstimatedProgress(page);
}
@@ -46,7 +46,7 @@ void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo&
m_bitmap->AddChild(m_surface);

}

IntPoint updateRectLocation = updateInfo.updateRectBounds.location();

GraphicsContext graphicsContext(m_surface);
@@ -57,11 +57,12 @@ void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo&
srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
bitmap->paint(graphicsContext,updateRect.location(),srcRect);
}

}

void BackingStore::paint(BView* context,const IntRect& rect)
{
context->DrawBitmap(m_bitmap,BRect(rect),BRect(rect));
context->DrawBitmap(m_bitmap);
}

}
@@ -112,7 +112,7 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
bool WebPage::platformCanHandleRequest(const ResourceRequest&)
{
notImplemented();
return true;
return false;
}

const char* WebPage::interpretKeyEvent(const KeyboardEvent* event)
@@ -121,8 +121,9 @@ const char* WebPage::interpretKeyEvent(const KeyboardEvent* event)
return 0;
}

String WebPage::platformUserAgent(const URL&) const
String WebPage::platformUserAgent(const URL& url) const
{
notImplemented();
return String();
}

0 comments on commit a108435

Please sign in to comment.
You can’t perform that action at this time.