Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GFX_ImplementTextureProfile(GFXWebTextureProfile,
- GFXTextureProfile::DiffuseMap,
- GFXTextureProfile::NoMipmap | GFXTextureProfile::Dynamic,
- GFXTextureProfile::NONE);
- void CefHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
- CEF_REQUIRE_UI_THREAD();
- // Create texture to write to
- mTextureObject.set(mTextureSize, mTextureSize, GFXFormatB8G8R8A8, &GFXWebTextureProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0);
- }
- // 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
- // returned from GetScreenInfo.
- // |type| indicates whether the element is the view or the popup widget.
- // |buffer| contains the pixel data for the whole image.
- // |dirtyRects| contains the set of rectangles in pixel coordinates that need to be repainted.
- // |buffer| will be |width|*|height|*4 bytes in size and represents a BGRA image with an upper-left origin.
- void CefHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const void* buffer, int width, int height) {
- CEF_REQUIRE_UI_THREAD();
- if (type == PET_VIEW) {
- GFXLockedRect *lockedRect = mTextureObject->lock();
- memcpy(lockedRect->bits, buffer, mTextureSize*mTextureSize * 4);
- mTextureObject->unlock();
- }
- else if (type == PET_POPUP) {
- // @TODO: Handle painting pop-ups
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement