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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 2180793002: remove fClipStack and attach/deattach-from-canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: no need for attachToCanvas Created 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.h » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels , rowBytes, flags); 280 fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels , rowBytes, flags);
281 281
282 return true; 282 return true;
283 } 283 }
284 284
285 bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) { 285 bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) {
286 ASSERT_SINGLE_OWNER 286 ASSERT_SINGLE_OWNER
287 return false; 287 return false;
288 } 288 }
289 289
290 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {
291 ASSERT_SINGLE_OWNER
292 INHERITED::onAttachToCanvas(canvas);
293
294 // Canvas promises that this ptr is valid until onDetachFromCanvas is called
295 fClipStack.reset(SkRef(canvas->getClipStack()));
296 }
297
298 void SkGpuDevice::onDetachFromCanvas() {
299 ASSERT_SINGLE_OWNER
300 INHERITED::onDetachFromCanvas();
301 fClip.reset();
302 fClipStack.reset(nullptr);
303 }
304
305 // call this every draw call, to ensure that the context reflects our state, 290 // call this every draw call, to ensure that the context reflects our state,
306 // and not the state from some other canvas/device 291 // and not the state from some other canvas/device
307 void SkGpuDevice::prepareDraw(const SkDraw& draw) { 292 void SkGpuDevice::prepareDraw(const SkDraw& draw) {
308 ASSERT_SINGLE_OWNER 293 ASSERT_SINGLE_OWNER
309 SkASSERT(fClipStack.get());
310 294
311 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack); 295 fClip.reset(draw.fClipStack, &this->getOrigin());
312
313 fClip.reset(fClipStack, &this->getOrigin());
314 } 296 }
315 297
316 GrDrawContext* SkGpuDevice::accessDrawContext() { 298 GrDrawContext* SkGpuDevice::accessDrawContext() {
317 ASSERT_SINGLE_OWNER 299 ASSERT_SINGLE_OWNER
318 return fDrawContext.get(); 300 return fDrawContext.get();
319 } 301 }
320 302
321 void SkGpuDevice::clearAll() { 303 void SkGpuDevice::clearAll() {
322 ASSERT_SINGLE_OWNER 304 ASSERT_SINGLE_OWNER
323 GrColor color = 0; 305 GrColor color = 0;
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 } 1852 }
1871 1853
1872 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1854 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1873 ASSERT_SINGLE_OWNER 1855 ASSERT_SINGLE_OWNER
1874 // We always return a transient cache, so it is freed after each 1856 // We always return a transient cache, so it is freed after each
1875 // filter traversal. 1857 // filter traversal.
1876 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1858 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1877 } 1859 }
1878 1860
1879 #endif 1861 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698