// Called whenever the in-browser window changes size. virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { if (position.size().width() == width && position.size().height() == height) return; // Size didn't change, no need to update anything. if (opengl_context_ == NULL) { opengl_context_.reset(new OpenGLContext(this)); }; opengl_context_->InvalidateContext(this); opengl_context_->ResizeContext(position.size()); if (!opengl_context_->MakeContextCurrent(this)) return; width = position.size().width(); height = position.size().height(); // init gl here? OS::VideoMode vm; vm.width = width; vm.height = height; vm.resizable = false; vm.fullscreen = true; OS::get_singleton()->set_video_mode(vm, 0); DrawSelf(); };
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { if (position.size().width() == fWidth && position.size().height() == fHeight) { return; // We don't care about the position, only the size. } fWidth = position.size().width(); fHeight = position.size().height(); fDeviceContext = pp::Graphics2D(this, pp::Size(fWidth, fHeight), false); if (!BindGraphics(fDeviceContext)) { SkDebugf("Couldn't bind the device context\n"); return; } fImage = pp::ImageData(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, pp::Size(fWidth, fHeight), false); fBitmap.setConfig(SkBitmap::kARGB_8888_Config, fWidth, fHeight); fBitmap.setPixels(fImage.data()); if (fCanvas) { delete fCanvas; } fCanvas = new SkCanvas(fBitmap); fCanvas->clear(SK_ColorWHITE); if (!fFlushLoopRunning) { Paint(); } }
void eUSPInstance::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { if(size == position.size()) return; size = position.size(); if(!gl_context) { gl_context = new eGLContext(this); gl_context->MakeCurrent(this); gles2 = eGLES2::Create(); } gl_context->Invalidate(); gl_context->Resize(size); Draw(); }
void GboxInstance::DidChangeView(const pp::Rect& position, const pp::Rect& clip) { if (position.size().width() == width() && position.size().height() == height()) return; // Size didn't change, no need to update anything. // Create a new device context with the new size. DestroyContext(); CreateContext(position.size()); // Delete the old pixel buffer and create a new one. ScopedMutexLock scoped_mutex(&pixel_buffer_mutex_); delete pixel_buffer_; pixel_buffer_ = NULL; if (graphics_2d_context_ != NULL) { pixel_buffer_ = new pp::ImageData(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, graphics_2d_context_->size(), false); } }