| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
| 8 | 8 |
| 9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 //#define TRACE_BITMAP_DRAWS | 37 //#define TRACE_BITMAP_DRAWS |
| 38 | 38 |
| 39 | 39 |
| 40 /** Helper for allocating small blitters on the stack. | 40 /** Helper for allocating small blitters on the stack. |
| 41 */ | 41 */ |
| 42 class SkAutoBlitterChoose : SkNoncopyable { | 42 class SkAutoBlitterChoose : SkNoncopyable { |
| 43 public: | 43 public: |
| 44 SkAutoBlitterChoose() { | 44 SkAutoBlitterChoose() { |
| 45 fBlitter = NULL; | 45 fBlitter = NULL; |
| 46 } | 46 } |
| 47 SkAutoBlitterChoose(const SkBitmap& device, const SkMatrix& matrix, | 47 SkAutoBlitterChoose(const SkPixmap& dst, const SkMatrix& matrix, |
| 48 const SkPaint& paint, bool drawCoverage = false) { | 48 const SkPaint& paint, bool drawCoverage = false) { |
| 49 fBlitter = SkBlitter::Choose(device, matrix, paint, &fAllocator, | 49 fBlitter = SkBlitter::Choose(dst, matrix, paint, &fAllocator, drawCovera
ge); |
| 50 drawCoverage); | |
| 51 } | 50 } |
| 52 | 51 |
| 53 SkBlitter* operator->() { return fBlitter; } | 52 SkBlitter* operator->() { return fBlitter; } |
| 54 SkBlitter* get() const { return fBlitter; } | 53 SkBlitter* get() const { return fBlitter; } |
| 55 | 54 |
| 56 void choose(const SkBitmap& device, const SkMatrix& matrix, | 55 void choose(const SkPixmap& dst, const SkMatrix& matrix, |
| 57 const SkPaint& paint, bool drawCoverage = false) { | 56 const SkPaint& paint, bool drawCoverage = false) { |
| 58 SkASSERT(!fBlitter); | 57 SkASSERT(!fBlitter); |
| 59 fBlitter = SkBlitter::Choose(device, matrix, paint, &fAllocator, | 58 fBlitter = SkBlitter::Choose(dst, matrix, paint, &fAllocator, drawCovera
ge); |
| 60 drawCoverage); | |
| 61 } | 59 } |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 // Owned by fAllocator, which will handle the delete. | 62 // Owned by fAllocator, which will handle the delete. |
| 65 SkBlitter* fBlitter; | 63 SkBlitter* fBlitter; |
| 66 SkTBlitterAllocator fAllocator; | 64 SkTBlitterAllocator fAllocator; |
| 67 }; | 65 }; |
| 68 #define SkAutoBlitterChoose(...) SK_REQUIRE_LOCAL_VAR(SkAutoBlitterChoose) | 66 #define SkAutoBlitterChoose(...) SK_REQUIRE_LOCAL_VAR(SkAutoBlitterChoose) |
| 69 | 67 |
| 70 /** | 68 /** |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 143 } |
| 146 | 144 |
| 147 static void D16_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { | 145 static void D16_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { |
| 148 sk_memset16((uint16_t*)pixels, data, SkToInt(bytes >> 1)); | 146 sk_memset16((uint16_t*)pixels, data, SkToInt(bytes >> 1)); |
| 149 } | 147 } |
| 150 | 148 |
| 151 static void DA8_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { | 149 static void DA8_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { |
| 152 memset(pixels, data, bytes); | 150 memset(pixels, data, bytes); |
| 153 } | 151 } |
| 154 | 152 |
| 155 static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap, | 153 static BitmapXferProc ChooseBitmapXferProc(const SkPixmap& dst, const SkPaint& p
aint, |
| 156 const SkPaint& paint, | |
| 157 uint32_t* data) { | 154 uint32_t* data) { |
| 158 // todo: we can apply colorfilter up front if no shader, so we wouldn't | 155 // todo: we can apply colorfilter up front if no shader, so we wouldn't |
| 159 // need to abort this fastpath | 156 // need to abort this fastpath |
| 160 if (paint.getShader() || paint.getColorFilter()) { | 157 if (paint.getShader() || paint.getColorFilter()) { |
| 161 return NULL; | 158 return NULL; |
| 162 } | 159 } |
| 163 | 160 |
| 164 SkXfermode::Mode mode; | 161 SkXfermode::Mode mode; |
| 165 if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) { | 162 if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) { |
| 166 return NULL; | 163 return NULL; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 183 // SkDebugf("--- D_Clear_BitmapXferProc\n"); | 180 // SkDebugf("--- D_Clear_BitmapXferProc\n"); |
| 184 return D_Clear_BitmapXferProc; // ignore data | 181 return D_Clear_BitmapXferProc; // ignore data |
| 185 case SkXfermode::kDst_Mode: | 182 case SkXfermode::kDst_Mode: |
| 186 // SkDebugf("--- D_Dst_BitmapXferProc\n"); | 183 // SkDebugf("--- D_Dst_BitmapXferProc\n"); |
| 187 return D_Dst_BitmapXferProc; // ignore data | 184 return D_Dst_BitmapXferProc; // ignore data |
| 188 case SkXfermode::kSrc_Mode: { | 185 case SkXfermode::kSrc_Mode: { |
| 189 /* | 186 /* |
| 190 should I worry about dithering for the lower depths? | 187 should I worry about dithering for the lower depths? |
| 191 */ | 188 */ |
| 192 SkPMColor pmc = SkPreMultiplyColor(color); | 189 SkPMColor pmc = SkPreMultiplyColor(color); |
| 193 switch (bitmap.colorType()) { | 190 switch (dst.colorType()) { |
| 194 case kN32_SkColorType: | 191 case kN32_SkColorType: |
| 195 if (data) { | 192 if (data) { |
| 196 *data = pmc; | 193 *data = pmc; |
| 197 } | 194 } |
| 198 // SkDebugf("--- D32_Src_BitmapXferProc\n"); | 195 // SkDebugf("--- D32_Src_BitmapXferProc\n"); |
| 199 return D32_Src_BitmapXferProc; | 196 return D32_Src_BitmapXferProc; |
| 200 case kRGB_565_SkColorType: | 197 case kRGB_565_SkColorType: |
| 201 if (data) { | 198 if (data) { |
| 202 *data = SkPixel32ToPixel16(pmc); | 199 *data = SkPixel32ToPixel16(pmc); |
| 203 } | 200 } |
| 204 // SkDebugf("--- D16_Src_BitmapXferProc\n"); | 201 // SkDebugf("--- D16_Src_BitmapXferProc\n"); |
| 205 return D16_Src_BitmapXferProc; | 202 return D16_Src_BitmapXferProc; |
| 206 case kAlpha_8_SkColorType: | 203 case kAlpha_8_SkColorType: |
| 207 if (data) { | 204 if (data) { |
| 208 *data = SkGetPackedA32(pmc); | 205 *data = SkGetPackedA32(pmc); |
| 209 } | 206 } |
| 210 // SkDebugf("--- DA8_Src_BitmapXferProc\n"); | 207 // SkDebugf("--- DA8_Src_BitmapXferProc\n"); |
| 211 return DA8_Src_BitmapXferProc; | 208 return DA8_Src_BitmapXferProc; |
| 212 default: | 209 default: |
| 213 break; | 210 break; |
| 214 } | 211 } |
| 215 break; | 212 break; |
| 216 } | 213 } |
| 217 default: | 214 default: |
| 218 break; | 215 break; |
| 219 } | 216 } |
| 220 return NULL; | 217 return NULL; |
| 221 } | 218 } |
| 222 | 219 |
| 223 static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect, | 220 static void CallBitmapXferProc(const SkPixmap& dst, const SkIRect& rect, BitmapX
ferProc proc, |
| 224 BitmapXferProc proc, uint32_t procData) { | 221 uint32_t procData) { |
| 225 int shiftPerPixel; | 222 int shiftPerPixel; |
| 226 switch (bitmap.colorType()) { | 223 switch (dst.colorType()) { |
| 227 case kN32_SkColorType: | 224 case kN32_SkColorType: |
| 228 shiftPerPixel = 2; | 225 shiftPerPixel = 2; |
| 229 break; | 226 break; |
| 230 case kRGB_565_SkColorType: | 227 case kRGB_565_SkColorType: |
| 231 shiftPerPixel = 1; | 228 shiftPerPixel = 1; |
| 232 break; | 229 break; |
| 233 case kAlpha_8_SkColorType: | 230 case kAlpha_8_SkColorType: |
| 234 shiftPerPixel = 0; | 231 shiftPerPixel = 0; |
| 235 break; | 232 break; |
| 236 default: | 233 default: |
| 237 SkDEBUGFAIL("Can't use xferproc on this config"); | 234 SkDEBUGFAIL("Can't use xferproc on this config"); |
| 238 return; | 235 return; |
| 239 } | 236 } |
| 240 | 237 |
| 241 uint8_t* pixels = (uint8_t*)bitmap.getPixels(); | 238 uint8_t* pixels = (uint8_t*)dst.writable_addr(); |
| 242 SkASSERT(pixels); | 239 SkASSERT(pixels); |
| 243 const size_t rowBytes = bitmap.rowBytes(); | 240 const size_t rowBytes = dst.rowBytes(); |
| 244 const int widthBytes = rect.width() << shiftPerPixel; | 241 const int widthBytes = rect.width() << shiftPerPixel; |
| 245 | 242 |
| 246 // skip down to the first scanline and X position | 243 // skip down to the first scanline and X position |
| 247 pixels += rect.fTop * rowBytes + (rect.fLeft << shiftPerPixel); | 244 pixels += rect.fTop * rowBytes + (rect.fLeft << shiftPerPixel); |
| 248 for (int scans = rect.height() - 1; scans >= 0; --scans) { | 245 for (int scans = rect.height() - 1; scans >= 0; --scans) { |
| 249 proc(pixels, widthBytes, procData); | 246 proc(pixels, widthBytes, procData); |
| 250 pixels += rowBytes; | 247 pixels += rowBytes; |
| 251 } | 248 } |
| 252 } | 249 } |
| 253 | 250 |
| 254 void SkDraw::drawPaint(const SkPaint& paint) const { | 251 void SkDraw::drawPaint(const SkPaint& paint) const { |
| 255 SkDEBUGCODE(this->validate();) | 252 SkDEBUGCODE(this->validate();) |
| 256 | 253 |
| 257 if (fRC->isEmpty()) { | 254 if (fRC->isEmpty()) { |
| 258 return; | 255 return; |
| 259 } | 256 } |
| 260 | 257 |
| 261 SkIRect devRect; | 258 SkIRect devRect; |
| 262 devRect.set(0, 0, fBitmap->width(), fBitmap->height()); | 259 devRect.set(0, 0, fDst.width(), fDst.height()); |
| 263 | 260 |
| 264 if (fRC->isBW()) { | 261 if (fRC->isBW()) { |
| 265 /* If we don't have a shader (i.e. we're just a solid color) we may | 262 /* If we don't have a shader (i.e. we're just a solid color) we may |
| 266 be faster to operate directly on the device bitmap, rather than invo
king | 263 be faster to operate directly on the device bitmap, rather than invo
king |
| 267 a blitter. Esp. true for xfermodes, which require a colorshader to b
e | 264 a blitter. Esp. true for xfermodes, which require a colorshader to b
e |
| 268 present, which is just redundant work. Since we're drawing everywher
e | 265 present, which is just redundant work. Since we're drawing everywher
e |
| 269 in the clip, we don't have to worry about antialiasing. | 266 in the clip, we don't have to worry about antialiasing. |
| 270 */ | 267 */ |
| 271 uint32_t procData = 0; // to avoid the warning | 268 uint32_t procData = 0; // to avoid the warning |
| 272 BitmapXferProc proc = ChooseBitmapXferProc(*fBitmap, paint, &procData); | 269 BitmapXferProc proc = ChooseBitmapXferProc(fDst, paint, &procData); |
| 273 if (proc) { | 270 if (proc) { |
| 274 if (D_Dst_BitmapXferProc == proc) { // nothing to do | 271 if (D_Dst_BitmapXferProc == proc) { // nothing to do |
| 275 return; | 272 return; |
| 276 } | 273 } |
| 277 | 274 |
| 278 SkRegion::Iterator iter(fRC->bwRgn()); | 275 SkRegion::Iterator iter(fRC->bwRgn()); |
| 279 while (!iter.done()) { | 276 while (!iter.done()) { |
| 280 CallBitmapXferProc(*fBitmap, iter.rect(), proc, procData); | 277 CallBitmapXferProc(fDst, iter.rect(), proc, procData); |
| 281 iter.next(); | 278 iter.next(); |
| 282 } | 279 } |
| 283 return; | 280 return; |
| 284 } | 281 } |
| 285 } | 282 } |
| 286 | 283 |
| 287 // normal case: use a blitter | 284 // normal case: use a blitter |
| 288 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); | 285 SkAutoBlitterChoose blitter(fDst, *fMatrix, paint); |
| 289 SkScan::FillIRect(devRect, *fRC, blitter.get()); | 286 SkScan::FillIRect(devRect, *fRC, blitter.get()); |
| 290 } | 287 } |
| 291 | 288 |
| 292 /////////////////////////////////////////////////////////////////////////////// | 289 /////////////////////////////////////////////////////////////////////////////// |
| 293 | 290 |
| 294 struct PtProcRec { | 291 struct PtProcRec { |
| 295 SkCanvas::PointMode fMode; | 292 SkCanvas::PointMode fMode; |
| 296 const SkPaint* fPaint; | 293 const SkPaint* fPaint; |
| 297 const SkRegion* fClip; | 294 const SkRegion* fClip; |
| 298 const SkRasterClip* fRC; | 295 const SkRasterClip* fRC; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 324 } | 321 } |
| 325 } | 322 } |
| 326 } | 323 } |
| 327 | 324 |
| 328 static void bw_pt_rect_16_hair_proc(const PtProcRec& rec, | 325 static void bw_pt_rect_16_hair_proc(const PtProcRec& rec, |
| 329 const SkPoint devPts[], int count, | 326 const SkPoint devPts[], int count, |
| 330 SkBlitter* blitter) { | 327 SkBlitter* blitter) { |
| 331 SkASSERT(rec.fRC->isRect()); | 328 SkASSERT(rec.fRC->isRect()); |
| 332 const SkIRect& r = rec.fRC->getBounds(); | 329 const SkIRect& r = rec.fRC->getBounds(); |
| 333 uint32_t value; | 330 uint32_t value; |
| 334 const SkBitmap* bitmap = blitter->justAnOpaqueColor(&value); | 331 const SkPixmap* dst = blitter->justAnOpaqueColor(&value); |
| 335 SkASSERT(bitmap); | 332 SkASSERT(dst); |
| 336 | 333 |
| 337 uint16_t* addr = bitmap->getAddr16(0, 0); | 334 uint16_t* addr = dst->writable_addr16(0, 0); |
| 338 size_t rb = bitmap->rowBytes(); | 335 size_t rb = dst->rowBytes(); |
| 339 | 336 |
| 340 for (int i = 0; i < count; i++) { | 337 for (int i = 0; i < count; i++) { |
| 341 int x = SkScalarFloorToInt(devPts[i].fX); | 338 int x = SkScalarFloorToInt(devPts[i].fX); |
| 342 int y = SkScalarFloorToInt(devPts[i].fY); | 339 int y = SkScalarFloorToInt(devPts[i].fY); |
| 343 if (r.contains(x, y)) { | 340 if (r.contains(x, y)) { |
| 344 ((uint16_t*)((char*)addr + y * rb))[x] = SkToU16(value); | 341 ((uint16_t*)((char*)addr + y * rb))[x] = SkToU16(value); |
| 345 } | 342 } |
| 346 } | 343 } |
| 347 } | 344 } |
| 348 | 345 |
| 349 static void bw_pt_rect_32_hair_proc(const PtProcRec& rec, | 346 static void bw_pt_rect_32_hair_proc(const PtProcRec& rec, |
| 350 const SkPoint devPts[], int count, | 347 const SkPoint devPts[], int count, |
| 351 SkBlitter* blitter) { | 348 SkBlitter* blitter) { |
| 352 SkASSERT(rec.fRC->isRect()); | 349 SkASSERT(rec.fRC->isRect()); |
| 353 const SkIRect& r = rec.fRC->getBounds(); | 350 const SkIRect& r = rec.fRC->getBounds(); |
| 354 uint32_t value; | 351 uint32_t value; |
| 355 const SkBitmap* bitmap = blitter->justAnOpaqueColor(&value); | 352 const SkPixmap* dst = blitter->justAnOpaqueColor(&value); |
| 356 SkASSERT(bitmap); | 353 SkASSERT(dst); |
| 357 | 354 |
| 358 SkPMColor* addr = bitmap->getAddr32(0, 0); | 355 SkPMColor* addr = dst->writable_addr32(0, 0); |
| 359 size_t rb = bitmap->rowBytes(); | 356 size_t rb = dst->rowBytes(); |
| 360 | 357 |
| 361 for (int i = 0; i < count; i++) { | 358 for (int i = 0; i < count; i++) { |
| 362 int x = SkScalarFloorToInt(devPts[i].fX); | 359 int x = SkScalarFloorToInt(devPts[i].fX); |
| 363 int y = SkScalarFloorToInt(devPts[i].fY); | 360 int y = SkScalarFloorToInt(devPts[i].fY); |
| 364 if (r.contains(x, y)) { | 361 if (r.contains(x, y)) { |
| 365 ((SkPMColor*)((char*)addr + y * rb))[x] = value; | 362 ((SkPMColor*)((char*)addr + y * rb))[x] = value; |
| 366 } | 363 } |
| 367 } | 364 } |
| 368 } | 365 } |
| 369 | 366 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 }; | 502 }; |
| 506 proc = gAAProcs[fMode]; | 503 proc = gAAProcs[fMode]; |
| 507 } else if (fPaint->getStrokeCap() != SkPaint::kRound_Cap) { | 504 } else if (fPaint->getStrokeCap() != SkPaint::kRound_Cap) { |
| 508 SkASSERT(SkCanvas::kPoints_PointMode == fMode); | 505 SkASSERT(SkCanvas::kPoints_PointMode == fMode); |
| 509 proc = aa_square_proc; | 506 proc = aa_square_proc; |
| 510 } | 507 } |
| 511 } else { // BW | 508 } else { // BW |
| 512 if (fRadius <= SK_FixedHalf) { // small radii and hairline | 509 if (fRadius <= SK_FixedHalf) { // small radii and hairline |
| 513 if (SkCanvas::kPoints_PointMode == fMode && fClip->isRect()) { | 510 if (SkCanvas::kPoints_PointMode == fMode && fClip->isRect()) { |
| 514 uint32_t value; | 511 uint32_t value; |
| 515 const SkBitmap* bm = blitter->justAnOpaqueColor(&value); | 512 const SkPixmap* bm = blitter->justAnOpaqueColor(&value); |
| 516 if (bm && kRGB_565_SkColorType == bm->colorType()) { | 513 if (bm && kRGB_565_SkColorType == bm->colorType()) { |
| 517 proc = bw_pt_rect_16_hair_proc; | 514 proc = bw_pt_rect_16_hair_proc; |
| 518 } else if (bm && kN32_SkColorType == bm->colorType()) { | 515 } else if (bm && kN32_SkColorType == bm->colorType()) { |
| 519 proc = bw_pt_rect_32_hair_proc; | 516 proc = bw_pt_rect_32_hair_proc; |
| 520 } else { | 517 } else { |
| 521 proc = bw_pt_rect_hair_proc; | 518 proc = bw_pt_rect_hair_proc; |
| 522 } | 519 } |
| 523 } else { | 520 } else { |
| 524 static Proc gBWProcs[] = { | 521 static Proc gBWProcs[] = { |
| 525 bw_pt_hair_proc, bw_line_hair_proc, bw_poly_hair_proc | 522 bw_pt_hair_proc, bw_line_hair_proc, bw_poly_hair_proc |
| (...skipping 26 matching lines...) Expand all Loading... |
| 552 SkASSERT(pts != NULL); | 549 SkASSERT(pts != NULL); |
| 553 SkDEBUGCODE(this->validate();) | 550 SkDEBUGCODE(this->validate();) |
| 554 | 551 |
| 555 // nothing to draw | 552 // nothing to draw |
| 556 if (fRC->isEmpty()) { | 553 if (fRC->isEmpty()) { |
| 557 return; | 554 return; |
| 558 } | 555 } |
| 559 | 556 |
| 560 PtProcRec rec; | 557 PtProcRec rec; |
| 561 if (!forceUseDevice && rec.init(mode, paint, fMatrix, fRC)) { | 558 if (!forceUseDevice && rec.init(mode, paint, fMatrix, fRC)) { |
| 562 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); | 559 SkAutoBlitterChoose blitter(fDst, *fMatrix, paint); |
| 563 | 560 |
| 564 SkPoint devPts[MAX_DEV_PTS]; | 561 SkPoint devPts[MAX_DEV_PTS]; |
| 565 const SkMatrix* matrix = fMatrix; | 562 const SkMatrix* matrix = fMatrix; |
| 566 SkBlitter* bltr = blitter.get(); | 563 SkBlitter* bltr = blitter.get(); |
| 567 PtProcRec::Proc proc = rec.chooseProc(&bltr); | 564 PtProcRec::Proc proc = rec.chooseProc(&bltr); |
| 568 // we have to back up subsequent passes if we're in polygon mode | 565 // we have to back up subsequent passes if we're in polygon mode |
| 569 const size_t backup = (SkCanvas::kPolygon_PointMode == mode); | 566 const size_t backup = (SkCanvas::kPolygon_PointMode == mode); |
| 570 | 567 |
| 571 do { | 568 do { |
| 572 int n = SkToInt(count); | 569 int n = SkToInt(count); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 : compute_stroke_size(paint, *fMatrix); | 843 : compute_stroke_size(paint, *fMatrix); |
| 847 bbox.outset(SkScalarHalf(ssize.x()), SkScalarHalf(ssize.y())); | 844 bbox.outset(SkScalarHalf(ssize.x()), SkScalarHalf(ssize.y())); |
| 848 } | 845 } |
| 849 } | 846 } |
| 850 | 847 |
| 851 SkIRect ir = bbox.roundOut(); | 848 SkIRect ir = bbox.roundOut(); |
| 852 if (fRC->quickReject(ir)) { | 849 if (fRC->quickReject(ir)) { |
| 853 return; | 850 return; |
| 854 } | 851 } |
| 855 | 852 |
| 856 SkDeviceLooper looper(*fBitmap, *fRC, ir, paint.isAntiAlias()); | 853 SkDeviceLooper looper(fDst, *fRC, ir, paint.isAntiAlias()); |
| 857 while (looper.next()) { | 854 while (looper.next()) { |
| 858 SkRect localDevRect; | 855 SkRect localDevRect; |
| 859 looper.mapRect(&localDevRect, devRect); | 856 looper.mapRect(&localDevRect, devRect); |
| 860 SkMatrix localMatrix; | 857 SkMatrix localMatrix; |
| 861 looper.mapMatrix(&localMatrix, *matrix); | 858 looper.mapMatrix(&localMatrix, *matrix); |
| 862 | 859 |
| 863 SkAutoBlitterChoose blitterStorage(looper.getBitmap(), localMatrix, pain
t); | 860 SkAutoBlitterChoose blitterStorage(looper.getPixmap(), localMatrix, pain
t); |
| 864 const SkRasterClip& clip = looper.getRC(); | 861 const SkRasterClip& clip = looper.getRC(); |
| 865 SkBlitter* blitter = blitterStorage.get(); | 862 SkBlitter* blitter = blitterStorage.get(); |
| 866 | 863 |
| 867 // we want to "fill" if we are kFill or kStrokeAndFill, since in the lat
ter | 864 // we want to "fill" if we are kFill or kStrokeAndFill, since in the lat
ter |
| 868 // case we are also hairline (if we've gotten to here), which devolves t
o | 865 // case we are also hairline (if we've gotten to here), which devolves t
o |
| 869 // effectively just kFill | 866 // effectively just kFill |
| 870 switch (rtype) { | 867 switch (rtype) { |
| 871 case kFill_RectType: | 868 case kFill_RectType: |
| 872 if (paint.isAntiAlias()) { | 869 if (paint.isAntiAlias()) { |
| 873 SkScan::AntiFillRect(localDevRect, clip, blitter); | 870 SkScan::AntiFillRect(localDevRect, clip, blitter); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 904 | 901 |
| 905 SkMask dstM; | 902 SkMask dstM; |
| 906 if (paint.getMaskFilter() && | 903 if (paint.getMaskFilter() && |
| 907 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL)) { | 904 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL)) { |
| 908 mask = &dstM; | 905 mask = &dstM; |
| 909 } else { | 906 } else { |
| 910 dstM.fImage = NULL; | 907 dstM.fImage = NULL; |
| 911 } | 908 } |
| 912 SkAutoMaskFreeImage ami(dstM.fImage); | 909 SkAutoMaskFreeImage ami(dstM.fImage); |
| 913 | 910 |
| 914 SkAutoBlitterChoose blitterChooser(*fBitmap, *fMatrix, paint); | 911 SkAutoBlitterChoose blitterChooser(fDst, *fMatrix, paint); |
| 915 SkBlitter* blitter = blitterChooser.get(); | 912 SkBlitter* blitter = blitterChooser.get(); |
| 916 | 913 |
| 917 SkAAClipBlitterWrapper wrapper; | 914 SkAAClipBlitterWrapper wrapper; |
| 918 const SkRegion* clipRgn; | 915 const SkRegion* clipRgn; |
| 919 | 916 |
| 920 if (fRC->isBW()) { | 917 if (fRC->isBW()) { |
| 921 clipRgn = &fRC->bwRgn(); | 918 clipRgn = &fRC->bwRgn(); |
| 922 } else { | 919 } else { |
| 923 wrapper.init(*fRC, blitter); | 920 wrapper.init(*fRC, blitter); |
| 924 clipRgn = &wrapper.getRgn(); | 921 clipRgn = &wrapper.getRgn(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 | 979 |
| 983 if (paint.getRasterizer()) { | 980 if (paint.getRasterizer()) { |
| 984 goto DRAW_PATH; | 981 goto DRAW_PATH; |
| 985 } | 982 } |
| 986 } | 983 } |
| 987 | 984 |
| 988 if (paint.getMaskFilter()) { | 985 if (paint.getMaskFilter()) { |
| 989 // Transform the rrect into device space. | 986 // Transform the rrect into device space. |
| 990 SkRRect devRRect; | 987 SkRRect devRRect; |
| 991 if (rrect.transform(*fMatrix, &devRRect)) { | 988 if (rrect.transform(*fMatrix, &devRRect)) { |
| 992 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); | 989 SkAutoBlitterChoose blitter(fDst, *fMatrix, paint); |
| 993 if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, bli
tter.get(), | 990 if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, bli
tter.get(), |
| 994 SkPaint::kFill_Style)) { | 991 SkPaint::kFill_Style)) { |
| 995 return; // filterRRect() called the blitter, so we're done | 992 return; // filterRRect() called the blitter, so we're done |
| 996 } | 993 } |
| 997 } | 994 } |
| 998 } | 995 } |
| 999 | 996 |
| 1000 DRAW_PATH: | 997 DRAW_PATH: |
| 1001 // Now fall back to the default case of using a path. | 998 // Now fall back to the default case of using a path. |
| 1002 SkPath path; | 999 SkPath path; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 | 1098 |
| 1102 // avoid possibly allocating a new path in transform if we can | 1099 // avoid possibly allocating a new path in transform if we can |
| 1103 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; | 1100 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; |
| 1104 | 1101 |
| 1105 // transform the path into device space | 1102 // transform the path into device space |
| 1106 pathPtr->transform(*matrix, devPathPtr); | 1103 pathPtr->transform(*matrix, devPathPtr); |
| 1107 | 1104 |
| 1108 SkBlitter* blitter = NULL; | 1105 SkBlitter* blitter = NULL; |
| 1109 SkAutoBlitterChoose blitterStorage; | 1106 SkAutoBlitterChoose blitterStorage; |
| 1110 if (NULL == customBlitter) { | 1107 if (NULL == customBlitter) { |
| 1111 blitterStorage.choose(*fBitmap, *fMatrix, *paint, drawCoverage); | 1108 blitterStorage.choose(fDst, *fMatrix, *paint, drawCoverage); |
| 1112 blitter = blitterStorage.get(); | 1109 blitter = blitterStorage.get(); |
| 1113 } else { | 1110 } else { |
| 1114 blitter = customBlitter; | 1111 blitter = customBlitter; |
| 1115 } | 1112 } |
| 1116 | 1113 |
| 1117 if (paint->getMaskFilter()) { | 1114 if (paint->getMaskFilter()) { |
| 1118 SkPaint::Style style = doFill ? SkPaint::kFill_Style : | 1115 SkPaint::Style style = doFill ? SkPaint::kFill_Style : |
| 1119 SkPaint::kStroke_Style; | 1116 SkPaint::kStroke_Style; |
| 1120 if (paint->getMaskFilter()->filterPath(*devPathPtr, *fMatrix, *fRC, blit
ter, style)) { | 1117 if (paint->getMaskFilter()->filterPath(*devPathPtr, *fMatrix, *fRC, blit
ter, style)) { |
| 1121 return; // filterPath() called the blitter, so we're done | 1118 return; // filterPath() called the blitter, so we're done |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 | 1172 |
| 1176 r.set(0, 0, | 1173 r.set(0, 0, |
| 1177 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())); | 1174 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())); |
| 1178 fMatrix->mapRect(&r); | 1175 fMatrix->mapRect(&r); |
| 1179 r.round(&mask.fBounds); | 1176 r.round(&mask.fBounds); |
| 1180 | 1177 |
| 1181 // set the mask's bounds to the transformed bitmap-bounds, | 1178 // set the mask's bounds to the transformed bitmap-bounds, |
| 1182 // clipped to the actual device | 1179 // clipped to the actual device |
| 1183 { | 1180 { |
| 1184 SkIRect devBounds; | 1181 SkIRect devBounds; |
| 1185 devBounds.set(0, 0, fBitmap->width(), fBitmap->height()); | 1182 devBounds.set(0, 0, fDst.width(), fDst.height()); |
| 1186 // need intersect(l, t, r, b) on irect | 1183 // need intersect(l, t, r, b) on irect |
| 1187 if (!mask.fBounds.intersect(devBounds)) { | 1184 if (!mask.fBounds.intersect(devBounds)) { |
| 1188 return; | 1185 return; |
| 1189 } | 1186 } |
| 1190 } | 1187 } |
| 1191 | 1188 |
| 1192 mask.fFormat = SkMask::kA8_Format; | 1189 mask.fFormat = SkMask::kA8_Format; |
| 1193 mask.fRowBytes = SkAlign4(mask.fBounds.width()); | 1190 mask.fRowBytes = SkAlign4(mask.fBounds.width()); |
| 1194 size_t size = mask.computeImageSize(); | 1191 size_t size = mask.computeImageSize(); |
| 1195 if (0 == size) { | 1192 if (0 == size) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 // (more or less) identity. | 1270 // (more or less) identity. |
| 1274 // | 1271 // |
| 1275 SkAutoPixmapUnlock unlocker; | 1272 SkAutoPixmapUnlock unlocker; |
| 1276 if (!bitmap.requestLock(&unlocker)) { | 1273 if (!bitmap.requestLock(&unlocker)) { |
| 1277 return; | 1274 return; |
| 1278 } | 1275 } |
| 1279 const SkPixmap& pmap = unlocker.pixmap(); | 1276 const SkPixmap& pmap = unlocker.pixmap(); |
| 1280 int ix = SkScalarRoundToInt(matrix.getTranslateX()); | 1277 int ix = SkScalarRoundToInt(matrix.getTranslateX()); |
| 1281 int iy = SkScalarRoundToInt(matrix.getTranslateY()); | 1278 int iy = SkScalarRoundToInt(matrix.getTranslateY()); |
| 1282 if (clipHandlesSprite(*fRC, ix, iy, pmap)) { | 1279 if (clipHandlesSprite(*fRC, ix, iy, pmap)) { |
| 1283 SkPixmap dstPM; | |
| 1284 if (!fBitmap->peekPixels(&dstPM)) { | |
| 1285 return; | |
| 1286 } | |
| 1287 SkTBlitterAllocator allocator; | 1280 SkTBlitterAllocator allocator; |
| 1288 // blitter will be owned by the allocator. | 1281 // blitter will be owned by the allocator. |
| 1289 SkBlitter* blitter = SkBlitter::ChooseSprite(dstPM, paint, pmap, ix,
iy, &allocator); | 1282 SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, paint, pmap, ix,
iy, &allocator); |
| 1290 if (blitter) { | 1283 if (blitter) { |
| 1291 SkScan::FillIRect(SkIRect::MakeXYWH(ix, iy, pmap.width(), pmap.h
eight()), | 1284 SkScan::FillIRect(SkIRect::MakeXYWH(ix, iy, pmap.width(), pmap.h
eight()), |
| 1292 *fRC, blitter); | 1285 *fRC, blitter); |
| 1293 return; | 1286 return; |
| 1294 } | 1287 } |
| 1295 // if !blitter, then we fall-through to the slower case | 1288 // if !blitter, then we fall-through to the slower case |
| 1296 } | 1289 } |
| 1297 } | 1290 } |
| 1298 | 1291 |
| 1299 // now make a temp draw on the stack, and use it | 1292 // now make a temp draw on the stack, and use it |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 SkPaint paint(origPaint); | 1327 SkPaint paint(origPaint); |
| 1335 paint.setStyle(SkPaint::kFill_Style); | 1328 paint.setStyle(SkPaint::kFill_Style); |
| 1336 | 1329 |
| 1337 SkAutoPixmapUnlock unlocker; | 1330 SkAutoPixmapUnlock unlocker; |
| 1338 if (!bitmap.requestLock(&unlocker)) { | 1331 if (!bitmap.requestLock(&unlocker)) { |
| 1339 return; | 1332 return; |
| 1340 } | 1333 } |
| 1341 const SkPixmap& pmap = unlocker.pixmap(); | 1334 const SkPixmap& pmap = unlocker.pixmap(); |
| 1342 | 1335 |
| 1343 if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) { | 1336 if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) { |
| 1344 SkPixmap dstPM; | |
| 1345 if (!fBitmap->peekPixels(&dstPM)) { | |
| 1346 return; | |
| 1347 } | |
| 1348 SkTBlitterAllocator allocator; | 1337 SkTBlitterAllocator allocator; |
| 1349 // blitter will be owned by the allocator. | 1338 // blitter will be owned by the allocator. |
| 1350 SkBlitter* blitter = SkBlitter::ChooseSprite(dstPM, paint, pmap, x, y, &
allocator); | 1339 SkBlitter* blitter = SkBlitter::ChooseSprite(fDst, paint, pmap, x, y, &a
llocator); |
| 1351 if (blitter) { | 1340 if (blitter) { |
| 1352 SkScan::FillIRect(bounds, *fRC, blitter); | 1341 SkScan::FillIRect(bounds, *fRC, blitter); |
| 1353 return; | 1342 return; |
| 1354 } | 1343 } |
| 1355 } | 1344 } |
| 1356 | 1345 |
| 1357 SkMatrix matrix; | 1346 SkMatrix matrix; |
| 1358 SkRect r; | 1347 SkRect r; |
| 1359 | 1348 |
| 1360 // get a scalar version of our rect | 1349 // get a scalar version of our rect |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 x -= stopX; | 1628 x -= stopX; |
| 1640 y -= stopY; | 1629 y -= stopY; |
| 1641 } | 1630 } |
| 1642 | 1631 |
| 1643 const char* stop = text + byteLength; | 1632 const char* stop = text + byteLength; |
| 1644 | 1633 |
| 1645 SkAAClipBlitter aaBlitter; | 1634 SkAAClipBlitter aaBlitter; |
| 1646 SkAutoBlitterChoose blitterChooser; | 1635 SkAutoBlitterChoose blitterChooser; |
| 1647 SkBlitter* blitter = NULL; | 1636 SkBlitter* blitter = NULL; |
| 1648 if (needsRasterTextBlit(*this)) { | 1637 if (needsRasterTextBlit(*this)) { |
| 1649 blitterChooser.choose(*fBitmap, *fMatrix, paint); | 1638 blitterChooser.choose(fDst, *fMatrix, paint); |
| 1650 blitter = blitterChooser.get(); | 1639 blitter = blitterChooser.get(); |
| 1651 if (fRC->isAA()) { | 1640 if (fRC->isAA()) { |
| 1652 aaBlitter.init(blitter, &fRC->aaRgn()); | 1641 aaBlitter.init(blitter, &fRC->aaRgn()); |
| 1653 blitter = &aaBlitter; | 1642 blitter = &aaBlitter; |
| 1654 } | 1643 } |
| 1655 } | 1644 } |
| 1656 | 1645 |
| 1657 SkAutoKern autokern; | 1646 SkAutoKern autokern; |
| 1658 SkDraw1Glyph d1g; | 1647 SkDraw1Glyph d1g; |
| 1659 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); | 1648 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 } | 1747 } |
| 1759 | 1748 |
| 1760 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); | 1749 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); |
| 1761 SkAutoGlyphCache autoCache(paint, &fDevice->getLeakyProperties(), fMatrix
); | 1750 SkAutoGlyphCache autoCache(paint, &fDevice->getLeakyProperties(), fMatrix
); |
| 1762 SkGlyphCache* cache = autoCache.getCache(); | 1751 SkGlyphCache* cache = autoCache.getCache(); |
| 1763 | 1752 |
| 1764 SkAAClipBlitterWrapper wrapper; | 1753 SkAAClipBlitterWrapper wrapper; |
| 1765 SkAutoBlitterChoose blitterChooser; | 1754 SkAutoBlitterChoose blitterChooser; |
| 1766 SkBlitter* blitter = NULL; | 1755 SkBlitter* blitter = NULL; |
| 1767 if (needsRasterTextBlit(*this)) { | 1756 if (needsRasterTextBlit(*this)) { |
| 1768 blitterChooser.choose(*fBitmap, *fMatrix, paint); | 1757 blitterChooser.choose(fDst, *fMatrix, paint); |
| 1769 blitter = blitterChooser.get(); | 1758 blitter = blitterChooser.get(); |
| 1770 if (fRC->isAA()) { | 1759 if (fRC->isAA()) { |
| 1771 wrapper.init(*fRC, blitter); | 1760 wrapper.init(*fRC, blitter); |
| 1772 blitter = wrapper.getBlitter(); | 1761 blitter = wrapper.getBlitter(); |
| 1773 } | 1762 } |
| 1774 } | 1763 } |
| 1775 | 1764 |
| 1776 const char* stop = text + byteLength; | 1765 const char* stop = text + byteLength; |
| 1777 SkTextAlignProc alignProc(paint.getTextAlign()); | 1766 SkTextAlignProc alignProc(paint.getTextAlign()); |
| 1778 SkDraw1Glyph d1g; | 1767 SkDraw1Glyph d1g; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 releaseMode = true; | 2077 releaseMode = true; |
| 2089 } | 2078 } |
| 2090 composeShader.reset(SkNEW_ARGS(SkComposeShader, (&triShader, shader,
xmode))); | 2079 composeShader.reset(SkNEW_ARGS(SkComposeShader, (&triShader, shader,
xmode))); |
| 2091 p.setShader(composeShader); | 2080 p.setShader(composeShader); |
| 2092 if (releaseMode) { | 2081 if (releaseMode) { |
| 2093 xmode->unref(); | 2082 xmode->unref(); |
| 2094 } | 2083 } |
| 2095 } | 2084 } |
| 2096 } | 2085 } |
| 2097 | 2086 |
| 2098 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, p); | 2087 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); |
| 2099 // Abort early if we failed to create a shader context. | 2088 // Abort early if we failed to create a shader context. |
| 2100 if (blitter->isNullBlitter()) { | 2089 if (blitter->isNullBlitter()) { |
| 2101 return; | 2090 return; |
| 2102 } | 2091 } |
| 2103 | 2092 |
| 2104 // setup our state and function pointer for iterating triangles | 2093 // setup our state and function pointer for iterating triangles |
| 2105 VertState state(count, indices, indexCount); | 2094 VertState state(count, indices, indexCount); |
| 2106 VertState::Proc vertProc = state.chooseProc(vmode); | 2095 VertState::Proc vertProc = state.chooseProc(vmode); |
| 2107 | 2096 |
| 2108 if (textures || colors) { | 2097 if (textures || colors) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2159 } | 2148 } |
| 2160 } | 2149 } |
| 2161 } | 2150 } |
| 2162 | 2151 |
| 2163 /////////////////////////////////////////////////////////////////////////////// | 2152 /////////////////////////////////////////////////////////////////////////////// |
| 2164 /////////////////////////////////////////////////////////////////////////////// | 2153 /////////////////////////////////////////////////////////////////////////////// |
| 2165 | 2154 |
| 2166 #ifdef SK_DEBUG | 2155 #ifdef SK_DEBUG |
| 2167 | 2156 |
| 2168 void SkDraw::validate() const { | 2157 void SkDraw::validate() const { |
| 2169 SkASSERT(fBitmap != NULL); | |
| 2170 SkASSERT(fMatrix != NULL); | 2158 SkASSERT(fMatrix != NULL); |
| 2171 SkASSERT(fClip != NULL); | 2159 SkASSERT(fClip != NULL); |
| 2172 SkASSERT(fRC != NULL); | 2160 SkASSERT(fRC != NULL); |
| 2173 | 2161 |
| 2174 const SkIRect& cr = fRC->getBounds(); | 2162 const SkIRect& cr = fRC->getBounds(); |
| 2175 SkIRect br; | 2163 SkIRect br; |
| 2176 | 2164 |
| 2177 br.set(0, 0, fBitmap->width(), fBitmap->height()); | 2165 br.set(0, 0, fDst.width(), fDst.height()); |
| 2178 SkASSERT(cr.isEmpty() || br.contains(cr)); | 2166 SkASSERT(cr.isEmpty() || br.contains(cr)); |
| 2179 } | 2167 } |
| 2180 | 2168 |
| 2181 #endif | 2169 #endif |
| 2182 | 2170 |
| 2183 ////////////////////////////////////////////////////////////////////////////////
//////////////// | 2171 ////////////////////////////////////////////////////////////////////////////////
//////////////// |
| 2184 | 2172 |
| 2185 #include "SkPath.h" | 2173 #include "SkPath.h" |
| 2186 #include "SkDraw.h" | 2174 #include "SkDraw.h" |
| 2187 #include "SkRegion.h" | 2175 #include "SkRegion.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 static const int MAX_MARGIN = 128; | 2211 static const int MAX_MARGIN = 128; |
| 2224 if (!bounds->intersect(clipBounds->makeOutset(SkMin32(margin.fX, MAX_MAR
GIN), | 2212 if (!bounds->intersect(clipBounds->makeOutset(SkMin32(margin.fX, MAX_MAR
GIN), |
| 2225 SkMin32(margin.fY, MAX_MAR
GIN)))) { | 2213 SkMin32(margin.fY, MAX_MAR
GIN)))) { |
| 2226 return false; | 2214 return false; |
| 2227 } | 2215 } |
| 2228 } | 2216 } |
| 2229 | 2217 |
| 2230 return true; | 2218 return true; |
| 2231 } | 2219 } |
| 2232 | 2220 |
| 2233 static void draw_into_mask(const SkMask& mask, const SkPath& devPath, | 2221 static void draw_into_mask(const SkMask& mask, const SkPath& devPath, SkPaint::S
tyle style) { |
| 2234 SkPaint::Style style) { | 2222 SkDraw draw; |
| 2235 SkBitmap bm; | 2223 if (!draw.fDst.reset(mask)) { |
| 2236 SkDraw draw; | 2224 return; |
| 2225 } |
| 2226 |
| 2237 SkRasterClip clip; | 2227 SkRasterClip clip; |
| 2238 SkMatrix matrix; | 2228 SkMatrix matrix; |
| 2239 SkPaint paint; | 2229 SkPaint paint; |
| 2240 | 2230 |
| 2241 bm.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask.fBounds.heig
ht()), | |
| 2242 mask.fImage, mask.fRowBytes); | |
| 2243 | |
| 2244 clip.setRect(SkIRect::MakeWH(mask.fBounds.width(), mask.fBounds.height())); | 2231 clip.setRect(SkIRect::MakeWH(mask.fBounds.width(), mask.fBounds.height())); |
| 2245 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft), | 2232 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft), |
| 2246 -SkIntToScalar(mask.fBounds.fTop)); | 2233 -SkIntToScalar(mask.fBounds.fTop)); |
| 2247 | 2234 |
| 2248 draw.fBitmap = &bm; | |
| 2249 draw.fRC = &clip; | 2235 draw.fRC = &clip; |
| 2250 draw.fClip = &clip.bwRgn(); | 2236 draw.fClip = &clip.bwRgn(); |
| 2251 draw.fMatrix = &matrix; | 2237 draw.fMatrix = &matrix; |
| 2252 paint.setAntiAlias(true); | 2238 paint.setAntiAlias(true); |
| 2253 paint.setStyle(style); | 2239 paint.setStyle(style); |
| 2254 draw.drawPath(devPath, paint); | 2240 draw.drawPath(devPath, paint); |
| 2255 } | 2241 } |
| 2256 | 2242 |
| 2257 bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, | 2243 bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, |
| 2258 const SkMaskFilter* filter, const SkMatrix* filterMatrix
, | 2244 const SkMaskFilter* filter, const SkMatrix* filterMatrix
, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2274 mask->fImage = SkMask::AllocImage(size); | 2260 mask->fImage = SkMask::AllocImage(size); |
| 2275 memset(mask->fImage, 0, mask->computeImageSize()); | 2261 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2276 } | 2262 } |
| 2277 | 2263 |
| 2278 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2264 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2279 draw_into_mask(*mask, devPath, style); | 2265 draw_into_mask(*mask, devPath, style); |
| 2280 } | 2266 } |
| 2281 | 2267 |
| 2282 return true; | 2268 return true; |
| 2283 } | 2269 } |
| OLD | NEW |