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

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

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrSurface.cpp » ('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 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 "GrSWMaskHelper.h" 8 #include "GrSWMaskHelper.h"
9 #include "GrDrawState.h" 9 #include "GrDrawState.h"
10 #include "GrDrawTargetCaps.h" 10 #include "GrDrawTargetCaps.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } else { 92 } else {
93 fMatrix.setIdentity(); 93 fMatrix.setIdentity();
94 } 94 }
95 95
96 // Now translate so the bound's UL corner is at the origin 96 // Now translate so the bound's UL corner is at the origin
97 fMatrix.postTranslate(-resultBounds.fLeft * SK_Scalar1, 97 fMatrix.postTranslate(-resultBounds.fLeft * SK_Scalar1,
98 -resultBounds.fTop * SK_Scalar1); 98 -resultBounds.fTop * SK_Scalar1);
99 SkIRect bounds = SkIRect::MakeWH(resultBounds.width(), 99 SkIRect bounds = SkIRect::MakeWH(resultBounds.width(),
100 resultBounds.height()); 100 resultBounds.height());
101 101
102 fBM.setConfig(SkBitmap::kA8_Config, bounds.fRight, bounds.fBottom); 102 if (!fBM.allocPixels(SkImageInfo::MakeA8(bounds.fRight, bounds.fBottom))) {
103 if (!fBM.allocPixels()) {
104 return false; 103 return false;
105 } 104 }
106 sk_bzero(fBM.getPixels(), fBM.getSafeSize()); 105 sk_bzero(fBM.getPixels(), fBM.getSafeSize());
107 106
108 sk_bzero(&fDraw, sizeof(fDraw)); 107 sk_bzero(&fDraw, sizeof(fDraw));
109 fRasterClip.setRect(bounds); 108 fRasterClip.setRect(bounds);
110 fDraw.fRC = &fRasterClip; 109 fDraw.fRC = &fRasterClip;
111 fDraw.fClip = &fRasterClip.bwRgn(); 110 fDraw.fClip = &fRasterClip.bwRgn();
112 fDraw.fMatrix = &fMatrix; 111 fDraw.fMatrix = &fMatrix;
113 fDraw.fBitmap = &fBM; 112 fDraw.fBitmap = &fBM;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 maskMatrix.preConcat(drawState->getViewMatrix()); 203 maskMatrix.preConcat(drawState->getViewMatrix());
205 204
206 drawState->addCoverageEffect( 205 drawState->addCoverageEffect(
207 GrSimpleTextureEffect::Create(texture, 206 GrSimpleTextureEffect::Create(texture,
208 maskMatrix, 207 maskMatrix,
209 GrTextureParams::kNone_Fi lterMode, 208 GrTextureParams::kNone_Fi lterMode,
210 kPosition_GrCoordSet))->u nref(); 209 kPosition_GrCoordSet))->u nref();
211 210
212 target->drawSimpleRect(dstRect); 211 target->drawSimpleRect(dstRect);
213 } 212 }
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698