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

Unified Diff: cc/resources/raster_source.h

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/resources/raster_buffer.h ('k') | cc/resources/raster_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..603b883427a7e771116294c3a75081b78f97d8ba
--- /dev/null
+++ b/cc/resources/raster_source.h
@@ -0,0 +1,77 @@
+// 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 "third_party/skia/include/core/SkColor.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class RenderingStatsInstrumentation;
+
+class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
+ public:
+ struct CC_EXPORT SolidColorAnalysis {
+ SolidColorAnalysis()
+ : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
+ ~SolidColorAnalysis() {}
+
+ bool is_solid_color;
+ SkColor solid_color;
+ };
+
+ // Raster a subrect of this RasterSource into the given canvas. It is
+ // 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 nullptr.
+ // TODO(vmpstr): Remove RenderingStatsInstrumentation from the interface.
+ virtual void PlaybackToCanvas(
+ 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 PerformSolidColorAnalysis(
+ const gfx::Rect& content_rect,
+ float contents_scale,
+ SolidColorAnalysis* 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 CoversRect(const gfx::Rect& content_rect,
+ float contents_scale) const = 0;
+
+ // Return true iff this raster source would benefit from using distance
+ // field 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_
« no previous file with comments | « cc/resources/raster_buffer.h ('k') | cc/resources/raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698