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

Side by Side Diff: Source/platform/graphics/OpaqueRectTrackingContentLayerDelegate.cpp

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, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void OpaqueRectTrackingContentLayerDelegate::paintContents( 51 void OpaqueRectTrackingContentLayerDelegate::paintContents(
52 SkCanvas* canvas, const WebRect& clip, bool canPaintLCDText, WebFloatRect& o paque, 52 SkCanvas* canvas, const WebRect& clip, bool canPaintLCDText, WebFloatRect& o paque,
53 blink::WebContentLayerClient::GraphicsContextStatus contextStatus) 53 blink::WebContentLayerClient::GraphicsContextStatus contextStatus)
54 { 54 {
55 static const unsigned char* annotationsEnabled = 0; 55 static const unsigned char* annotationsEnabled = 0;
56 if (UNLIKELY(!annotationsEnabled)) 56 if (UNLIKELY(!annotationsEnabled))
57 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA BLED_BY_DEFAULT("blink.graphics_context_annotations")); 57 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA BLED_BY_DEFAULT("blink.graphics_context_annotations"));
58 58
59 GraphicsContext context(canvas, 59 GraphicsContext context(canvas,
60 contextStatus == blink::WebContentLayerClient::GraphicsContextEnabled ? GraphicsContext::NothingDisabled : GraphicsContext::FullyDisabled); 60 contextStatus == blink::WebContentLayerClient::GraphicsContextEnabled ? GraphicsContext::NothingDisabled : GraphicsContext::FullyDisabled);
61 context.setTrackOpaqueRegion(!m_opaque); 61 context.setRegionTrackingMode(m_opaque ? GraphicsContext::RegionTrackingDisa bled : GraphicsContext::RegionTrackingOpaque);
62 context.setCertainlyOpaque(m_opaque); 62 context.setCertainlyOpaque(m_opaque);
63 context.setShouldSmoothFonts(canPaintLCDText); 63 context.setShouldSmoothFonts(canPaintLCDText);
64 64
65 if (*annotationsEnabled) 65 if (*annotationsEnabled)
66 context.setAnnotationMode(AnnotateAll); 66 context.setAnnotationMode(AnnotateAll);
67 67
68 // Record transform prior to painting, as all opaque tracking will be 68 // Record transform prior to painting, as all opaque tracking will be
69 // relative to this current value. 69 // relative to this current value.
70 AffineTransform canvasToContentTransform = context.getCTM().inverse(); 70 AffineTransform canvasToContentTransform = context.getCTM().inverse();
71 71
72 m_painter->paint(context, clip); 72 m_painter->paint(context, clip);
73 73
74 // Transform tracked opaque paints back to our layer's content space. 74 // Transform tracked opaque paints back to our layer's content space.
75 ASSERT(canvasToContentTransform.isInvertible()); 75 ASSERT(canvasToContentTransform.isInvertible());
76 ASSERT(canvasToContentTransform.preservesAxisAlignment()); 76 ASSERT(canvasToContentTransform.preservesAxisAlignment());
77 opaque = canvasToContentTransform.mapRect(context.opaqueRegion().asRect()); 77 opaque = canvasToContentTransform.mapRect(context.opaqueRegion().asRect());
78 } 78 }
79 79
80 } 80 }
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContextTest.cpp ('k') | Source/platform/graphics/RecordingImageBufferSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698