diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-13 13:24:50 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 10:57:25 +0000 |
commit | af3d4809763ef308f08ced947a73b624729ac7ea (patch) | |
tree | 4402b911e30383f6c6dace1e8cf3b8e85355db3a /chromium/cc/layers/picture_image_layer.cc | |
parent | 0e8ff63a407fe323e215bb1a2c423c09a4747c8a (diff) |
BASELINE: Update Chromium to 47.0.2526.14
Also adding in sources needed for spellchecking.
Change-Id: Idd44170fa1616f26315188970a8d5ba7d472b18a
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'chromium/cc/layers/picture_image_layer.cc')
-rw-r--r-- | chromium/cc/layers/picture_image_layer.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/chromium/cc/layers/picture_image_layer.cc b/chromium/cc/layers/picture_image_layer.cc index 6d903bd40bc..ee129330b3e 100644 --- a/chromium/cc/layers/picture_image_layer.cc +++ b/chromium/cc/layers/picture_image_layer.cc @@ -5,8 +5,10 @@ #include "cc/layers/picture_image_layer.h" #include "cc/layers/picture_image_layer_impl.h" +#include "cc/playback/display_item_list_settings.h" #include "cc/playback/drawing_display_item.h" #include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "ui/gfx/skia_util.h" @@ -31,18 +33,18 @@ scoped_ptr<LayerImpl> PictureImageLayer::CreateLayerImpl( } bool PictureImageLayer::HasDrawableContent() const { - return !bitmap_.isNull() && PictureLayer::HasDrawableContent(); + return image_ && PictureLayer::HasDrawableContent(); } -void PictureImageLayer::SetBitmap(const SkBitmap& bitmap) { - // SetBitmap() currently gets called whenever there is any +void PictureImageLayer::SetImage(skia::RefPtr<const SkImage> image) { + // SetImage() currently gets called whenever there is any // style change that affects the layer even if that change doesn't // affect the actual contents of the image (e.g. a CSS animation). // With this check in place we avoid unecessary texture uploads. - if (bitmap.pixelRef() && bitmap.pixelRef() == bitmap_.pixelRef()) + if (image_.get() == image.get()) return; - bitmap_ = bitmap; + image_ = image.Pass(); UpdateDrawsContent(HasDrawableContent()); SetNeedsDisplay(); } @@ -51,19 +53,20 @@ void PictureImageLayer::PaintContents( SkCanvas* canvas, const gfx::Rect& clip, ContentLayerClient::PaintingControlSetting painting_control) { - if (!bitmap_.width() || !bitmap_.height()) - return; + DCHECK(image_); + DCHECK_GT(image_->width(), 0); + DCHECK_GT(image_->height(), 0); SkScalar content_to_layer_scale_x = - SkFloatToScalar(static_cast<float>(bounds().width()) / bitmap_.width()); + SkFloatToScalar(static_cast<float>(bounds().width()) / image_->width()); SkScalar content_to_layer_scale_y = - SkFloatToScalar(static_cast<float>(bounds().height()) / bitmap_.height()); + SkFloatToScalar(static_cast<float>(bounds().height()) / image_->height()); canvas->scale(content_to_layer_scale_x, content_to_layer_scale_y); // Because Android WebView resourceless software draw mode rasters directly // to the root canvas, this draw must use the kSrcOver_Mode so that // transparent images blend correctly. - canvas->drawBitmap(bitmap_, 0, 0); + canvas->drawImage(image_.get(), 0, 0); } scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList( @@ -71,9 +74,10 @@ scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList( ContentLayerClient::PaintingControlSetting painting_control) { // Picture image layers can be used with GatherPixelRefs, so cached SkPictures // are currently required. - const bool use_cached_picture = true; + DisplayItemListSettings settings; + settings.use_cached_picture = true; scoped_refptr<DisplayItemList> display_list = - DisplayItemList::Create(clip, use_cached_picture); + DisplayItemList::Create(clip, settings); SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip)); @@ -92,4 +96,8 @@ bool PictureImageLayer::FillsBoundsCompletely() const { return false; } +size_t PictureImageLayer::GetApproximateUnsharedMemoryUsage() const { + return 0; +} + } // namespace cc |