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

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

Issue 913693002: Clean up clipping code a bit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix assert Created 5 years, 10 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 2010 Google Inc. 2 * Copyright 2010 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 "GrTextContext.h" 8 #include "GrTextContext.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 10
11 #include "SkAutoKern.h" 11 #include "SkAutoKern.h"
12 #include "SkGlyphCache.h" 12 #include "SkGlyphCache.h"
13 #include "GrFontScaler.h" 13 #include "GrFontScaler.h"
14 14
15 GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& prope rties) : 15 GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& prope rties) :
16 fFallbackTextContext(NULL), 16 fFallbackTextContext(NULL),
17 fContext(context), fDeviceProperties(properties), fD rawTarget(NULL) { 17 fContext(context), fDeviceProperties(properties), fD rawTarget(NULL) {
18 } 18 }
19 19
20 GrTextContext::~GrTextContext() { 20 GrTextContext::~GrTextContext() {
21 SkDELETE(fFallbackTextContext); 21 SkDELETE(fFallbackTextContext);
22 } 22 }
23 23
24 void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) { 24 void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) {
25 const GrClipData* clipData = fContext->getClip(); 25 const GrClipData* clipData = fContext->getClip();
26 26
27 SkRect devConservativeBound; 27 clipData->getConservativeBounds(fContext->getRenderTarget()->width(),
28 clipData->fClipStack->getConservativeBounds(
29 -clipData->fOrigin.fX,
30 -clipData->fOrigin.fY,
31 fContext->getRenderTarget()->width(),
32 fContext->getRenderTarget()->height(), 28 fContext->getRenderTarget()->height(),
33 &devConservativeBound); 29 &fClipRect);
34
35 devConservativeBound.roundOut(&fClipRect);
36 30
37 fDrawTarget = fContext->getTextTarget(); 31 fDrawTarget = fContext->getTextTarget();
38 32
39 fPaint = grPaint; 33 fPaint = grPaint;
40 fSkPaint = skPaint; 34 fSkPaint = skPaint;
41 } 35 }
42 36
43 bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint, 37 bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint,
44 const SkMatrix& viewMatrix, 38 const SkMatrix& viewMatrix,
45 const char text[], size_t byteLength, 39 const char text[], size_t byteLength,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { 108 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
115 scaler = (GrFontScaler*)auxData; 109 scaler = (GrFontScaler*)auxData;
116 } 110 }
117 if (NULL == scaler) { 111 if (NULL == scaler) {
118 scaler = SkNEW_ARGS(GrFontScaler, (cache)); 112 scaler = SkNEW_ARGS(GrFontScaler, (cache));
119 cache->setAuxProc(GlyphCacheAuxProc, scaler); 113 cache->setAuxProc(GlyphCacheAuxProc, scaler);
120 } 114 }
121 115
122 return scaler; 116 return scaler;
123 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698