1 // Copyright 2010 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CC_LAYERS_PICTURE_IMAGE_LAYER_H_ 6 #define CC_LAYERS_PICTURE_IMAGE_LAYER_H_ 7 8 #include <stddef.h> 9 10 #include "cc/cc_export.h" 11 #include "cc/layers/content_layer_client.h" 12 #include "cc/layers/picture_layer.h" 13 #include "cc/paint/paint_image.h" 14 #include "third_party/skia/include/core/SkRefCnt.h" 15 #include "ui/gfx/geometry/size.h" 16 17 namespace cc { 18 19 class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { 20 public: 21 static scoped_refptr<PictureImageLayer> Create(); 22 23 PictureImageLayer(const PictureImageLayer&) = delete; 24 PictureImageLayer& operator=(const PictureImageLayer&) = delete; 25 26 void SetImage(PaintImage image, 27 const SkMatrix& matrix, 28 bool uses_width_as_height); 29 30 gfx::Rect PaintableRegion() override; 31 32 // ContentLayerClient implementation. 33 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( 34 ContentLayerClient::PaintingControlSetting painting_control) override; 35 bool FillsBoundsCompletely() const override; 36 size_t GetApproximateUnsharedMemoryUsage() const override; 37 38 protected: 39 bool HasDrawableContent() const override; 40 41 private: 42 PictureImageLayer(); 43 ~PictureImageLayer() override; 44 45 PaintImage image_; 46 SkMatrix matrix_; 47 bool uses_width_as_height_; 48 }; 49 50 } // namespace cc 51 52 #endif // CC_LAYERS_PICTURE_IMAGE_LAYER_H_ 53