зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5c88b35cc6f5 (bug 1563770) for causing bug 1565231. a=backout
This commit is contained in:
Родитель
e146f6712d
Коммит
20e91a0890
|
@ -107,7 +107,6 @@ struct OpAddImage {
|
|||
struct OpAddBlobImage {
|
||||
ImageDescriptor descriptor;
|
||||
OffsetRange bytes;
|
||||
ImageIntRect visibleRect;
|
||||
uint16_t tiling;
|
||||
BlobImageKey key;
|
||||
};
|
||||
|
@ -122,11 +121,10 @@ struct OpUpdateBlobImage {
|
|||
ImageDescriptor descriptor;
|
||||
OffsetRange bytes;
|
||||
BlobImageKey key;
|
||||
ImageIntRect visibleRect;
|
||||
ImageIntRect dirtyRect;
|
||||
};
|
||||
|
||||
struct OpSetBlobImageVisibleArea {
|
||||
struct OpSetImageVisibleArea {
|
||||
ImageIntRect area;
|
||||
BlobImageKey key;
|
||||
};
|
||||
|
@ -179,7 +177,7 @@ union OpUpdateResource {
|
|||
OpAddBlobImage;
|
||||
OpUpdateImage;
|
||||
OpUpdateBlobImage;
|
||||
OpSetBlobImageVisibleArea;
|
||||
OpSetImageVisibleArea;
|
||||
OpDeleteImage;
|
||||
OpDeleteBlobImage;
|
||||
OpAddRawFont;
|
||||
|
|
|
@ -297,15 +297,13 @@ bool IpcResourceUpdateQueue::AddImage(ImageKey key,
|
|||
|
||||
bool IpcResourceUpdateQueue::AddBlobImage(BlobImageKey key,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
Range<uint8_t> aBytes,
|
||||
ImageIntRect aVisibleRect) {
|
||||
Range<uint8_t> aBytes) {
|
||||
MOZ_RELEASE_ASSERT(aDescriptor.width > 0 && aDescriptor.height > 0);
|
||||
auto bytes = mWriter.Write(aBytes);
|
||||
if (!bytes.length()) {
|
||||
return false;
|
||||
}
|
||||
mUpdates.AppendElement(
|
||||
layers::OpAddBlobImage(aDescriptor, bytes, aVisibleRect, 0, key));
|
||||
mUpdates.AppendElement(layers::OpAddBlobImage(aDescriptor, bytes, 0, key));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -338,14 +336,13 @@ bool IpcResourceUpdateQueue::UpdateImageBuffer(
|
|||
bool IpcResourceUpdateQueue::UpdateBlobImage(BlobImageKey aKey,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
Range<uint8_t> aBytes,
|
||||
ImageIntRect aVisibleRect,
|
||||
ImageIntRect aDirtyRect) {
|
||||
auto bytes = mWriter.Write(aBytes);
|
||||
if (!bytes.length()) {
|
||||
return false;
|
||||
}
|
||||
mUpdates.AppendElement(layers::OpUpdateBlobImage(aDescriptor, bytes, aKey,
|
||||
aVisibleRect, aDirtyRect));
|
||||
mUpdates.AppendElement(
|
||||
layers::OpUpdateBlobImage(aDescriptor, bytes, aKey, aDirtyRect));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -358,7 +355,7 @@ void IpcResourceUpdateQueue::UpdateExternalImage(wr::ExternalImageId aExtId,
|
|||
|
||||
void IpcResourceUpdateQueue::SetBlobImageVisibleArea(
|
||||
wr::BlobImageKey aKey, const ImageIntRect& aArea) {
|
||||
mUpdates.AppendElement(layers::OpSetBlobImageVisibleArea(aArea, aKey));
|
||||
mUpdates.AppendElement(layers::OpSetImageVisibleArea(aArea, aKey));
|
||||
}
|
||||
|
||||
void IpcResourceUpdateQueue::DeleteImage(ImageKey aKey) {
|
||||
|
|
|
@ -137,7 +137,7 @@ class IpcResourceUpdateQueue {
|
|||
Range<uint8_t> aBytes);
|
||||
|
||||
bool AddBlobImage(wr::BlobImageKey aKey, const ImageDescriptor& aDescriptor,
|
||||
Range<uint8_t> aBytes, ImageIntRect aVisibleRect);
|
||||
Range<uint8_t> aBytes);
|
||||
|
||||
void AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey);
|
||||
|
||||
|
@ -151,8 +151,7 @@ class IpcResourceUpdateQueue {
|
|||
|
||||
bool UpdateBlobImage(wr::BlobImageKey aKey,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
Range<uint8_t> aBytes, ImageIntRect aVisibleRect,
|
||||
ImageIntRect aDirtyRect);
|
||||
Range<uint8_t> aBytes, ImageIntRect aDirtyRect);
|
||||
|
||||
void UpdateExternalImage(ExternalImageId aExtID, ImageKey aKey,
|
||||
ImageIntRect aDirtyRect);
|
||||
|
|
|
@ -428,8 +428,7 @@ bool WebRenderBridgeParent::UpdateResources(
|
|||
if (!reader.Read(op.bytes(), bytes)) {
|
||||
return false;
|
||||
}
|
||||
aUpdates.AddBlobImage(op.key(), op.descriptor(), bytes,
|
||||
wr::ToDeviceIntRect(op.visibleRect()));
|
||||
aUpdates.AddBlobImage(op.key(), op.descriptor(), bytes);
|
||||
break;
|
||||
}
|
||||
case OpUpdateResource::TOpUpdateBlobImage: {
|
||||
|
@ -439,14 +438,17 @@ bool WebRenderBridgeParent::UpdateResources(
|
|||
return false;
|
||||
}
|
||||
aUpdates.UpdateBlobImage(op.key(), op.descriptor(), bytes,
|
||||
wr::ToDeviceIntRect(op.visibleRect()),
|
||||
wr::ToLayoutIntRect(op.dirtyRect()));
|
||||
break;
|
||||
}
|
||||
case OpUpdateResource::TOpSetBlobImageVisibleArea: {
|
||||
const auto& op = cmd.get_OpSetBlobImageVisibleArea();
|
||||
aUpdates.SetBlobImageVisibleArea(op.key(),
|
||||
wr::ToDeviceIntRect(op.area()));
|
||||
case OpUpdateResource::TOpSetImageVisibleArea: {
|
||||
const auto& op = cmd.get_OpSetImageVisibleArea();
|
||||
wr::DeviceIntRect area;
|
||||
area.origin.x = op.area().x;
|
||||
area.origin.y = op.area().y;
|
||||
area.size.width = op.area().width;
|
||||
area.size.height = op.area().height;
|
||||
aUpdates.SetImageVisibleArea(op.key(), area);
|
||||
break;
|
||||
}
|
||||
case OpUpdateResource::TOpAddExternalImage: {
|
||||
|
|
|
@ -721,10 +721,7 @@ struct DIGroup {
|
|||
GP("No previous key making new one %d\n", key._0.mHandle);
|
||||
wr::ImageDescriptor descriptor(dtSize, 0, dt->GetFormat(), opacity);
|
||||
MOZ_RELEASE_ASSERT(bytes.length() > sizeof(size_t));
|
||||
if (!aResources.AddBlobImage(
|
||||
key, descriptor, bytes,
|
||||
ViewAs<ImagePixel>(mPaintRect,
|
||||
PixelCastJustification::LayerIsImage))) {
|
||||
if (!aResources.AddBlobImage(key, descriptor, bytes)) {
|
||||
return;
|
||||
}
|
||||
mKey = Some(MakePair(aBuilder.GetRenderRoot(), key));
|
||||
|
@ -737,11 +734,8 @@ struct DIGroup {
|
|||
bottomRight.y <= dtSize.height);
|
||||
GP("Update Blob %d %d %d %d\n", mInvalidRect.x, mInvalidRect.y,
|
||||
mInvalidRect.width, mInvalidRect.height);
|
||||
if (!aResources.UpdateBlobImage(
|
||||
mKey.value().second(), descriptor, bytes,
|
||||
ViewAs<ImagePixel>(mPaintRect,
|
||||
PixelCastJustification::LayerIsImage),
|
||||
ViewAs<ImagePixel>(mInvalidRect))) {
|
||||
if (!aResources.UpdateBlobImage(mKey.value().second(), descriptor, bytes,
|
||||
ViewAs<ImagePixel>(mInvalidRect))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2312,10 +2306,7 @@ WebRenderCommandBuilder::GenerateFallbackData(
|
|||
wr::BlobImageKey{mManager->WrBridge()->GetNextImageKey()};
|
||||
wr::ImageDescriptor descriptor(dtSize.ToUnknownSize(), 0,
|
||||
dt->GetFormat(), opacity);
|
||||
if (!aResources.AddBlobImage(
|
||||
key, descriptor, bytes,
|
||||
ViewAs<ImagePixel>(visibleRect,
|
||||
PixelCastJustification::LayerIsImage))) {
|
||||
if (!aResources.AddBlobImage(key, descriptor, bytes)) {
|
||||
return nullptr;
|
||||
}
|
||||
TakeExternalSurfaces(
|
||||
|
@ -2330,11 +2321,11 @@ WebRenderCommandBuilder::GenerateFallbackData(
|
|||
if (!fallbackData->GetBlobImageKey().isSome()) {
|
||||
return nullptr;
|
||||
}
|
||||
aResources.SetBlobImageVisibleArea(
|
||||
fallbackData->GetBlobImageKey().value(),
|
||||
ViewAs<ImagePixel>(visibleRect,
|
||||
PixelCastJustification::LayerIsImage));
|
||||
}
|
||||
aResources.SetBlobImageVisibleArea(
|
||||
fallbackData->GetBlobImageKey().value(),
|
||||
ViewAs<ImagePixel>(visibleRect,
|
||||
PixelCastJustification::LayerIsImage));
|
||||
} else {
|
||||
WebRenderImageData* imageData = fallbackData->PaintIntoImage();
|
||||
|
||||
|
@ -2535,8 +2526,9 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
|
|||
wr::BlobImageKey{mManager->WrBridge()->GetNextImageKey()};
|
||||
wr::ImageDescriptor descriptor(size, 0, dt->GetFormat(),
|
||||
wr::OpacityType::HasAlphaChannel);
|
||||
if (!aResources.AddBlobImage(key, descriptor, bytes,
|
||||
ImageIntRect(0, 0, size.width, size.height))) {
|
||||
if (!aResources.AddBlobImage(key, descriptor,
|
||||
bytes)) { // visible area: ImageIntRect(0, 0,
|
||||
// size.width, size.height)
|
||||
return Nothing();
|
||||
}
|
||||
maskData->ClearImageKey();
|
||||
|
|
|
@ -307,7 +307,6 @@ static RefPtr<ScaledFont> GetScaledFont(Translator* aTranslator,
|
|||
|
||||
static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
|
||||
gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
const mozilla::wr::DeviceIntRect* aVisibleRect,
|
||||
const uint16_t* aTileSize,
|
||||
const mozilla::wr::TileOffset* aTileOffset,
|
||||
const mozilla::wr::LayoutIntRect* aDirtyRect,
|
||||
|
@ -474,15 +473,14 @@ extern "C" {
|
|||
|
||||
bool wr_moz2d_render_cb(const mozilla::wr::ByteSlice blob, int32_t width,
|
||||
int32_t height, mozilla::wr::ImageFormat aFormat,
|
||||
const mozilla::wr::DeviceIntRect* aVisibleRect,
|
||||
const uint16_t* aTileSize,
|
||||
const mozilla::wr::TileOffset* aTileOffset,
|
||||
const mozilla::wr::LayoutIntRect* aDirtyRect,
|
||||
mozilla::wr::MutByteSlice output) {
|
||||
return mozilla::wr::Moz2DRenderCallback(
|
||||
mozilla::wr::ByteSliceToRange(blob), mozilla::gfx::IntSize(width, height),
|
||||
mozilla::wr::ImageFormatToSurfaceFormat(aFormat), aVisibleRect, aTileSize,
|
||||
aTileOffset, aDirtyRect, mozilla::wr::MutByteSliceToRange(output));
|
||||
mozilla::wr::ImageFormatToSurfaceFormat(aFormat), aTileSize, aTileOffset,
|
||||
aDirtyRect, mozilla::wr::MutByteSliceToRange(output));
|
||||
}
|
||||
|
||||
} // extern
|
||||
|
|
|
@ -622,10 +622,8 @@ void TransactionBuilder::AddImage(ImageKey key,
|
|||
|
||||
void TransactionBuilder::AddBlobImage(BlobImageKey key,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
wr::Vec<uint8_t>& aBytes,
|
||||
const wr::DeviceIntRect& aVisibleRect) {
|
||||
wr_resource_updates_add_blob_image(mTxn, key, &aDescriptor, &aBytes.inner,
|
||||
aVisibleRect);
|
||||
wr::Vec<uint8_t>& aBytes) {
|
||||
wr_resource_updates_add_blob_image(mTxn, key, &aDescriptor, &aBytes.inner);
|
||||
}
|
||||
|
||||
void TransactionBuilder::AddExternalImage(ImageKey key,
|
||||
|
@ -654,10 +652,9 @@ void TransactionBuilder::UpdateImageBuffer(ImageKey aKey,
|
|||
void TransactionBuilder::UpdateBlobImage(BlobImageKey aKey,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
wr::Vec<uint8_t>& aBytes,
|
||||
const wr::DeviceIntRect& aVisibleRect,
|
||||
const wr::LayoutIntRect& aDirtyRect) {
|
||||
wr_resource_updates_update_blob_image(mTxn, aKey, &aDescriptor, &aBytes.inner,
|
||||
aVisibleRect, aDirtyRect);
|
||||
aDirtyRect);
|
||||
}
|
||||
|
||||
void TransactionBuilder::UpdateExternalImage(ImageKey aKey,
|
||||
|
@ -677,8 +674,8 @@ void TransactionBuilder::UpdateExternalImageWithDirtyRect(
|
|||
mTxn, aKey, &aDescriptor, aExtID, &aImageType, aChannelIndex, aDirtyRect);
|
||||
}
|
||||
|
||||
void TransactionBuilder::SetBlobImageVisibleArea(
|
||||
BlobImageKey aKey, const wr::DeviceIntRect& aArea) {
|
||||
void TransactionBuilder::SetImageVisibleArea(BlobImageKey aKey,
|
||||
const wr::DeviceIntRect& aArea) {
|
||||
wr_resource_updates_set_blob_image_visible_area(mTxn, aKey, &aArea);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,8 +125,7 @@ class TransactionBuilder final {
|
|||
wr::Vec<uint8_t>& aBytes);
|
||||
|
||||
void AddBlobImage(wr::BlobImageKey aKey, const ImageDescriptor& aDescriptor,
|
||||
wr::Vec<uint8_t>& aBytes,
|
||||
const wr::DeviceIntRect& aVisibleRect);
|
||||
wr::Vec<uint8_t>& aBytes);
|
||||
|
||||
void AddExternalImageBuffer(ImageKey key, const ImageDescriptor& aDescriptor,
|
||||
ExternalImageId aHandle);
|
||||
|
@ -142,7 +141,6 @@ class TransactionBuilder final {
|
|||
void UpdateBlobImage(wr::BlobImageKey aKey,
|
||||
const ImageDescriptor& aDescriptor,
|
||||
wr::Vec<uint8_t>& aBytes,
|
||||
const wr::DeviceIntRect& aVisibleRect,
|
||||
const wr::LayoutIntRect& aDirtyRect);
|
||||
|
||||
void UpdateExternalImage(ImageKey aKey, const ImageDescriptor& aDescriptor,
|
||||
|
@ -157,8 +155,7 @@ class TransactionBuilder final {
|
|||
const wr::DeviceIntRect& aDirtyRect,
|
||||
uint8_t aChannelIndex = 0);
|
||||
|
||||
void SetBlobImageVisibleArea(BlobImageKey aKey,
|
||||
const wr::DeviceIntRect& aArea);
|
||||
void SetImageVisibleArea(BlobImageKey aKey, const wr::DeviceIntRect& aArea);
|
||||
|
||||
void DeleteImage(wr::ImageKey aKey);
|
||||
|
||||
|
|
|
@ -1602,13 +1602,11 @@ pub extern "C" fn wr_resource_updates_add_blob_image(
|
|||
image_key: BlobImageKey,
|
||||
descriptor: &WrImageDescriptor,
|
||||
bytes: &mut WrVecU8,
|
||||
visible_rect: DeviceIntRect,
|
||||
) {
|
||||
txn.add_blob_image(
|
||||
image_key,
|
||||
descriptor.into(),
|
||||
Arc::new(bytes.flush_into_vec()),
|
||||
visible_rect,
|
||||
if descriptor.format == ImageFormat::BGRA8 { Some(256) } else { None }
|
||||
);
|
||||
}
|
||||
|
@ -1713,14 +1711,12 @@ pub extern "C" fn wr_resource_updates_update_blob_image(
|
|||
image_key: BlobImageKey,
|
||||
descriptor: &WrImageDescriptor,
|
||||
bytes: &mut WrVecU8,
|
||||
visible_rect: DeviceIntRect,
|
||||
dirty_rect: LayoutIntRect,
|
||||
) {
|
||||
txn.update_blob_image(
|
||||
image_key,
|
||||
descriptor.into(),
|
||||
Arc::new(bytes.flush_into_vec()),
|
||||
visible_rect,
|
||||
&DirtyRect::Partial(dirty_rect)
|
||||
);
|
||||
}
|
||||
|
@ -3164,7 +3160,6 @@ extern "C" {
|
|||
width: i32,
|
||||
height: i32,
|
||||
format: ImageFormat,
|
||||
visible_rect: &DeviceIntRect,
|
||||
tile_size: Option<&u16>,
|
||||
tile_offset: Option<&TileOffset>,
|
||||
dirty_rect: Option<&LayoutIntRect>,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! registering fonts found in the blob (see `prepare_request`).
|
||||
|
||||
use webrender::api::*;
|
||||
use webrender::api::units::{BlobDirtyRect, BlobToDeviceTranslation, DeviceIntRect};
|
||||
use webrender::api::units::{BlobDirtyRect, BlobToDeviceTranslation};
|
||||
use bindings::{ByteSlice, MutByteSlice, wr_moz2d_render_cb, ArcVecU8, gecko_profiler_start_marker, gecko_profiler_end_marker};
|
||||
use rayon::ThreadPool;
|
||||
use rayon::prelude::*;
|
||||
|
@ -445,9 +445,6 @@ struct BlobFont {
|
|||
struct BlobCommand {
|
||||
/// The blob.
|
||||
data: Arc<BlobImageData>,
|
||||
/// What part of the blob should be rasterized (visible_rect's top-left corresponds to
|
||||
/// (0,0) in the blob's rasterization)
|
||||
visible_rect: DeviceIntRect,
|
||||
/// The size of the tiles to use in rasterization, if tiling should be used.
|
||||
tile_size: Option<TileSize>,
|
||||
}
|
||||
|
@ -457,7 +454,6 @@ struct BlobCommand {
|
|||
descriptor: BlobImageDescriptor,
|
||||
commands: Arc<BlobImageData>,
|
||||
dirty_rect: BlobDirtyRect,
|
||||
visible_rect: DeviceIntRect,
|
||||
tile_size: Option<TileSize>,
|
||||
}
|
||||
|
||||
|
@ -496,12 +492,10 @@ impl AsyncBlobImageRasterizer for Moz2dBlobRasterizer {
|
|||
let command = &self.blob_commands[¶ms.request.key];
|
||||
let blob = Arc::clone(&command.data);
|
||||
assert!(params.descriptor.rect.size.width > 0 && params.descriptor.rect.size.height > 0);
|
||||
|
||||
Job {
|
||||
request: params.request,
|
||||
descriptor: params.descriptor,
|
||||
commands: blob,
|
||||
visible_rect: command.visible_rect,
|
||||
dirty_rect: params.dirty_rect,
|
||||
tile_size: command.tile_size,
|
||||
}
|
||||
|
@ -551,7 +545,6 @@ fn rasterize_blob(job: Job) -> (BlobImageRequest, BlobImageResult) {
|
|||
descriptor.rect.size.width,
|
||||
descriptor.rect.size.height,
|
||||
descriptor.format,
|
||||
&job.visible_rect,
|
||||
job.tile_size.as_ref(),
|
||||
job.request.tile.as_ref(),
|
||||
dirty_rect.as_ref(),
|
||||
|
@ -576,15 +569,15 @@ fn rasterize_blob(job: Job) -> (BlobImageRequest, BlobImageResult) {
|
|||
}
|
||||
|
||||
impl BlobImageHandler for Moz2dBlobImageHandler {
|
||||
fn add(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, visible_rect: &DeviceIntRect, tile_size: Option<TileSize>) {
|
||||
fn add(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, tile_size: Option<TileSize>) {
|
||||
{
|
||||
let index = BlobReader::new(&data);
|
||||
assert!(index.reader.has_more());
|
||||
}
|
||||
self.blob_commands.insert(key, BlobCommand { data: Arc::clone(&data), visible_rect: *visible_rect, tile_size });
|
||||
self.blob_commands.insert(key, BlobCommand { data: Arc::clone(&data), tile_size });
|
||||
}
|
||||
|
||||
fn update(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, visible_rect: &DeviceIntRect, dirty_rect: &BlobDirtyRect) {
|
||||
fn update(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, dirty_rect: &BlobDirtyRect) {
|
||||
match self.blob_commands.entry(key) {
|
||||
hash_map::Entry::Occupied(mut e) => {
|
||||
let command = e.get_mut();
|
||||
|
@ -604,8 +597,6 @@ impl BlobImageHandler for Moz2dBlobImageHandler {
|
|||
}
|
||||
};
|
||||
command.data = Arc::new(merge_blob_images(&command.data, &data, dirty_rect));
|
||||
assert_eq!(command.visible_rect, *visible_rect);
|
||||
command.visible_rect = *visible_rect;
|
||||
}
|
||||
_ => { panic!("missing image key"); }
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::sync::Arc;
|
|||
use webrender::api::{self, DisplayListBuilder, DocumentId, PipelineId, RenderApi, Transaction};
|
||||
use webrender::api::{ColorF, CommonItemProperties, SpaceAndClipInfo};
|
||||
use webrender::api::units::*;
|
||||
use webrender::euclid::{size2, rect};
|
||||
use webrender::euclid::size2;
|
||||
|
||||
// This example shows how to implement a very basic BlobImageHandler that can only render
|
||||
// a checkerboard pattern.
|
||||
|
@ -136,14 +136,12 @@ impl CheckerboardRenderer {
|
|||
}
|
||||
|
||||
impl api::BlobImageHandler for CheckerboardRenderer {
|
||||
fn add(&mut self, key: api::BlobImageKey, cmds: Arc<api::BlobImageData>,
|
||||
_visible_rect: &DeviceIntRect, _: Option<api::TileSize>) {
|
||||
fn add(&mut self, key: api::BlobImageKey, cmds: Arc<api::BlobImageData>, _: Option<api::TileSize>) {
|
||||
self.image_cmds
|
||||
.insert(key, Arc::new(deserialize_blob(&cmds[..]).unwrap()));
|
||||
}
|
||||
|
||||
fn update(&mut self, key: api::BlobImageKey, cmds: Arc<api::BlobImageData>,
|
||||
_visible_rect: &DeviceIntRect, _dirty_rect: &BlobDirtyRect) {
|
||||
fn update(&mut self, key: api::BlobImageKey, cmds: Arc<api::BlobImageData>, _dirty_rect: &BlobDirtyRect) {
|
||||
// Here, updating is just replacing the current version of the commands with
|
||||
// the new one (no incremental updates).
|
||||
self.image_cmds
|
||||
|
@ -211,7 +209,6 @@ impl Example for App {
|
|||
blob_img1,
|
||||
api::ImageDescriptor::new(500, 500, api::ImageFormat::BGRA8, true, false),
|
||||
serialize_blob(api::ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
Some(128),
|
||||
);
|
||||
|
||||
|
@ -220,7 +217,6 @@ impl Example for App {
|
|||
blob_img2,
|
||||
api::ImageDescriptor::new(200, 200, api::ImageFormat::BGRA8, true, false),
|
||||
serialize_blob(api::ColorU::new(50, 150, 50, 255)),
|
||||
rect(0, 0, 200, 200),
|
||||
None,
|
||||
);
|
||||
|
||||
|
|
|
@ -596,7 +596,6 @@ impl ResourceCache {
|
|||
&img.dirty_rect
|
||||
),
|
||||
);
|
||||
self.discard_tiles_outside_visible_area(img.key, &img.visible_rect);
|
||||
}
|
||||
ResourceUpdate::DeleteImage(img) => {
|
||||
self.delete_image_template(img);
|
||||
|
@ -631,7 +630,6 @@ impl ResourceCache {
|
|||
&img.descriptor,
|
||||
img.tiling,
|
||||
Arc::clone(&img.data),
|
||||
&img.visible_rect,
|
||||
);
|
||||
}
|
||||
ResourceUpdate::UpdateBlobImage(ref img) => {
|
||||
|
@ -640,7 +638,6 @@ impl ResourceCache {
|
|||
&img.descriptor,
|
||||
&img.dirty_rect,
|
||||
Arc::clone(&img.data),
|
||||
&img.visible_rect,
|
||||
);
|
||||
}
|
||||
ResourceUpdate::SetBlobImageVisibleArea(ref key, ref area) => {
|
||||
|
@ -923,14 +920,11 @@ impl ResourceCache {
|
|||
descriptor: &ImageDescriptor,
|
||||
mut tiling: Option<TileSize>,
|
||||
data: Arc<BlobImageData>,
|
||||
visible_rect: &DeviceIntRect,
|
||||
) {
|
||||
let max_texture_size = self.max_texture_size();
|
||||
tiling = get_blob_tiling(tiling, descriptor, max_texture_size);
|
||||
|
||||
let viewport_tiles = tiling.map(|tile_size| compute_tile_range(&visible_rect, tile_size));
|
||||
|
||||
self.blob_image_handler.as_mut().unwrap().add(key, data, visible_rect, tiling);
|
||||
self.blob_image_handler.as_mut().unwrap().add(key, data, tiling);
|
||||
|
||||
self.blob_image_templates.insert(
|
||||
key,
|
||||
|
@ -938,7 +932,7 @@ impl ResourceCache {
|
|||
descriptor: *descriptor,
|
||||
tiling,
|
||||
dirty_rect: DirtyRect::All,
|
||||
viewport_tiles,
|
||||
viewport_tiles: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -950,9 +944,8 @@ impl ResourceCache {
|
|||
descriptor: &ImageDescriptor,
|
||||
dirty_rect: &BlobDirtyRect,
|
||||
data: Arc<BlobImageData>,
|
||||
visible_rect: &DeviceIntRect,
|
||||
) {
|
||||
self.blob_image_handler.as_mut().unwrap().update(key, data, visible_rect, dirty_rect);
|
||||
self.blob_image_handler.as_mut().unwrap().update(key, data, dirty_rect);
|
||||
|
||||
let max_texture_size = self.max_texture_size();
|
||||
|
||||
|
@ -962,13 +955,11 @@ impl ResourceCache {
|
|||
|
||||
let tiling = get_blob_tiling(image.tiling, descriptor, max_texture_size);
|
||||
|
||||
let viewport_tiles = image.tiling.map(|tile_size| compute_tile_range(&visible_rect, tile_size));
|
||||
|
||||
*image = BlobImageTemplate {
|
||||
descriptor: *descriptor,
|
||||
tiling,
|
||||
dirty_rect: dirty_rect.union(&image.dirty_rect),
|
||||
viewport_tiles,
|
||||
viewport_tiles: image.viewport_tiles,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,6 @@ impl Transaction {
|
|||
key: BlobImageKey,
|
||||
descriptor: ImageDescriptor,
|
||||
data: Arc<BlobImageData>,
|
||||
visible_rect: DeviceIntRect,
|
||||
tiling: Option<TileSize>,
|
||||
) {
|
||||
self.resource_updates.push(
|
||||
|
@ -355,7 +354,6 @@ impl Transaction {
|
|||
key,
|
||||
descriptor,
|
||||
data,
|
||||
visible_rect,
|
||||
tiling,
|
||||
})
|
||||
);
|
||||
|
@ -366,7 +364,6 @@ impl Transaction {
|
|||
key: BlobImageKey,
|
||||
descriptor: ImageDescriptor,
|
||||
data: Arc<BlobImageData>,
|
||||
visible_rect: DeviceIntRect,
|
||||
dirty_rect: &BlobDirtyRect,
|
||||
) {
|
||||
self.resource_updates.push(
|
||||
|
@ -374,7 +371,6 @@ impl Transaction {
|
|||
key,
|
||||
descriptor,
|
||||
data,
|
||||
visible_rect,
|
||||
dirty_rect: *dirty_rect,
|
||||
})
|
||||
);
|
||||
|
@ -527,7 +523,6 @@ pub struct AddBlobImage {
|
|||
pub descriptor: ImageDescriptor,
|
||||
//#[serde(with = "serde_image_data_raw")]
|
||||
pub data: Arc<BlobImageData>,
|
||||
pub visible_rect: DeviceIntRect,
|
||||
pub tiling: Option<TileSize>,
|
||||
}
|
||||
|
||||
|
@ -537,7 +532,6 @@ pub struct UpdateBlobImage {
|
|||
pub descriptor: ImageDescriptor,
|
||||
//#[serde(with = "serde_image_data_raw")]
|
||||
pub data: Arc<BlobImageData>,
|
||||
pub visible_rect: DeviceIntRect,
|
||||
pub dirty_rect: BlobDirtyRect,
|
||||
}
|
||||
|
||||
|
|
|
@ -309,12 +309,10 @@ pub trait BlobImageHandler: Send {
|
|||
);
|
||||
|
||||
/// Register a blob image.
|
||||
fn add(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, visible_rect: &DeviceIntRect,
|
||||
tiling: Option<TileSize>);
|
||||
fn add(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, tiling: Option<TileSize>);
|
||||
|
||||
/// Update an already registered blob image.
|
||||
fn update(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, visible_rect: &DeviceIntRect,
|
||||
dirty_rect: &BlobDirtyRect);
|
||||
fn update(&mut self, key: BlobImageKey, data: Arc<BlobImageData>, dirty_rect: &BlobDirtyRect);
|
||||
|
||||
/// Delete an already registered blob image.
|
||||
fn delete(&mut self, key: BlobImageKey);
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::sync::Arc;
|
|||
use std::sync::Mutex;
|
||||
use webrender::api::*;
|
||||
use webrender::api::units::{BlobDirtyRect, BlobToDeviceTranslation, TileOffset};
|
||||
use webrender::api::units::DeviceIntRect;
|
||||
|
||||
// Serialize/deserialize the blob.
|
||||
|
||||
|
@ -130,14 +129,12 @@ impl CheckerboardRenderer {
|
|||
}
|
||||
|
||||
impl BlobImageHandler for CheckerboardRenderer {
|
||||
fn add(&mut self, key: BlobImageKey, cmds: Arc<BlobImageData>,
|
||||
_visible_rect: &DeviceIntRect, tile_size: Option<TileSize>) {
|
||||
fn add(&mut self, key: BlobImageKey, cmds: Arc<BlobImageData>, tile_size: Option<TileSize>) {
|
||||
self.image_cmds
|
||||
.insert(key, (deserialize_blob(&cmds[..]).unwrap(), tile_size));
|
||||
}
|
||||
|
||||
fn update(&mut self, key: BlobImageKey, cmds: Arc<BlobImageData>,
|
||||
_visible_rect: &DeviceIntRect, _dirty_rect: &BlobDirtyRect) {
|
||||
fn update(&mut self, key: BlobImageKey, cmds: Arc<BlobImageData>, _dirty_rect: &BlobDirtyRect) {
|
||||
// Here, updating is just replacing the current version of the commands with
|
||||
// the new one (no incremental updates).
|
||||
self.image_cmds.get_mut(&key).unwrap().0 = deserialize_blob(&cmds[..]).unwrap();
|
||||
|
|
|
@ -213,7 +213,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(151, 56, ImageFormat::BGRA8, true, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 151, 56),
|
||||
Some(128),
|
||||
);
|
||||
|
||||
|
@ -270,7 +269,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(1510, 111256, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 15010, 111256),
|
||||
Some(31),
|
||||
);
|
||||
|
||||
|
@ -403,7 +401,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
false
|
||||
),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, image_size.width as i32, image_size.height as i32),
|
||||
Some(100),
|
||||
);
|
||||
|
||||
|
@ -435,14 +432,14 @@ impl<'a> RawtestHarness<'a> {
|
|||
false
|
||||
),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
// Set a visible rectangle that is too small.
|
||||
// This will force sync rasterization of the missing tiles during frame building.
|
||||
DeviceIntRect {
|
||||
origin: point2(200, 200),
|
||||
size: size2(80, 80),
|
||||
},
|
||||
Some(100),
|
||||
);
|
||||
// Set a visible rectangle that is too small.
|
||||
// This will force sync rasterization of the missing tiles during frame building.
|
||||
txn.set_blob_image_visible_area(blob_img2, DeviceIntRect {
|
||||
origin: point2(200, 200),
|
||||
size: size2(80, 80),
|
||||
});
|
||||
|
||||
builder.push_image(
|
||||
&info,
|
||||
|
@ -488,7 +485,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(1510, 1510, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 1510, 1510),
|
||||
None,
|
||||
);
|
||||
|
||||
|
@ -546,7 +542,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(1510, 1510, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 1510, 1510),
|
||||
&rect(10, 10, 100, 100).into(),
|
||||
);
|
||||
|
||||
|
@ -604,7 +599,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
@ -695,7 +689,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
None,
|
||||
);
|
||||
blob_img2 = api.generate_blob_image_key();
|
||||
|
@ -703,7 +696,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img2,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(80, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
None,
|
||||
);
|
||||
(blob_img, blob_img2)
|
||||
|
@ -761,20 +753,19 @@ impl<'a> RawtestHarness<'a> {
|
|||
self.submit_dl(&mut epoch, layout_size, builder, &txn.resource_updates);
|
||||
let _pixels_first = self.render_and_get_pixels(window_rect);
|
||||
|
||||
|
||||
// update and redraw both images
|
||||
let mut txn = Transaction::new();
|
||||
txn.update_blob_image(
|
||||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
&rect(100, 100, 100, 100).into(),
|
||||
);
|
||||
txn.update_blob_image(
|
||||
blob_img2,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(59, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
&rect(100, 100, 100, 100).into(),
|
||||
);
|
||||
|
||||
|
@ -783,13 +774,13 @@ impl<'a> RawtestHarness<'a> {
|
|||
self.submit_dl(&mut epoch, layout_size, builder, &txn.resource_updates);
|
||||
let _pixels_second = self.render_and_get_pixels(window_rect);
|
||||
|
||||
|
||||
// only update the first image
|
||||
let mut txn = Transaction::new();
|
||||
txn.update_blob_image(
|
||||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 150, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
&rect(200, 200, 100, 100).into(),
|
||||
);
|
||||
|
||||
|
@ -825,11 +816,10 @@ impl<'a> RawtestHarness<'a> {
|
|||
img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
None,
|
||||
);
|
||||
img
|
||||
};
|
||||
};
|
||||
|
||||
// draw the blobs the first time
|
||||
let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size);
|
||||
|
@ -857,7 +847,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 50, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
&rect(100, 100, 100, 100).into(),
|
||||
);
|
||||
|
||||
|
@ -884,7 +873,6 @@ impl<'a> RawtestHarness<'a> {
|
|||
blob_img,
|
||||
ImageDescriptor::new(500, 500, ImageFormat::BGRA8, false, false),
|
||||
blob::serialize_blob(ColorU::new(50, 150, 150, 255)),
|
||||
rect(0, 0, 500, 500),
|
||||
&rect(200, 200, 100, 100).into(),
|
||||
);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче