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

Side by Side Diff: src/effects/SkLayerRasterizer.cpp

Issue 1148793007: change SkDraw and all Blitters to use pixmap instead of bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 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/core/SkScan_Path.cpp ('k') | src/gpu/GrAADistanceFieldPathRenderer.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkLayerRasterizer.h" 10 #include "SkLayerRasterizer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 mask->fRowBytes = mask->fBounds.width(); 109 mask->fRowBytes = mask->fBounds.width();
110 size_t size = mask->computeImageSize(); 110 size_t size = mask->computeImageSize();
111 if (0 == size) { 111 if (0 == size) {
112 return false; // too big to allocate, abort 112 return false; // too big to allocate, abort
113 } 113 }
114 mask->fImage = SkMask::AllocImage(size); 114 mask->fImage = SkMask::AllocImage(size);
115 memset(mask->fImage, 0, size); 115 memset(mask->fImage, 0, size);
116 } 116 }
117 117
118 if (SkMask::kJustComputeBounds_CreateMode != mode) { 118 if (SkMask::kJustComputeBounds_CreateMode != mode) {
119 SkBitmap device; 119 SkDraw draw;
120 if (!draw.fDst.reset(*mask)) {
121 return false;
122 }
123
120 SkRasterClip rectClip; 124 SkRasterClip rectClip;
121 SkDraw draw;
122 SkMatrix translatedMatrix; // this translates us to our local pi xels 125 SkMatrix translatedMatrix; // this translates us to our local pi xels
123 SkMatrix drawMatrix; // this translates the path by each l ayer's offset 126 SkMatrix drawMatrix; // this translates the path by each l ayer's offset
124 127
125 rectClip.setRect(SkIRect::MakeWH(mask->fBounds.width(), mask->fBounds.he ight())); 128 rectClip.setRect(SkIRect::MakeWH(mask->fBounds.width(), mask->fBounds.he ight()));
126 129
127 translatedMatrix = matrix; 130 translatedMatrix = matrix;
128 translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft), 131 translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft),
129 -SkIntToScalar(mask->fBounds.fTop)); 132 -SkIntToScalar(mask->fBounds.fTop));
130 133
131 device.installMaskPixels(*mask);
132
133 draw.fBitmap = &device;
134 draw.fMatrix = &drawMatrix; 134 draw.fMatrix = &drawMatrix;
135 draw.fRC = &rectClip; 135 draw.fRC = &rectClip;
136 draw.fClip = &rectClip.bwRgn(); 136 draw.fClip = &rectClip.bwRgn();
137 // we set the matrixproc in the loop, as the matrix changes each time (p otentially) 137 // we set the matrixproc in the loop, as the matrix changes each time (p otentially)
138 138
139 SkDeque::F2BIter iter(*fLayers); 139 SkDeque::F2BIter iter(*fLayers);
140 SkLayerRasterizer_Rec* rec; 140 SkLayerRasterizer_Rec* rec;
141 141
142 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { 142 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) {
143 drawMatrix = translatedMatrix; 143 drawMatrix = translatedMatrix;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 SkDEBUGCODE(count++); 226 SkDEBUGCODE(count++);
227 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay ers->push_back()); 227 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay ers->push_back());
228 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); 228 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint));
229 recCopy->fOffset = recOrig->fOffset; 229 recCopy->fOffset = recOrig->fOffset;
230 } 230 }
231 SkASSERT(fLayers->count() == count); 231 SkASSERT(fLayers->count() == count);
232 SkASSERT(layers->count() == count); 232 SkASSERT(layers->count() == count);
233 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); 233 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers));
234 return rasterizer; 234 return rasterizer;
235 } 235 }
OLDNEW
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | src/gpu/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698