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

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

Issue 651243002: Clarify GraphicsContext::beginLayer()/endLayer() have unexpected behaviors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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 unified diff | Download patch
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 } 185 }
186 186
187 void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint) 187 void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint)
188 { 188 {
189 if (contextDisabled()) 189 if (contextDisabled())
190 return; 190 return;
191 191
192 ASSERT(m_canvas); 192 ASSERT(m_canvas);
193 193
194 realizeCanvasSave(); 194 m_paintState->incrementSaveCount();
195 195 m_canvasStateStack.append(CanvasSaveState(m_pendingCanvasSave, m_canvas->get SaveCount()));
196 m_canvas->saveLayer(bounds, paint); 196 m_canvas->saveLayer(bounds, paint);
197 m_pendingCanvasSave = false;
197 if (regionTrackingEnabled()) 198 if (regionTrackingEnabled())
198 m_trackedRegion.pushCanvasLayer(paint); 199 m_trackedRegion.pushCanvasLayer(paint);
199 } 200 }
200 201
201 void GraphicsContext::restoreLayer() 202 void GraphicsContext::restoreLayer()
202 { 203 {
203 if (contextDisabled()) 204 if (contextDisabled())
204 return; 205 return;
205 206
206 ASSERT(m_canvas); 207 ASSERT(m_canvas);
207 208
208 m_canvas->restore(); 209 restore();
209 if (regionTrackingEnabled()) 210 if (regionTrackingEnabled())
210 m_trackedRegion.popCanvasLayer(this); 211 m_trackedRegion.popCanvasLayer(this);
211 } 212 }
212 213
213 void GraphicsContext::beginAnnotation(const AnnotationList& annotations) 214 void GraphicsContext::beginAnnotation(const AnnotationList& annotations)
214 { 215 {
215 if (contextDisabled()) 216 if (contextDisabled())
216 return; 217 return;
217 218
218 ASSERT(m_canvas); 219 ASSERT(m_canvas);
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 // FIXME: This is to not break tests (it results in the filter bitmap fl ag 2014 // FIXME: This is to not break tests (it results in the filter bitmap fl ag
2014 // being set to true). We need to decide if we respect InterpolationNone 2015 // being set to true). We need to decide if we respect InterpolationNone
2015 // being returned from computeInterpolationQuality. 2016 // being returned from computeInterpolationQuality.
2016 resampling = InterpolationLow; 2017 resampling = InterpolationLow;
2017 } 2018 }
2018 resampling = limitInterpolationQuality(this, resampling); 2019 resampling = limitInterpolationQuality(this, resampling);
2019 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); 2020 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling));
2020 } 2021 }
2021 2022
2022 } // namespace blink 2023 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698