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

Unified Diff: Source/platform/graphics/RegionTracker.h

Issue 413313002: Treat calls to CanvasRenderingContext2D.clearRect as operations that clear the canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: regionTrackingEnabled Created 6 years, 5 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
Index: Source/platform/graphics/RegionTracker.h
diff --git a/Source/platform/graphics/skia/OpaqueRegionSkia.h b/Source/platform/graphics/RegionTracker.h
similarity index 81%
rename from Source/platform/graphics/skia/OpaqueRegionSkia.h
rename to Source/platform/graphics/RegionTracker.h
index 14cb5ad67b91e11b7e9d7a5b33f5489e857ba287..793a13dda8896ee69294a27bfe2f678b3cd96139 100644
--- a/Source/platform/graphics/skia/OpaqueRegionSkia.h
+++ b/Source/platform/graphics/RegionTracker.h
@@ -28,26 +28,30 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef OpaqueRegionSkia_h
-#define OpaqueRegionSkia_h
+#ifndef RegionTracker_h
+#define RegionTracker_h
#include "platform/PlatformExport.h"
#include "platform/geometry/IntRect.h"
-
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkPaint.h"
-#include "SkPoint.h"
-#include "SkRect.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkPaint.h"
+#include "third_party/skia/include/core/SkPoint.h"
+#include "third_party/skia/include/core/SkRect.h"
namespace blink {
class GraphicsContext;
+enum RegionTrackingMode {
+ TrackOpaqueRegion,
+ TRackOverwriteRegion
+};
+
// This class is an encapsulation of functionality for GraphicsContext, and its methods are mirrored
// there for the outside world. It tracks paints and computes what area will be opaque.
-class PLATFORM_EXPORT OpaqueRegionSkia FINAL {
+class PLATFORM_EXPORT RegionTracker FINAL {
public:
- OpaqueRegionSkia();
+ RegionTracker();
// The resulting opaque region as a single rect.
IntRect asRect() const;
@@ -57,6 +61,14 @@ public:
void setImageMask(const SkRect& imageOpaqueRect);
+ enum RegionType {
+ Opaque,
+ Overwrite
+ };
+
+ // Set this to true to track regions that occlude the destination instead of only regions that produce opaque pixels.
+ void setTrackedRegionType(RegionType type) { m_trackedRegionType = type; }
+
enum DrawType {
FillOnly,
FillOrStroke
@@ -96,9 +108,10 @@ private:
SkRect& currentTrackingOpaqueRect();
SkRect m_opaqueRect;
+ RegionType m_trackedRegionType;
Vector<CanvasLayerState, 3> m_canvasLayerStack;
};
}
-#endif // OpaqueRegionSkia_h
+#endif // RegionTracker_h
« no previous file with comments | « Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp ('k') | Source/platform/graphics/RegionTracker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698