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

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

Issue 452273003: Fix crash in nvpr text after abandoning context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« 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 2014 Google Inc. 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" 8 #include "GrStencilAndCoverTextContext.h"
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // fallback, which we don't want to do at this point. 87 // fallback, which we don't want to do at this point.
88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke)) { 88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke)) {
89 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs)); 89 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs));
90 } 90 }
91 91
92 ~GlyphPathRange() { 92 ~GlyphPathRange() {
93 this->release(); 93 this->release();
94 SkDescriptor::Free(fDesc); 94 SkDescriptor::Free(fDesc);
95 } 95 }
96 96
97 virtual void onRelease() SK_OVERRIDE {
98 INHERITED::onRelease();
99 fPathRange.reset(NULL);
100 }
101
102 virtual void onAbandon() SK_OVERRIDE {
103 INHERITED::onAbandon();
104 fPathRange->abandon();
105 fPathRange.reset(NULL);
106 }
107
108
109 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) / kGlyphGroupSize; 97 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) / kGlyphGroupSize;
110 SkDescriptor* const fDesc; 98 SkDescriptor* const fDesc;
111 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group 99 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group
112 SkAutoTUnref<GrPathRange> fPathRange; 100 SkAutoTUnref<GrPathRange> fPathRange;
113 101
114 typedef GrGpuResource INHERITED; 102 typedef GrGpuResource INHERITED;
115 }; 103 };
116 104
117 105
118 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext( 106 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 SkSafeUnref(fGlyphs); 443 SkSafeUnref(fGlyphs);
456 fGlyphs = NULL; 444 fGlyphs = NULL;
457 fGlyphCache = NULL; 445 fGlyphCache = NULL;
458 446
459 fDrawTarget->drawState()->stencil()->setDisabled(); 447 fDrawTarget->drawState()->stencil()->setDisabled();
460 fStateRestore.set(NULL); 448 fStateRestore.set(NULL);
461 fContext->setMatrix(fContextInitialMatrix); 449 fContext->setMatrix(fContextInitialMatrix);
462 GrTextContext::finish(); 450 GrTextContext::finish();
463 } 451 }
464 452
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