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

Unified Diff: cc/resources/raster_source.h

Issue 666273002: cc: Added raster source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reviews 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..04d96af3ee5a808611fd5237167ab39836574499
--- /dev/null
+++ b/cc/resources/raster_source.h
@@ -0,0 +1,72 @@
+// 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"
reveman 2014/10/27 14:39:46 Can you forward declare RenderingStatsInstrumentat
vmpstr 2014/10/27 15:55:11 Done.
+#include "third_party/skia/include/core/SkCanvas.h"
reveman 2014/10/27 14:39:46 forward declare SkCanvas instead?
vmpstr 2014/10/27 15:55:11 Done.
+
+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;
+ };
reveman 2014/10/27 14:39:46 Seems a bit silly to keep this struct when it's on
vmpstr 2014/10/27 15:55:10 I've kept this for now and added a TODO. Currently
reveman 2014/10/27 17:14:43 Ok, can you change the name to SolidColorAnalysis
vmpstr 2014/10/27 18:46:40 Done.
+
+ // 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.
+ virtual void RasterToBitmap(
reveman 2014/10/27 14:39:46 hm, ToBitmap doesn't seem right. RasterToCanvas? o
vmpstr 2014/10/27 15:55:11 Changed to PlaybackToCanvas
+ SkCanvas* canvas,
+ const gfx::Rect& canvas_rect,
+ float contents_scale,
+ RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0;
reveman 2014/10/27 14:39:46 Do we need to be passing this RenderingStatsInstru
vmpstr 2014/10/27 15:55:11 Good question. I'll talk to ernstm to see whether
reveman 2014/10/27 17:14:43 Acknowledged.
+
+ // 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,
reveman 2014/10/27 14:39:46 CoversRect? RasterSource::CoversRect looks better
vmpstr 2014/10/27 15:55:11 Done.
+ float contents_scale) const = 0;
+
+ // Return true iff this raster source would benefit from using distance
+ // fiend text.
reveman 2014/10/27 14:39:46 typo: fiend
vmpstr 2014/10/27 15:55:11 Done.
+ 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