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

Unified Diff: cc/playback/raster_source.h

Issue 2748263002: Move cc::DisplayItemList and related classes into cc/paint/ (Closed)
Patch Set: Merge branch 'master' into ccpaint Created 3 years, 9 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 | « cc/playback/largest_display_item.cc ('k') | cc/playback/raster_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/raster_source.h
diff --git a/cc/playback/raster_source.h b/cc/playback/raster_source.h
deleted file mode 100644
index 5fd81aa129c6149b56757e117f625a75a307c834..0000000000000000000000000000000000000000
--- a/cc/playback/raster_source.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2014 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_PLAYBACK_RASTER_SOURCE_H_
-#define CC_PLAYBACK_RASTER_SOURCE_H_
-
-#include <stddef.h>
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "cc/base/cc_export.h"
-#include "cc/debug/rendering_stats_instrumentation.h"
-#include "cc/playback/image_id.h"
-#include "cc/playback/recording_source.h"
-#include "skia/ext/analysis_canvas.h"
-#include "third_party/skia/include/core/SkPicture.h"
-#include "ui/gfx/color_space.h"
-
-namespace cc {
-class DisplayItemList;
-class DrawImage;
-class ImageDecodeCache;
-
-class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
- public:
- struct CC_EXPORT PlaybackSettings {
- PlaybackSettings();
- PlaybackSettings(const PlaybackSettings&);
- PlaybackSettings(PlaybackSettings&&);
- ~PlaybackSettings();
-
- // If set to true, this indicates that the canvas has already been
- // rasterized into. This means that the canvas cannot be cleared safely.
- bool playback_to_shared_canvas;
-
- // If set to true, none of the images will be rasterized.
- bool skip_images;
-
- // If set to true, we will use an image hijack canvas, which enables
- // compositor image caching.
- bool use_image_hijack_canvas;
-
- // If non-empty, an image hijack canvas will be used to skip these images
- // during raster.
- // TODO(khushalsagar): Consolidate more settings for playback here? See
- // crbug.com/691076.
- ImageIdFlatSet images_to_skip;
- };
-
- static scoped_refptr<RasterSource> CreateFromRecordingSource(
- const RecordingSource* other,
- bool can_use_lcd_text);
-
- // TODO(trchen): Deprecated.
- void PlaybackToCanvas(SkCanvas* canvas,
- const gfx::ColorSpace& canvas_color_space,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- float contents_scale,
- const PlaybackSettings& settings) const;
-
- // Raster this RasterSource into the given canvas. Canvas states such as
- // CTM and clip region will be respected. This function will replace pixels
- // in the clip region without blending. It is assumed that existing pixels
- // may be uninitialized and will be cleared before playback.
- //
- // Virtual for testing.
- //
- // Note that this should only be called after the image decode controller has
- // been set, which happens during commit.
- virtual void PlaybackToCanvas(SkCanvas* canvas,
- const gfx::ColorSpace& canvas_color_space,
- const PlaybackSettings& settings) const;
-
- // Returns whether the given rect at given scale is of solid color in
- // this raster source, as well as the solid color value.
- bool PerformSolidColorAnalysis(const gfx::Rect& content_rect,
- float contents_scale,
- SkColor* color) const;
-
- // Returns true iff the whole raster source is of solid color.
- bool IsSolidColor() const;
-
- // Returns the color of the raster source if it is solid color. The results
- // are unspecified if IsSolidColor returns false.
- SkColor GetSolidColor() const;
-
- // Returns the size of this raster source.
- gfx::Size GetSize() const;
-
- // Populate the given list with all images that may overlap the given
- // rect in layer space. The returned draw images' matrices are modified as if
- // they were being using during raster at scale |raster_scale|.
- void GetDiscardableImagesInRect(const gfx::Rect& layer_rect,
- float contents_scale,
- std::vector<DrawImage>* images) const;
-
- // Return true iff this raster source can raster the given rect in layer
- // space.
- bool CoversRect(const gfx::Rect& layer_rect) const;
-
- // Returns true if this raster source has anything to rasterize.
- virtual bool HasRecordings() const;
-
- // Valid rectangle in which everything is recorded and can be rastered from.
- virtual gfx::Rect RecordedViewport() const;
-
- gfx::Rect GetRectForImage(ImageId image_id) const;
-
- // Tracing functionality.
- virtual void DidBeginTracing();
- virtual void AsValueInto(base::trace_event::TracedValue* array) const;
- virtual sk_sp<SkPicture> GetFlattenedPicture();
- virtual size_t GetMemoryUsage() const;
-
- // Return true if LCD anti-aliasing may be used when rastering text.
- virtual bool CanUseLCDText() const;
-
- scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const;
-
- // Image decode controller should be set once. Its lifetime has to exceed that
- // of the raster source, since the raster source will access it during raster.
- void set_image_decode_cache(ImageDecodeCache* image_decode_cache) {
- DCHECK(image_decode_cache);
- image_decode_cache_ = image_decode_cache;
- }
-
- protected:
- friend class base::RefCountedThreadSafe<RasterSource>;
-
- RasterSource(const RecordingSource* other, bool can_use_lcd_text);
- RasterSource(const RasterSource* other, bool can_use_lcd_text);
- virtual ~RasterSource();
-
- // These members are const as this raster source may be in use on another
- // thread and so should not be touched after construction.
- const scoped_refptr<DisplayItemList> display_list_;
- const size_t painter_reported_memory_usage_;
- const SkColor background_color_;
- const bool requires_clear_;
- const bool can_use_lcd_text_;
- const bool is_solid_color_;
- const SkColor solid_color_;
- const gfx::Rect recorded_viewport_;
- const gfx::Size size_;
- const bool clear_canvas_with_debug_color_;
- const int slow_down_raster_scale_factor_for_debug_;
-
- // In practice, this is only set once before raster begins, so it's ok with
- // respect to threading.
- ImageDecodeCache* image_decode_cache_;
-
- private:
- void RasterCommon(SkCanvas* canvas,
- const gfx::ColorSpace& canvas_color_space,
- SkPicture::AbortCallback* callback) const;
-
- void PrepareForPlaybackToCanvas(SkCanvas* canvas) const;
-
- DISALLOW_COPY_AND_ASSIGN(RasterSource);
-};
-
-} // namespace cc
-
-#endif // CC_PLAYBACK_RASTER_SOURCE_H_
« no previous file with comments | « cc/playback/largest_display_item.cc ('k') | cc/playback/raster_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698