Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: cc/playback/display_list_raster_source.cc

Issue 1666583002: Use SkTLazy for ScopedDecodedImageLock's optional paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/display_list_raster_source.cc
diff --git a/cc/playback/display_list_raster_source.cc b/cc/playback/display_list_raster_source.cc
index d1a9fc40d051438e6ba269e0bed53766f240bcd6..f20252d66fac46a8549a7a26761a32a557b7eafe 100644
--- a/cc/playback/display_list_raster_source.cc
+++ b/cc/playback/display_list_raster_source.cc
@@ -16,6 +16,7 @@
#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "third_party/skia/include/core/SkTLazy.h"
#include "third_party/skia/include/utils/SkNWayCanvas.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -145,7 +146,6 @@ class ImageHijackCanvas : public SkNWayCanvas {
bool has_perspective,
const SkPaint* paint)
: image_decode_controller_(image_decode_controller),
- paint_(paint),
draw_image_(image,
RoundOutRect(src_rect),
scale,
@@ -155,10 +155,9 @@ class ImageHijackCanvas : public SkNWayCanvas {
decoded_draw_image_(
image_decode_controller_->GetDecodedImageForDraw(draw_image_)) {
DCHECK(image->isLazyGenerated());
- if (paint) {
- decoded_paint_ = *paint;
- decoded_paint_.setFilterQuality(decoded_draw_image_.filter_quality());
- }
+ if (paint)
+ decoded_paint_.set(*paint)->setFilterQuality(
+ decoded_draw_image_.filter_quality());
}
~ScopedDecodedImageLock() {
@@ -170,15 +169,15 @@ class ImageHijackCanvas : public SkNWayCanvas {
return decoded_draw_image_;
}
const SkPaint* decoded_paint() const {
- return paint_ ? &decoded_paint_ : nullptr;
+ return decoded_paint_.getMaybeNull();
}
private:
ImageDecodeController* image_decode_controller_;
- const SkPaint* paint_;
DrawImage draw_image_;
DecodedDrawImage decoded_draw_image_;
- SkPaint decoded_paint_;
+ // TODO(fmalita): use base::Optional when it becomes available
+ SkTLazy<SkPaint> decoded_paint_;
};
ImageDecodeController* image_decode_controller_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698