Bug 1561303. Add some asserts for the surface size. r=nical

This is the first piece of the blob-recoord series. Adding
some checks to ensure things stay sane.

Differential Revision: https://phabricator.services.mozilla.com/D35806

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Muizelaar 2019-07-01 07:28:03 +00:00
Родитель bcbc22fbef
Коммит d14beb98f4
3 изменённых файлов: 5 добавлений и 1 удалений

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

@ -312,7 +312,7 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
const mozilla::wr::LayoutIntRect* aDirtyRect,
Range<uint8_t> aOutput) {
AUTO_PROFILER_TRACING("WebRender", "RasterizeSingleBlob", GRAPHICS);
MOZ_ASSERT(aSize.width > 0 && aSize.height > 0);
MOZ_RELEASE_ASSERT(aSize.width > 0 && aSize.height > 0);
if (aSize.width <= 0 || aSize.height <= 0) {
return false;
}

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

@ -477,6 +477,7 @@ impl AsyncBlobImageRasterizer for Moz2dBlobRasterizer {
let requests: Vec<Job> = requests.into_iter().map(|params| {
let command = &self.blob_commands[&params.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,
@ -522,6 +523,7 @@ fn rasterize_blob(job: Job) -> (BlobImageRequest, BlobImageResult) {
DirtyRect::Partial(rect) => Some(rect),
DirtyRect::All => None,
};
assert!(descriptor.rect.size.width > 0 && descriptor.rect.size.height > 0);
let result = unsafe {
if wr_moz2d_render_cb(

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

@ -1245,6 +1245,7 @@ impl ResourceCache {
format: template.descriptor.format,
};
assert!(descriptor.rect.size.width > 0 && descriptor.rect.size.height > 0);
// TODO: We only track dirty rects for non-tiled blobs but we
// should also do it with tiled ones unless we settle for a small
// tile size.
@ -1293,6 +1294,7 @@ impl ResourceCache {
template.dirty_rect
};
assert!(template.descriptor.size.width > 0 && template.descriptor.size.height > 0);
blob_request_params.push(
BlobImageParams {
request: BlobImageRequest {