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

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

Issue 1385823002: Fix memory leak in ClipMaskManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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 2012 Google Inc. 2 * Copyright 2012 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 "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { 301 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) {
302 scissorState->set(scissorSpaceIBounds); 302 scissorState->set(scissorSpaceIBounds);
303 } 303 }
304 this->setPipelineBuilderStencil(pipelineBuilder, ars); 304 this->setPipelineBuilderStencil(pipelineBuilder, ars);
305 return true; 305 return true;
306 } 306 }
307 } 307 }
308 308
309 // If MSAA is enabled we can do everything in the stencil buffer. 309 // If MSAA is enabled we can do everything in the stencil buffer.
310 if (0 == rt->numStencilSamples() && requiresAA) { 310 if (0 == rt->numStencilSamples() && requiresAA) {
311 GrTexture* result = nullptr; 311 SkAutoTUnref<GrTexture> result;
312 312
313 // The top-left of the mask corresponds to the top-left corner of the bo unds. 313 // The top-left of the mask corresponds to the top-left corner of the bo unds.
314 SkVector clipToMaskOffset = { 314 SkVector clipToMaskOffset = {
315 SkIntToScalar(-clipSpaceIBounds.fLeft), 315 SkIntToScalar(-clipSpaceIBounds.fLeft),
316 SkIntToScalar(-clipSpaceIBounds.fTop) 316 SkIntToScalar(-clipSpaceIBounds.fTop)
317 }; 317 };
318 318
319 if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) { 319 if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) {
320 // The clip geometry is complex enough that it will be more efficien t to create it 320 // The clip geometry is complex enough that it will be more efficien t to create it
321 // entirely in software 321 // entirely in software
322 result = this->createSoftwareClipMask(genID, 322 result.reset(this->createSoftwareClipMask(genID,
323 initialState, 323 initialState,
324 elements, 324 elements,
325 clipToMaskOffset, 325 clipToMaskOffset,
326 clipSpaceIBounds); 326 clipSpaceIBounds));
327 } else { 327 } else {
328 result = this->createAlphaClipMask(genID, 328 result.reset(this->createAlphaClipMask(genID,
329 initialState, 329 initialState,
330 elements, 330 elements,
331 clipToMaskOffset, 331 clipToMaskOffset,
332 clipSpaceIBounds); 332 clipSpaceIBounds));
333 } 333 }
334 334
335 if (result) { 335 if (result) {
336 arfps->set(&pipelineBuilder); 336 arfps->set(&pipelineBuilder);
337 // The mask's top left coord should be pinned to the rounded-out top left corner of 337 // The mask's top left coord should be pinned to the rounded-out top left corner of
338 // clipSpace bounds. We determine the mask's position WRT to the ren der target here. 338 // clipSpace bounds. We determine the mask's position WRT to the ren der target here.
339 SkIRect rtSpaceMaskBounds = clipSpaceIBounds; 339 SkIRect rtSpaceMaskBounds = clipSpaceIBounds;
340 rtSpaceMaskBounds.offset(-clip.origin()); 340 rtSpaceMaskBounds.offset(-clip.origin());
341 setup_drawstate_aaclip(pipelineBuilder, result, arfps, rtSpaceMaskBo unds); 341 setup_drawstate_aaclip(pipelineBuilder, result, arfps, rtSpaceMaskBo unds);
342 this->setPipelineBuilderStencil(pipelineBuilder, ars); 342 this->setPipelineBuilderStencil(pipelineBuilder, ars);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1134
1135 //////////////////////////////////////////////////////////////////////////////// 1135 ////////////////////////////////////////////////////////////////////////////////
1136 1136
1137 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1137 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1138 GrStencilSettings* settings) { 1138 GrStencilSettings* settings) {
1139 if (stencilAttachment) { 1139 if (stencilAttachment) {
1140 int stencilBits = stencilAttachment->bits(); 1140 int stencilBits = stencilAttachment->bits();
1141 this->adjustStencilParams(settings, fClipMode, stencilBits); 1141 this->adjustStencilParams(settings, fClipMode, stencilBits);
1142 } 1142 }
1143 } 1143 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698