apply fixes
This commit is contained in:
parent
6e1db86a77
commit
f90e62a7a5
4 changed files with 16 additions and 27 deletions
|
@ -281,6 +281,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
private:
|
||||
AtomBrowserContext* GetBrowserContext() const;
|
||||
|
||||
atom::OnPaintCallback paint_callback_;
|
||||
|
||||
uint32_t GetNextRequestId() {
|
||||
return ++request_id_;
|
||||
}
|
||||
|
|
|
@ -10,23 +10,18 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
OffScreenOutputDevice::OffScreenOutputDevice(const OnPaintCallback& callback)
|
||||
: callback_(callback),
|
||||
OffScreenOutputDevice::OffScreenOutputDevice(bool transparent,
|
||||
const OnPaintCallback& callback)
|
||||
: transparent_(transparent),
|
||||
callback_(callback),
|
||||
active_(false) {
|
||||
DCHECK(!callback_.is_null());
|
||||
}
|
||||
|
||||
OffScreenOutputDevice::~OffScreenOutputDevice() {
|
||||
std::cout << "~OffScreenOutputDevice" << std::endl;
|
||||
}
|
||||
|
||||
void OffScreenOutputDevice::SetPaintCallback(const OnPaintCallback* callback) {
|
||||
callback_.reset(callback);
|
||||
}
|
||||
OffScreenOutputDevice::~OffScreenOutputDevice() { }
|
||||
|
||||
void OffScreenOutputDevice::Resize(
|
||||
const gfx::Size& pixel_size, float scale_factor) {
|
||||
std::cout << "Resize" << std::endl;
|
||||
std::cout << pixel_size.width() << "x" << pixel_size.height() << std::endl;
|
||||
|
||||
scale_factor_ = scale_factor;
|
||||
|
@ -38,13 +33,14 @@ void OffScreenOutputDevice::Resize(
|
|||
bitmap_.reset(new SkBitmap);
|
||||
bitmap_->allocN32Pixels(viewport_pixel_size_.width(),
|
||||
viewport_pixel_size_.height(),
|
||||
false);
|
||||
!transparent_);
|
||||
if (bitmap_->drawsNothing()) {
|
||||
std::cout << "drawsNothing" << std::endl;
|
||||
NOTREACHED();
|
||||
bitmap_.reset(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (transparent_)
|
||||
bitmap_->eraseARGB(0, 0, 0, 0);
|
||||
|
||||
canvas_.reset(new SkCanvas(*bitmap_.get()));
|
||||
|
|
|
@ -20,25 +20,21 @@ public:
|
|||
typedef base::Callback<void(const gfx::Rect&,int,int,void*)>
|
||||
OnPaintCallback;
|
||||
|
||||
OffScreenOutputDevice(const OnPaintCallback& callback);
|
||||
OffScreenOutputDevice(bool transparent, const OnPaintCallback& callback);
|
||||
~OffScreenOutputDevice();
|
||||
|
||||
void SetPaintCallback(const OnPaintCallback*);
|
||||
|
||||
// void saveSkBitmapToBMPFile(const SkBitmap& skBitmap, const char* path);
|
||||
void Resize(const gfx::Size& pixel_size, float scale_factor) override;
|
||||
|
||||
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
|
||||
|
||||
void EndPaint() override;
|
||||
|
||||
void OnPaint(const gfx::Rect& damage_rect);
|
||||
|
||||
void SetActive(bool active);
|
||||
|
||||
void OnPaint(const gfx::Rect& damage_rect);
|
||||
|
||||
private:
|
||||
const bool transparent_;
|
||||
const OnPaintCallback callback_;
|
||||
|
||||
bool active_;
|
||||
|
@ -47,8 +43,6 @@ private:
|
|||
std::unique_ptr<SkBitmap> bitmap_;
|
||||
gfx::Rect pending_damage_rect_;
|
||||
|
||||
std::unique_ptr<const atom::OnPaintCallback> callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
|
||||
};
|
||||
|
||||
|
|
|
@ -309,7 +309,6 @@ class CefCopyFrameGenerator {
|
|||
|
||||
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap.getPixels());
|
||||
|
||||
std::cout << "ASDADASDA" << std::endl;
|
||||
view_->OnPaint(damage_rect, bitmap.width(), bitmap.height(), pixels);
|
||||
|
||||
// Reset the frame retry count on successful frame generation.
|
||||
|
@ -476,8 +475,6 @@ void OffScreenWindow::SendBeginFrame(base::TimeTicks frame_time,
|
|||
|
||||
void OffScreenWindow::SetPaintCallback(const OnPaintCallback* callback) {
|
||||
paintCallback.reset(callback);
|
||||
if (software_output_device_)
|
||||
software_output_device_->SetPaintCallback(paintCallback.get());
|
||||
}
|
||||
|
||||
OffScreenWindow::~OffScreenWindow() {
|
||||
|
@ -880,8 +877,8 @@ std::unique_ptr<cc::SoftwareOutputDevice>
|
|||
DCHECK_EQ(compositor_.get(), compositor);
|
||||
DCHECK(!copy_frame_generator_);
|
||||
DCHECK(!software_output_device_);
|
||||
std::cout << "CREATEEEEE" << std::endl;
|
||||
software_output_device_ = new OffScreenOutputDevice(
|
||||
|
||||
software_output_device_ = new OffScreenOutputDevice(true,
|
||||
base::Bind(&OffScreenWindow::OnPaint,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
return base::WrapUnique(software_output_device_);
|
||||
|
|
Loading…
Add table
Reference in a new issue