Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. GFX_ImplementTextureProfile(GFXWebTextureProfile,
  2.   GFXTextureProfile::DiffuseMap,
  3.   GFXTextureProfile::NoMipmap | GFXTextureProfile::Dynamic,
  4.   GFXTextureProfile::NONE);
  5.  
  6. void CefHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
  7.   CEF_REQUIRE_UI_THREAD();
  8.  
  9.   // Create texture to write to
  10.   mTextureObject.set(mTextureSize, mTextureSize, GFXFormatB8G8R8A8, &GFXWebTextureProfile, avar("%s() -  (line %d)", __FUNCTION__, __LINE__), 0);
  11. }
  12.  
  13. // Called when an element should be painted. Pixel values passed to this method are scaled relative to view coordinates based on the value of CefScreenInfo.device_scale_factor
  14. // returned from GetScreenInfo.
  15. // |type| indicates whether the element is the view or the popup widget.
  16. // |buffer| contains the pixel data for the whole image.
  17. // |dirtyRects| contains the set of rectangles in pixel coordinates that need to be repainted.
  18. // |buffer| will be |width|*|height|*4 bytes in size and represents a BGRA image with an upper-left origin.
  19. void CefHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const void* buffer, int width, int height) {
  20.   CEF_REQUIRE_UI_THREAD();
  21.   if (type == PET_VIEW) {
  22.     GFXLockedRect *lockedRect = mTextureObject->lock();
  23.     memcpy(lockedRect->bits, buffer, mTextureSize*mTextureSize * 4);
  24.     mTextureObject->unlock();
  25.   }
  26.   else if (type == PET_POPUP) {
  27.     // @TODO: Handle painting pop-ups
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement