Bug 1451761. Only paint the dirty rect. r=mstange

This commit is contained in:
Jeff Muizelaar 2018-04-05 13:18:22 -04:00
Родитель 3ffd2fdb72
Коммит 228407bcf0
4 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -168,6 +168,7 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
gfx::SurfaceFormat aFormat,
const uint16_t *aTileSize,
const mozilla::wr::TileOffset *aTileOffset,
const mozilla::wr::DeviceUintRect *aDirtyRect,
Range<uint8_t> aOutput)
{
MOZ_ASSERT(aSize.width > 0 && aSize.height > 0);
@ -197,6 +198,11 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
return false;
}
if (aDirtyRect) {
Rect dirty(aDirtyRect->origin.x, aDirtyRect->origin.y, aDirtyRect->size.width, aDirtyRect->size.height);
dt->PushClipRect(dirty);
}
if (aTileOffset) {
// It's overkill to use a TiledDrawTarget for a single tile
// but it was the easiest way to get the offset handling working
@ -262,6 +268,18 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
offset = extra_end;
}
#if 0
dt->SetTransform(gfx::Matrix());
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
dt->FillRect(gfx::Rect(0, 0, aSize.width, aSize.height), gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
#endif
if (aDirtyRect) {
dt->PopClip();
}
#if 0
static int i = 0;
char filename[40];
@ -282,6 +300,7 @@ bool wr_moz2d_render_cb(const mozilla::wr::ByteSlice blob,
mozilla::wr::ImageFormat aFormat,
const uint16_t *aTileSize,
const mozilla::wr::TileOffset *aTileOffset,
const mozilla::wr::DeviceUintRect *aDirtyRect,
mozilla::wr::MutByteSlice output)
{
return mozilla::wr::Moz2DRenderCallback(mozilla::wr::ByteSliceToRange(blob),
@ -289,6 +308,7 @@ bool wr_moz2d_render_cb(const mozilla::wr::ByteSlice blob,
mozilla::wr::ImageFormatToSurfaceFormat(aFormat),
aTileSize,
aTileOffset,
aDirtyRect,
mozilla::wr::MutByteSliceToRange(output));
}

Просмотреть файл

@ -2177,6 +2177,7 @@ extern "C" {
format: ImageFormat,
tile_size: *const u16,
tile_offset: *const TileOffset,
dirty_rect: *const DeviceUintRect,
output: MutByteSlice)
-> bool;
}

Просмотреть файл

@ -366,7 +366,7 @@ impl BlobImageRenderer for Moz2dImageRenderer {
resources: &BlobImageResources,
request: BlobImageRequest,
descriptor: &BlobImageDescriptor,
_dirty_rect: Option<DeviceUintRect>) {
dirty_rect: Option<DeviceUintRect>) {
debug_assert!(!self.rendered_images.contains_key(&request), "{:?}", request);
// TODO: implement tiling.
@ -440,6 +440,7 @@ impl BlobImageRenderer for Moz2dImageRenderer {
descriptor.format,
option_to_nullable(&tile_size),
option_to_nullable(&request.tile),
option_to_nullable(&dirty_rect),
MutByteSlice::new(output.as_mut_slice())
) {

Просмотреть файл

@ -733,6 +733,8 @@ struct ByteSlice {
using TileOffset = TypedPoint2D<uint16_t, Tiles>;
using DeviceUintRect = TypedRect<uint32_t, DevicePixel>;
struct MutByteSlice {
uint8_t *buffer;
uintptr_t len;
@ -909,8 +911,6 @@ struct FontInstancePlatformOptions {
};
#endif
using DeviceUintRect = TypedRect<uint32_t, DevicePixel>;
struct WrOpacityProperty {
uint64_t id;
float opacity;
@ -1344,6 +1344,7 @@ extern bool wr_moz2d_render_cb(ByteSlice aBlob,
ImageFormat aFormat,
const uint16_t *aTileSize,
const TileOffset *aTileOffset,
const DeviceUintRect *aDirtyRect,
MutByteSlice aOutput);
extern void wr_notifier_external_event(WrWindowId aWindowId,