Index: cc/raster/image_hijack_canvas.cc |
diff --git a/cc/raster/image_hijack_canvas.cc b/cc/raster/image_hijack_canvas.cc |
index ea03dfbf6364419dfee5209518ce7af6576e7ee4..d35e1bbc76b6267546345f4782d44d317a740b65 100644 |
--- a/cc/raster/image_hijack_canvas.cc |
+++ b/cc/raster/image_hijack_canvas.cc |
@@ -13,6 +13,11 @@ |
namespace cc { |
namespace { |
+// Using a single id for images captured using the hijack canvas. |
+// TODO(khushalsagar): This should not be necessary once this is eliminated and |
+// we replace images while iterating through the ops in PaintOpBuffer. |
+PaintImage::Id s_canvas_paint_image_id = PaintImage::GetNextId(); |
vmpstr
2017/05/12 22:15:42
I think this should be a static int instead of Get
Khushal
2017/05/13 02:45:50
Do you mean like kNonLazyStableId?
vmpstr
2017/05/15 15:02:55
Either kNonLazyStableId or some other identifier,
Khushal
2017/05/15 21:22:14
Done. I added a kWrongStableId to mark it clearly
|
+ |
SkIRect RoundOutRect(const SkRect& rect) { |
SkIRect result; |
rect.roundOut(&result); |
@@ -22,13 +27,13 @@ SkIRect RoundOutRect(const SkRect& rect) { |
class ScopedDecodedImageLock { |
public: |
ScopedDecodedImageLock(ImageDecodeCache* image_decode_cache, |
- sk_sp<const SkImage> image, |
+ sk_sp<SkImage> image, |
const SkRect& src_rect, |
const SkMatrix& matrix, |
const SkPaint* paint, |
const gfx::ColorSpace& target_color_space) |
: image_decode_cache_(image_decode_cache), |
- draw_image_(std::move(image), |
+ draw_image_(PaintImage(s_canvas_paint_image_id, std::move(image)), |
RoundOutRect(src_rect), |
paint ? paint->getFilterQuality() : kNone_SkFilterQuality, |
matrix, |
@@ -94,7 +99,7 @@ class ScopedImagePaint { |
total_image_matrix.preConcat(ctm); |
ScopedDecodedImageLock scoped_lock( |
- image_decode_cache, sk_ref_sp(image), |
+ image_decode_cache, sk_ref_sp(const_cast<SkImage*>(image)), |
vmpstr
2017/05/12 22:15:42
image is already non const?
Khushal
2017/05/15 21:22:14
Done.
|
SkRect::MakeIWH(image->width(), image->height()), total_image_matrix, |
&paint, target_color_space); |
const DecodedDrawImage& decoded_image = scoped_lock.decoded_image(); |
@@ -133,7 +138,7 @@ const SkImage* GetImageInPaint(const SkPaint& paint) { |
ImageHijackCanvas::ImageHijackCanvas(int width, |
int height, |
ImageDecodeCache* image_decode_cache, |
- const ImageIdFlatSet* images_to_skip, |
+ const SkImageIdFlatSet* images_to_skip, |
const gfx::ColorSpace& target_color_space) |
: SkNWayCanvas(width, height), |
image_decode_cache_(image_decode_cache), |
@@ -173,7 +178,7 @@ void ImageHijackCanvas::onDrawImage(const SkImage* image, |
SkMatrix ctm = getTotalMatrix(); |
ScopedDecodedImageLock scoped_lock( |
- image_decode_cache_, sk_ref_sp(image), |
+ image_decode_cache_, sk_ref_sp(const_cast<SkImage*>(image)), |
SkRect::MakeIWH(image->width(), image->height()), ctm, paint, |
target_color_space_); |
const DecodedDrawImage& decoded_image = scoped_lock.decoded_image(); |
@@ -223,7 +228,8 @@ void ImageHijackCanvas::onDrawImageRect(const SkImage* image, |
matrix.setRectToRect(*src, dst, SkMatrix::kFill_ScaleToFit); |
matrix.postConcat(getTotalMatrix()); |
- ScopedDecodedImageLock scoped_lock(image_decode_cache_, sk_ref_sp(image), |
+ ScopedDecodedImageLock scoped_lock(image_decode_cache_, |
+ sk_ref_sp(const_cast<SkImage*>(image)), |
*src, matrix, paint, target_color_space_); |
const DecodedDrawImage& decoded_image = scoped_lock.decoded_image(); |
if (!decoded_image.image()) |