Chromium Code Reviews| Index: cc/resources/raster_source.h |
| diff --git a/cc/resources/raster_source.h b/cc/resources/raster_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..026f4673ad7a1f41297d19cb8a1f25b673a9a1f3 |
| --- /dev/null |
| +++ b/cc/resources/raster_source.h |
| @@ -0,0 +1,74 @@ |
| +// 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_RESOURCES_RASTER_SOURCE_H_ |
| +#define CC_RESOURCES_RASTER_SOURCE_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "cc/base/cc_export.h" |
| +#include "cc/debug/rendering_stats_instrumentation.h" |
| +#include "third_party/skia/include/core/SkCanvas.h" |
| + |
| +namespace cc { |
| + |
| +class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { |
| + public: |
| + struct CC_EXPORT Analysis { |
| + Analysis() : is_solid_color(false) {} |
| + ~Analysis() {} |
| + |
| + bool is_solid_color; |
| + SkColor solid_color; |
| + }; |
| + |
| + // Raster a subrect of this PicturePileImpl into the given canvas. It is |
|
enne (OOO)
2014/10/24 22:27:35
"PicturePileImpl"
vmpstr
2014/10/24 23:15:23
Oops. Done.
|
| + // assumed that contents_scale has already been applied to this canvas. |
| + // Writes the total number of pixels rasterized and the time spent |
| + // rasterizing to the stats if the respective pointer is not NULL. When |
|
enne (OOO)
2014/10/24 22:27:35
Maybe the slow-down-raster-scale-factor bit should
vmpstr
2014/10/24 23:15:23
Done.
|
| + // slow-down-raster-scale-factor is set to a value greater than 1, the |
| + // reported rasterize time is the minimum measured value over all runs. |
| + virtual void RasterToBitmap( |
| + SkCanvas* canvas, |
| + const gfx::Rect& canvas_rect, |
| + float contents_scale, |
| + RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; |
| + |
| + // Analyze to determine if the given rect at given scale is of solid color in |
| + // this raster source. |
| + virtual void AnalyzeInRect( |
| + const gfx::Rect& content_rect, |
| + float contents_scale, |
| + Analysis* analysis, |
| + RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; |
| + |
| + // Populate the given list with all SkPixelRefs that may overlap the given |
| + // rect at given scale. |
| + virtual void GatherPixelRefs(const gfx::Rect& content_rect, |
| + float contents_scale, |
| + std::vector<SkPixelRef*>* pixel_refs) const = 0; |
| + |
| + // Return true iff this raster source can raster the given rect at given |
| + // scale. |
| + virtual bool RasterCoversRect(const gfx::Rect& content_rect, |
| + float contents_scale) const = 0; |
| + |
| + // Return true iff this raster source would benefit from using distance |
| + // fiend text. |
| + virtual bool SuitableForDistanceFieldText() const = 0; |
| + |
| + protected: |
| + friend class base::RefCountedThreadSafe<RasterSource>; |
| + |
| + RasterSource() {} |
| + virtual ~RasterSource() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_RESOURCES_RASTER_SOURCE_H_ |