// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_PICTURE_PILE_IMPL_H_ #define CC_PICTURE_PILE_IMPL_H_ #include #include #include "base/threading/thread.h" #include "cc/cc_export.h" #include "cc/picture_pile_base.h" #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkPicture.h" namespace cc { struct RenderingStats; class CC_EXPORT PicturePileImpl : public PicturePileBase { public: static scoped_refptr Create(); // Get paint-safe version of this picture for a specific thread. PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*); // Clone a paint-safe version of this picture. scoped_refptr CloneForDrawing() const; // Raster a subrect of this PicturePileImpl into the given canvas. // It's only safe to call paint on a cloned version. // It is assumed that contentsScale has already been applied to this canvas. void Raster( SkCanvas* canvas, gfx::Rect content_rect, float contents_scale, int64* total_pixels_rasterized); void GatherPixelRefs( gfx::Rect content_rect, float contents_scale, std::list& pixel_refs); void PushPropertiesTo(PicturePileImpl* other); skia::RefPtr GetFlattenedPicture(); void set_slow_down_raster_scale_factor(int factor) { slow_down_raster_scale_factor_for_debug_ = factor; } bool IsCheapInRect(gfx::Rect content_rect, float contents_scale) const; protected: friend class PicturePile; PicturePileImpl(); virtual ~PicturePileImpl(); typedef std::map > CloneMap; CloneMap clones_; int slow_down_raster_scale_factor_for_debug_; DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); }; } // namespace cc #endif // CC_PICTURE_PILE_IMPL_H_