fixes buffer size and adds pixel size to paint event

This commit is contained in:
gellert 2016-08-03 13:28:19 +02:00
parent 230943d425
commit 50485a28d3
7 changed files with 20 additions and 8 deletions

View file

@ -87,7 +87,7 @@ void OffScreenOutputDevice::OnPaint(const gfx::Rect& damage_rect) {
SkAutoLockPixels bitmap_pixels_lock(*bitmap_);
callback_.Run(rect, gfx::Size(bitmap_->width(), bitmap_->height()),
bitmap_->getPixels());
bitmap_->bytesPerPixel(), bitmap_->getPixels());
}
} // namespace atom

View file

@ -12,8 +12,8 @@
namespace atom {
typedef base::Callback<void(const gfx::Rect&,
const gfx::Size&, void*)> OnPaintCallback;
typedef base::Callback<void(const gfx::Rect&, const gfx::Size&,
const int, void*)> OnPaintCallback;
class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
public:

View file

@ -262,7 +262,7 @@ class AtomCopyFrameGenerator {
std::unique_ptr<SkAutoLockPixels> bitmap_pixels_lock) {
view_->OnPaint(damage_rect,
gfx::Size(bitmap.width(), bitmap.height()),
bitmap.getPixels());
bitmap.bytesPerPixel(), bitmap.getPixels());
if (frame_retry_count_ > 0)
frame_retry_count_ = 0;
@ -791,11 +791,12 @@ void OffScreenRenderWidgetHostView::SetPaintCallback(
void OffScreenRenderWidgetHostView::OnPaint(
const gfx::Rect& damage_rect,
const gfx::Size& bitmap_size,
const int pixel_size,
void* bitmap_pixels) {
TRACE_EVENT0("electron", "OffScreenRenderWidgetHostView::OnPaint");
if (!callback_.is_null())
callback_.Run(damage_rect, bitmap_size, bitmap_pixels);
callback_.Run(damage_rect, bitmap_size, pixel_size, bitmap_pixels);
}
void OffScreenRenderWidgetHostView::SetPainting(bool painting) {

View file

@ -192,6 +192,7 @@ class OffScreenRenderWidgetHostView
void SetPaintCallback(const OnPaintCallback& callback);
void OnPaint(const gfx::Rect& damage_rect,
const gfx::Size& bitmap_size,
const int pixel_size,
void* bitmap_pixels);
void SetPainting(bool painting);