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

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

Issue 212993004: GC::saveLayer() may taint the current clip. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Always save the clip & matrix. Created 6 years, 9 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 m_paintStateIndex--; 172 m_paintStateIndex--;
173 m_paintState = m_paintStateStack[m_paintStateIndex].get(); 173 m_paintState = m_paintStateStack[m_paintStateIndex].get();
174 } 174 }
175 175
176 CanvasSaveState savedState = m_canvasStateStack.last(); 176 CanvasSaveState savedState = m_canvasStateStack.last();
177 m_canvasStateStack.removeLast(); 177 m_canvasStateStack.removeLast();
178 m_canvasSaveFlags = savedState.m_flags; 178 m_canvasSaveFlags = savedState.m_flags;
179 m_canvas->restoreToCount(savedState.m_restoreCount); 179 m_canvas->restoreToCount(savedState.m_restoreCount);
180 } 180 }
181 181
182 void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint, SkCa nvas::SaveFlags saveFlags) 182 void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint,
183 SkCanvas::SaveFlags extraFlags)
183 { 184 {
184 if (paintingDisabled()) 185 if (paintingDisabled())
185 return; 186 return;
186 187
187 realizeCanvasSave(SkCanvas::kMatrixClip_SaveFlag); 188 realizeCanvasSave(SkCanvas::kMatrixClip_SaveFlag);
188 189
189 m_canvas->saveLayer(bounds, paint, saveFlags); 190 // Always save the clip & matrix.
191 SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(
192 SkCanvas::kMatrixClip_SaveFlag | extraFlags);
Stephen White 2014/03/26 17:45:52 Just an idea, but we could probably set these in t
f(malita) 2014/03/26 19:31:28 Done.
193 m_canvas->saveLayer(bounds, paint, flags);
194
190 if (bounds) 195 if (bounds)
191 m_canvas->clipRect(*bounds); 196 m_canvas->clipRect(*bounds);
192 if (m_trackOpaqueRegion) 197 if (m_trackOpaqueRegion)
193 m_opaqueRegion.pushCanvasLayer(paint); 198 m_opaqueRegion.pushCanvasLayer(paint);
194 } 199 }
195 200
196 void GraphicsContext::restoreLayer() 201 void GraphicsContext::restoreLayer()
197 { 202 {
198 if (paintingDisabled()) 203 if (paintingDisabled())
199 return; 204 return;
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 1890
1886 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) 1891 void GraphicsContext::didDrawTextInRect(const SkRect& textRect)
1887 { 1892 {
1888 if (m_trackTextRegion) { 1893 if (m_trackTextRegion) {
1889 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); 1894 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion");
1890 m_textRegion.join(textRect); 1895 m_textRegion.join(textRect);
1891 } 1896 }
1892 } 1897 }
1893 1898
1894 } 1899 }
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698