Skip to content

Commit

Permalink
Update to non-deprecated drawImage
Browse files Browse the repository at this point in the history
1. drawBitmap --> drawImage
2. drawImage specify sampling options

Note: drawBitmap was (under the hood) calling bitmap.asImage() already,
so these changes only surface what was already happening.

Bug: 1169871
Change-Id: I15ebbfec8173d9c05429c41eba7b7fcddad32892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2658420
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849198}
  • Loading branch information
reed-at-google authored and Chromium LUCI CQ committed Feb 1, 2021
1 parent 0ad18b2 commit 566a2f0
Show file tree
Hide file tree
Showing 45 changed files with 141 additions and 117 deletions.
4 changes: 2 additions & 2 deletions android_webview/browser/gfx/vulkan_gl_interop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ void VulkanGLInterop::DrawVk(sk_sp<GrVkSecondaryCBDrawContext> draw_context,
// Draw the SkImage.
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrcOver);
pending_draw->draw_context->getCanvas()->drawImage(pending_draw->ahb_skimage,
0, 0, &paint);
pending_draw->draw_context->getCanvas()->drawImage(
pending_draw->ahb_skimage, 0, 0, SkSamplingOptions(), &paint);
pending_draw->draw_context->flush();

// Transfer |pending_draw| to |pending_draw_| for handling in
Expand Down
17 changes: 9 additions & 8 deletions ash/app_list/views/ghost_image_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,13 @@ gfx::ImageSkia GhostImageView::GetIconOutline(
SkIPoint thick_inner_blur_offset;
preview.extractAlpha(&thick_inner_blur, &paint, &thick_inner_blur_offset);

SkSamplingOptions sampling;
// Mask out the inner blur.
paint.setMaskFilter(nullptr);
paint.setBlendMode(SkBlendMode::kDstOut);
canvas = std::make_unique<SkCanvas>(thick_inner_blur);
canvas->drawBitmap(preview, -thick_inner_blur_offset.fX,
-thick_inner_blur_offset.fY, &paint);
canvas->drawImage(preview.asImage(), -thick_inner_blur_offset.fX,
-thick_inner_blur_offset.fY, sampling, &paint);
canvas->drawRect(
SkRect{0, 0, -thick_inner_blur_offset.fX, thick_inner_blur.height()},
paint);
Expand All @@ -264,14 +265,14 @@ gfx::ImageSkia GhostImageView::GetIconOutline(
paint.setBlendMode(SkBlendMode::kPlus);
canvas = std::make_unique<SkCanvas>(preview);
canvas->drawColor(0, SkBlendMode::kClear);
canvas->drawBitmap(thick_inner_blur, thick_inner_blur_offset.fX,
thick_inner_blur_offset.fY, &paint);
canvas->drawBitmap(thick_outer_blur, outer_blur_offset.fX,
outer_blur_offset.fY, &paint);
canvas->drawImage(thick_inner_blur.asImage(), thick_inner_blur_offset.fX,
thick_inner_blur_offset.fY, sampling, &paint);
canvas->drawImage(thick_outer_blur.asImage(), outer_blur_offset.fX,
outer_blur_offset.fY, sampling, &paint);

// Draw the bright outline.
canvas->drawBitmap(bright_outline, bright_outline_offset.fX,
bright_outline_offset.fY, &paint);
canvas->drawImage(bright_outline.asImage(), bright_outline_offset.fX,
bright_outline_offset.fY, sampling, &paint);

// Cleanup bitmaps.
canvas.reset();
Expand Down
2 changes: 1 addition & 1 deletion ash/display/cursor_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ SkBitmap CursorWindowController::GetAdjustedBitmap(
recolored.allocN32Pixels(bitmap.width(), bitmap.height());
recolored.eraseARGB(0, 0, 0, 0);
SkCanvas canvas(recolored);
canvas.drawBitmap(bitmap, 0, 0);
canvas.drawImage(bitmap.asImage(), 0, 0);
color_utils::HSL cursor_hsl;
color_utils::SkColorToHSL(cursor_color_, &cursor_hsl);
for (int y = 0; y < bitmap.height(); ++y) {
Expand Down
3 changes: 2 additions & 1 deletion cc/resources/ui_resource_bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/check_op.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkMallocPixelRef.h"
#include "third_party/skia/include/core/SkPixelRef.h"
Expand Down Expand Up @@ -55,7 +56,7 @@ void UIResourceBitmap::DrawToCanvas(SkCanvas* canvas, SkPaint* paint) {
SkBitmap bitmap;
bitmap.setInfo(info_, pixel_ref_.get()->rowBytes());
bitmap.setPixelRef(pixel_ref_, 0, 0);
canvas->drawBitmap(bitmap, 0, 0, paint);
canvas->drawImage(bitmap.asImage(), 0, 0, SkSamplingOptions(), paint);
canvas->flush();
}

Expand Down
10 changes: 5 additions & 5 deletions cc/tiles/gpu_image_decode_cache_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ TEST_P(GpuImageDecodeCachePerfTestNoSw, DecodeWithMips) {
DecodedDrawImage decoded_image = cache_->GetDecodedImageForDraw(image);

if (GetParam() == TestMode::kGpu) {
SkPaint paint;
paint.setFilterQuality(kMedium_SkFilterQuality);
surface->getCanvas()->drawImageRect(decoded_image.image().get(),
SkRect::MakeWH(1024, 2048),
SkRect::MakeWH(614, 1229), &paint);
SkSamplingOptions sampling(SkFilterMode::kLinear, SkMipmapMode::kLinear);
surface->getCanvas()->drawImageRect(
decoded_image.image().get(), SkRect::MakeWH(1024, 2048),
SkRect::MakeWH(614, 1229), sampling, nullptr,
SkCanvas::kStrict_SrcRectConstraint);
surface->flushAndSubmit();
}

Expand Down
2 changes: 1 addition & 1 deletion cc/trees/layer_tree_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4409,7 +4409,7 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
// fully filled by drawBitmap(), so we ensure they start empty. (See
// crbug.com/642011 for an example.)
scaled_canvas->clear(SK_ColorTRANSPARENT);
scaled_canvas->drawBitmap(source_bitmap, 0, 0);
scaled_canvas->drawImage(source_bitmap.asImage(), 0, 0);

if (layer_tree_frame_sink_->context_provider()) {
SkPixmap pixmap;
Expand Down
18 changes: 11 additions & 7 deletions chrome/browser/apps/icon_standardizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ bool IsIconCircleShaped(const gfx::ImageSkia& image) {

preview.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas1(preview);
canvas1.drawBitmap(scaled_preview, -visible_preview_bounds.x() * scale,
-visible_preview_bounds.y() * scale);
canvas1.drawImage(scaled_preview.asImage(),
-visible_preview_bounds.x() * scale,
-visible_preview_bounds.y() * scale);

// Use a canvas to perform XOR and DST_OUT operations, which should
// generate a transparent bitmap for |preview| if the original icon is
Expand Down Expand Up @@ -267,8 +268,8 @@ gfx::ImageSkia StandardizeSize(const gfx::ImageSkia& image) {
final_bitmap.eraseColor(SK_ColorTRANSPARENT);

SkCanvas canvas(final_bitmap);
canvas.drawBitmap(unscaled_bitmap, (longest_side - width) / 2,
(longest_side - height) / 2);
canvas.drawImage(unscaled_bitmap.asImage(), (longest_side - width) / 2,
(longest_side - height) / 2);

final_image.AddRepresentation(gfx::ImageSkiaRep(final_bitmap, rep.scale()));
}
Expand Down Expand Up @@ -316,7 +317,8 @@ gfx::ImageSkia CreateStandardIconImage(const gfx::ImageSkia& image) {
int target_top = (height - scaled_icon_size.height()) / 2;

// Draw the scaled down bitmap and add that to the final image.
canvas.drawBitmap(scaled_bitmap, target_left, target_top, &paint_icon);
canvas.drawImage(scaled_bitmap.asImage(), target_left, target_top,
SkSamplingOptions(), &paint_icon);
final_image.AddRepresentation(
gfx::ImageSkiaRep(final_bitmap, rep.scale()));
} else {
Expand Down Expand Up @@ -368,7 +370,8 @@ gfx::ImageSkia CreateStandardIconImage(const gfx::ImageSkia& image) {

if (icon_scale == 1.0f) {
// Draw the unscaled icon on top of the background.
canvas.drawBitmap(unscaled_bitmap, 0, 0, &paint_icon);
canvas.drawImage(unscaled_bitmap.asImage(), 0, 0, SkSamplingOptions(),
&paint_icon);
} else {
gfx::Size scaled_icon_size =
gfx::ScaleToRoundedSize(rep.pixel_size(), icon_scale);
Expand All @@ -380,7 +383,8 @@ gfx::ImageSkia CreateStandardIconImage(const gfx::ImageSkia& image) {
int target_top = (height - scaled_icon_size.height()) / 2;

// Draw the scaled icon on top of the background.
canvas.drawBitmap(scaled_bitmap, target_left, target_top, &paint_icon);
canvas.drawImage(scaled_bitmap.asImage(), target_left, target_top,
SkSamplingOptions(), &paint_icon);
}

final_image.AddRepresentation(gfx::ImageSkiaRep(final_bitmap, rep.scale()));
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/apps/icon_standardizer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST_F(CreateStandardIconTest, SquareIconToStandardIcon) {

const SkBitmap scaled_bitmap = skia::ImageOperations::Resize(
square_icon_bitmap, skia::ImageOperations::RESIZE_BEST, 36, 36);
canvas.drawBitmap(scaled_bitmap, 14, 14);
canvas.drawImage(scaled_bitmap.asImage(), 14, 14);

EXPECT_TRUE(AreBitmapsEqual(*standard_icon.bitmap(), test_standard_bitmap));
}
Expand Down Expand Up @@ -100,7 +100,7 @@ TEST_F(CreateStandardIconTest, CircularIconToStandardIcon) {
manually_scaled_bitmap.allocN32Pixels(kIconSize, kIconSize);
manually_scaled_bitmap.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas2(manually_scaled_bitmap);
canvas2.drawBitmap(scaled_bitmap, 3, 3);
canvas2.drawImage(scaled_bitmap.asImage(), 3, 3);

EXPECT_TRUE(AreBitmapsEqual(*generated_standard_icon.bitmap(),
manually_scaled_bitmap));
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/scanning/scan_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool AddPdfPage(sk_sp<SkDocument> pdf_doc, PngImageData& image_data) {
LOG(ERROR) << "Unable to access PDF page canvas.";
return false;
}
page_canvas->drawBitmap(img_bitmap, /*left=*/0, /*top=*/0);
page_canvas->drawImage(img_bitmap.asImage(), /*left=*/0, /*top=*/0);
pdf_doc->endPage();
return true;
}
Expand Down
4 changes: 3 additions & 1 deletion chrome/browser/devtools/devtools_eye_dropper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ void DevToolsEyeDropper::UpdateCursor() {
last_cursor_y_ - pixel_count / 2,
pixel_count, pixel_count);
SkRect dst_rect = SkRect::MakeXYWH(padding, padding, kDiameter, kDiameter);
canvas.drawBitmapRect(frame_, src_rect, dst_rect, NULL);
canvas.drawImageRect(frame_.asImage(), src_rect, dst_rect,
SkSamplingOptions(), nullptr,
SkCanvas::kStrict_SrcRectConstraint);

// Paint grid.
paint.setStrokeWidth(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ SkBitmap CropImage(const SkBitmap& original_bitmap) {
SkBitmap container_bitmap;
container_bitmap.allocN32Pixels(container_size.width(),
container_size.height());
SkPaint paint;
paint.setFilterQuality(kHigh_SkFilterQuality);
SkSamplingOptions sampling({1.0f / 3, 1.0f / 3});
SkCanvas container_image(container_bitmap);
container_image.drawColor(kImageBackgroundColor);
container_image.drawBitmapRect(
original_bitmap, source_rect, SkRect::MakeSize(container_size), &paint);
container_image.drawImageRect(original_bitmap.asImage(), source_rect,
SkRect::MakeSize(container_size), sampling,
nullptr, SkCanvas::kStrict_SrcRectConstraint);

return container_bitmap;
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/media/webrtc/tab_desktop_media_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ gfx::ImageSkia CreateEnclosedFaviconImage(gfx::Size size,
SkRect dest_rect =
SkRect::MakeLTRB(center_rect.x(), center_rect.y(), center_rect.right(),
center_rect.bottom());
canvas.drawBitmapRect(*favicon.bitmap(), dest_rect, nullptr);
canvas.drawImageRect(favicon.bitmap()->asImage(), dest_rect,
SkSamplingOptions());

return gfx::ImageSkia::CreateFrom1xBitmap(result);
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/profiles/profile_avatar_icon_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ SkBitmap GetBadgedWinIconBitmapForAvatar(const SkBitmap& app_icon_bitmap,
app_icon_bitmap.height());
SkCanvas offscreen_canvas(badged_bitmap, SkSurfaceProps{});
offscreen_canvas.clear(SK_ColorTRANSPARENT);
offscreen_canvas.drawBitmap(app_icon_bitmap, 0, 0);
offscreen_canvas.drawImage(app_icon_bitmap.asImage(), 0, 0);

// Render the avatar in a cutout circle. If the avatar is not square, center
// it in the circle but favor pushing it further down.
Expand All @@ -826,7 +826,7 @@ SkBitmap GetBadgedWinIconBitmapForAvatar(const SkBitmap& app_icon_bitmap,
SkRect::MakeXYWH(cutout_left, cutout_top, cutout_size, cutout_size));

offscreen_canvas.clipRRect(clip_circle, true);
offscreen_canvas.drawBitmap(sk_icon, icon_left, icon_top);
offscreen_canvas.drawImage(sk_icon.asImage(), icon_left, icon_top);
return badged_bitmap;
}
#endif // OS_WIN
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/taskbar/taskbar_decorator_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void SetOverlayIcon(HWND hwnd,
// it in the paintable region instead, rounding up to the closest pixel to
// avoid smearing.
const int y_offset = std::ceilf((kOverlayIconSize - resized_height) / 2.0f);
offscreen_canvas.drawBitmap(sk_icon, 0, y_offset);
offscreen_canvas.drawImage(sk_icon.asImage(), 0, y_offset);

icon = IconUtil::CreateHICONFromSkBitmap(offscreen_bitmap);
if (!icon.is_valid())
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/themes/browser_theme_pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ SkBitmap CreateLowQualityResizedBitmap(const SkBitmap& source_bitmap,
SkRect scaled_bounds = RectToSkRect(gfx::Rect(scaled_size));
// Note(oshima): The following scaling code doesn't work with
// a mask image.
canvas.drawBitmapRect(source_bitmap, scaled_bounds, nullptr);
canvas.drawImageRect(source_bitmap.asImage(), scaled_bounds,
SkSamplingOptions());
return scaled_bitmap;
}

Expand Down
5 changes: 3 additions & 2 deletions chrome/browser/thumbnail/cc/thumbnail_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkMallocPixelRef.h"
#include "third_party/skia/include/core/SkPixelRef.h"
#include "ui/android/resources/ui_resource_provider.h"
Expand Down Expand Up @@ -995,7 +996,7 @@ void ThumbnailCache::DecompressionTask(
raw_data_small.allocPixels(SkImageInfo::MakeN32(
content_size.width(), content_size.height(), kOpaque_SkAlphaType));
SkCanvas small_canvas(raw_data_small);
small_canvas.drawBitmap(raw_data, 0, 0);
small_canvas.drawImage(raw_data.asImage(), 0, 0);
raw_data_small.setImmutable();
}
}
Expand Down Expand Up @@ -1026,7 +1027,7 @@ std::pair<SkBitmap, float> ThumbnailCache::CreateApproximation(
dst_bitmap.eraseColor(0);
SkCanvas canvas(dst_bitmap);
canvas.scale(new_scale, new_scale);
canvas.drawBitmap(bitmap, 0, 0, nullptr);
canvas.drawImage(bitmap.asImage(), 0, 0);
dst_bitmap.setImmutable();

return std::make_pair(dst_bitmap, new_scale * scale);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/vr/elements/environment/background.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ GLuint UploadImage(std::unique_ptr<SkBitmap> bitmap,
DCHECK(surface->get());
SkCanvas* canvas = (*surface)->getCanvas();
if (bitmap) {
canvas->drawBitmap(*bitmap, 0, 0);
canvas->drawImage(bitmap->asImage(), 0, 0);
} else {
// If we are missing a gradient image, blending with channels at .5 will
// have no effect -- it will be as if there is no gradient image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ void QRCodeGeneratorServiceImpl::DrawDino(SkCanvas* canvas,
dest_rect.offset(delta_x, delta_y);
SkRect dino_bounds;
dino_bitmap_.getBounds(&dino_bounds);
canvas->drawBitmapRect(dino_bitmap_, dino_bounds, dest_rect, nullptr);
canvas->drawImageRect(dino_bitmap_.asImage(), dino_bounds, dest_rect,
SkSamplingOptions(), nullptr,
SkCanvas::kStrict_SrcRectConstraint);
}

// Draws QR locators at three corners of |canvas|.
Expand Down
10 changes: 5 additions & 5 deletions components/exo/wayland/clients/blur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void DrawContents(SkImage* background_grid_image,
// Draw background grid.
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
canvas->drawImage(background_grid_image, 0, 0, &paint);
canvas->drawImage(background_grid_image, 0, 0, SkSamplingOptions(), &paint);

// Draw rotated rectangles.
SkScalar rect_size =
Expand Down Expand Up @@ -172,8 +172,8 @@ void Blur::Run(double sigma_x,
size.height() / content_surfaces.back()->height());
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
content_surfaces.back()->draw(canvas, 0, 0, &paint);
content_surfaces.back()->draw(
canvas, 0, 0, SkSamplingOptions(SkFilterMode::kLinear), &paint);
}

canvas->restore();
Expand All @@ -194,12 +194,12 @@ void Blur::Run(double sigma_x,
size.height() / blur_image->height());
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
SkSamplingOptions sampling(SkFilterMode::kLinear);
// Simulate multi-texturing by adding foreground opacity.
int alpha = (1.0 - kForegroundOpacity) * 255.0 + 0.5;
paint.setColor(SkColorSetA(SK_ColorBLACK, alpha));
canvas->drawImage(blurred_image, offset.x() - subset.x(),
offset.y() - subset.y(), &paint);
offset.y() - subset.y(), sampling, &paint);
canvas->restore();

// Restore blur surfaces for next frame.
Expand Down
6 changes: 4 additions & 2 deletions components/favicon_base/favicon_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
#include "ui/base/layout.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/favicon_size.h"
Expand Down Expand Up @@ -128,8 +129,9 @@ SkBitmap ResizeBitmapByDownsamplingIfPossible(
bitmap.eraseARGB(0, 0, 0, 0);

SkCanvas canvas(bitmap, SkSurfaceProps{});
canvas.drawBitmapRect(best_bitmap,
SkRect::MakeIWH(desired_size, desired_size), nullptr);
canvas.drawImageRect(best_bitmap.asImage(),
SkRect::MakeIWH(desired_size, desired_size),
SkSamplingOptions());
return bitmap;
}
return skia::ImageOperations::Resize(best_bitmap,
Expand Down
6 changes: 4 additions & 2 deletions components/favicon_base/select_favicon_frames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "components/favicon_base/favicon_util.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
Expand Down Expand Up @@ -44,8 +45,9 @@ SkBitmap SampleNearestNeighbor(const SkBitmap& contents, int desired_size) {

{
SkCanvas canvas(bitmap, SkSurfaceProps{});
canvas.drawBitmapRect(contents, SkRect::MakeIWH(desired_size, desired_size),
nullptr);
canvas.drawImageRect(contents.asImage(),
SkRect::MakeIWH(desired_size, desired_size),
SkSamplingOptions());
}

return bitmap;
Expand Down
10 changes: 5 additions & 5 deletions components/paint_preview/common/serial_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ TEST(PaintPreviewSerialUtils, TestImageContextLimitBudget) {
canvas1.drawRect(SkRect::MakeWH(1, 4), paint);
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(SkRect::MakeWH(40, 40));
canvas->drawBitmap(bitmap1, 0, 0);
canvas->drawBitmap(bitmap1, 0, 0);
canvas->drawBitmap(bitmap1, 0, 0);
canvas->drawImage(bitmap1.asImage(), 0, 0);
canvas->drawImage(bitmap1.asImage(), 0, 0);
canvas->drawImage(bitmap1.asImage(), 0, 0);
auto pic = recorder.finishRecordingAsPicture();

PictureSerializationContext picture_ctx;
Expand Down Expand Up @@ -194,8 +194,8 @@ TEST(PaintPreviewSerialUtils, TestImageContextLimitSize) {
canvas2.drawRect(SkRect::MakeWH(20, 5), paint);
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(SkRect::MakeWH(40, 40));
canvas->drawBitmap(bitmap1, 0, 0);
canvas->drawBitmap(bitmap2, 0, 0);
canvas->drawImage(bitmap1.asImage(), 0, 0);
canvas->drawImage(bitmap2.asImage(), 0, 0);
auto pic = recorder.finishRecordingAsPicture();

PictureSerializationContext picture_ctx;
Expand Down
Loading

0 comments on commit 566a2f0

Please sign in to comment.